< prev index next > src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/CDSPlugin.java
Print this page
/*
! * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
/*
! * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
} else {
return "java";
}
}
! private void generateCDSArchive(ExecutableImage image, boolean noCoops, boolean noCoh) {
List<String> javaCmd = new ArrayList<String>();
Path javaPath = image.getHome().resolve("bin").resolve(javaExecutableName());
if (!Files.exists(javaPath)) {
throw new PluginException("Cannot find java executable at: " + javaPath.toString());
}
} else {
return "java";
}
}
! private void generateCDSArchive(ExecutableImage image, boolean noCoops) {
List<String> javaCmd = new ArrayList<String>();
Path javaPath = image.getHome().resolve("bin").resolve(javaExecutableName());
if (!Files.exists(javaPath)) {
throw new PluginException("Cannot find java executable at: " + javaPath.toString());
}
String archiveMsg = "CDS";
if (noCoops) {
javaCmd.add("-XX:-UseCompressedOops");
archiveMsg += "-NOCOOPS";
}
- if (noCoh) {
- javaCmd.add("-XX:-UseCompactObjectHeaders");
- archiveMsg += "-NOCOH";
- }
ProcessBuilder builder = new ProcessBuilder(javaCmd);
int status = -1;
try {
Process p = builder.inheritIO().start();
status = p.waitFor();
runtimePlatform.toString());
}
Path classListPath = image.getHome().resolve("lib").resolve("classlist");
if (Files.exists(classListPath)) {
! generateCDSArchive(image, false, false);
! // Generate all of the CDS archive combinations: nocoops, nocoh, nocoops_nocoh.
if (Architecture.is64bit()) {
! generateCDSArchive(image, true, false);
- generateCDSArchive(image, false, true);
- generateCDSArchive(image, true, true);
}
System.out.println("Created CDS archive successfully");
} else {
throw new PluginException("Cannot generate CDS archives: classlist not found: " +
classListPath.toString());
runtimePlatform.toString());
}
Path classListPath = image.getHome().resolve("lib").resolve("classlist");
if (Files.exists(classListPath)) {
! generateCDSArchive(image,false);
! // The targetPlatform is the same as the runtimePlatform.
+ // For a 64-bit platform, generate the non-compressed oop CDS archive
if (Architecture.is64bit()) {
! generateCDSArchive(image,true);
}
System.out.println("Created CDS archive successfully");
} else {
throw new PluginException("Cannot generate CDS archives: classlist not found: " +
classListPath.toString());
< prev index next >