RFR: 8285364: Remove REF_ enum for java.lang.ref.Reference [v2]

Stefan Karlsson stefank at openjdk.java.net
Fri Apr 22 16:04:26 UTC 2022


On Fri, 22 Apr 2022 09:04:37 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> > > Using REF_SOFT seems too hacky.
> > 
> > 
> > Just to put all alternatives on the table. The use of `REF_SOFT` is ephemeral.
> > [...]
> > I have no particular preference. What does everyone think?
> 
> I also think using REF_SOFT like that is overly hacky.
> 
> I think there is still a bootstrapping weirdness, whether using REF_REFERENCE or using Stefan's approach. I think Soft/Weak/Final/PhantomReference_klass get constructed with the reftype of Reference_klass (whatever that is), and then have it later updated to the correct value. In that respect REF_OTHER seems better than REF_REFERENCE. So I no longer like the renaming. Getting rid of it entirely with Stefan's approach, they get REF_NONE initially and then set to the proper value; that's far from the worst bootstrapping kludge I've ever seen.

I think we can fix the bootstrapping kludge with something like this:
https://github.com/stefank/jdk/commit/e62ddb780730dbb5d6766f882346bf0fcc6cdb59

With this patch, we'll always have the correct _reference_type after the InstanceRefKlass constructor has run.

(Patch has not gone through full testing yet)

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

PR: https://git.openjdk.java.net/jdk/pull/8332


More information about the serviceability-dev mailing list