diff --git a/compiler/jvm/njvmcal.pas b/compiler/jvm/njvmcal.pas index 09a9c2a74a..53b214e14b 100644 --- a/compiler/jvm/njvmcal.pas +++ b/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 diff --git a/compiler/llvm/nllvmcal.pas b/compiler/llvm/nllvmcal.pas index 8deb9951a2..4d35cf8063 100644 --- a/compiler/llvm/nllvmcal.pas +++ b/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 diff --git a/compiler/ncgcal.pas b/compiler/ncgcal.pas index 815d54fdd5..5bdfae5479 100644 --- a/compiler/ncgcal.pas +++ b/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 }