From 0a0ec1de65c374eae3a483d4d98908a2e003cdc6 Mon Sep 17 00:00:00 2001 From: nickysn Date: Mon, 4 Jan 2021 13:08:58 +0000 Subject: [PATCH] + adjust the stack properly on function calls git-svn-id: branches/wasm@48037 - --- compiler/wasm32/nwasmcal.pas | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/wasm32/nwasmcal.pas b/compiler/wasm32/nwasmcal.pas index 5accaf8317..3b388fc85c 100644 --- a/compiler/wasm32/nwasmcal.pas +++ b/compiler/wasm32/nwasmcal.pas @@ -40,6 +40,7 @@ interface twasmcallnode = class(tcgcallnode) protected + procedure extra_post_call_code; override; procedure do_release_unused_return_value; override; procedure set_result_location(realresdef: tstoreddef); override; end; @@ -52,13 +53,17 @@ implementation { twasmcallnode } + procedure twasmcallnode.extra_post_call_code; + begin + thlcgwasm(hlcg).g_adjust_stack_after_call(current_asmdata.CurrAsmList,procdefinition,pushedparasize,typedef); + end; + procedure twasmcallnode.do_release_unused_return_value; begin if is_void(resultdef) then exit; current_asmdata.CurrAsmList.concat(taicpu.op_none(a_drop)); - // todo: decstack - //thlcgwasm(hlcg).decstack(current_asmdata.CurrAsmList,1); + thlcgwasm(hlcg).decstack(current_asmdata.CurrAsmList,1); end; procedure twasmcallnode.set_result_location(realresdef: tstoreddef);