8262376: ReplaceCriticalClassesForSubgraphs.java fails if --with-build-jdk is used

Reviewed-by: dholmes, minqi, ccheung
This commit is contained in:
Ioi Lam 2021-04-29 23:22:49 +00:00
parent 5ecef01c4a
commit 2c381e0f8d
2 changed files with 16 additions and 7 deletions

View File

@ -561,7 +561,15 @@ void ArchivedKlassSubGraphInfoRecord::init(KlassSubGraphInfo* info) {
_entry_field_records = NULL;
_subgraph_object_klasses = NULL;
_is_full_module_graph = info->is_full_module_graph();
_has_non_early_klasses = info->has_non_early_klasses();
if (_is_full_module_graph) {
// Consider all classes referenced by the full module graph as early -- we will be
// allocating objects of these classes during JVMTI early phase, so they cannot
// be processed by (non-early) JVMTI ClassFileLoadHook
_has_non_early_klasses = false;
} else {
_has_non_early_klasses = info->has_non_early_klasses();
}
if (_has_non_early_klasses) {
ResourceMark rm;

View File

@ -48,15 +48,16 @@ public class ReplaceCriticalClasses {
public void process(String args[]) throws Throwable {
if (args.length == 0) {
// Add an extra class to provoke JDK-8262376. This will be ignored if this class doesn't exist
// in the JDK that's being tested (e.g., if the "jdk.localedata" module is somehow missing).
String extraClasses[] = {"sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo"};
// Dump the shared archive in case it was not generated during the JDK build.
// Put the archive at separate file to avoid clashes with concurrent tests.
CDSOptions opts = new CDSOptions()
.setXShareMode("dump")
.setArchiveName(ReplaceCriticalClasses.class.getName() + ".jsa")
.setUseVersion(false)
.addSuffix("-showversion")
.addSuffix("-Xlog:cds");
CDSTestUtils.run(opts).assertNormalExit("");
.setClassList(extraClasses)
.setArchiveName(ReplaceCriticalClasses.class.getName() + ".jsa");
CDSTestUtils.createArchiveAndCheck(opts);
launchChildProcesses(getTests());
} else if (args.length == 3 && args[0].equals("child")) {