< prev index next > test/hotspot/jtreg/compiler/gcbarriers/TestZGCBarrierElision.java
Print this page
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.ThreadLocalRandom;
/**
! * @test
* @summary Test that the ZGC barrier elision optimization does not elide
* necessary barriers. The tests use volatile memory accesses and
* blackholes to prevent C2 from simply optimizing them away.
* @library /test/lib /
* @requires vm.gc.ZGenerational
* @run driver compiler.gcbarriers.TestZGCBarrierElision test-correctness
*/
/**
! * @test
* @summary Test that the ZGC barrier elision optimization elides unnecessary
* barriers following simple allocation and domination rules.
* @library /test/lib /
* @requires vm.gc.ZGenerational & (vm.simpleArch == "x64" | vm.simpleArch == "aarch64")
* @run driver compiler.gcbarriers.TestZGCBarrierElision test-effectiveness
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.ThreadLocalRandom;
/**
! * @test id=Z
* @summary Test that the ZGC barrier elision optimization does not elide
* necessary barriers. The tests use volatile memory accesses and
* blackholes to prevent C2 from simply optimizing them away.
* @library /test/lib /
* @requires vm.gc.ZGenerational
* @run driver compiler.gcbarriers.TestZGCBarrierElision test-correctness
*/
/**
! * @test id=ZGen
* @summary Test that the ZGC barrier elision optimization elides unnecessary
* barriers following simple allocation and domination rules.
* @library /test/lib /
* @requires vm.gc.ZGenerational & (vm.simpleArch == "x64" | vm.simpleArch == "aarch64")
* @run driver compiler.gcbarriers.TestZGCBarrierElision test-effectiveness
Common.blackhole(o);
Common.field1VarHandle.getAndSet(o, i);
}
@Test
! @IR(counts = { IRNode.Z_LOAD_P_WITH_BARRIER_FLAG, Common.REMAINING, "1" }, phase = CompilePhase.FINAL_CODE)
@IR(counts = { IRNode.Z_GET_AND_SET_P_WITH_BARRIER_FLAG, Common.REMAINING, "1" }, phase = CompilePhase.FINAL_CODE)
static void testLoadThenAtomic(Outer o, Inner i) {
Common.blackhole(o.field1);
Common.field1VarHandle.getAndSet(o, i);
}
Common.blackhole(o);
Common.field1VarHandle.getAndSet(o, i);
}
@Test
! // TODO 8329234
+ // @IR(counts = { IRNode.Z_LOAD_P_WITH_BARRIER_FLAG, Common.REMAINING, "1" }, phase = CompilePhase.FINAL_CODE)
@IR(counts = { IRNode.Z_GET_AND_SET_P_WITH_BARRIER_FLAG, Common.REMAINING, "1" }, phase = CompilePhase.FINAL_CODE)
static void testLoadThenAtomic(Outer o, Inner i) {
Common.blackhole(o.field1);
Common.field1VarHandle.getAndSet(o, i);
}
< prev index next >