Browse Source

* properly pass execution weight in SetExecutionWeight

git-svn-id: trunk@39622 -
florian 7 năm trước cách đây
mục cha
commit
75251913b1
1 tập tin đã thay đổi với 5 bổ sung4 xóa
  1. 5 4
      compiler/optutils.pas

+ 5 - 4
compiler/optutils.pas

@@ -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;