Browse Source

* fixed inline-related problems (partially "merges")

Jonas Maebe 25 years ago
parent
commit
cc5b2c5709
3 changed files with 26 additions and 20 deletions
  1. 7 3
      compiler/i386/cgai386.pas
  2. 10 14
      compiler/i386/n386cal.pas
  3. 9 3
      compiler/ncal.pas

+ 7 - 3
compiler/i386/cgai386.pas

@@ -2197,7 +2197,8 @@ implementation
         end;
 
       { omit stack frame ? }
-      if (not inlined) and (procinfo^.framepointer=stack_pointer) then
+      if (not inlined) then
+        if (procinfo^.framepointer=stack_pointer) then
           begin
               CGMessage(cg_d_stackframe_omited);
               nostackframe:=true;
@@ -2209,7 +2210,7 @@ implementation
                 exprasmlist^.insert(new(paicpu,
                   op_const_reg(A_SUB,S_L,stackframe,R_ESP)));
           end
-      else
+        else
           begin
               alignstack(alist);
               if (aktprocsym^.definition^.proctypeoption in [potype_unitinit,potype_proginit,potype_unitfinalize]) then
@@ -2936,7 +2937,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.11  2000-11-17 10:30:24  florian
+  Revision 1.12  2000-11-22 15:12:06  jonas
+    * fixed inline-related problems (partially "merges")
+
+  Revision 1.11  2000/11/17 10:30:24  florian
     * passing interfaces as parameters fixed
 
   Revision 1.10  2000/11/07 23:40:48  florian

+ 10 - 14
compiler/i386/n386cal.pas

@@ -294,13 +294,12 @@ implementation
           exit;
 
          { Deciding whether we may still need the parameters happens next (JM) }
-         params:=left;
+         if assigned(left) then
+           params:=left.getcopy
+         else params := nil;
 
          if (pocall_inline in procdefinition^.proccalloptions) then
            begin
-              { make a copy for the next time the procedure is inlined (JM) }
-              if assigned(left) then
-                left:=left.getcopy;
               inlined:=true;
               inlinecode:=tprocinlinenode(right);
               { set it to the same lexical level as the local symtable, becuase
@@ -317,16 +316,10 @@ implementation
                strpnew('inlined parasymtable is at offset '
                +tostr(pprocdef(procdefinition)^.parast^.address_fixup)))));
 {$endif extdebug}
-              { copy for the next time the procedure is inlined (JM) }
-              if assigned(right) then
-                right:=right.getcopy;
               { disable further inlining of the same proc
                 in the args }
               exclude(procdefinition^.proccalloptions,pocall_inline);
-           end
-         else
-           { parameters not necessary anymore (JM) }
-           left := nil;
+           end;
          { only if no proc var }
          if inlined or
             not(assigned(right)) then
@@ -1340,8 +1333,8 @@ implementation
            end;
          if inlined then
            ungetpersistanttemp(inlinecode.retoffset);
-         inlinecode.free;
-         params.free;
+         if assigned(params) then
+           params.free;
 
 
          { from now on the result can be freed normally }
@@ -1592,7 +1585,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.8  2000-11-17 09:54:58  florian
+  Revision 1.9  2000-11-22 15:12:06  jonas
+    * fixed inline-related problems (partially "merges")
+
+  Revision 1.8  2000/11/17 09:54:58  florian
     * INT_CHECK_OBJECT_* isn't applied to interfaces anymore
 
   Revision 1.7  2000/11/12 23:24:14  florian

+ 9 - 3
compiler/ncal.pas

@@ -1485,7 +1485,9 @@ interface
          if ret_in_param(inlineprocsym^.definition^.rettype.def) then
            para_size:=para_size+target_os.size_of_pointer;
          { copy args }
-         inlinetree:=code;
+         if assigned(code) then
+           inlinetree:=code.getcopy
+         else inlinetree := nil;
          registers32:=code.registers32;
          registersfpu:=code.registersfpu;
 {$ifdef SUPPORT_MMX}
@@ -1496,7 +1498,8 @@ interface
 
     destructor tprocinlinenode.destroy;
       begin
-        inlinetree.free;
+        if assigned(inlinetree) then
+          inlinetree.free;
         inherited destroy;
       end;
 
@@ -1539,7 +1542,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.16  2000-11-11 16:14:52  peter
+  Revision 1.17  2000-11-22 15:12:06  jonas
+    * fixed inline-related problems (partially "merges")
+
+  Revision 1.16  2000/11/11 16:14:52  peter
     * fixed crash with settextbuf,ptr
 
   Revision 1.15  2000/11/06 21:36:25  peter