From 75dca646483a584df7cae395d0fdc5c33f3e7294 Mon Sep 17 00:00:00 2001 From: mlokr Date: Mon, 2 Sep 2024 03:56:22 +0200 Subject: [PATCH] popping the inlined function arguments --- hblang/src/codegen.rs | 4 ++++ hblang/tests/codegen_tests_directives.txt | 2 +- hblang/tests/codegen_tests_inline.txt | 2 +- hblang/tests/codegen_tests_inline_test.txt | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hblang/src/codegen.rs b/hblang/src/codegen.rs index 0f6e7f2..2419826 100644 --- a/hblang/src/codegen.rs +++ b/hblang/src/codegen.rs @@ -1545,6 +1545,10 @@ impl Codegen { self.ci.file = prev_file; self.ci.ret = prev_ret; + for var in self.ci.vars.drain(scope..).collect::>() { + self.ci.free_loc(var.value.loc); + } + if let Some(last_ret) = self.ci.ret_relocs.last() && last_ret.offset as usize + self.ci.snap.code == self.output.code.len() - 5 { diff --git a/hblang/tests/codegen_tests_directives.txt b/hblang/tests/codegen_tests_directives.txt index 871c629..02f8530 100644 --- a/hblang/tests/codegen_tests_directives.txt +++ b/hblang/tests/codegen_tests_directives.txt @@ -1,4 +1,4 @@ ev: Ecall -code size: 239 +code size: 234 ret: 0 status: Ok(()) diff --git a/hblang/tests/codegen_tests_inline.txt b/hblang/tests/codegen_tests_inline.txt index 4e788d6..deb087b 100644 --- a/hblang/tests/codegen_tests_inline.txt +++ b/hblang/tests/codegen_tests_inline.txt @@ -1,3 +1,3 @@ -code size: 124 +code size: 116 ret: 0 status: Ok(()) diff --git a/hblang/tests/codegen_tests_inline_test.txt b/hblang/tests/codegen_tests_inline_test.txt index e69de29..9c8be48 100644 --- a/hblang/tests/codegen_tests_inline_test.txt +++ b/hblang/tests/codegen_tests_inline_test.txt @@ -0,0 +1,3 @@ +code size: 1043 +ret: 0 +status: Ok(())