mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8217389: JTREG: Clean up, remove unused variable warnings
Reviewed-by: lmesnik, tschatzl
This commit is contained in:
parent
3d13ab6882
commit
b09dfdbc01
15 changed files with 43 additions and 42 deletions
|
@ -120,19 +120,16 @@ public class TestMaxNewSize {
|
||||||
|
|
||||||
public static void main(String args[]) throws Exception {
|
public static void main(String args[]) throws Exception {
|
||||||
String gcName = args[0];
|
String gcName = args[0];
|
||||||
final int M32 = 32 * 1024 * 1024;
|
final int M = 1024 * 1024;
|
||||||
final int M64 = 64 * 1024 * 1024;
|
checkMaxNewSize(new String[] { gcName, "-Xmx128M" }, 128 * M);
|
||||||
final int M96 = 96 * 1024 * 1024;
|
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=5" }, 128 * M);
|
||||||
final int M128 = 128 * 1024 * 1024;
|
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M" }, 128 * M);
|
||||||
checkMaxNewSize(new String[] { gcName, "-Xmx128M" }, M128);
|
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:OldSize=96M" }, 128 * M);
|
||||||
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=5" }, M128);
|
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:MaxNewSize=32M" }, 32 * M);
|
||||||
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M" }, M128);
|
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M", "-XX:MaxNewSize=32M" }, 32 * M);
|
||||||
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:OldSize=96M" }, M128);
|
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=6", "-XX:MaxNewSize=32M" }, 32 * M);
|
||||||
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:MaxNewSize=32M" }, M32);
|
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-Xms96M" }, 128 * M);
|
||||||
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M", "-XX:MaxNewSize=32M" }, M32);
|
checkMaxNewSize(new String[] { gcName, "-Xmx96M", "-Xms96M" }, 96 * M);
|
||||||
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=6", "-XX:MaxNewSize=32M" }, M32);
|
checkMaxNewSize(new String[] { gcName, "-XX:NewSize=128M", "-XX:MaxNewSize=50M"}, 128 * M);
|
||||||
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-Xms96M" }, M128);
|
|
||||||
checkMaxNewSize(new String[] { gcName, "-Xmx96M", "-Xms96M" }, M96);
|
|
||||||
checkMaxNewSize(new String[] { gcName, "-XX:NewSize=128M", "-XX:MaxNewSize=50M"}, M128);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
package gc.arguments;
|
package gc.arguments;
|
||||||
|
|
||||||
|
import static java.lang.ref.Reference.reachabilityFence;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test TestTargetSurvivorRatioFlag
|
* @test TestTargetSurvivorRatioFlag
|
||||||
* @key gc
|
* @key gc
|
||||||
|
@ -297,7 +299,7 @@ public class TestTargetSurvivorRatioFlag {
|
||||||
|
|
||||||
// force minor GC
|
// force minor GC
|
||||||
while (youngGCBean.getCollectionCount() <= initialGcId + MAX_TENURING_THRESHOLD * 2) {
|
while (youngGCBean.getCollectionCount() <= initialGcId + MAX_TENURING_THRESHOLD * 2) {
|
||||||
byte b[] = new byte[ARRAY_LENGTH];
|
reachabilityFence(new byte[ARRAY_LENGTH]);
|
||||||
}
|
}
|
||||||
|
|
||||||
allocator.release();
|
allocator.release();
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
package gc.cms;
|
package gc.cms;
|
||||||
|
|
||||||
|
import static java.lang.ref.Reference.reachabilityFence;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test DisableResizePLAB
|
* @test DisableResizePLAB
|
||||||
* @key gc
|
* @key gc
|
||||||
|
@ -41,7 +43,7 @@ public class DisableResizePLAB {
|
||||||
}
|
}
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
while (System.currentTimeMillis() - startTime < 10_000) {
|
while (System.currentTimeMillis() - startTime < 10_000) {
|
||||||
Object o = new byte[1024];
|
reachabilityFence(new byte[1024]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
package gc.cslocker;
|
package gc.cslocker;
|
||||||
|
|
||||||
|
import static java.lang.ref.Reference.reachabilityFence;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test TestCSLocker
|
* @test TestCSLocker
|
||||||
* @key gc
|
* @key gc
|
||||||
|
@ -73,8 +75,7 @@ class GarbageProducer extends Thread
|
||||||
|
|
||||||
while (isRunning) {
|
while (isRunning) {
|
||||||
try {
|
try {
|
||||||
int[] arr = null;
|
reachabilityFence(new int[size]);
|
||||||
arr = new int[size];
|
|
||||||
sleep(sleepTime);
|
sleep(sleepTime);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
isRunning = false;
|
isRunning = false;
|
||||||
|
|
|
@ -57,8 +57,8 @@ public class TestMemoryMXBeans {
|
||||||
MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
|
MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
|
||||||
long heapInit = memoryMXBean.getHeapMemoryUsage().getInit();
|
long heapInit = memoryMXBean.getHeapMemoryUsage().getInit();
|
||||||
long heapMax = memoryMXBean.getHeapMemoryUsage().getMax();
|
long heapMax = memoryMXBean.getHeapMemoryUsage().getMax();
|
||||||
long nonHeapInit = memoryMXBean.getNonHeapMemoryUsage().getInit();
|
memoryMXBean.getNonHeapMemoryUsage().getInit(); // value not used
|
||||||
long nonHeapMax = memoryMXBean.getNonHeapMemoryUsage().getMax();
|
memoryMXBean.getNonHeapMemoryUsage().getMax(); // value not used
|
||||||
|
|
||||||
if (initSize > 0 && heapInit != initSize) {
|
if (initSize > 0 && heapInit != initSize) {
|
||||||
throw new IllegalStateException("Init heap size is wrong: " + heapInit + " vs " + initSize);
|
throw new IllegalStateException("Init heap size is wrong: " + heapInit + " vs " + initSize);
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class TestFromCardCacheIndex {
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final long startAddress = WB.getObjectAddress(target);
|
WB.getObjectAddress(target); // startAddress not used
|
||||||
final long lastAddress = getObjectLastAddress(target);
|
final long lastAddress = getObjectLastAddress(target);
|
||||||
final int card = getCardIndex32bit(lastAddress);
|
final int card = getCardIndex32bit(lastAddress);
|
||||||
if (card == -1) {
|
if (card == -1) {
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
package gc.g1;
|
package gc.g1;
|
||||||
|
|
||||||
|
import static java.lang.ref.Reference.reachabilityFence;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test TestHumongousAllocNearlyFullRegion
|
* @test TestHumongousAllocNearlyFullRegion
|
||||||
* @bug 8143587
|
* @bug 8143587
|
||||||
|
@ -62,7 +64,7 @@ public class TestHumongousAllocNearlyFullRegion {
|
||||||
for (int i = 0; i < heapSize; i++) {
|
for (int i = 0; i < heapSize; i++) {
|
||||||
// 131069 is the number of longs it takes to fill a heapRegion except
|
// 131069 is the number of longs it takes to fill a heapRegion except
|
||||||
// for 8 bytes on 64 bit.
|
// for 8 bytes on 64 bit.
|
||||||
long[] largeObect = new long[131069];
|
reachabilityFence(new long[131069]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,10 +54,6 @@ public class TestRemsetLoggingThreads {
|
||||||
|
|
||||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
|
|
||||||
// a zero in refinement thread numbers indicates that the value in ParallelGCThreads should be used.
|
|
||||||
// Additionally use at least one thread.
|
|
||||||
int expectedNumRefinementThreads = refinementThreads;
|
|
||||||
|
|
||||||
String pattern = "Concurrent RS threads times \\(s\\)$";
|
String pattern = "Concurrent RS threads times \\(s\\)$";
|
||||||
Matcher m = Pattern.compile(pattern, Pattern.MULTILINE).matcher(output.getStdout());
|
Matcher m = Pattern.compile(pattern, Pattern.MULTILINE).matcher(output.getStdout());
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ package gc.g1.humongousObjects;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
import sun.hotspot.WhiteBox;
|
import sun.hotspot.WhiteBox;
|
||||||
|
|
||||||
|
import static java.lang.ref.Reference.reachabilityFence;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
@ -139,7 +141,7 @@ public class TestNoAllocationsInHRegions {
|
||||||
// Dead object allocation
|
// Dead object allocation
|
||||||
() -> {
|
() -> {
|
||||||
int size = RND.nextInt(DEAD_OBJECT_MAX_SIZE);
|
int size = RND.nextInt(DEAD_OBJECT_MAX_SIZE);
|
||||||
byte[] deadObject = new byte[size];
|
reachabilityFence(new byte[size]);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Check
|
// Check
|
||||||
|
|
|
@ -27,7 +27,6 @@ package gc.logging;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.util.function.Predicate;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
|
@ -67,8 +66,6 @@ public class TestMetaSpaceLog {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void verifyContainsMetaSpaceUpdate(OutputAnalyzer output) {
|
private static void verifyContainsMetaSpaceUpdate(OutputAnalyzer output) {
|
||||||
Predicate<String> collectedMetaSpace = line -> check(line);
|
|
||||||
|
|
||||||
// At least one metaspace line from GC should show GC being collected.
|
// At least one metaspace line from GC should show GC being collected.
|
||||||
boolean foundCollectedMetaSpace = output.asLines().stream()
|
boolean foundCollectedMetaSpace = output.asLines().stream()
|
||||||
.filter(s -> s.contains("[gc,metaspace"))
|
.filter(s -> s.contains("[gc,metaspace"))
|
||||||
|
|
|
@ -131,7 +131,6 @@ public class TestPrintReferences {
|
||||||
|
|
||||||
// Find the first Reference Processing log and check its format.
|
// Find the first Reference Processing log and check its format.
|
||||||
private static void checkLogFormat(OutputAnalyzer output, boolean parallelRefProcEnabled) {
|
private static void checkLogFormat(OutputAnalyzer output, boolean parallelRefProcEnabled) {
|
||||||
String countRegex = "[0-9]+";
|
|
||||||
String timeRegex = doubleRegex + "ms";
|
String timeRegex = doubleRegex + "ms";
|
||||||
|
|
||||||
/* Total Reference processing time */
|
/* Total Reference processing time */
|
||||||
|
|
|
@ -31,6 +31,9 @@ import javax.management.MBeanServer;
|
||||||
import javax.management.MalformedObjectNameException;
|
import javax.management.MalformedObjectNameException;
|
||||||
import javax.management.ObjectName;
|
import javax.management.ObjectName;
|
||||||
import javax.management.ReflectionException;
|
import javax.management.ReflectionException;
|
||||||
|
|
||||||
|
import static java.lang.ref.Reference.reachabilityFence;
|
||||||
|
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -128,7 +131,7 @@ class MemoryStresser implements Runnable {
|
||||||
// Dead object allocation
|
// Dead object allocation
|
||||||
() -> {
|
() -> {
|
||||||
int size = RND.nextInt(DEAD_OBJECT_MAX_SIZE);
|
int size = RND.nextInt(DEAD_OBJECT_MAX_SIZE);
|
||||||
byte[] deadObject = new byte[size];
|
reachabilityFence(new byte[size]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -111,13 +111,12 @@ public class G1AddMetaspaceDependency {
|
||||||
Loader f_loader = new Loader(b_name, b_bytes, a_name, a_loader);
|
Loader f_loader = new Loader(b_name, b_bytes, a_name, a_loader);
|
||||||
Loader g_loader = new Loader(b_name, b_bytes, a_name, a_loader);
|
Loader g_loader = new Loader(b_name, b_bytes, a_name, a_loader);
|
||||||
|
|
||||||
Class<?> c;
|
b_loader.loadClass(b_name);
|
||||||
c = b_loader.loadClass(b_name);
|
c_loader.loadClass(b_name);
|
||||||
c = c_loader.loadClass(b_name);
|
d_loader.loadClass(b_name);
|
||||||
c = d_loader.loadClass(b_name);
|
e_loader.loadClass(b_name);
|
||||||
c = e_loader.loadClass(b_name);
|
f_loader.loadClass(b_name);
|
||||||
c = f_loader.loadClass(b_name);
|
g_loader.loadClass(b_name);
|
||||||
c = g_loader.loadClass(b_name);
|
|
||||||
}
|
}
|
||||||
public class A {
|
public class A {
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import java.util.ArrayList;
|
||||||
*/
|
*/
|
||||||
public class TestMetaspaceInitialization {
|
public class TestMetaspaceInitialization {
|
||||||
private class Internal {
|
private class Internal {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public int x;
|
public int x;
|
||||||
public Internal(int x) {
|
public Internal(int x) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
|
|
|
@ -132,7 +132,7 @@ class Decompiler {
|
||||||
byteCodeIndex++;
|
byteCodeIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int def = cursor.readIntAt(byteCodeIndex);
|
cursor.readIntAt(byteCodeIndex); // def
|
||||||
byteCodeIndex +=4;
|
byteCodeIndex +=4;
|
||||||
|
|
||||||
int npairs = cursor.readIntAt(byteCodeIndex);
|
int npairs = cursor.readIntAt(byteCodeIndex);
|
||||||
|
@ -149,7 +149,7 @@ class Decompiler {
|
||||||
byteCodeIndex++;
|
byteCodeIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int def = cursor.readIntAt(byteCodeIndex);
|
cursor.readIntAt(byteCodeIndex); // def
|
||||||
byteCodeIndex +=4;
|
byteCodeIndex +=4;
|
||||||
|
|
||||||
int low = cursor.readIntAt(byteCodeIndex);
|
int low = cursor.readIntAt(byteCodeIndex);
|
||||||
|
@ -245,7 +245,7 @@ class Decompiler {
|
||||||
|
|
||||||
private ConstantPoolEntry[] decodeConstantPool() {
|
private ConstantPoolEntry[] decodeConstantPool() {
|
||||||
final int CONSTANT_Utf8 = 1;
|
final int CONSTANT_Utf8 = 1;
|
||||||
final int CONSTANT_Unicode = 2;
|
// final int CONSTANT_Unicode = 2;
|
||||||
final int CONSTANT_Integer = 3;
|
final int CONSTANT_Integer = 3;
|
||||||
final int CONSTANT_Float = 4;
|
final int CONSTANT_Float = 4;
|
||||||
final int CONSTANT_Long = 5;
|
final int CONSTANT_Long = 5;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue