Explorar el Código

+ new flag ra_different_scope: used if a node tree is marked as non-regable if a variable is accessed from a different scope

git-svn-id: trunk@38689 -
florian hace 7 años
padre
commit
0fd0e356e1
Se han modificado 2 ficheros con 9 adiciones y 6 borrados
  1. 7 4
      compiler/htypechk.pas
  2. 2 2
      compiler/nld.pas

+ 7 - 4
compiler/htypechk.pas

@@ -99,10 +99,13 @@ interface
       tregableinfoflag = (
          // can be put in a register if it's the address of a var/out/const parameter
          ra_addr_regable,
-         // orthogonal to above flag: the address of the node is taken and may
-         // possibly escape the block in which this node is declared (e.g. a
-         // local variable is passed as var parameter to another procedure)
-         ra_addr_taken);
+         { orthogonal to above flag: the address of the node is taken and may
+           possibly escape the block in which this node is declared (e.g. a
+           local variable is passed as var parameter to another procedure)
+         }
+         ra_addr_taken,
+         { variable is accessed in a different scope }
+         ra_different_scope);
       tregableinfoflags = set of tregableinfoflag;
 
     const

+ 2 - 2
compiler/nld.pas

@@ -313,7 +313,7 @@ implementation
                     (symtable.symtablelevel<>current_procinfo.procdef.localst.symtablelevel) or
                     (current_procinfo.procdef.proctypeoption=potype_unitfinalize)
                   ) then
-                 make_not_regable(self,[ra_addr_taken]);
+                 make_not_regable(self,[ra_different_scope]);
                resultdef:=tabstractvarsym(symtableentry).vardef;
                if vo_is_thread_var in tstaticvarsym(symtableentry).varoptions then
                  result:=handle_threadvar_access;
@@ -335,7 +335,7 @@ implementation
                    exclude(tprocdef(symtable.defowner).procoptions,po_inline);
                    { reference in nested procedures, variable needs to be in memory }
                    { and behaves as if its address escapes its parent block         }
-                   make_not_regable(self,[ra_addr_taken]);
+                   make_not_regable(self,[ra_different_scope]);
                  end;
                resultdef:=tabstractvarsym(symtableentry).vardef;
                { self for objects is passed as var-parameter on the caller