Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func blah(c) {
- var j = 1;
- for i = 1, 10 {
- j *= 2;
- c <- j;
- yield;
- j++;
- }
- }
- Split generated code on yielding points into separate cases in a switch/case:
- blah(c): ; func blah(c):
- mov reentry_point, a ;
- add reentry_point, 1 ;
- tableswitch(a) { ;
- 0: sl0 ;
- 1: sl1 ;
- } ;
- sl0: ;
- mov 1, j ; var j = 1
- mov 1, i ; var i = 1
- ll0: ;
- mul j, 2 ; j *= 2
- send c, j ; c <- j
- ret ; yield
- sl1: ;
- add j, 1 ; j++
- if i <= 10: ;
- jmp ll0 ;
- ret ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement