8396723: Fix JIT compiler crashes caused by AssemblerX86 gtest changing global CPU feature state #34080
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.48) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 548 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.377
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #34080"
general
weight: 0.35
vnkozlov
This PR fixes the JIT compiler crashes reported due to the mutation of the global CPU feature state by the AssemblerX86 gtest.
Background
AssemblerX86.validatechecks HotSpot's x86 instruction encodings byte for byte against GNUas(asmtest.out.h, generated byx86-asmtest.py). This covers encodings, such as AVX-512 and APX, that normal testing cannot run on most hosts.Problem
To encode every instruction in
asmtest.out.h,AssemblerX86.validatechanged global VM state at runtime: it setUseAVX=3andUseAPX=trueand added feature bits toVM_Version. Compiler threads (running in parallel) read the same state while they generated code, so they saw inconsistent values and crashed. In the shared VM (TEST_VM, JDK-8396651) the state also stayed inconsistent after the test, because the feature bits were never restored. Running the test in a separate VM (TEST_OTHER_VM, JDK-8396723) did not help, because C1 threads in the child VM could still see the state change.Fix
Each x86
Assemblernow gets its CPU features from an assembler features object instead of from globals:AbstractAssemblerFeaturesis a small interface:use_avx(),use_apx(),cpu_supports_evex()and thesupports_()queries the assembler uses.HotSpotAssemblerFeaturesis the production implementation. It is stateless and forwards each query to the existing flags andVM_Version. It is the default for all existingAssemblerandMacroAssemblerconstructors, so production call sites and generated code are unchanged.assembler_x86.cppthat affect encoding now go through the assembler's features. This coversUseAVX,UseAPXandVM_Version::supports_(), as well as theInstructionAttrlegacy-mode and EVEX address-attribute decisions, and thelocate_operandsanity asserts.SyntheticAssemblerFeaturesexists only in the test. It enables the full feature set, and the test builds itsMacroAssemblerwith it.The test no longer writes any global flag or feature bit. It runs as a normal
TEST_VMtest, and every other thread always sees the real host configuration. Because the test only compares bytes and never executes the generated code, it runs on any x86_64 host, including hosts without AVX-512 or APX.asmtest.out.his unchanged.Testing
GTestWrapper.javapassed. All gtests passed, includingAssemblerX86.validate_vm.GTestWrapper.javapassed. The full gtest suite also passed with-XX:UseAVX=2(EVEX disabled in production assemblers), andcompiler/vectorizationpassed with-XX:UseAVX=2.x86-asmtest.py --full(62,802 cases) passed on Linux.---------
<!-- Anything below this marker will be automatically updated, please do not edit manually! -->
---------
Progress
Issue
* JDK-8396723: Fix JIT compiler crashes caused by AssemblerX86 gtest changing global CPU feature state (Bug - P3)
Reviewing
<details><summary>Using <code>git</code></summary>
Checkout this PR locally: \
$ git fetch https://git.openjdk.org/jdk.git pull/34080/head:pull/34080\$ git checkout pull/34080Update a local copy of the PR: \
$ git checkout pull/34080\$ git pull https://git.openjdk.org/jdk.git pull/34080/head</details>
<details><summary>Using Skara CLI tools</summary>
Checkout this PR locally: \
$ git pr checkout 34080View PR using the GUI difftool: \
$ git pr show -t 34080</details>
<details><summary>Using diff file</summary>
Download this PR as a diff file: \
<a href="https://git.openjdk.org/jdk/pull/34080.diff">https://git.openjdk.org/jdk/pull/34080.diff</a>
</details>
<details><summary>Using Webrev</summary>
Link to Webrev Comment
</details>