Skip to content

Conversation

david-beaumont
Copy link
Contributor

@david-beaumont david-beaumont commented Sep 23, 2025

C++ changes for supporting preview mode when preview mode resources (with new location flags) are available.

At the moment, this code will operate on non-preview jimage files (1.0) and act as if no preview resources are available by virtue of the default value for missing attributes being zero (which matches location flags for "normal" entries).


Progress

  • Change must not contain extraneous whitespace

Issue

  • JDK-8366093: [lworld] Add preview mode to C++ classloader (Sub-task - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/1618/head:pull/1618
$ git checkout pull/1618

Update a local copy of the PR:
$ git checkout pull/1618
$ git pull https://git.openjdk.org/valhalla.git pull/1618/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1618

View PR using the GUI difftool:
$ git pr show -t 1618

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1618.diff

Using Webrev

Link to Webrev Comment

@david-beaumont
Copy link
Contributor Author

This is a new version of #1609, re-created so there's now a pr/xxx branch for use by dependent PRs.

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 23, 2025

👋 Welcome back david-beaumont! A progress list of the required criteria for merging this PR into lworld will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Sep 23, 2025

@david-beaumont This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8366093: [lworld] Add preview mode to C++ classloader

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 247 new commits pushed to the lworld branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 23, 2025
@mlbridge
Copy link

mlbridge bot commented Sep 23, 2025

Webrevs

enum {
// Set on a "normal" (non-preview) location if a preview version of
// it exists in the same module.
FLAGS_HAS_PREVIEW_VERSION = 0x1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid confusion, the value and spelling of the flag should agree across all modules.
In ImageLocation and jimage/ModulesReference.

Comment on lines +248 to +259
// Flag masks for the ATTRIBUTE_PREVIEW_FLAGS attribute. Defined so
// that zero is the overwhelmingly common case for normal resources.
enum {
// Set on a "normal" (non-preview) location if a preview version of
// it exists in the same module.
FLAGS_HAS_PREVIEW_VERSION = 0x1,
// Set on all preview locations in "/modules/xxx/META-INF/preview/..."
FLAGS_IS_PREVIEW_VERSION = 0x2,
// Set on a preview location if no normal (non-preview) version of
// it exists in the same module.
FLAGS_IS_PREVIEW_ONLY = 0x4
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A refactoring of the flags can avoid conflicting states.
FLAGS_IS_PREVIEW_VERSION = 2; // set for preview version
FLAGS_NO_NORMAL_VERSION = 1; // preserving the zero value for normal and no preview.

Create static methods in ImageLocation to perform the desired tests on flags.
The utility methods make the code easier to read.
Also define macros/function in the native code in ImageFile and jimage.

isPreviewVersion(flags) { return (flags & FLAGS_IS_PREVIEW_VERSION) != 0)}
isPreviewOnly(flags) { return (flags & FLAGS_IS_REVIEW_VERSION | FLAGS_NO_NORMAL_VERSION) == FLAGS_NO_NORMAL_VERSION}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reprise:

Your name FLAGS_IS_PREVIEW_ONLY probably better than FLAGS_NO_NORMAL_VERSION and has the same semantics.

FLAGS_HAS_PREVIEW_VERSION means that there is a preview version and it will be found in the <META-INF/Preview> hierarchy. if the flag is in the preview node then this is it. If found in the normal hierarchy, the preview class is found in the <META-INF/Preview> hierarchy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Pull request is ready to be integrated rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants