RFR(m): 8220351: Cross-modifying code

Robbin Ehn robbin.ehn at oracle.com
Wed Mar 13 11:07:20 UTC 2019


On 2019-03-13 11:48, Andrew Haley wrote:
> Hi,
> 
> On 3/13/19 10:19 AM, Doerr, Martin wrote:
> 
>> mustIterateImmediateOopsInCode means that nmethods may contain oops
>> in the instruction stream which are not in the nmethod's separately
>> recorded oops section. This only occurs on x86.
> 
>> Other platforms use the oop recorder for such oops so they can be
>> found there, too. So they can be referenced by the nmethod twice: in
>> the separate section and in the instruction stream. This may be the
>> case on aarch64 (not sure).
> 
> That's right. In more detail, mustIterateImmediateOopsInCode assumes
> that inline oops can be patched with simple stores, i.e. that an
> immediate move is an instruction followed by a separately-addressible
> field that contains the word-sized address.

Thanks
sparc have the same issue as arm, with "flush <address>".
Adding an indirection to these, so we don't have the oops in the instruction 
stream, as you suggested, seems like the sane thing to do. But costly.

/Robbin

> 
> On AArch64, paching of oops is done by
> 
> void oop_Relocation::fix_oop_relocation() {
>    if (!oop_is_immediate()) {
>      // get the oop from the pool, and re-insert it into the instruction:
>      set_value(value());
> 
>      |
>      v
> 
> DataRelocation::set_value
> 
>      |
>      v
> 
> Relocation::pd_set_data_value
> 
>      |
>      v
> 
> MacroAssembler::patch_oop
> 


More information about the hotspot-dev mailing list