Browse Source

* manually fix unwanted stripping of exception frame info based on a patch by Gareth J. Moreton

Florian Klämpfl 3 years ago
parent
commit
5cd1c4f5bc
1 changed files with 10 additions and 2 deletions
  1. 10 2
      compiler/aoptobj.pas

+ 10 - 2
compiler/aoptobj.pas

@@ -1506,7 +1506,15 @@ Unit AoptObj;
       var
         p,hp1,hp2 : tai;
         stoploop:boolean;
-      begin
+      const
+{$ifdef JVM}
+        TaiFence = SkipInstr + [ait_const, ait_realconst, ait_typedconst, ait_label, ait_jcatch];
+{$else JVM}
+        { Stop if it reaches SEH directive information in the form of
+          consts, which may occur if RemoveDeadCodeAfterJump is called on
+          the final RET instruction on x86, for example }
+        TaiFence = SkipInstr + [ait_const, ait_realconst, ait_typedconst, ait_label, ait_align];
+{$endif JVM}      begin
         repeat
           stoploop:=true;
           p := BlockStart;
@@ -1545,7 +1553,7 @@ Unit AoptObj;
                                   and (hp1.typ <> ait_jcatch)
 {$endif}
                                   do
-                              if not(hp1.typ in ([ait_label,ait_align]+skipinstr)) then
+                              if not(hp1.typ in TaiFence) then
                                 begin
                                   if (hp1.typ = ait_instruction) and
                                      taicpu(hp1).is_jmp and