mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-14 21:27:12 +02:00
+ support for constant array indices in treference for the JVM target
(art_indexconst) git-svn-id: branches/jvmbackend@18366 -
This commit is contained in:
parent
5fd205c130
commit
2a6caa539c
@ -34,7 +34,7 @@ unit cgutils;
|
|||||||
|
|
||||||
type
|
type
|
||||||
{$ifdef jvm}
|
{$ifdef jvm}
|
||||||
tarrayreftype = (art_none,art_indexreg,art_indexref);
|
tarrayreftype = (art_none,art_indexreg,art_indexref,art_indexconst);
|
||||||
{$endif jvm}
|
{$endif jvm}
|
||||||
{ reference record, reordered for best alignment }
|
{ reference record, reordered for best alignment }
|
||||||
preference = ^treference;
|
preference = ^treference;
|
||||||
|
@ -631,19 +631,27 @@ implementation
|
|||||||
a_load_reg_stack(list,voidpointertype,ref.base);
|
a_load_reg_stack(list,voidpointertype,ref.base);
|
||||||
{ index can either be in a register, or located in a simple memory
|
{ index can either be in a register, or located in a simple memory
|
||||||
location (since we have to load it anyway) }
|
location (since we have to load it anyway) }
|
||||||
if ref.arrayreftype=art_indexreg then
|
case ref.arrayreftype of
|
||||||
|
art_indexreg:
|
||||||
begin
|
begin
|
||||||
if ref.index=NR_NO then
|
if ref.index=NR_NO then
|
||||||
internalerror(2010120513);
|
internalerror(2010120513);
|
||||||
{ all array indices in Java are 32 bit ints }
|
{ all array indices in Java are 32 bit ints }
|
||||||
a_load_reg_stack(list,s32inttype,ref.index);
|
a_load_reg_stack(list,s32inttype,ref.index);
|
||||||
end
|
end;
|
||||||
else
|
art_indexref:
|
||||||
begin
|
begin
|
||||||
reference_reset_base(href,ref.indexbase,ref.indexoffset,4);
|
reference_reset_base(href,ref.indexbase,ref.indexoffset,4);
|
||||||
href.symbol:=href.indexsymbol;
|
href.symbol:=ref.indexsymbol;
|
||||||
a_load_ref_stack(list,s32inttype,href,prepare_stack_for_ref(list,href,false));
|
a_load_ref_stack(list,s32inttype,href,prepare_stack_for_ref(list,href,false));
|
||||||
end;
|
end;
|
||||||
|
art_indexconst:
|
||||||
|
begin
|
||||||
|
a_load_const_stack(list,s32inttype,ref.indexoffset,R_INTREGISTER);
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
internalerror(2011012001);
|
||||||
|
end;
|
||||||
{ adjustment of the index }
|
{ adjustment of the index }
|
||||||
if ref.offset<>0 then
|
if ref.offset<>0 then
|
||||||
a_op_const_stack(list,OP_ADD,s32inttype,ref.offset);
|
a_op_const_stack(list,OP_ADD,s32inttype,ref.offset);
|
||||||
|
Loading…
Reference in New Issue
Block a user