mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 01:49:20 +02:00
* don't add a separate high parameter for array-of-const parameters on the
JVM target (just like for open array parameters), since the array length is already encoded in the array itself there git-svn-id: trunk@22968 -
This commit is contained in:
parent
d67f31a0e1
commit
d9e67fc835
@ -36,6 +36,7 @@ interface
|
|||||||
|
|
||||||
TJVMParaManager=class(TParaManager)
|
TJVMParaManager=class(TParaManager)
|
||||||
function push_high_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
|
function push_high_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
|
||||||
|
function keep_para_array_range(varspez: tvarspez; def: tdef; calloption: tproccalloption): boolean; override;
|
||||||
function push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
|
function push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
|
||||||
function push_copyout_param(varspez: tvarspez; def: tdef; calloption: tproccalloption): boolean; override;
|
function push_copyout_param(varspez: tvarspez; def: tdef; calloption: tproccalloption): boolean; override;
|
||||||
function push_size(varspez: tvarspez; def: tdef; calloption: tproccalloption): longint;override;
|
function push_size(varspez: tvarspez; def: tdef; calloption: tproccalloption): longint;override;
|
||||||
@ -73,13 +74,27 @@ implementation
|
|||||||
begin
|
begin
|
||||||
{ we don't need a separate high parameter, since all arrays in Java
|
{ we don't need a separate high parameter, since all arrays in Java
|
||||||
have an implicit associated length }
|
have an implicit associated length }
|
||||||
if not is_open_array(def) then
|
if not is_open_array(def) and
|
||||||
|
not is_array_of_const(def) then
|
||||||
result:=inherited
|
result:=inherited
|
||||||
else
|
else
|
||||||
result:=false;
|
result:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TJVMParaManager.keep_para_array_range(varspez: tvarspez; def: tdef; calloption: tproccalloption): boolean;
|
||||||
|
begin
|
||||||
|
{ even though these don't need a high parameter (see push_high_param),
|
||||||
|
we do have to keep the original parameter's array length because it's
|
||||||
|
used by the compiler (to determine the size of the array to construct
|
||||||
|
to pass to an array of const parameter) }
|
||||||
|
if not is_array_of_const(def) then
|
||||||
|
result:=inherited
|
||||||
|
else
|
||||||
|
result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ true if a parameter is too large to copy and only the address is pushed }
|
{ true if a parameter is too large to copy and only the address is pushed }
|
||||||
function TJVMParaManager.push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
|
function TJVMParaManager.push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
|
||||||
begin
|
begin
|
||||||
|
@ -89,7 +89,8 @@ implementation
|
|||||||
begin
|
begin
|
||||||
typecheckpass(left);
|
typecheckpass(left);
|
||||||
if is_open_array(left.resultdef) or
|
if is_open_array(left.resultdef) or
|
||||||
is_dynamic_array(left.resultdef) then
|
is_dynamic_array(left.resultdef) or
|
||||||
|
is_array_of_const(left.resultdef) then
|
||||||
begin
|
begin
|
||||||
resultdef:=s32inttype;
|
resultdef:=s32inttype;
|
||||||
result:=nil;
|
result:=nil;
|
||||||
@ -102,7 +103,8 @@ implementation
|
|||||||
begin
|
begin
|
||||||
typecheckpass(left);
|
typecheckpass(left);
|
||||||
if is_dynamic_array(left.resultdef) or
|
if is_dynamic_array(left.resultdef) or
|
||||||
is_open_array(left.resultdef) then
|
is_open_array(left.resultdef) or
|
||||||
|
is_array_of_const(left.resultdef) then
|
||||||
begin
|
begin
|
||||||
{ replace with pred(length(arr)) }
|
{ replace with pred(length(arr)) }
|
||||||
result:=cinlinenode.create(in_pred_x,false,
|
result:=cinlinenode.create(in_pred_x,false,
|
||||||
@ -629,7 +631,8 @@ implementation
|
|||||||
procedure tjvminlinenode.second_length;
|
procedure tjvminlinenode.second_length;
|
||||||
begin
|
begin
|
||||||
if is_dynamic_array(left.resultdef) or
|
if is_dynamic_array(left.resultdef) or
|
||||||
is_open_array(left.resultdef) then
|
is_open_array(left.resultdef) or
|
||||||
|
is_array_of_const(left.resultdef) then
|
||||||
begin
|
begin
|
||||||
location_reset(location,LOC_REGISTER,OS_S32);
|
location_reset(location,LOC_REGISTER,OS_S32);
|
||||||
location.register:=hlcg.getintregister(current_asmdata.CurrAsmList,s32inttype);
|
location.register:=hlcg.getintregister(current_asmdata.CurrAsmList,s32inttype);
|
||||||
|
@ -822,7 +822,7 @@ implementation
|
|||||||
not(parasym.univpara) then
|
not(parasym.univpara) then
|
||||||
begin
|
begin
|
||||||
{ Process open parameters }
|
{ Process open parameters }
|
||||||
if paramanager.push_high_param(parasym.varspez,parasym.vardef,aktcallnode.procdefinition.proccalloption) then
|
if paramanager.keep_para_array_range(parasym.varspez,parasym.vardef,aktcallnode.procdefinition.proccalloption) then
|
||||||
begin
|
begin
|
||||||
{ insert type conv but hold the ranges of the array }
|
{ insert type conv but hold the ranges of the array }
|
||||||
olddef:=left.resultdef;
|
olddef:=left.resultdef;
|
||||||
|
@ -50,6 +50,7 @@ unit paramgr;
|
|||||||
function ret_in_param(def : tdef;calloption : tproccalloption) : boolean;virtual;
|
function ret_in_param(def : tdef;calloption : tproccalloption) : boolean;virtual;
|
||||||
|
|
||||||
function push_high_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;virtual;
|
function push_high_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;virtual;
|
||||||
|
function keep_para_array_range(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;virtual;
|
||||||
|
|
||||||
{ Returns true if a parameter is too large to copy and only
|
{ Returns true if a parameter is too large to copy and only
|
||||||
the address is pushed
|
the address is pushed
|
||||||
@ -197,6 +198,12 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tparamanager.keep_para_array_range(varspez: tvarspez; def: tdef; calloption: tproccalloption): boolean;
|
||||||
|
begin
|
||||||
|
result:=push_high_param(varspez,def,calloption);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tparamanager.push_copyout_param(varspez: tvarspez; def: tdef; calloption: tproccalloption): boolean;
|
function tparamanager.push_copyout_param(varspez: tvarspez; def: tdef; calloption: tproccalloption): boolean;
|
||||||
begin
|
begin
|
||||||
push_copyout_param:=false;
|
push_copyout_param:=false;
|
||||||
|
@ -43,7 +43,7 @@ type
|
|||||||
{$endif Test_Double_checksum}
|
{$endif Test_Double_checksum}
|
||||||
|
|
||||||
const
|
const
|
||||||
CurrentPPUVersion = 154;
|
CurrentPPUVersion = 155;
|
||||||
|
|
||||||
{ buffer sizes }
|
{ buffer sizes }
|
||||||
maxentrysize = 1024;
|
maxentrysize = 1024;
|
||||||
|
Loading…
Reference in New Issue
Block a user