RFR: 8189871: Refactor GC barriers to use declarative semantics

Erik Österlund erik.osterlund at oracle.com
Tue Nov 21 16:20:45 UTC 2017


Hi Kim,

I am merely more precisely annotating that unsafe accesses on oops have 
explicitly unknown oop ref strength. However, the GC backends do not do 
more about it than they did before. I.e. only G1 loads check the actual 
reference strength and act accordingly (as before), and other exotic 
accesses are treated the same in the backends (as before) since their 
pre-write barriers are enough anyway. The behaviour is the same before 
and after.

Thanks,
/Erik

On 2017-11-21 08:07, Kim Barrett wrote:
> Noticed another issue while looking for something else.
>
> Before these changes, Unsafe_CompareAndExchangeObject does not
> specially handle Reference referents. Attempting to do so is new
> behavior introduced by Access. I don't think that change should be
> made. I think anyone who uses an Unsafe compare and swap to modify the
> referent of a reference deserves all the pain and suffering we can
> inflict upon them. With Unsafe, just because the current
> implementation doesn't outright prevent something doesn't make it a
> valid thing to do. There are many ways to (mis)use Unsafe that create
> havoc by breaking invariants and such. Consider the damange that could
> be done by using Unsafe to modify the discovered field of a reference,
> for example.
>
> I haven't looked for other similar "quiet changes".
>
> I'm also finding what look to me like some inconsistencies between the
> documentation for Unsafe and the implementation, but except for things
> like the above they are pre-existing.
>



More information about the hotspot-dev mailing list