From 6be5a28bb90b391a5842a8ce3dfc7c154100ab68 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Sat, 12 Aug 2023 15:12:03 +0200 Subject: make a macro for pushing out thunks --- include/apply.s | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'include/apply.s') 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 -- cgit v1.2.3