mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-09 19:07:26 +02:00
* improved the accuracy of the stack tracking in g_adjust_stack_after_call
git-svn-id: branches/wasm@48257 -
This commit is contained in:
parent
fdf1f7d966
commit
dd00619e1a
@ -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;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user