* fixed calculation of fpu resources

git-svn-id: trunk@8779 -
This commit is contained in:
florian 2007-10-13 19:39:25 +00:00
parent 96eaeeaf98
commit f66916fc95
3 changed files with 36 additions and 17 deletions

1
.gitattributes vendored
View File

@ -8482,6 +8482,7 @@ tests/webtbs/tw9827.pp svneol=native#text/plain
tests/webtbs/tw9894.pp svneol=native#text/plain
tests/webtbs/tw9894a.pp svneol=native#text/plain
tests/webtbs/tw9897.pp svneol=native#text/plain
tests/webtbs/tw9919.pp -text
tests/webtbs/ub1873.pp svneol=native#text/plain
tests/webtbs/ub1883.pp svneol=native#text/plain
tests/webtbs/uw0555.pp svneol=native#text/plain

View File

@ -718,26 +718,23 @@ implementation
res1:=0;
res2:=0;
res3:=0;
if p.inheritsfrom(ttertiarynode) and assigned(ttertiarynode(p).third) then
res3:=node_resources_fpu(ttertiarynode(p).third)
else if p.inheritsfrom(tbinarynode) and assigned(tbinarynode(p).right) then
res2:=node_resources_fpu(tbinarynode(p).right)
else
if p.inheritsfrom(tunarynode) and assigned(tunarynode(p).left) then
res1:=node_resources_fpu(tunarynode(p).left);
if p.inheritsfrom(tunarynode) then
begin
if assigned(tunarynode(p).left) then
res1:=node_resources_fpu(tunarynode(p).left);
if p.inheritsfrom(tbinarynode) then
begin
if assigned(tbinarynode(p).right) then
res2:=node_resources_fpu(tbinarynode(p).right);
if p.inheritsfrom(ttertiarynode) and assigned(ttertiarynode(p).third) then
res3:=node_resources_fpu(ttertiarynode(p).third)
end;
end;
result:=max(max(res1,res2),res3);
case p.nodetype of
calln:
begin
{$ifdef i386}
if tcallnode(p).procdefinition.typ=procdef then
result:=max(result,tprocdef(tcallnode(p).procdefinition).fpu_used)
else
result:=maxfpuregs;
{$else i386}
result:=maxfpuregs;
{$endif i386}
end;
{ it could be a recursive call, so we never really know the number of used fpu registers }
result:=maxfpuregs;
realconstn,
typeconvn,
loadn :

21
tests/webtbs/tw9919.pp Normal file
View File

@ -0,0 +1,21 @@
type
TForm1 = class
function crash(n:integer):real;
end;
function TForm1.crash(n:integer):real;
begin
case n of
0: Result:=0;
1..100: Result:=crash(n-1)+crash(n-1);
end;
end;
var
f : TForm1;
begin
f:=TForm1.create;
writeln(f.crash(15));
f.Free;
end.