< prev index next >

test/hotspot/jtreg/compiler/c2/irTests/stable/StableRefFinalTest.java

Print this page
@@ -1,7 +1,8 @@
  /*
   * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
+  * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -69,11 +70,16 @@
      static final Carrier BLANK_CARRIER = new Carrier(false);
      static final Carrier INIT_CARRIER = new Carrier(true);
  
      @Test
      @IR(counts = { IRNode.LOAD, ">0" })
-     @IR(failOn = { IRNode.MEMBAR })
+     @IR(applyIf = {"enable-valhalla", "false"}, failOn = { IRNode.MEMBAR })
+     // We have barriers with valhalla from the atomic expansion of the LoadFlatNode
+     // Indeed, since the field is not initialized, it is not known to be constant yet,
+     // and so, the LoadFlat cannot be expanded non-atomically. We need barriers to synchronize
+     // the LoadFlat and potential updates to sub-field of the flatten field.
+     @IR(applyIfAnd = {"UseFieldFlattening", "true", "enable-valhalla", "true"}, counts = { IRNode.MEMBAR, ">0" })
      static int testNoFold() {
          // Access should not be folded.
          // No barriers expected for plain fields.
          Integer i = BLANK_CARRIER.field;
          return i != null ? i : 0;
< prev index next >