mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 20:09:19 +02:00
* stack size estimation again improved
git-svn-id: trunk@46739 -
This commit is contained in:
parent
d0c9b4f982
commit
d5ce344b67
@ -58,7 +58,8 @@ unit cpupi;
|
|||||||
globals,systems,
|
globals,systems,
|
||||||
verbose,
|
verbose,
|
||||||
tgobj,
|
tgobj,
|
||||||
symconst,symtype,symsym,symcpu,paramgr,
|
symconst,symtype,symsym,symcpu,symdef,
|
||||||
|
paramgr,
|
||||||
cgutils,
|
cgutils,
|
||||||
cgobj,
|
cgobj,
|
||||||
defutil,
|
defutil,
|
||||||
@ -127,7 +128,12 @@ unit cpupi;
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
localsize:=align(localsize,tparavarsym(procdef.parast.SymList[i]).paraloc[calleeside].alignment);
|
localsize:=align(localsize,tparavarsym(procdef.parast.SymList[i]).paraloc[calleeside].alignment);
|
||||||
inc(localsize,tabstractnormalvarsym(procdef.parast.SymList[i]).getsize);
|
{ getsize returns 0 for e.g. open arrays, however, they require a pointer at the stack, so
|
||||||
|
allocate one pointer }
|
||||||
|
if tabstractnormalvarsym(procdef.parast.SymList[i]).getsize=0 then
|
||||||
|
inc(localsize,voidpointertype.size)
|
||||||
|
else
|
||||||
|
inc(localsize,tabstractnormalvarsym(procdef.parast.SymList[i]).getsize);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
inc(stackframesize,localsize);
|
inc(stackframesize,localsize);
|
||||||
@ -165,9 +171,9 @@ unit cpupi;
|
|||||||
if pi_estimatestacksize in flags then
|
if pi_estimatestacksize in flags then
|
||||||
begin
|
begin
|
||||||
if pi_do_call in current_procinfo.flags then
|
if pi_do_call in current_procinfo.flags then
|
||||||
extra:=4*4+maxcall*4
|
extra:=maxcall*4+4*4
|
||||||
else
|
else
|
||||||
extra:=0;
|
extra:=4*4;
|
||||||
if Align(tg.direction*tg.lasttemp,max(current_settings.alignment.localalignmin,4))+extra>stackframesize then
|
if Align(tg.direction*tg.lasttemp,max(current_settings.alignment.localalignmin,4))+extra>stackframesize then
|
||||||
InternalError(2020082801);
|
InternalError(2020082801);
|
||||||
result:=stackframesize
|
result:=stackframesize
|
||||||
|
Loading…
Reference in New Issue
Block a user