* properly pass execution weight in SetExecutionWeight

git-svn-id: trunk@39622 -
This commit is contained in:
florian 2018-08-16 20:45:36 +00:00
parent a825a66d01
commit 75251913b1

View File

@ -359,11 +359,12 @@ unit optutils;
function SetExecutionWeight(var n: tnode; arg: pointer): foreachnoderesult; function SetExecutionWeight(var n: tnode; arg: pointer): foreachnoderesult;
var var
Weight : AWord absolute arg; Weight : AWord;
i : Integer; i : Integer;
begin begin
Result:=fen_false; Result:=fen_false;
n.allocoptinfo; n.allocoptinfo;
Weight:=PAWord(arg)^;
case n.nodetype of case n.nodetype of
casen: casen:
begin begin
@ -392,10 +393,10 @@ unit optutils;
{ The code below emits two warnings if ptruint and aword are the same type } { The code below emits two warnings if ptruint and aword are the same type }
{$warn 4044 off} {$warn 4044 off}
{$warn 6018 off} {$warn 6018 off}
if ptruint(arg) > high(aword) then if PAWord(arg)^ > high(aword) then
n.optinfo^.executionweight:=high(AWord) n.optinfo^.executionweight:=high(AWord)
else else
n.optinfo^.executionweight:=AWord(ptruint(arg)); n.optinfo^.executionweight:=PAWord(arg)^;
{$pop} {$pop}
end; end;
end; end;
@ -404,7 +405,7 @@ unit optutils;
procedure CalcExecutionWeights(p : tnode;Initial : AWord = 100); procedure CalcExecutionWeights(p : tnode;Initial : AWord = 100);
begin begin
if assigned(p) then if assigned(p) then
foreachnodestatic(pm_postprocess,p,@SetExecutionWeight,Pointer(ptruint(Initial))); foreachnodestatic(pm_postprocess,p,@SetExecutionWeight,Pointer(@Initial));
end; end;