aboutsummaryrefslogtreecommitdiff
path: root/include/apply.s
diff options
context:
space:
mode:
Diffstat (limited to 'include/apply.s')
-rw-r--r--include/apply.s13
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