Updated specifications

Dan Heidinga dan.heidinga at oracle.com
Wed Jun 5 17:56:06 UTC 2024



From: Dan Smith <daniel.smith at oracle.com>
Date: Wednesday, June 5, 2024 at 1:42 PM
To: Dan Heidinga <dan.heidinga at oracle.com>
Cc: valhalla-spec-experts <valhalla-spec-experts at openjdk.java.net>
Subject: Re: Updated specifications
> On Jun 5, 2024, at 9:21 AM, Dan Heidinga <dan.heidinga at oracle.com> wrote:
>
> Thanks for making the update from Preload to LoadableDescriptors.  It cleans up the spec a lot.
>
>  I have concerns about the changes to 5.4 related to loading classes.  As discussed at the offsite meeting, from an implementation perspective, we don’t want to introduce new rules that allow loading of arbitrary classes at any point during linking.  There are already rules in place about further execution being driven by the invocation of the main method (JVMS 5.2) and the linking activities driven by its execution.  Introducing new rules that legitimize other loading strategies are outside the remit of Valhalla and are unnecessary for our purposes.

Not the intent—I did leave in these rephrasings that, on review, didn't look like they were weighing in on this issue.
I would prefer to revert these additions as it introduces an ambiguity into spec – some loading may be driven by resolution while the new sentence implies additional unstated reasons classes may be loaded from the constant pool.

>  The original 5.4 states “Linking also involves resolution of symbolic references in the class or interface, though not necessarily at the same time as the class or interface is verified and prepared.” which already allows for loading of necessary classes.  The new sentence “All of these linking activities may involve the loading of other classes and interfaces mentioned in the constant pool of the current class or interface.” unnecessary widens what and when loading can occur and opens doors I don’t think we need or want opened.

The clarification I wanted to make, in particular, is that verification can lead to loading, independently from resolution.

Would it help to say "the **specified** loading of other classes and interfaces"?
Class loading due to verification is already covered in 5.4.1 where it the spec says: “Verification may cause additional classes and interfaces to be loaded…”.  There is a state machine in class loading that goes from loaded > verified > prepared > initialized.  Linking is a longer stage that spans from verified to unloaded as linking can continue throughout execution when using a lazy strategy.  Since linking includes verification and preparation I don’t think we need additional clarification in 5.4 as 5.4.1 covers it already.

>  I think this change should also be reverted: “, (and, because of recursion, loading) including the loading of other classes,” as it broadens the loading behaviour beyond what the original struck thru clause meant.

I just thought the "because of recursion" felt very tailored to constant resolution, again ignoring verification-time loading.

Given the previous sentence, I'd actually be happy to just delete this aside about loading entirely. This paragraph and bulleted list really doesn't need to be concerned with loading (of other classes) at all.
Deleting both the original “because of recursion” and the new “including the loading of other classes” text works for me.
--Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-spec-observers/attachments/20240605/0ed91c57/attachment-0001.htm>


More information about the valhalla-spec-observers mailing list