Browse Source

* "push" zero-sized value parameters for LLVM and JVM, because all parameters
are part of the signature on those platforms (fixes e.g. tbs/tb0408.pp for
LLVM)

git-svn-id: trunk@34128 -

Jonas Maebe 9 năm trước cách đây
mục cha
commit
f5e4265b1e
3 tập tin đã thay đổi với 40 bổ sung3 xóa
  1. 9 0
      compiler/jvm/njvmcal.pas
  2. 19 0
      compiler/llvm/nllvmcal.pas
  3. 12 3
      compiler/ncgcal.pas

+ 9 - 0
compiler/jvm/njvmcal.pas

@@ -33,6 +33,8 @@ interface
     type
        tjvmcallparanode = class(tcgcallparanode)
         protected
+         function push_zero_sized_value_para: boolean; override;
+
          procedure push_formal_para; override;
          procedure push_copyout_para; override;
 
@@ -72,6 +74,13 @@ implementation
                            TJVMCALLPARANODE
 *****************************************************************************}
 
+    function tjvmcallparanode.push_zero_sized_value_para: boolean;
+      begin
+        { part of the signature -> need to be pushed }
+        result:=true;
+      end;
+
+
     procedure tjvmcallparanode.push_formal_para;
       begin
         { primitive values are boxed, so in all cases this is a pointer to

+ 19 - 0
compiler/llvm/nllvmcal.pas

@@ -31,6 +31,11 @@ interface
       cgutils;
 
     type
+      tllvmcallparanode = class(tcgcallparanode)
+       protected
+        function push_zero_sized_value_para: boolean; override;
+      end;
+
       tllvmcallnode = class(tcgcallnode)
        protected
         function can_call_ref(var ref: treference): boolean; override;
@@ -44,6 +49,20 @@ implementation
        verbose,
        ncal;
 
+{*****************************************************************************
+                          TLLVMCALLPARANODE
+ *****************************************************************************}
+
+    function tllvmcallparanode.push_zero_sized_value_para: boolean;
+      begin
+        { part of the signature -> need to be pushed }
+        result:=true;
+      end;
+
+
+{*****************************************************************************
+                           TLLVMCALLNODE
+ *****************************************************************************}
 
     function tllvmcallnode.can_call_ref(var ref: treference): boolean;
       begin

+ 12 - 3
compiler/ncgcal.pas

@@ -35,6 +35,8 @@ interface
     type
        tcgcallparanode = class(tcallparanode)
        protected
+          function push_zero_sized_value_para: boolean; virtual;
+
           procedure push_addr_para;
           procedure push_value_para;virtual;
           procedure push_formal_para;virtual;
@@ -153,6 +155,13 @@ implementation
       end;
 
 
+    function tcgcallparanode.push_zero_sized_value_para: boolean;
+      begin
+        { nothing to push by default }
+        result:=false;
+      end;
+
+
     procedure tcgcallparanode.push_addr_para;
       begin
         if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
@@ -234,10 +243,10 @@ implementation
     procedure tcgcallparanode.push_value_para;
       begin
         { we've nothing to push when the size of the parameter is 0
-          -- except in case of the self parameter of an emptry record on e.g.
-             the JVM target }
+          -- except on platforms where the parameters are part of the signature
+             and checked by the runtime/backend compiler (e.g. JVM, LLVM) }
         if (left.resultdef.size=0) and
-           not(vo_is_self in parasym.varoptions) then
+           not push_zero_sized_value_para then
           exit;
 
         { Move flags and jump in register to make it less complex }