mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 13:59:28 +02:00
* properly pass execution weight in SetExecutionWeight
git-svn-id: trunk@39622 -
This commit is contained in:
parent
a825a66d01
commit
75251913b1
@ -359,11 +359,12 @@ unit optutils;
|
||||
|
||||
function SetExecutionWeight(var n: tnode; arg: pointer): foreachnoderesult;
|
||||
var
|
||||
Weight : AWord absolute arg;
|
||||
Weight : AWord;
|
||||
i : Integer;
|
||||
begin
|
||||
Result:=fen_false;
|
||||
n.allocoptinfo;
|
||||
Weight:=PAWord(arg)^;
|
||||
case n.nodetype of
|
||||
casen:
|
||||
begin
|
||||
@ -392,10 +393,10 @@ unit optutils;
|
||||
{ The code below emits two warnings if ptruint and aword are the same type }
|
||||
{$warn 4044 off}
|
||||
{$warn 6018 off}
|
||||
if ptruint(arg) > high(aword) then
|
||||
if PAWord(arg)^ > high(aword) then
|
||||
n.optinfo^.executionweight:=high(AWord)
|
||||
else
|
||||
n.optinfo^.executionweight:=AWord(ptruint(arg));
|
||||
n.optinfo^.executionweight:=PAWord(arg)^;
|
||||
{$pop}
|
||||
end;
|
||||
end;
|
||||
@ -404,7 +405,7 @@ unit optutils;
|
||||
procedure CalcExecutionWeights(p : tnode;Initial : AWord = 100);
|
||||
begin
|
||||
if assigned(p) then
|
||||
foreachnodestatic(pm_postprocess,p,@SetExecutionWeight,Pointer(ptruint(Initial)));
|
||||
foreachnodestatic(pm_postprocess,p,@SetExecutionWeight,Pointer(@Initial));
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user