mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 08:49:25 +02:00
* "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 -
This commit is contained in:
parent
c0ff55e95a
commit
f5e4265b1e
@ -33,6 +33,8 @@ interface
|
|||||||
type
|
type
|
||||||
tjvmcallparanode = class(tcgcallparanode)
|
tjvmcallparanode = class(tcgcallparanode)
|
||||||
protected
|
protected
|
||||||
|
function push_zero_sized_value_para: boolean; override;
|
||||||
|
|
||||||
procedure push_formal_para; override;
|
procedure push_formal_para; override;
|
||||||
procedure push_copyout_para; override;
|
procedure push_copyout_para; override;
|
||||||
|
|
||||||
@ -72,6 +74,13 @@ implementation
|
|||||||
TJVMCALLPARANODE
|
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;
|
procedure tjvmcallparanode.push_formal_para;
|
||||||
begin
|
begin
|
||||||
{ primitive values are boxed, so in all cases this is a pointer to
|
{ primitive values are boxed, so in all cases this is a pointer to
|
||||||
|
@ -31,6 +31,11 @@ interface
|
|||||||
cgutils;
|
cgutils;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
tllvmcallparanode = class(tcgcallparanode)
|
||||||
|
protected
|
||||||
|
function push_zero_sized_value_para: boolean; override;
|
||||||
|
end;
|
||||||
|
|
||||||
tllvmcallnode = class(tcgcallnode)
|
tllvmcallnode = class(tcgcallnode)
|
||||||
protected
|
protected
|
||||||
function can_call_ref(var ref: treference): boolean; override;
|
function can_call_ref(var ref: treference): boolean; override;
|
||||||
@ -44,6 +49,20 @@ implementation
|
|||||||
verbose,
|
verbose,
|
||||||
ncal;
|
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;
|
function tllvmcallnode.can_call_ref(var ref: treference): boolean;
|
||||||
begin
|
begin
|
||||||
|
@ -35,6 +35,8 @@ interface
|
|||||||
type
|
type
|
||||||
tcgcallparanode = class(tcallparanode)
|
tcgcallparanode = class(tcallparanode)
|
||||||
protected
|
protected
|
||||||
|
function push_zero_sized_value_para: boolean; virtual;
|
||||||
|
|
||||||
procedure push_addr_para;
|
procedure push_addr_para;
|
||||||
procedure push_value_para;virtual;
|
procedure push_value_para;virtual;
|
||||||
procedure push_formal_para;virtual;
|
procedure push_formal_para;virtual;
|
||||||
@ -153,6 +155,13 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tcgcallparanode.push_zero_sized_value_para: boolean;
|
||||||
|
begin
|
||||||
|
{ nothing to push by default }
|
||||||
|
result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure tcgcallparanode.push_addr_para;
|
procedure tcgcallparanode.push_addr_para;
|
||||||
begin
|
begin
|
||||||
if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
|
if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
|
||||||
@ -234,10 +243,10 @@ implementation
|
|||||||
procedure tcgcallparanode.push_value_para;
|
procedure tcgcallparanode.push_value_para;
|
||||||
begin
|
begin
|
||||||
{ we've nothing to push when the size of the parameter is 0
|
{ 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.
|
-- except on platforms where the parameters are part of the signature
|
||||||
the JVM target }
|
and checked by the runtime/backend compiler (e.g. JVM, LLVM) }
|
||||||
if (left.resultdef.size=0) and
|
if (left.resultdef.size=0) and
|
||||||
not(vo_is_self in parasym.varoptions) then
|
not push_zero_sized_value_para then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
{ Move flags and jump in register to make it less complex }
|
{ Move flags and jump in register to make it less complex }
|
||||||
|
Loading…
Reference in New Issue
Block a user