浏览代码

- disable inlining of routines that contain a call to a C-style varargs
function, as we don't save/restore the synthetic paravarsyms that
are created for this

git-svn-id: trunk@29584 -

Jonas Maebe 10 年之前
父节点
当前提交
eb419b58c5
共有 4 个文件被更改,包括 13 次插入2 次删除
  1. 3 1
      compiler/globtype.pas
  2. 1 0
      compiler/ncal.pas
  3. 6 0
      compiler/psub.pas
  4. 3 1
      compiler/utils/ppuutils/ppudump.pp

+ 3 - 1
compiler/globtype.pas

@@ -617,7 +617,9 @@ interface
          { allocates memory on stack, so stack is unbalanced on exit }
          { allocates memory on stack, so stack is unbalanced on exit }
          pi_has_stack_allocs,
          pi_has_stack_allocs,
          { set if the stack frame of the procedure is estimated }
          { set if the stack frame of the procedure is estimated }
-         pi_estimatestacksize
+         pi_estimatestacksize,
+         { the routine calls a C-style varargs function }
+         pi_calls_c_varargs
        );
        );
        tprocinfoflags=set of tprocinfoflag;
        tprocinfoflags=set of tprocinfoflag;
 
 

+ 1 - 0
compiler/ncal.pas

@@ -2837,6 +2837,7 @@ implementation
           end;
           end;
         if (i>0) then
         if (i>0) then
           begin
           begin
+            include(current_procinfo.flags,pi_calls_c_varargs);
             varargsparas:=tvarargsparalist.create;
             varargsparas:=tvarargsparalist.create;
             pt:=tcallparanode(left);
             pt:=tcallparanode(left);
             while assigned(pt) do
             while assigned(pt) do

+ 6 - 0
compiler/psub.pas

@@ -155,6 +155,12 @@ implementation
             Message(parser_h_inlining_disabled);
             Message(parser_h_inlining_disabled);
             exit;
             exit;
           end;
           end;
+        if pi_calls_c_varargs in current_procinfo.flags then
+          begin
+            Message1(parser_h_not_supported_for_inline,'called C-style varargs functions');
+            Message(parser_h_inlining_disabled);
+            exit;
+          end;
         { the compiler cannot handle inherited in inlined subroutines because
         { the compiler cannot handle inherited in inlined subroutines because
           it tries to search for self in the symtable, however, the symtable
           it tries to search for self in the symtable, however, the symtable
           is not available }
           is not available }

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

@@ -1266,7 +1266,9 @@ const
          (mask:pi_has_stack_allocs;
          (mask:pi_has_stack_allocs;
          str:' allocates memory on stack, so stack may be unbalanced on exit '),
          str:' allocates memory on stack, so stack may be unbalanced on exit '),
          (mask:pi_estimatestacksize;
          (mask:pi_estimatestacksize;
-         str:' stack size is estimated before subroutine is compiled ')
+         str:' stack size is estimated before subroutine is compiled '),
+         (mask:pi_calls_c_varargs;
+         str:' calls function with C-style varargs ')
   );
   );
 var
 var
   procinfooptions : tprocinfoflags;
   procinfooptions : tprocinfoflags;