RFR: 8189871: Refactor GC barriers to use declarative semantics
Kim Barrett
kim.barrett at oracle.com
Tue Nov 21 07:07:03 UTC 2017
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