JDK-8329234 : [lworld] compiler/gcbarriers/TestZGCBarrierElision.java fails after JDK-8329205
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: repo-valhalla
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-03-28
  • Updated: 2025-07-07
  • Resolved: 2025-07-02
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
Relates :  
Relates :  
Description
JDK-8329205 added runtime checks to VarHandleReferences$FieldInstanceReadWrite::getAndSet​ that are not folded by C2:

1) Method "static void compiler.gcbarriers.TestZGCCorrectBarrierElision.testLoadThenAtomic(compiler.gcbarriers.Outer,compiler.gcbarriers.Inner)" - [Failed IR rules: 1]:
   * @IR rule 1: "@compiler.lib.ir_framework.IR(phase={FINAL_CODE}, applyIfPlatformAnd={}, applyIfCPUFeatureOr={}, counts={"_#C#Z_LOAD_P_WITH_BARRIER_FLAG#_", "strong", "1"}, failOn={}, applyIfPlatform={}, applyIfPlatformOr={}, applyIfOr={}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeature={}, applyIfAnd={}, applyIfNot={})"
     > Phase "Final Code":
       - counts: Graph contains wrong number of nodes:
         * Constraint 1: "(\\d+(\\s){2}(zLoadP\\S*.*)+(\\s){2}===.*barrier\\(\\s*strong\\s*\\))"
           - Failed comparison: [found] 2 = 1 [given]
             - Matched nodes (2):
               * 31  zLoadP  === 112 14 12 32  [[ 33 27 29 ]] compiler/gcbarriers/Inner * barrier(strong )
               * 34  zLoadP  === _ 38 35 36  [[ 37 43 72 ]] java/lang/Class (java/io/Serializable,java/lang/constant/Constable,java/lang/reflect/AnnotatedElement,java/lang/invoke/TypeDescriptor,java/lang/reflect/GenericDeclaration,java/lang/reflect/Type,java/lang/invoke/TypeDescriptor$OfField):exact * barrier(strong )

I'll disable the corresponding IR rule with https://github.com/openjdk/valhalla/pull/1064.
Comments
A pull request was submitted for review. Branch: lworld URL: https://git.openjdk.org/valhalla/pull/1496 Date: 2025-07-02 10:45:19 +0000
02-07-2025

JDK-8350515 seems to have fixed this particular issue. JDK-8353182 is unrelated.
02-07-2025

JDK-8353182 seems to be very similar. I closed it as duplicate for now. Please also look at the test / IR rules marked with "// TODO JDK-8353182"
12-06-2025

Maybe it's similar to JDK-8342488, [~dfenacci] could you please take a look if you get a chance?
11-06-2025