* improved the accuracy of the stack tracking in g_adjust_stack_after_call

git-svn-id: branches/wasm@48257 -
This commit is contained in:
nickysn 2021-01-21 04:34:43 +00:00
parent fdf1f7d966
commit dd00619e1a

View File

@ -1949,23 +1949,17 @@ implementation
var
totalremovesize: longint;
realresdef: tdef;
ft: TWasmFuncType;
begin
if not assigned(forceresdef) then
realresdef:=pd.returndef
else
realresdef:=forceresdef;
{ a constructor doesn't actually return a value in the jvm }
if (tabstractprocdef(pd).proctypeoption=potype_constructor) then
totalremovesize:=paraheight
else
{ even a byte takes up a full stackslot -> align size to multiple of 4 }
totalremovesize:=paraheight-(align(realresdef.size,4) shr 2);
ft:=tcpuprocdef(pd).create_functype;
totalremovesize:=Length(ft.params)-Length(ft.results);
{ remove parameters from internal evaluation stack counter (in case of
e.g. no parameters and a result, it can also increase) }
if totalremovesize>0 then
decstack(list,totalremovesize)
else if totalremovesize<0 then
incstack(list,-totalremovesize);
ft.free;
end;