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 /include/apply.s | |
| parent | 5184299c7dfddeba4d2d2ba95d390040368f9736 (diff) | |
| download | uskel-6be5a28bb90b391a5842a8ce3dfc7c154100ab68.tar.gz uskel-6be5a28bb90b391a5842a8ce3dfc7c154100ab68.tar.bz2 | |
make a macro for pushing out thunks
Diffstat (limited to 'include/apply.s')
| -rw-r--r-- | include/apply.s | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/include/apply.s b/include/apply.s index 124e434..2b88dd0 100644 --- a/include/apply.s +++ b/include/apply.s @@ -3,14 +3,7 @@ # | fun | arg | -> cont .thunkcode apply1 - # push a thunk for eval - push %rsi # cont - push %rbp # ret (self) - pushq 030(%rbp) # arg - pushq $3 - pushq $apply1_fini - - mov %rsp, %rsi # return to above thunk + thunkto %rsi, $apply1_fini, $3, 030(%rbp), %rbp, %rsi enter 020(%rbp) # evaluate fun # fun -> | arg | ret | cont | @@ -23,7 +16,7 @@ pushq 020(%rbp) #push the new arg lea 030(%rsi), %rdx # the end (first arg) lea (%rdx, %r11, 8), %rbx # address behind the last arg - + cmp %rdx, %rbx jle apply1_fini_cont apply1_fini_copy: @@ -43,7 +36,7 @@ apply1_fini_cont: mov -010(%rdi), %r12 # amount of args required to make the thunk cmp %r11, %r12 jg apply1_fini_feed # not enough args, just make a bigger FUN - + # if there was enough args, we simply have a thunk that we want to # continue evaluating, so let's jump to it. mov 030(%rbp), %rdi # load the original thunk |
