Skip to content

8379913: [lworld] AppCDS test asserts with -Xcomp --enable-preview#2233

Closed
dafedafe wants to merge 10 commits intoopenjdk:lworldfrom
dafedafe:JDK-8379913
Closed

8379913: [lworld] AppCDS test asserts with -Xcomp --enable-preview#2233
dafedafe wants to merge 10 commits intoopenjdk:lworldfrom
dafedafe:JDK-8379913

Conversation

@dafedafe
Copy link
Copy Markdown
Contributor

@dafedafe dafedafe commented Mar 16, 2026

Issue

Many AppCDS test asserts with assert(false) failed: Address 0x00007f0dfc2923e0 for <unknown>/('verify_oop: r11: broken oop oop_result, "broken oop in call_VM_base" (src/hotspot/cpu/x86/macroAssembler_x86.cpp:1353)') is missing in AOT Code Cache addresses table when run with -Xcomp --enable-preview

Cause

The crash happens during AOT cache dumping seemingly because -XX:+VerifyOops causes the adapter to use addresses that the AOT doesn't know about. In particular, verify_oop/verify_oop_addr add a message C‑string and reference the verify‑oop stub entry. AOTCodeCache::write_relocations() tries to serialize those relocations, AOTCodeAddressTable::id_for_address() can’t resolve them and crashes.
In this case the issue happens with --enable-preview because it creates an adapter for scalarized arguments and, after creating the oop from the arguments, get_vm_result_oop invokes verify_oop_msg. Without --enable-preview the path is never taken and the missing "registration" isn’t exercised (I fear that this crash could potentially be triggered by some other (non preview) code but the fix doesn't need to distinguish between preview/non-preview).

Fix

Instead of making the two addresses used by verify_oop_msg "visible" to AOT we disable AOT code generation if both VerifyOops and InlineTypePassFieldsAsArgs are true.

Testing

Tier 1-3+
Failing CDS tests before and after


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-8379913: [lworld] AppCDS test asserts with -Xcomp --enable-preview (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2233

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper bot commented Mar 16, 2026

👋 Welcome back dfenacci! 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 16, 2026

@dafedafe 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:

8379913: [lworld] AppCDS test asserts with -Xcomp --enable-preview

Reviewed-by: kvn, thartmann

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 2 new commits pushed to the lworld branch:

  • 357956b: 8377670: [lworld] RO adapter signature should not scalarize inline receiver in CompiledEntrySignature::initialize_from_fingerprint()
  • 2bb7e72: 8380197: [lworld] [REDO] OptimizePtrCompare is too conservative

Please see this link for an up-to-date comparison between the source branch of this pull request and 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.

➡️ To integrate this PR with the above commit message to the lworld branch, type /integrate in a new comment.

@openjdk openjdk bot changed the title JDK-8379913: [lworld] AppCDS test asserts with -Xcomp --enable-preview 8379913: [lworld] AppCDS test asserts with -Xcomp --enable-preview Mar 16, 2026
@dafedafe dafedafe marked this pull request as ready for review March 25, 2026 07:38
@dafedafe
Copy link
Copy Markdown
Contributor Author

@vnkozlov I think it would be good if could have a quick look at this.

@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 25, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge bot commented Mar 25, 2026

Webrevs

Copy link
Copy Markdown
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

The fix is correct. Good work.

We actually disable AOT code generation when VerifyOops is on. It produces a lot of C strings and we have only fixed number of slots (500 in debug VM) to record them.

If you can manually run locally test, please run with -Xlog:aot+codecache+exit=debug it will show (among other things) how many C strings were recorded in AOT cache during -XXAOTMode=record phase:

[3.139s][debug][aot,codecache,exit]   Wrote 1 C strings of total length 22 

I don't want to hit 500 limit.

@vnkozlov
Copy link
Copy Markdown
Contributor

An other solution would be to disable AOT code generation if VerifyOops is on:

diff --git a/src/hotspot/share/code/aotCodeCache.cpp b/src/hotspot/share/code/aotCodeCache.cpp
index 68db21850aa..cb7098f8641 100644
--- a/src/hotspot/share/code/aotCodeCache.cpp
+++ b/src/hotspot/share/code/aotCodeCache.cpp
@@ -188,14 +188,14 @@ void AOTCodeCache::initialize() {
   FLAG_SET_ERGO(AOTStubCaching, false);
 
   if (VerifyOops) {
-    // Disable AOT stubs caching when VerifyOops flag is on.
+    // Disable AOT code caching when VerifyOops flag is on.
     // Verify oops code generated a lot of C strings which overflow
     // AOT C string table (which has fixed size).
     // AOT C string table will be reworked later to handle such cases.
     //
-    // Note: AOT adapters are not affected - they don't have oop operations.
-    log_info(aot, codecache, init)("AOT Stubs Caching is not supported with VerifyOops.");
-    FLAG_SET_ERGO(AOTStubCaching, false);
+    log_info(aot, codecache, init)("AOT Code Caching is not supported with VerifyOops.");
+    disable_caching();
+    return;
   }
 
   bool is_dumping = false;

@dafedafe
Copy link
Copy Markdown
Contributor Author

Thank you @vnkozlov!

Disabling the AOT seems actually a more sensible solution (even though my tests showed just a few C strings recorded) but I've only added the disabling of the adapter part (FLAG_SET_ERGO(AOTAdapterCaching, false);) instead of disabling all the caching. Does it make sense?

Copy link
Copy Markdown
Member

@TobiHartmann TobiHartmann left a comment

Choose a reason for hiding this comment

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

That looks like a reasonable fix to me but it's only needed when preview is enabled, right?

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 26, 2026
@dafedafe
Copy link
Copy Markdown
Contributor Author

That looks like a reasonable fix to me but it's only needed when preview is enabled, right?

Yep, more precisely only when InlineTypePassFieldsAsArgs is true. Added that condition.

Copy link
Copy Markdown
Member

@TobiHartmann TobiHartmann left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Copy Markdown
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Good.

@dafedafe
Copy link
Copy Markdown
Contributor Author

Thank you @vnkozlov @TobiHartmann for your reviews.

@dafedafe
Copy link
Copy Markdown
Contributor Author

/integrate

@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 27, 2026

Going to push as commit f12276a.
Since your change was applied there have been 4 commits pushed to the lworld branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 27, 2026
@openjdk openjdk bot closed this Mar 27, 2026
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Mar 27, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 27, 2026

@dafedafe Pushed as commit f12276a.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

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

Labels

integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants