JDK-8352737 : [lworld] Fix TestIntrinsics after VarHandle support cleanup
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: repo-valhalla
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-03-24
  • Updated: 2025-09-09
  • Resolved: 2025-09-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
repo-valhallaFixed
Related Reports
Blocks :  
Causes :  
Relates :  
Description
The fix for JDK-8351569 redefines which access modes are supported by value var handles. For CAS to be supported on a field var handle  the field must be either:

* nullable
* volatile
* have a type of a non-weakly consistent value class

(similar restrictions apply to array access). In other words, CAS operation will either target values with non-flat layout or with atomic flat layout. In the latter case, we expect the size of the flat layout not to exceed 64 bits.

The TestIntrinsics test has test cases for atomic operations invoked on value types (via the Unsafe API). However, these test cases do not conform to the restrictions outlined above. For instance, `test63` attempts a CAS on a non-volatile, null-restricted field whose type is a weakly-consistent class. As such, calling `compareAndSetFlatValue` on such a field will result in undefined behavior, as the flat layout for this class doesn't fit in 64 bits.


Comments
A pull request was submitted for review. Branch: lworld URL: https://git.openjdk.org/valhalla/pull/1555 Date: 2025-09-09 09:14:50 +0000
09-09-2025

I think the bailouts added by JDK-8351569 to the problematic tests are fine: https://github.com/openjdk/valhalla/commit/0f7cdf3b34b8339d3c4f7982a09133089c5b09b0#diff-d220522adf48a947724b2f00d9e8d5875085f62bed4fdcbbb7f07b9fec673109 We might want to refactor a bit and/or add comments but I'll leave this for now.
12-06-2025