diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2018-04-22 17:03:16 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2018-04-22 17:03:16 +0000 |
commit | e6044e02b0c04d2212568dad3033c8be3c60fa6c (patch) | |
tree | 62fae83b789730b4c4b731095153e48808bac9d8 /compiler/jvm | |
parent | e3e340b703faf25d21c2b19c891dfc1fa3681256 (diff) | |
download | fpc-e6044e02b0c04d2212568dad3033c8be3c60fa6c.tar.gz |
* keep track of the temp position separately from the offset in references,
so that they can still be freed after the reference has been changed
(e.g. in case of array indexing or record field accesses) (mantis #33628)
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@38814 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/jvm')
-rw-r--r-- | compiler/jvm/hlcgcpu.pas | 10 | ||||
-rw-r--r-- | compiler/jvm/njvmcnv.pas | 2 | ||||
-rw-r--r-- | compiler/jvm/njvmld.pas | 2 | ||||
-rw-r--r-- | compiler/jvm/njvmmem.pas | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/compiler/jvm/hlcgcpu.pas b/compiler/jvm/hlcgcpu.pas index 72efc0fa87..46e9ab8dd7 100644 --- a/compiler/jvm/hlcgcpu.pas +++ b/compiler/jvm/hlcgcpu.pas @@ -1033,7 +1033,7 @@ implementation end; art_indexref: begin - cgutils.reference_reset_base(href,ref.indexbase,ref.indexoffset,4,ref.volatility); + cgutils.reference_reset_base(href,ref.indexbase,ref.indexoffset,ref.temppos,4,ref.volatility); href.symbol:=ref.indexsymbol; a_load_ref_stack(list,s32inttype,href,prepare_stack_for_ref(list,href,false)); end; @@ -1791,7 +1791,7 @@ implementation { passed by reference in array of single element; l contains the base address of the array } location_reset_ref(tmploc,LOC_REFERENCE,OS_ADDR,4,ref.volatility); - cgutils.reference_reset_base(tmploc.reference,getaddressregister(list,java_jlobject),0,4,ref.volatility); + cgutils.reference_reset_base(tmploc.reference,getaddressregister(list,java_jlobject),0,tmploc.reference.temppos,4,ref.volatility); tmploc.reference.arrayreftype:=art_indexconst; tmploc.reference.indexoffset:=0; a_load_loc_reg(list,java_jlobject,java_jlobject,l,tmploc.reference.base); @@ -1858,7 +1858,7 @@ implementation case current_procinfo.procdef.proctypeoption of potype_unitinit: begin - cgutils.reference_reset_base(ref,NR_NO,0,1,[]); + cgutils.reference_reset_base(ref,NR_NO,0,ctempposinvalid,1,[]); if assigned(current_module.globalsymtable) then allocate_implicit_structs_for_st_with_base_ref(list,current_module.globalsymtable,ref,staticvarsym); allocate_implicit_structs_for_st_with_base_ref(list,current_module.localsymtable,ref,staticvarsym); @@ -1868,7 +1868,7 @@ implementation { also initialise local variables, if any } inherited; { initialise class fields } - cgutils.reference_reset_base(ref,NR_NO,0,1,[]); + cgutils.reference_reset_base(ref,NR_NO,0,ctempposinvalid,1,[]); allocate_implicit_structs_for_st_with_base_ref(list,tabstractrecorddef(current_procinfo.procdef.owner.defowner).symtable,ref,staticvarsym); end else @@ -2418,7 +2418,7 @@ implementation internalerror(2011033001); selfreg:=getaddressregister(list,selfpara.vardef); a_load_loc_reg(list,obj,obj,selfpara.localloc,selfreg); - cgutils.reference_reset_base(ref,selfreg,0,1,[]); + cgutils.reference_reset_base(ref,selfreg,0,ctempposinvalid,1,[]); allocate_implicit_structs_for_st_with_base_ref(list,obj.symtable,ref,fieldvarsym); end; diff --git a/compiler/jvm/njvmcnv.pas b/compiler/jvm/njvmcnv.pas index 5c4f666988..d760e82753 100644 --- a/compiler/jvm/njvmcnv.pas +++ b/compiler/jvm/njvmcnv.pas @@ -831,7 +831,7 @@ implementation { store the data in the newly created array } basereg:=hlcg.getaddressregister(current_asmdata.CurrAsmList,java_jlobject); thlcgjvm(hlcg).a_load_stack_reg(current_asmdata.CurrAsmList,java_jlobject,basereg); - reference_reset_base(arrayref,basereg,0,4,[]); + reference_reset_base(arrayref,basereg,0,ctempposinvalid,4,[]); arrayref.arrayreftype:=art_indexconst; arrayref.indexoffset:=0; hlcg.a_load_loc_ref(current_asmdata.CurrAsmList,left.resultdef,left.resultdef,left.location,arrayref); diff --git a/compiler/jvm/njvmld.pas b/compiler/jvm/njvmld.pas index fdb6465439..26f7114223 100644 --- a/compiler/jvm/njvmld.pas +++ b/compiler/jvm/njvmld.pas @@ -288,7 +288,7 @@ procedure tjvmarrayconstructornode.makearrayref(var ref: treference; eledef: tde { arrays are implicitly dereferenced } basereg:=hlcg.getaddressregister(current_asmdata.CurrAsmList,java_jlobject); hlcg.a_load_ref_reg(current_asmdata.CurrAsmList,java_jlobject,java_jlobject,ref,basereg); - reference_reset_base(ref,basereg,0,1,[]); + reference_reset_base(ref,basereg,0,ctempposinvalid,1,[]); ref.arrayreftype:=art_indexconst; ref.indexoffset:=0; end; diff --git a/compiler/jvm/njvmmem.pas b/compiler/jvm/njvmmem.pas index b052c2d466..098c901a15 100644 --- a/compiler/jvm/njvmmem.pas +++ b/compiler/jvm/njvmmem.pas @@ -121,7 +121,7 @@ implementation kind of pointers) } hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true); location_reset_ref(location,LOC_REFERENCE,def_cgsize(resultdef),4,[]); - reference_reset_base(location.reference,left.location.register,0,4,[]); + reference_reset_base(location.reference,left.location.register,0,ctempposinvalid,4,[]); location.reference.arrayreftype:=art_indexconst; if (left.nodetype<>addrn) and not(resultdef.typ in [orddef,floatdef]) and |