RFR(m): 8220351: Cross-modifying code

Andrew Haley aph at redhat.com
Thu Mar 14 18:36:34 UTC 2019


On 3/14/19 6:18 PM, Andrew Haley wrote:
> I have an idea that might work. Let's say that icache::flush(),
> executed whenever we patch code, increments a global patching
> counter. When a Java thread returns from a handshake, it compares a
> thread-local copy of the old value of the patching counter with the
> current value. If they are different, do whatever local fencing is
> necessary and record the current value of the patching counter.
> 
> That should work, right? So we only execute necessary barriers, and
> if some port keeps most constants in the constant pool (rather than
> patching) it'll benefit.

But, I should stress, all of this can be done in platform-specific code,
so the main code base doesn't have to be bothered by any of it.

> And, just to complicate this even more, on some processors you'd not
> only need to to do local fencing but you might need to know which
> memory addresses had changed.

For avoidance of doubt, I don't think that we support any such processors.

-- 
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671


More information about the hotspot-dev mailing list