< prev index next > test/hotspot/jtreg/gc/shenandoah/TestReferenceRefersToShenandoah.java
Print this page
/*
! * Copyright (c) 2020, 2022, 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.
/*
! * Copyright (c) 2020, 2023, 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.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=satb
* gc.shenandoah.TestReferenceRefersToShenandoah
*/
! /* @test id=iu
* @requires vm.gc.Shenandoah
* @library /test/lib
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm
* -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
! * -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
* gc.shenandoah.TestReferenceRefersToShenandoah
*/
! /* @test id=satb-100
* @requires vm.gc.Shenandoah
* @library /test/lib
* @build jdk.test.whitebox.WhiteBox
* @modules java.base
* @run main jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm
* -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
! * -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=satb -XX:ShenandoahGarbageThreshold=100 -Xmx100m
* gc.shenandoah.TestReferenceRefersToShenandoah
*/
/* @test id=iu-100
* @requires vm.gc.Shenandoah
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=satb
* gc.shenandoah.TestReferenceRefersToShenandoah
*/
! /* @test id=satb-100
+ * @requires vm.gc.Shenandoah
+ * @library /test/lib
+ * @build jdk.test.whitebox.WhiteBox
+ * @modules java.base
+ * @run main jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ * -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=satb -XX:ShenandoahGarbageThreshold=100 -Xmx100m
+ * gc.shenandoah.TestReferenceRefersToShenandoah
+ */
+
+ /* @test id=generational
* @requires vm.gc.Shenandoah
* @library /test/lib
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm
* -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
! * -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational
* gc.shenandoah.TestReferenceRefersToShenandoah
*/
! /* @test id=generational-100
* @requires vm.gc.Shenandoah
* @library /test/lib
* @build jdk.test.whitebox.WhiteBox
* @modules java.base
* @run main jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm
* -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
! * -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational -XX:ShenandoahGarbageThreshold=100 -Xmx100m
+ * gc.shenandoah.TestReferenceRefersToShenandoah
+ */
+
+ /* @test id=iu
+ * @requires vm.gc.Shenandoah
+ * @library /test/lib
+ * @build jdk.test.whitebox.WhiteBox
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ * -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
* gc.shenandoah.TestReferenceRefersToShenandoah
*/
/* @test id=iu-100
* @requires vm.gc.Shenandoah
private static void gcUntilOld(Object o) throws Exception {
if (!WB.isObjectInOldGen(o)) {
WB.fullGC();
if (!WB.isObjectInOldGen(o)) {
! fail("object not promoted by full gc");
}
}
}
private static void gcUntilOld() throws Exception {
private static void gcUntilOld(Object o) throws Exception {
if (!WB.isObjectInOldGen(o)) {
WB.fullGC();
if (!WB.isObjectInOldGen(o)) {
! // This is just a warning, because failing would
+ // be overspecifying for generational shenandoah,
+ // which need not necessarily promote objects upon
+ // a full GC.
+ warn("object not promoted by full gc");
}
}
}
private static void gcUntilOld() throws Exception {
private static void fail(String msg) throws Exception {
throw new RuntimeException(msg);
}
+ private static void warn(String msg) {
+ System.out.println("Warning: " + msg);
+ }
+
private static void expectCleared(Reference<TestObject> ref,
String which) throws Exception {
expectNotValue(ref, testObjectNone, which);
if (!ref.refersTo(null)) {
fail("expected " + which + " to be cleared");
< prev index next >