Kaynağa Gözat

Merge of commits 40142, 40189 and 40347
------------------------------------------------------------------------
r40142 | jonas | 2018-11-01 13:19:33 +0000 (Thu, 01 Nov 2018) | 2 lines

* ttryfinallynode now inherits from tbinarynode instead of tloopnode, as its
t1 field was always set to tnothingnode
------------------------------------------------------------------------
--- Merging r40142 into '.':
U compiler/i386/n386flw.pas
U compiler/nflw.pas
U compiler/x86_64/nx64flw.pas
U compiler/nutils.pas
U compiler/ppu.pas
U compiler/ncgflw.pas
U compiler/psub.pas
--- Recording mergeinfo for merge of r40142 into '.':
U .
------------------------------------------------------------------------
r40189 | jonas | 2018-11-02 21:12:18 +0000 (Fri, 02 Nov 2018) | 2 lines

* fixed overzealous removal of an assigned(t1) check in r40142 (it was for a
ttryexceptnode instead of for a ttryfinally node)
------------------------------------------------------------------------
--- Merging r40189 into '.':
G compiler/x86_64/nx64flw.pas
--- Recording mergeinfo for merge of r40189 into '.':
G .
------------------------------------------------------------------------
r40347 | pierre | 2018-11-18 10:32:13 +0000 (Sun, 18 Nov 2018) | 3 lines

* Use getasizeint/putasizeint for tfieldvarsym.fieldoffset
* Change CurrentPPUVersion

------------------------------------------------------------------------
--- Merging r40347 into '.':
G compiler/ppu.pas
U compiler/utils/ppuutils/ppudump.pp
U compiler/symsym.pas
--- Recording mergeinfo for merge of r40347 into '.':
G .

git-svn-id: branches/fixes_3_2@40717 -

pierre 6 yıl önce
ebeveyn
işleme
23b9dde397

+ 3 - 3
compiler/i386/n386flw.pas

@@ -44,7 +44,7 @@ interface
     ti386tryfinallynode=class(tcgtryfinallynode)
       finalizepi: tcgprocinfo;
       constructor create(l,r:TNode);override;
-      constructor create_implicit(l,r,_t1:TNode);override;
+      constructor create_implicit(l,r:TNode);override;
       function pass_1: tnode;override;
       function simplify(forinline: boolean): tnode;override;
       procedure pass_generate_code;override;
@@ -183,9 +183,9 @@ constructor ti386tryfinallynode.create(l, r: TNode);
     include(finalizepi.flags,pi_uses_exceptions);
   end;
 
-constructor ti386tryfinallynode.create_implicit(l, r, _t1: TNode);
+constructor ti386tryfinallynode.create_implicit(l, r: TNode);
   begin
-    inherited create_implicit(l, r, _t1);
+    inherited create_implicit(l, r);
     if (target_info.system<>system_i386_win32) then
       exit;
 

+ 0 - 5
compiler/ncgflw.pas

@@ -1183,11 +1183,6 @@ implementation
              { finally code only needed to be executed on exception (-> in
                if-branch -> fc_inflowcontrol) }
              flowcontrol:=[fc_inflowcontrol];
-             secondpass(t1);
-             if flowcontrol<>[fc_inflowcontrol] then
-               CGMessage(cg_e_control_flow_outside_finally);
-             if codegenerror then
-               exit;
              if (tf_safecall_exceptions in target_info.flags) and
                 (current_procinfo.procdef.proccalloption=pocall_safecall) then
                handle_safecall_exception

+ 5 - 16
compiler/nflw.pas

@@ -189,10 +189,10 @@ interface
        end;
        ttryexceptnodeclass = class of ttryexceptnode;
 
-       ttryfinallynode = class(tloopnode)
+       ttryfinallynode = class(tbinarynode)
           implicitframe : boolean;
           constructor create(l,r:tnode);virtual;reintroduce;
-          constructor create_implicit(l,r,_t1:tnode);virtual;
+          constructor create_implicit(l,r:tnode);virtual;
           function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
           function simplify(forinline:boolean): tnode;override;
@@ -2299,14 +2299,14 @@ implementation
 
     constructor ttryfinallynode.create(l,r:tnode);
       begin
-        inherited create(tryfinallyn,l,r,nil,nil);
+        inherited create(tryfinallyn,l,r);
         implicitframe:=false;
       end;
 
 
-    constructor ttryfinallynode.create_implicit(l,r,_t1:tnode);
+    constructor ttryfinallynode.create_implicit(l,r:tnode);
       begin
-        inherited create(tryfinallyn,l,r,_t1,nil);
+        inherited create(tryfinallyn,l,r);
         implicitframe:=true;
       end;
 
@@ -2323,14 +2323,6 @@ implementation
         typecheckpass(right);
         // "except block" is "used"? (JM)
         set_varstate(right,vs_readwritten,[vsf_must_be_valid]);
-
-        { special finally block only executed when there was an exception }
-        if assigned(t1) then
-          begin
-            typecheckpass(t1);
-            // "finally block" is "used"? (JM)
-            set_varstate(t1,vs_readwritten,[vsf_must_be_valid]);
-          end;
       end;
 
 
@@ -2342,9 +2334,6 @@ implementation
 
         firstpass(right);
 
