Review Request: Add ClassOption.STRONG and default is unspecified

John Rose john.r.rose at oracle.com
Fri Mar 13 19:31:12 UTC 2020


On Mar 13, 2020, at 9:09 AM, Alex Buckley <alex.buckley at oracle.com> wrote:
> 
> Got it: (i) the default is specified to be WEAK; (ii) the API offers a single enum constant, STRONG, to override the default; (iii) both of the previous clauses apply to hidden classes that are nestmates AND to hidden classes that are not nestmates. Thanks for the enjoyable writeup.

You are welcome.  I agree with your following comment
that “weak class” is a fraught concept.

One more little clarification:

On Mar 12, 2020, at 5:35 PM, John Rose <john.r.rose at oracle.com> wrote:
> 
> a special option ties them *additionally* (not *instead*!!)
> to the CL of their LC.

I said “not instead” because, of course, even if a CL would go
dead somehow and wish to take the HC along with it to
the junkyard, the HC has to stay alive if some table somewhere
has the last remaining reference to that HC, and (via it)
to the CL.  A HC naturally keeps its CL alive via a strong
reference (because it might need the CL to resolve symbols).
The CL repays the favor by keeping the HC alive only if
the HC was loaded with the STRONG option.  We implement
this by grouping the HC with the CL’s metadata segment,
but from the user’s POV (and in a different implementation)
it is as if the CL has an extra little table of pointers to
STRONG-mode HCs that it has become acquainted with.

— John




More information about the valhalla-dev mailing list