From 4a1770b1cc5b668fe0f46d1c6ded569fcb94c4ef Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Wed, 13 Nov 2019 15:07:27 -0800 Subject: [PATCH] 4 is already an offset --- thun/asm-dump.txt | 48 ++++++++++++++++------------------------ thun/compiler.markII.pl | 6 +++-- thun/joy_asmii.bin | Bin 968 -> 936 bytes 3 files changed, 23 insertions(+), 31 deletions(-) diff --git a/thun/asm-dump.txt b/thun/asm-dump.txt index 3aaa519..7ada828 100644 --- a/thun/asm-dump.txt +++ b/thun/asm-dump.txt @@ -5,7 +5,7 @@ label(A), mov_imm(0, 0), store_word(0, 0, 0), mov_imm(0, 4096), -mov_imm(1, B2), +mov_imm(1, Z1), mov_imm(2, 0), mov_imm(3, 0), store_word(2, 0, 0), @@ -233,57 +233,47 @@ eq_offset(Q1), sub(9, 9, 0), and_imm(9, 9, 32767), label(Q1), -sub_imm(6, 6, 0), -eq_offset(R1), -sub(6, 6, 0), -and_imm(6, 6, 32767), -label(R1), lsl_imm(9, 9, 15), ior(9, 9, 6), store_word(9, 0, 0), do_offset(H), +label(R1), +symbol(R1), +mov_imm(2, S1), +do_offset(U1), label(S1), -symbol(S1), -mov_imm(2, T1), -do_offset(V1), -label(T1), expr_cell(I1, 4), expr_cell(J, 0), -label(U1), -symbol(U1), -mov_imm(2, W1), -do_offset(V1), -label(W1), +label(T1), +symbol(T1), +mov_imm(2, V1), +do_offset(U1), +label(V1), expr_cell(R, 4), expr_cell(S, 0), +label(W1), +symbol(W1), +mov_imm(2, X1), +do_offset(U1), label(X1), -symbol(X1), -mov_imm(2, Y1), -do_offset(V1), -label(Y1), expr_cell(J1, 4), expr_cell(J, 0), -label(V1), +label(U1), mov_imm(7, 4), sub_imm(0, 0, 4), sub_imm(2, 2, 0), -eq_offset(Z1), +eq_offset(Y1), sub(2, 2, 0), and_imm(2, 2, 32767), -label(Z1), -sub_imm(7, 7, 0), -eq_offset(A2), -sub(7, 7, 0), -and_imm(7, 7, 32767), -label(A2), +label(Y1), lsl_imm(2, 2, 15), ior(2, 2, 7), store_word(2, 0, 0), mov_imm(7, S), add_imm(7, 7, 4), do(7), -label(B2), +label(Z1), expr_cell(I1, 4), expr_cell(R, 4), -expr_cell(X1, 4), +expr_cell(W1, 4), expr_cell(S, 0)]. \ No newline at end of file diff --git a/thun/compiler.markII.pl b/thun/compiler.markII.pl index 1dd61ab..ff0286c 100644 --- a/thun/compiler.markII.pl +++ b/thun/compiler.markII.pl @@ -165,7 +165,8 @@ Mark II sub_base_merge_and_store(TEMP0, TEMP4, SP), % Push first item onto stack. asm(mov_imm(TEMP0, 4)), % Used for linking to previous cell. incr(SP), - sub_base_merge_and_store(TEMP3, TEMP0, SP), % Push first item onto stack. + sub_base_from_offset(TEMP3, SP), + merge_and_store(TEMP3, TEMP0, SP), % Push second item onto stack. jump(Main), definition(Unit, [New, Cons], DoDef, TOS), @@ -175,7 +176,8 @@ Mark II label(DoDef), % TOS points to body expr, set by definition. asm(mov_imm(TEMP1, 4)), % Used for linking to previous cell. incr(SP), - sub_base_merge_and_store(TOS, TEMP1, SP), % Push body expr onto stack. + sub_base_from_offset(TOS, SP), + merge_and_store(TOS, TEMP1, SP), % Push body expr onto stack. asm(mov_imm(TEMP1, I)), % Get address of I's machine code. asm(add_imm(TEMP1, TEMP1, 4)), asm(do(TEMP1)), diff --git a/thun/joy_asmii.bin b/thun/joy_asmii.bin index 9e6a2a164d9a1f88dd93ea0cdd02e94724b7883c..52a61c2c3aae5ef63a275e6464974ad8840e39a8 100644 GIT binary patch delta 139 zcmX@XzJi@`&O}Ci#-5Fa&zVyA876wNF-+rRU|?A3_W%EL6=sG89cBh69tMWzEDTHj zGccU^X8{y*0E)4L#dv^XLjQe$Vj(~=Ca~BvpxBmwEDQ|pEDW3u3=Ene@rOW~>3_Y7 a)8skKQbHyFSs0!GmD~a40HZ7FdX>j0Tc@Wim`*mSb$<&|6_n+DL^rxSwMAtK(RIdSQr@G zSr|AS7#K7`;y^nznf}+SI599(x