Browse Source

* set flag if a procedure references a symbol in staticsymtable

peter 20 years ago
parent
commit
2a20174317
3 changed files with 21 additions and 22 deletions
  1. 7 3
      compiler/globtype.pas
  2. 4 18
      compiler/psub.pas
  3. 10 1
      compiler/symtable.pas

+ 7 - 3
compiler/globtype.pas

@@ -237,8 +237,9 @@ than 255 characters. That's why using Ansi Strings}
          pi_uses_fpu,
          pi_uses_fpu,
          { procedure uses GOT for PIC code }
          { procedure uses GOT for PIC code }
          pi_needs_got,
          pi_needs_got,
-         { references local var/proc }
-         pi_inline_local_only
+         { references var/proc/type/const in static symtable,
+           i.e. not allowed for inlining from other units }
+         pi_uses_static_symtable
        );
        );
        tprocinfoflags=set of tprocinfoflag;
        tprocinfoflags=set of tprocinfoflag;
 
 
@@ -315,7 +316,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.65  2004-12-15 21:08:15  peter
+  Revision 1.66  2004-12-27 16:35:48  peter
+    * set flag if a procedure references a symbol in staticsymtable
+
+  Revision 1.65  2004/12/15 21:08:15  peter
     * disable inlining across units when the inline procedure references
     * disable inlining across units when the inline procedure references
       a variable or procedure in the static symtable
       a variable or procedure in the static symtable
 
 

+ 4 - 18
compiler/psub.pas

@@ -959,20 +959,6 @@ implementation
       end;
       end;
 
 
 
 
-    function checklocalinlining(var n: tnode; arg: pointer): foreachnoderesult;
-      begin
-        result:=fen_false;
-        case n.nodetype of
-          loadn :
-            if tloadnode(n).symtableentry.owner.symtabletype=staticsymtable then
-              result:=fen_norecurse_true;
-          calln :
-            if tcallnode(n).procdefinition.owner.symtabletype=staticsymtable then
-              result:=fen_norecurse_true;
-        end;
-      end;
-
-
     procedure tcgprocinfo.parse_body;
     procedure tcgprocinfo.parse_body;
       var
       var
          oldprocinfo : tprocinfo;
          oldprocinfo : tprocinfo;
@@ -1060,9 +1046,6 @@ implementation
                  include(procdef.procoptions,po_has_inlininginfo);
                  include(procdef.procoptions,po_has_inlininginfo);
                  procdef.inlininginfo^.code:=code.getcopy;
                  procdef.inlininginfo^.code:=code.getcopy;
                  procdef.inlininginfo^.flags:=current_procinfo.flags;
                  procdef.inlininginfo^.flags:=current_procinfo.flags;
-                 { References a local var or proc? }
-                 if foreachnodestatic(procdef.inlininginfo^.code,@checklocalinlining,nil) then
-                   include(procdef.inlininginfo^.flags,pi_inline_local_only);
                  { The blocknode needs to set an exit label }
                  { The blocknode needs to set an exit label }
                  if procdef.inlininginfo^.code.nodetype=blockn then
                  if procdef.inlininginfo^.code.nodetype=blockn then
                    include(procdef.inlininginfo^.code.flags,nf_block_with_exit);
                    include(procdef.inlininginfo^.code.flags,nf_block_with_exit);
@@ -1464,7 +1447,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.226  2004-12-27 14:41:09  jonas
+  Revision 1.227  2004-12-27 16:35:48  peter
+    * set flag if a procedure references a symbol in staticsymtable
+
+  Revision 1.226  2004/12/27 14:41:09  jonas
     - disable inlining for any procedure that contains assembler. Could
     - disable inlining for any procedure that contains assembler. Could
       be enabled again if the procedure has neither local variables nor
       be enabled again if the procedure has neither local variables nor
       parameters.
       parameters.

+ 10 - 1
compiler/symtable.pas

@@ -1799,6 +1799,12 @@ implementation
                    end;
                    end;
                  if Tsym(srsym).is_visible_for_object(topclass) then
                  if Tsym(srsym).is_visible_for_object(topclass) then
                    begin
                    begin
+                     { we need to know if a procedure references symbols
+                       in the static symtable, because then it can't be
+                       inlined from outside this unit }
+                     if assigned(current_procinfo) and
+                        (srsym.owner.symtabletype=staticsymtable) then
+                       include(current_procinfo.flags,pi_uses_static_symtable);
                      searchsym:=true;
                      searchsym:=true;
                      exit;
                      exit;
                    end;
                    end;
@@ -2312,7 +2318,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.166  2004-12-21 08:38:16  michael
+  Revision 1.167  2004-12-27 16:35:48  peter
+    * set flag if a procedure references a symbol in staticsymtable
+
+  Revision 1.166  2004/12/21 08:38:16  michael
   + Enable local debug info in methods
   + Enable local debug info in methods
 
 
   Revision 1.165  2004/12/15 15:59:54  peter
   Revision 1.165  2004/12/15 15:59:54  peter