-        if assigned(t1) then
-          firstpass(t1);
-
         include(current_procinfo.flags,pi_do_call);
 
         { pi_uses_exceptions is an information for the optimizer and it

+ 2 - 2
compiler/nutils.pas

@@ -184,7 +184,7 @@ implementation
               result := foreachnode(procmethod,tcallnode(n).funcretnode,f,arg) or result;
               result := foreachnode(procmethod,tnode(tcallnode(n).callcleanupblock),f,arg) or result;
             end;
-          ifn, whilerepeatn, forn, tryexceptn, tryfinallyn:
+          ifn, whilerepeatn, forn, tryexceptn:
             begin
               { not in one statement, won't work because of b- }
               result := foreachnode(procmethod,tloopnode(n).t1,f,arg) or result;
@@ -281,7 +281,7 @@ implementation
               result := foreachnodestatic(procmethod,tcallnode(n).funcretnode,f,arg) or result;
               result := foreachnodestatic(procmethod,tnode(tcallnode(n).callcleanupblock),f,arg) or result;
             end;
-          ifn, whilerepeatn, forn, tryexceptn, tryfinallyn:
+          ifn, whilerepeatn, forn, tryexceptn:
             begin
               { not in one statement, won't work because of b- }
               result := foreachnodestatic(procmethod,tloopnode(n).t1,f,arg) or result;

+ 1 - 1
compiler/ppu.pas

@@ -43,7 +43,7 @@ type
 {$endif Test_Double_checksum}
 
 const
-  CurrentPPUVersion = 202;
+  CurrentPPUVersion = 204;
 
 { unit flags }
   uf_init                = $000001; { unit has initialization section }

+ 1 - 4
compiler/psub.pas

@@ -919,10 +919,7 @@ implementation
             final_used:=true;
 
             current_filepos:=entrypos;
-            wrappedbody:=ctryfinallynode.create_implicit(
-               code,
-               finalcode,
-               cnothingnode.create);
+            wrappedbody:=ctryfinallynode.create_implicit(code,finalcode);
             { afterconstruction must be called after final_asmnode, because it
                has to execute after the temps have been finalised in case of a
                refcounted class (afterconstruction decreases the refcount

+ 2 - 2
compiler/symsym.pas

@@ -1753,7 +1753,7 @@ implementation
     constructor tfieldvarsym.ppuload(ppufile:tcompilerppufile);
       begin
          inherited ppuload(fieldvarsym,ppufile);
-         fieldoffset:=ppufile.getaint;
+         fieldoffset:=ppufile.getasizeint;
          if (vo_has_mangledname in varoptions) then
            externalname:=ppufile.getpshortstring
          else
@@ -1765,7 +1765,7 @@ implementation
     procedure tfieldvarsym.ppuwrite(ppufile:tcompilerppufile);
       begin
          inherited ppuwrite(ppufile);
-         ppufile.putaint(fieldoffset);
+         ppufile.putasizeint(fieldoffset);
          if (vo_has_mangledname in varoptions) then
            ppufile.putstring(externalname^);
          writeentry(ppufile,ibfieldvarsym);

+ 1 - 1
compiler/utils/ppuutils/ppudump.pp

@@ -2783,7 +2783,7 @@ begin
            begin
              def:=TPpuFieldDef.Create(ParentDef);
              readabstractvarsym('Field Variable symbol ',varoptions,TPpuVarDef(def));
-             writeln([space,'      Address : ',getaint]);
+             writeln([space,'      Address : ',getasizeint]);
              if vo_has_mangledname in varoptions then
                writeln([space,' Mangled name : ',getstring]);
            end;

+ 5 - 5
compiler/x86_64/nx64flw.pas

@@ -44,7 +44,7 @@ interface
     tx64tryfinallynode=class(tcgtryfinallynode)
       finalizepi: tcgprocinfo;
       constructor create(l,r:TNode);override;
-      constructor create_implicit(l,r,_t1:TNode);override;
+      constructor create_implicit(l,r:TNode);override;
       function simplify(forinline: boolean): tnode;override;
       procedure pass_generate_code;override;
     end;
@@ -176,9 +176,9 @@ constructor tx64tryfinallynode.create(l, r: TNode);
       end;
   end;
 
-constructor tx64tryfinallynode.create_implicit(l, r, _t1: TNode);
+constructor tx64tryfinallynode.create_implicit(l, r: TNode);
   begin
-    inherited create_implicit(l, r, _t1);
+    inherited create_implicit(l, r);
     if (target_info.system=system_x86_64_win64) then
       begin
         if df_generic in current_procinfo.procdef.defoptions then
@@ -254,8 +254,8 @@ procedure tx64tryfinallynode.pass_generate_code;
     { Do not generate a frame that catches exceptions if the only action
       would be reraising it. Doing so is extremely inefficient with SEH
       (in contrast with setjmp/longjmp exception handling) }
-    catch_frame:=implicitframe and ((not has_no_code(t1)) or
-      (current_procinfo.procdef.proccalloption=pocall_safecall));
+    catch_frame:=implicitframe and
+      (current_procinfo.procdef.proccalloption=pocall_safecall);
 
     oldflowcontrol:=flowcontrol;
     flowcontrol:=[fc_inflowcontrol];