mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-19 10:34:38 +02:00
8217612: (CL)HSDB cannot show some JVM flags
Reviewed-by: dholmes, cjplummer
This commit is contained in:
parent
1ebe11a28d
commit
d6a75a0f86
3 changed files with 122 additions and 9 deletions
|
@ -140,8 +140,8 @@ define_pd_global(uint64_t,MaxRAM, 1ULL*G);
|
||||||
// notproduct flags are settable / visible only during development and are not declared in the PRODUCT version
|
// notproduct flags are settable / visible only during development and are not declared in the PRODUCT version
|
||||||
|
|
||||||
// A flag must be declared with one of the following types:
|
// A flag must be declared with one of the following types:
|
||||||
// bool, int, uint, intx, uintx, size_t, ccstr, double, or uint64_t.
|
// bool, int, uint, intx, uintx, size_t, ccstr, ccstrlist, double, or uint64_t.
|
||||||
// The type "ccstr" is an alias for "const char*" and is used
|
// The type "ccstr" and "ccstrlist" are an alias for "const char*" and is used
|
||||||
// only in this file, because the macrology requires single-token type names.
|
// only in this file, because the macrology requires single-token type names.
|
||||||
|
|
||||||
// Note: Diagnostic options not meant for VM tuning or for product modes.
|
// Note: Diagnostic options not meant for VM tuning or for product modes.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -130,6 +130,7 @@ public class VM {
|
||||||
private static Type intxType;
|
private static Type intxType;
|
||||||
private static Type uintxType;
|
private static Type uintxType;
|
||||||
private static Type sizetType;
|
private static Type sizetType;
|
||||||
|
private static Type uint64tType;
|
||||||
private static CIntegerType boolType;
|
private static CIntegerType boolType;
|
||||||
private Boolean sharingEnabled;
|
private Boolean sharingEnabled;
|
||||||
private Boolean compressedOopsEnabled;
|
private Boolean compressedOopsEnabled;
|
||||||
|
@ -231,6 +232,50 @@ public class VM {
|
||||||
return addr.getCIntegerAt(0, sizetType.getSize(), true);
|
return addr.getCIntegerAt(0, sizetType.getSize(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCcstr() {
|
||||||
|
return type.equals("ccstr");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCcstr() {
|
||||||
|
if (Assert.ASSERTS_ENABLED) {
|
||||||
|
Assert.that(isCcstr(), "not a ccstr flag!");
|
||||||
|
}
|
||||||
|
return CStringUtilities.getString(addr.getAddressAt(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCcstrlist() {
|
||||||
|
return type.equals("ccstrlist");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCcstrlist() {
|
||||||
|
if (Assert.ASSERTS_ENABLED) {
|
||||||
|
Assert.that(isCcstrlist(), "not a ccstrlist flag!");
|
||||||
|
}
|
||||||
|
return CStringUtilities.getString(addr.getAddressAt(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDouble() {
|
||||||
|
return type.equals("double");
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getDouble() {
|
||||||
|
if (Assert.ASSERTS_ENABLED) {
|
||||||
|
Assert.that(isDouble(), "not a double flag!");
|
||||||
|
}
|
||||||
|
return addr.getJDoubleAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUint64t() {
|
||||||
|
return type.equals("uint64_t");
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getUint64t() {
|
||||||
|
if (Assert.ASSERTS_ENABLED) {
|
||||||
|
Assert.that(isUint64t(), "not an uint64_t flag!");
|
||||||
|
}
|
||||||
|
return addr.getCIntegerAt(0, uint64tType.getSize(), true);
|
||||||
|
}
|
||||||
|
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
if (isBool()) {
|
if (isBool()) {
|
||||||
return Boolean.toString(getBool());
|
return Boolean.toString(getBool());
|
||||||
|
@ -241,11 +286,27 @@ public class VM {
|
||||||
} else if (isIntx()) {
|
} else if (isIntx()) {
|
||||||
return Long.toString(getIntx());
|
return Long.toString(getIntx());
|
||||||
} else if (isUIntx()) {
|
} else if (isUIntx()) {
|
||||||
return Long.toString(getUIntx());
|
return Long.toUnsignedString(getUIntx());
|
||||||
} else if (isSizet()) {
|
} else if (isSizet()) {
|
||||||
return Long.toString(getSizet());
|
return Long.toUnsignedString(getSizet());
|
||||||
|
} else if (isCcstr()) {
|
||||||
|
var str = getCcstr();
|
||||||
|
if (str != null) {
|
||||||
|
str = "\"" + str + "\"";
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
} else if (isCcstrlist()) {
|
||||||
|
var str = getCcstrlist();
|
||||||
|
if (str != null) {
|
||||||
|
str = "\"" + str + "\"";
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
} else if (isDouble()) {
|
||||||
|
return Double.toString(getDouble());
|
||||||
|
} else if (isUint64t()) {
|
||||||
|
return Long.toUnsignedString(getUint64t());
|
||||||
} else {
|
} else {
|
||||||
return null;
|
throw new WrongTypeException("Unknown type: " + type + " (" + name + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -383,6 +444,7 @@ public class VM {
|
||||||
intxType = db.lookupType("intx");
|
intxType = db.lookupType("intx");
|
||||||
uintxType = db.lookupType("uintx");
|
uintxType = db.lookupType("uintx");
|
||||||
sizetType = db.lookupType("size_t");
|
sizetType = db.lookupType("size_t");
|
||||||
|
uint64tType = db.lookupType("uint64_t");
|
||||||
boolType = (CIntegerType) db.lookupType("bool");
|
boolType = (CIntegerType) db.lookupType("bool");
|
||||||
|
|
||||||
minObjAlignmentInBytes = getObjectAlignmentInBytes();
|
minObjAlignmentInBytes = getObjectAlignmentInBytes();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -33,6 +33,7 @@ import jdk.test.lib.Utils;
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 8190198
|
* @bug 8190198
|
||||||
|
* @bug 8217612
|
||||||
* @summary Test clhsdb flags command
|
* @summary Test clhsdb flags command
|
||||||
* @requires vm.hasSA
|
* @requires vm.hasSA
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
|
@ -41,8 +42,8 @@ import jdk.test.lib.Utils;
|
||||||
|
|
||||||
public class ClhsdbFlags {
|
public class ClhsdbFlags {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void runBasicTest() throws Exception {
|
||||||
System.out.println("Starting ClhsdbFlags test");
|
System.out.println("Starting ClhsdbFlags basic test");
|
||||||
|
|
||||||
LingeredApp theApp = null;
|
LingeredApp theApp = null;
|
||||||
try {
|
try {
|
||||||
|
@ -88,4 +89,54 @@ public class ClhsdbFlags {
|
||||||
}
|
}
|
||||||
System.out.println("Test PASSED");
|
System.out.println("Test PASSED");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void runAllTypesTest() throws Exception {
|
||||||
|
System.out.println("Starting ClhsdbFlags all types test");
|
||||||
|
|
||||||
|
LingeredApp theApp = null;
|
||||||
|
try {
|
||||||
|
ClhsdbLauncher test = new ClhsdbLauncher();
|
||||||
|
List<String> vmArgs = new ArrayList<String>();
|
||||||
|
vmArgs.add("-XX:+UnlockDiagnosticVMOptions"); // bool
|
||||||
|
vmArgs.add("-XX:ActiveProcessorCount=1"); // int
|
||||||
|
vmArgs.add("-XX:ParallelGCThreads=1"); // uint
|
||||||
|
vmArgs.add("-XX:MaxJavaStackTraceDepth=1024"); // intx
|
||||||
|
vmArgs.add("-XX:LogEventsBufferEntries=10"); // uintx
|
||||||
|
vmArgs.add("-XX:HeapSizePerGCThread=32m"); // size_t
|
||||||
|
vmArgs.add("-XX:NativeMemoryTracking=off"); // ccstr
|
||||||
|
vmArgs.add("-XX:OnError='echo error'"); // ccstrlist
|
||||||
|
vmArgs.add("-XX:CompileThresholdScaling=1.0"); // double
|
||||||
|
vmArgs.add("-XX:ErrorLogTimeout=120"); // uint64_t
|
||||||
|
vmArgs.addAll(Utils.getVmOptions());
|
||||||
|
theApp = LingeredApp.startApp(vmArgs);
|
||||||
|
System.out.println("Started LingeredApp with pid " + theApp.getPid());
|
||||||
|
|
||||||
|
List<String> cmds = List.of("flags");
|
||||||
|
|
||||||
|
Map<String, List<String>> expStrMap = new HashMap<>();
|
||||||
|
expStrMap.put("flags", List.of(
|
||||||
|
"UnlockDiagnosticVMOptions = true",
|
||||||
|
"ActiveProcessorCount = 1",
|
||||||
|
"ParallelGCThreads = 1",
|
||||||
|
"MaxJavaStackTraceDepth = 1024",
|
||||||
|
"LogEventsBufferEntries = 10",
|
||||||
|
"HeapSizePerGCThread = 3",
|
||||||
|
"NativeMemoryTracking = \"off\"",
|
||||||
|
"OnError = \"'echo error'\"",
|
||||||
|
"CompileThresholdScaling = 1.0",
|
||||||
|
"ErrorLogTimeout = 120"));
|
||||||
|
|
||||||
|
test.run(theApp.getPid(), cmds, expStrMap, null);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new RuntimeException("Test ERROR " + ex, ex);
|
||||||
|
} finally {
|
||||||
|
LingeredApp.stopApp(theApp);
|
||||||
|
}
|
||||||
|
System.out.println("Test PASSED");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
runBasicTest();
|
||||||
|
runAllTypesTest();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue