On Fri, 12 Jul 2024 13:19:31 GMT, Aleksey Shipilev <sh...@openjdk.org> wrote:

> > The runtime use of the Access API knows how to resolve an unknown oop ref 
> > strength using AccessBarrierSupport::resolve_unknown_oop_ref_strength. 
> > However, we do not have support for that in the C2 backend. In fact, it 
> > does not understand non-strong oop stores at all.
> 
> Aw, nice usability landmine. I thought C2 barrier set would assert on me if 
> it cannot deliver. Apparently not, [...]

Reference.refersTo has similar issues.  See refersToImpl and refersTo0 in both 
Reference and PhantomReference.
I think you should be able to model on those and the intrinsic implementation 
for refersTo to get what you want.

One additional complication is that Reference.enqueue intentionally calls 
clear0.  If implementing clear similarly
to refersTo, then enqueue should be changed to call clearImpl.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20139#issuecomment-2228872926

Reply via email to