mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-13 23:09:09 +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
|
||||
{$ifdef jvm}
|
||||
tarrayreftype = (art_none,art_indexreg,art_indexref);
|
||||
tarrayreftype = (art_none,art_indexreg,art_indexref,art_indexconst);
|
||||
{$endif jvm}
|
||||
{ reference record, reordered for best alignment }
|
||||
preference = ^treference;
|
||||
|
@ -631,19 +631,27 @@ implementation
|
||||
a_load_reg_stack(list,voidpointertype,ref.base);
|
||||
{ index can either be in a register, or located in a simple memory
|
||||
location (since we have to load it anyway) }
|
||||
if ref.arrayreftype=art_indexreg then
|
||||
begin
|
||||
if ref.index=NR_NO then
|
||||
internalerror(2010120513);
|
||||
{ all array indices in Java are 32 bit ints }
|
||||
a_load_reg_stack(list,s32inttype,ref.index);
|
||||
end
|
||||
else
|
||||
begin
|
||||
reference_reset_base(href,ref.indexbase,ref.indexoffset,4);
|
||||
href.symbol:=href.indexsymbol;
|
||||
a_load_ref_stack(list,s32inttype,href,prepare_stack_for_ref(list,href,false));
|
||||
end;
|
||||
case ref.arrayreftype of
|
||||
art_indexreg:
|
||||
begin
|
||||
if ref.index=NR_NO then
|
||||
internalerror(2010120513);
|
||||
{ all array indices in Java are 32 bit ints }
|
||||
a_load_reg_stack(list,s32inttype,ref.index);
|
||||
end;
|
||||
art_indexref:
|
||||
begin
|
||||
reference_reset_base(href,ref.indexbase,ref.indexoffset,4);
|
||||
href.symbol:=ref.indexsymbol;
|
||||
a_load_ref_stack(list,s32inttype,href,prepare_stack_for_ref(list,href,false));
|
||||
end;
|
||||
art_indexconst:
|
||||
begin
|
||||
a_load_const_stack(list,s32inttype,ref.indexoffset,R_INTREGISTER);
|
||||
end;
|
||||
else
|
||||
internalerror(2011012001);
|
||||
end;
|
||||
{ adjustment of the index }
|
||||
if ref.offset<>0 then
|
||||
a_op_const_stack(list,OP_ADD,s32inttype,ref.offset);
|
||||
|
Loading…
Reference in New Issue
Block a user