< prev index next > test/hotspot/jtreg/runtime/cds/serviceability/ReplaceCriticalClasses.java
Print this page
"java/lang/ModuleLayer",
// Replace classes that are loaded after JVMTI_PHASE_PRIMORDIAL. It's OK to replace
// such
// classes even when CDS is enabled. Nothing bad should happen.
! "-notshared java/util/Locale",
- "-notshared sun/util/locale/BaseLocale",
};
return tests;
}
static void launchChildProcesses(String tests[]) throws Throwable {
"java/lang/ModuleLayer",
// Replace classes that are loaded after JVMTI_PHASE_PRIMORDIAL. It's OK to replace
// such
// classes even when CDS is enabled. Nothing bad should happen.
! "-notshared java/util/Calendar",
};
return tests;
}
static void launchChildProcesses(String tests[]) throws Throwable {
klassName = args[args.length-1];
}
Class.forName(klassName.replace("/", ".")); // make sure it's a valid class
final String subgraphInit = "initialize_from_archived_subgraph " + subgraphKlass;
! // We will pass an option like "-agentlib:SimpleClassFileLoadHook=java/util/Locale,XXX,XXX".
! // The SimpleClassFileLoadHook agent would attempt to hook the java/util/Locale class
// but leave the class file bytes unchanged (it replaces all bytes "XXX" with "XXX", i.e.,
// a no-op). JVMTI doesn't check the class file bytes returned by the agent, so as long
// as the agent returns a buffer, it will not load the class from CDS, and will instead
// load the class by parsing the buffer.
//
// Note that for safety we don't change the contents of the class file bytes. If in the
// future JVMTI starts checking the contents of the class file bytes, this test would need
! // to be updated. (You'd see the test case with java/util/Locale staring to fail).
String agent = "-agentlib:SimpleClassFileLoadHook=" + early + klassName + ",XXX,XXX";
CDSOptions opts = (new CDSOptions())
.setXShareMode("auto")
.setArchiveName(ReplaceCriticalClasses.class.getName() + ".jsa")
klassName = args[args.length-1];
}
Class.forName(klassName.replace("/", ".")); // make sure it's a valid class
final String subgraphInit = "initialize_from_archived_subgraph " + subgraphKlass;
! // We will pass an option like "-agentlib:SimpleClassFileLoadHook=java/util/Calendar,XXX,XXX".
! // The SimpleClassFileLoadHook agent would attempt to hook the java/util/Calendar class
// but leave the class file bytes unchanged (it replaces all bytes "XXX" with "XXX", i.e.,
// a no-op). JVMTI doesn't check the class file bytes returned by the agent, so as long
// as the agent returns a buffer, it will not load the class from CDS, and will instead
// load the class by parsing the buffer.
//
// Note that for safety we don't change the contents of the class file bytes. If in the
// future JVMTI starts checking the contents of the class file bytes, this test would need
! // to be updated. (You'd see the test case with java/util/Calendar staring to fail).
String agent = "-agentlib:SimpleClassFileLoadHook=" + early + klassName + ",XXX,XXX";
CDSOptions opts = (new CDSOptions())
.setXShareMode("auto")
.setArchiveName(ReplaceCriticalClasses.class.getName() + ".jsa")
< prev index next >