mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-07 15:58:31 +02:00
* fixed array indexing via LOC_JUMP on the JVM target
git-svn-id: branches/jvmbackend@18981 -
This commit is contained in:
parent
015ed4d0b6
commit
c9ebd433db
@ -57,8 +57,9 @@ interface
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
systems,globals,
|
systems,globals,procinfo,
|
||||||
cutils,verbose,constexp,
|
cutils,verbose,constexp,
|
||||||
|
aasmbase,
|
||||||
symconst,symtype,symtable,symsym,symdef,defutil,jvmdef,
|
symconst,symtype,symtable,symsym,symdef,defutil,jvmdef,
|
||||||
htypechk,paramgr,
|
htypechk,paramgr,
|
||||||
nadd,ncal,ncnv,ncon,nld,pass_1,njvmcon,
|
nadd,ncal,ncnv,ncon,nld,pass_1,njvmcon,
|
||||||
@ -341,8 +342,10 @@ implementation
|
|||||||
|
|
||||||
procedure tjvmvecnode.pass_generate_code;
|
procedure tjvmvecnode.pass_generate_code;
|
||||||
var
|
var
|
||||||
|
otl,ofl: tasmlabel;
|
||||||
psym: tsym;
|
psym: tsym;
|
||||||
newsize: tcgsize;
|
newsize: tcgsize;
|
||||||
|
isjump: boolean;
|
||||||
begin
|
begin
|
||||||
if left.resultdef.typ=stringdef then
|
if left.resultdef.typ=stringdef then
|
||||||
internalerror(2011052702);
|
internalerror(2011052702);
|
||||||
@ -364,11 +367,28 @@ implementation
|
|||||||
and then asking for the size doesn't make any sense }
|
and then asking for the size doesn't make any sense }
|
||||||
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,java_jlobject,java_jlobject,true);
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,java_jlobject,java_jlobject,true);
|
||||||
location.reference.base:=left.location.register;
|
location.reference.base:=left.location.register;
|
||||||
|
isjump:=(right.expectloc=LOC_JUMP);
|
||||||
|
if isjump then
|
||||||
|
begin
|
||||||
|
otl:=current_procinfo.CurrTrueLabel;
|
||||||
|
current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel);
|
||||||
|
ofl:=current_procinfo.CurrFalseLabel;
|
||||||
|
current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel);
|
||||||
|
end;
|
||||||
secondpass(right);
|
secondpass(right);
|
||||||
|
|
||||||
|
if isjump then
|
||||||
|
begin
|
||||||
|
current_procinfo.CurrTrueLabel:=otl;
|
||||||
|
current_procinfo.CurrFalseLabel:=ofl;
|
||||||
|
end
|
||||||
|
else if (right.location.loc = LOC_JUMP) then
|
||||||
|
internalerror(2011090501);
|
||||||
{ simplify index location if necessary, since array references support
|
{ simplify index location if necessary, since array references support
|
||||||
an index in memory, but not an another array index }
|
an index in memory, but not an another array index }
|
||||||
if (right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) and
|
if (right.location.loc=LOC_JUMP) or
|
||||||
(right.location.reference.arrayreftype<>art_none) then
|
((right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) and
|
||||||
|
(right.location.reference.arrayreftype<>art_none)) then
|
||||||
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,true);
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,true);
|
||||||
{ replace enum class instance with the corresponding integer value }
|
{ replace enum class instance with the corresponding integer value }
|
||||||
if (right.resultdef.typ=enumdef) then
|
if (right.resultdef.typ=enumdef) then
|
||||||
|
Loading…
Reference in New Issue
Block a user