Advertisement
sci4me

Some Nonsense Idk

Jan 9th, 2017 (edited)
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. func blah(c) {
  2. var j = 1;
  3. for i = 1, 10 {
  4. j *= 2;
  5. c <- j;
  6. yield;
  7. j++;
  8. }
  9. }
  10.  
  11.  
  12. Split generated code on yielding points into separate cases in a switch/case:
  13. blah(c): ; func blah(c):
  14. mov reentry_point, a ;
  15. add reentry_point, 1 ;
  16. tableswitch(a) { ;
  17. 0: sl0 ;
  18. 1: sl1 ;
  19. } ;
  20. sl0: ;
  21. mov 1, j ; var j = 1
  22. mov 1, i ; var i = 1
  23. ll0: ;
  24. mul j, 2 ; j *= 2
  25. send c, j ; c <- j
  26. ret ; yield
  27. sl1: ;
  28. add j, 1 ; j++
  29. if i <= 10: ;
  30. jmp ll0 ;
  31. ret ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement