Skip to content

8379148: [lworld] Wrapper class caches should not be used when --enable-preview#2249

Draft
Arraying wants to merge 3 commits intoopenjdk:lworldfrom
Arraying:JDK-8379148
Draft

8379148: [lworld] Wrapper class caches should not be used when --enable-preview#2249
Arraying wants to merge 3 commits intoopenjdk:lworldfrom
Arraying:JDK-8379148

Conversation

@Arraying
Copy link
Copy Markdown
Member

@Arraying Arraying commented Mar 20, 2026

Hi all,

This contributes @xmas92's previously disregarded patch to disable the boxed primitive cache entirely when using preview mode.

Testing: tiers 1-4, Oracle tiers 5-7 with --enable-preview only.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (1 review required, with at least 1 Committer)

Issue

  • JDK-8379148: [lworld] Wrapper class caches should not be used when --enable-preview (Bug - P3)

Contributors

  • Axel Boldt-Christmas <aboldtch@openjdk.org>

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2249

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

Using diff file

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

@Arraying
Copy link
Copy Markdown
Member Author

/contributor add @xmas92

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper bot commented Mar 20, 2026

👋 Welcome back phubner! 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
Copy Markdown

openjdk bot commented Mar 20, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title 8379148 8379148: [lworld] Wrapper class caches should not be used when --enable-preview Mar 20, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 20, 2026

@Arraying
Contributor Axel Boldt-Christmas <aboldtch@openjdk.org> successfully added.

@liach
Copy link
Copy Markdown
Member

liach commented Mar 20, 2026

What does this really solve? This doesn't identify the sites that incorrectly initialized these caches. This doesn't remove the C2 recognition of special wrapper arrays. Why do we need this?

@Arraying
Copy link
Copy Markdown
Member Author

Arraying commented Mar 27, 2026

Thanks for your comments @liach.

What does this really solve?

The purpose of this PR is to clean up the remaining box cache changes that are necessary. Once the scope of this task is finalized and the PR goes out of draft, I will update the description to be more representative.

This doesn't identify the sites that incorrectly initialized these caches.

There are likely other usage sites that I have not overhauled. This is still a draft.

This doesn't remove the C2 recognition of special wrapper arrays.

We cannot remove C2's recognition of these arrays. The box caches are VM symbols, we can only restrict their usages from the VM's side by ensuring control flow does not use them and verifying this through assertions. One prominent usage is during deoptimization. Axel has already changed the VM code for this in JDK-8378531.

We still had underlying test failures, for instance JDK-8379863, which was a missing piece for this PR. Now that this has been integrated, things will look a lot clearer.

Why do we need this?

When it comes to boxed caches, we should not initialize from (nor write to) the CDS archives.

}

static boolean isEnabled() {
return cache != unused;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall it looks good to me, but is it possible to do this:

 static boolean isEnabled() {
     return cache != null;

That way you don't need the unused anymore.

Copy link
Copy Markdown
Contributor

@matias9927 matias9927 left a comment

Choose a reason for hiding this comment

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

So far, the design makes sense to me! The caches will still exist in the CDS archive because they will be in the default classlist, but minimizing their use in preview mode will help transition to its deprecation.

assert cache.length == size;
} else {
cache = unused;
assert !isEnabled();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would assert that archivedCache is null here so we know it does not get loaded by CDS at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants