mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8351313: VM crashes when AOTMode/AOTCache/AOTConfiguration are empty
Reviewed-by: ccheung, shade, kvn
This commit is contained in:
parent
40f696dbe4
commit
28e6b7cb74
@ -112,9 +112,11 @@
|
||||
"The configuration file written by -XX:AOTMode=record, and " \
|
||||
"loaded by -XX:AOTMode=create. This file contains profiling data "\
|
||||
"for deciding what contents should be added to AOTCache. ") \
|
||||
constraint(AOTConfigurationConstraintFunc, AtParse) \
|
||||
\
|
||||
product(ccstr, AOTCache, nullptr, \
|
||||
"Cache for improving start up and warm up") \
|
||||
constraint(AOTCacheConstraintFunc, AtParse) \
|
||||
\
|
||||
product(bool, AOTInvokeDynamicLinking, false, DIAGNOSTIC, \
|
||||
"AOT-link JVM_CONSTANT_InvokeDynamic entries in cached " \
|
||||
|
||||
@ -31,7 +31,27 @@
|
||||
#include "runtime/task.hpp"
|
||||
#include "utilities/powerOfTwo.hpp"
|
||||
|
||||
JVMFlag::Error AOTCacheConstraintFunc(ccstr value, bool verbose) {
|
||||
if (value == nullptr) {
|
||||
JVMFlag::printError(verbose, "AOTCache cannot be empty\n");
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
return JVMFlag::SUCCESS;
|
||||
}
|
||||
|
||||
JVMFlag::Error AOTConfigurationConstraintFunc(ccstr value, bool verbose) {
|
||||
if (value == nullptr) {
|
||||
JVMFlag::printError(verbose, "AOTConfiguration cannot be empty\n");
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
return JVMFlag::SUCCESS;
|
||||
}
|
||||
|
||||
JVMFlag::Error AOTModeConstraintFunc(ccstr value, bool verbose) {
|
||||
if (value == nullptr) {
|
||||
JVMFlag::printError(verbose, "AOTMode cannot be empty\n");
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
if (strcmp(value, "off") != 0 &&
|
||||
strcmp(value, "record") != 0 &&
|
||||
strcmp(value, "create") != 0 &&
|
||||
@ -43,9 +63,9 @@ JVMFlag::Error AOTModeConstraintFunc(ccstr value, bool verbose) {
|
||||
value);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
return JVMFlag::SUCCESS;
|
||||
}
|
||||
|
||||
JVMFlag::Error ObjectAlignmentInBytesConstraintFunc(int value, bool verbose) {
|
||||
if (!is_power_of_2(value)) {
|
||||
JVMFlag::printError(verbose,
|
||||
|
||||
@ -34,6 +34,8 @@
|
||||
*/
|
||||
|
||||
#define RUNTIME_CONSTRAINTS(f) \
|
||||
f(ccstr, AOTCacheConstraintFunc) \
|
||||
f(ccstr, AOTConfigurationConstraintFunc) \
|
||||
f(ccstr, AOTModeConstraintFunc) \
|
||||
f(int, ObjectAlignmentInBytesConstraintFunc) \
|
||||
f(int, ContendedPaddingWidthConstraintFunc) \
|
||||
|
||||
@ -354,6 +354,20 @@ public class AOTFlags {
|
||||
out.shouldContain("Unable to use AOT cache.");
|
||||
out.shouldContain("Not a valid AOT cache (dynamic.jsa)");
|
||||
out.shouldHaveExitValue(1);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
testEmptyValue("AOTCache");
|
||||
testEmptyValue("AOTConfiguration");
|
||||
testEmptyValue("AOTMode");
|
||||
}
|
||||
|
||||
static void testEmptyValue(String option) throws Exception {
|
||||
printTestCase("Empty values for " + option);
|
||||
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||
"-XX:" + option + "=", "--version");
|
||||
OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "neg");
|
||||
out.shouldContain("Improperly specified VM option '" + option + "='");
|
||||
out.shouldHaveExitValue(1);
|
||||
}
|
||||
|
||||
static int testNum = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user