From f86665b97fd2d9d7759584bb6aa29f663537f7bd Mon Sep 17 00:00:00 2001 From: nickysn Date: Mon, 4 Jan 2021 12:44:11 +0000 Subject: [PATCH] * drop unused return values from the stack git-svn-id: branches/wasm@48036 - --- compiler/wasm32/nwasmcal.pas | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/compiler/wasm32/nwasmcal.pas b/compiler/wasm32/nwasmcal.pas index af64e77d0e..5accaf8317 100644 --- a/compiler/wasm32/nwasmcal.pas +++ b/compiler/wasm32/nwasmcal.pas @@ -39,6 +39,8 @@ interface { twasmcallnode } twasmcallnode = class(tcgcallnode) + protected + procedure do_release_unused_return_value; override; procedure set_result_location(realresdef: tstoreddef); override; end; @@ -50,6 +52,15 @@ implementation { twasmcallnode } + 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); + end; + procedure twasmcallnode.set_result_location(realresdef: tstoreddef); begin // default implementation is placing the return value on LOC_REGISTER.