diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2023-08-12 15:12:03 +0200 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2023-08-12 15:12:03 +0200 |
| commit | 6be5a28bb90b391a5842a8ce3dfc7c154100ab68 (patch) | |
| tree | 22e04a263e68d983c6bf5d1fdebd662e66915e96 /apply.s | |
| parent | 5184299c7dfddeba4d2d2ba95d390040368f9736 (diff) | |
| download | uskel-6be5a28bb90b391a5842a8ce3dfc7c154100ab68.tar.gz uskel-6be5a28bb90b391a5842a8ce3dfc7c154100ab68.tar.bz2 | |
make a macro for pushing out thunks
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 |
