< prev index next > test/hotspot/jtreg/compiler/c2/irTests/stable/StableRefArrayTest.java
Print this page
/*
* 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.
return 0;
}
@Test
@IR(counts = { IRNode.LOAD, ">0" })
! @IR(failOn = { IRNode.MEMBAR })
static int testPartialFold() {
// Access should not be folded.
- // No barriers expected for plain fields.
Integer[] is = INIT_EMPTY_CARRIER.field;
if (is != null) {
Integer i = is[0];
if (i != null) {
return i;
return 0;
}
@Test
@IR(counts = { IRNode.LOAD, ">0" })
! @IR(applyIf = {"enable-valhalla", "false"}, failOn = { IRNode.MEMBAR })
+ // We have barriers with valhalla from the atomic expansion of the LoadFlatNode
+ // Indeed, since the array element 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 field of the flatten array element.
+ @IR(applyIfAnd = {"UseArrayFlattening", "true", "enable-valhalla", "true"}, counts = { IRNode.MEMBAR, "> 0" })
static int testPartialFold() {
// Access should not be folded.
Integer[] is = INIT_EMPTY_CARRIER.field;
if (is != null) {
Integer i = is[0];
if (i != null) {
return i;
< prev index next >