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 --- print_123.s | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'print_123.s') diff --git a/print_123.s b/print_123.s index 612b4c8..b87309b 100644 --- a/print_123.s +++ b/print_123.s @@ -8,35 +8,21 @@ # || -> cont .thunkcode main # push a new integer - pushq $100 - pushq $INT_code - mov %rsp, %r11 # backup first arg + thunkto %r11, $INT_code, $100 # push another new integer - pushq $23 - pushq $INT_code - mov %rsp, %r12 # backup second arg + thunkto %r12, $INT_code, $23 # push the plus - push %r12 - push %r11 - pushq $2 - pushq $plus - mov %rsp, %r11 # backup plus + thunkto %r11, $plus, $2, %r11, %r12 # push the print - push %r11 - pushq $1 - pushq $print - mov %rsp, %r11 # backup print + thunkto %r11, $print, $1, %r11 - # push a cont thunk for main_exit - push %rsi - pushq $1 - pushq $main_exit + # push a cont thunk for main_exit and set continuation for main_exit + thunkto %rsi, $main_exit, $1, %rsi # evaluate into main_exit - mov %rsp, %rsi enter %r11 .include "include/main_exit.s" -- cgit v1.2.3