diff options
Diffstat (limited to 'apply.s')
| -rw-r--r-- | apply.s | 38 |
1 files changed, 10 insertions, 28 deletions
@@ -8,40 +8,22 @@ main: # make an integer - pushq $1 - pushq $INT_code - mov %rsp, %r11 + thunkto %r11, $INT_code, $1 - # make a closure for adding stuff - pushq $0 - pushq $plus - pushq $FUN2_code - mov %rsp, %r12 + # make an empty closure for adding stuff + thunkto %r12, $FUN2_code, $plus, $0 # apply first argument - push %r11 - push %r12 - pushq $2 - pushq $apply1 - mov %rsp, %r12 - + thunkto %r12, $apply1, $2, %r12, %r11 + # apply second argument (the p.a. function part is still in r12) - push %r11 - push %r12 - pushq $2 - pushq $apply1 - mov %rsp, %r12 + thunkto %r12, $apply1, $2, %r12, %r11 # print the result - push %r12 - pushq $1 - pushq $print - mov %rsp, %r12 + thunkto %r12, $print, $1, %r12 - # make the continuation for main (exit) - push %rsi - pushq $1 - pushq $main_exit + # make a continuation for main (exit) and set it for print call + thunkto %rsi, $main_exit, $1, %rsi - mov %rsp, %rsi + # start evaluating the print enter %r12 |
