From 31c8d7d496839208e2e24e85190f4ebc09c1d162 Mon Sep 17 00:00:00 2001 From: Robert-M-Lucas Date: Sun, 16 Jun 2024 18:28:17 +0100 Subject: [PATCH] Testing --- .idea/workspace.xml | 17 ++++-- build/out.asm | 140 +++++++------------------------------------- build/out.o | Bin 1712 -> 1024 bytes build/out.out | Bin 16768 -> 16744 bytes main.why | 22 ++----- 5 files changed, 39 insertions(+), 140 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ff2ef1e..812ff09 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -7,7 +7,7 @@ - + @@ -189,7 +189,7 @@ - + - @@ -434,6 +442,7 @@ - \ No newline at end of file diff --git a/build/out.asm b/build/out.asm index 77f19a6..c6df377 100644 --- a/build/out.asm +++ b/build/out.asm @@ -6,141 +6,43 @@ main: push rbp mov rbp, rsp - mov qword [rbp-8], 3 + mov qword [rbp-8], 1 mov rax, qword [rbp-8] mov qword [rbp-16], rax - push 0 - mov rdi, __10_fstr - mov rsi, [rbp-16] - mov al, 0 sub rsp, 16 - extern printf - call printf + call _1 add rsp, 16 - - mov rax, qword [rbp-8] - mov qword [rbp-24], rax - push 0 - mov rdi, __10_fstr - mov rsi, [rbp-24] - mov al, 0 - sub rsp, 24 - extern printf - call printf - add rsp, 24 - - mov rax, qword [rbp-8] - mov qword [rbp-32], rax - push 0 - mov rdi, __10_fstr - mov rsi, [rbp-32] - mov al, 0 - sub rsp, 32 - extern printf - call printf - add rsp, 32 - - mov rax, qword [rbp-8] - mov qword [rbp-40], rax - push 0 - mov rdi, __10_fstr - mov rsi, [rbp-40] - mov al, 0 - sub rsp, 40 - extern printf - call printf - add rsp, 40 - - mov rax, qword [rbp-8] - mov qword [rbp-48], rax - push 0 - mov rdi, __10_fstr - mov rsi, [rbp-48] - mov al, 0 - sub rsp, 48 - extern printf - call printf - add rsp, 48 - - mov rax, qword [rbp-8] - mov qword [rbp-56], rax - push 0 - mov rdi, __10_fstr - mov rsi, [rbp-56] - mov al, 0 - sub rsp, 56 - extern printf - call printf - add rsp, 56 - - mov rax, qword [rbp-8] - mov qword [rbp-64], rax - push 0 - mov rdi, __10_fstr - mov rsi, [rbp-64] - mov al, 0 - sub rsp, 64 - extern printf - call printf - add rsp, 64 - - mov rax, qword [rbp-8] - mov qword [rbp-72], rax - push 0 - mov rdi, __10_fstr - mov rsi, [rbp-72] - mov al, 0 - sub rsp, 72 - extern printf - call printf - add rsp, 72 - - mov rax, qword [rbp-8] - mov qword [rbp-88], rax - mov rax, qword [rbp-88] - mov qword [rbp-104], rax - sub rsp, 104 - call _2 - add rsp, 104 - mov rax, qword [rbp-96] - mov qword [rbp-80], rax - mov rax, qword [rbp-80] + mov qword [rbp-16], 255 + mov rax, qword [rbp-16] leave ret -_2: +_1: push rbp mov rbp, rsp mov rax, qword [rbp+16] - mov qword [rbp-16], rax - mov rax, qword [rbp-16] - mov qword [rbp-32], rax - sub rsp, 32 - call _1 - add rsp, 32 - mov rax, qword [rbp-24] mov qword [rbp-8], rax - mov qword [rbp-32], 1 - mov rax, qword [rbp-8] - add rax, qword [rbp-32] - mov qword [rbp+24], rax - leave - ret -_1: - push rbp - mov rbp, rsp + mov rdi, __10_fstr + mov rsi, [rbp-8] + mov al, 0 + sub rsp, 8 + extern printf + call printf + add rsp, 8 mov rax, qword [rbp+16] - mov qword [rbp-8], rax - mov rax, qword [rbp+16] + mov qword [rbp-24], rax + mov qword [rbp-32], 1 + mov rax, qword [rbp-24] + add rax, qword [rbp-32] mov qword [rbp-16], rax - mov rax, qword [rbp-8] - add rax, qword [rbp-16] - mov qword [rbp+24], rax - leave - ret + mov rax, qword [rbp-16] + mov qword [rbp-40], rax + sub rsp, 40 + call _1 + add rsp, 40 section .data __10_fstr db `Integer: %d\n`,0 \ No newline at end of file diff --git a/build/out.o b/build/out.o index 6eed537c0d689d5a9d4ca62bd19a10b9e9b17282..77c790b4252fbc3f5c7b324708dff527ae87c3e3 100644 GIT binary patch delta 338 zcmdnM+rTk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sog<~IT_gg^q#M+7{MyMFi&k^FG-aHvP;Q=l>dpt2tx`*|E3 zfHEMBr9UkdjvNd=?SrL?h$kVS;25*a-os*_*9 zl!3#}0VWNmA5Ok#A};v_EGy3N!X8zYYciv$xTGi0(+Ug{3>?rPf*GJb*$^nJ2b2|J z;%9()4kl{?*6R+G6~Ll5Wb#Cy-ejPxAd>(ChXSg-1(Oc~WkC@sz#z$>fM##YWdCGEM{`bf3kc5|$dd;E%uAI1 delta 984 zcmZXTPiPZC6vk(E8)%~&w^_?3in0~KRH4Q+f9j#KDFg-;(S!CldJzMYvZb=||vy!U?JH~SvDYzmhg zd@q4Zvwa(3O-20CR5yw*DSJQnEKN*5n{+;nUvB-Fe?GE$ZDZZNt=6=n2a=gWo0JQ! z8;HExZQEQ)W^T5sh&Y=%TlurKMVy8%F&4lW$6{<=U@?g`16Y$|7IOq<39MLH3vg?k zOR!PFC8XVQ09)o*l4S&zl-ObbTjbaviwJB`Vs#%Ydd)(wbEx84slh^{s z2&)T>NUQ>T1txeO<~7Emo~6?mgX9B9R$;Hce|wRXzrjiO1`T@)_9k)8Y+CG);Jt}3 z$hOJ5LKE}Xg0l)#xe)tD-`?Tl5uO(ik80i8Q!5!!km08Kqa9&n*kFTDr$Nu9PHl(C z3-<*=`Z0BQSEm$chE1O+2V84F$9;2A;liz8dBG16v>wR6r1`Xo8?<-8#2@HH`Z)eV zAEwRtSI&1M-Lm<~Uw+Y*v>DQ%(Rs*{LF2lphGg|T{R!1MsOl*G-@81f zy;(C}^_-O$7z?eGq8h!BUBW4Me{NcFD<`k0N?oDhq5d5McZY}WsM;<0lO6 int { - return a + a; -} - -fn test(a: int) -> int { - return test_two(a) + 1; +fn r(a: int) { + printi(a); + r(a + 1); } fn main() -> int { - let x: int = 3; - printi(x); - printi(x); - printi(x); - printi(x); - printi(x); - printi(x); - printi(x); - printi(x); - return test(x); + r(1); + return 255; } -