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/listops.s | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'include/listops.s') diff --git a/include/listops.s b/include/listops.s index eb8f6cf..447c125 100644 --- a/include/listops.s +++ b/include/listops.s @@ -13,28 +13,20 @@ _listops_s_file: mov 020(%rbp), %rcx mov 010(%rcx), %rcx test %rcx, %rcx - jz list_int_index_found #we are taking 0, all happy, return it + jz list_int_index_found # we are taking the head, all happy, return it - #more probably we need to continue, make replacement thunks + # more likely, we need to continue -- make new args thunks sub $1, %rcx - pushq %rcx - pushq $INT_code - mov %rsp, %r11 - - pushq 030(%rsi) # tail - push %r11 - pushq $2 - pushq $list_int_index - mov %rsp, %r11 + thunkto %r11, $INT_code, %rcx # decreased index + thunkto %r11, $list_int_index, $2, %r11, 030(%rsi) # new call on tail primop2_cont_indirect %r11 -list_int_index_not_found: - movq 0, %rax #fault - list_int_index_found: mov 020(%rsi), %rax #head primop2_cont_indirect %rax - + +list_int_index_not_found: + movq 0, %rax #fault (TODO: we should have a better fault) .endif # _listops_s_file -- cgit v1.2.3