Skip to content

Commit

Permalink
Automatic merge of master into galahad
Browse files Browse the repository at this point in the history
  • Loading branch information
OracleLabsAutomation committed Jun 19, 2024
2 parents 40afb50 + d9e2870 commit b0dcbb4
Show file tree
Hide file tree
Showing 17 changed files with 283 additions and 272 deletions.
4 changes: 4 additions & 0 deletions compiler/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This changelog summarizes newly introduced optimizations and other compiler related changes.

## GraalVM for JDK 24 (Internal Version 24.2.0)
* (GR-54476): Issue a deprecation warning on first use of a legacy `graal.` prefix (see GR-49960 below).
The warning is planned to be replaced by an error in GraalVM for JDK 25.

## GraalVM for JDK 23 (Internal Version 24.1.0)
* (GR-50352): Added `-Djdk.graal.PrintPropertiesAll` to make `-XX:+JVMCIPrintProperties` show all Graal options.
* (GR-25968): New optimization for reducing code size on AMD64, by emitting smaller jump instructions if the displacement fits in one byte.
Expand Down
5 changes: 0 additions & 5 deletions compiler/mx.compiler/mx_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,12 +897,7 @@ def _check_using_latest_jars(dists):

def _parseVmArgs(args, addDefaultArgs=True):
args = mx.expand_project_in_args(args, insitu=False)

# add default graal.options.file
argsPrefix = []
options_file = join(mx.primary_suite().dir, 'graal.options')
if exists(options_file):
argsPrefix.append('-Djdk.graal.options.file=' + options_file)

if '-version' in args:
ignoredArgs = args[args.index('-version') + 1:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@
package jdk.graal.compiler.hotspot.test;

import static jdk.graal.compiler.hotspot.HotSpotGraalOptionValues.GRAAL_OPTION_PROPERTY_PREFIX;
import static jdk.graal.compiler.test.SubprocessUtil.getVMCommandLine;
import static jdk.graal.compiler.test.SubprocessUtil.withoutDebuggerArguments;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.util.List;

import jdk.graal.compiler.test.SubprocessUtil;
import org.junit.Assert;
import org.junit.Test;

Expand All @@ -38,6 +43,31 @@

public class HotSpotGraalOptionValuesTest extends HotSpotGraalCompilerTest {

@Test
public void testOptionsInFile() throws IOException, InterruptedException {
File optionsFile = File.createTempFile("options", ".properties").getAbsoluteFile();
try {
List<String> vmArgs = withoutDebuggerArguments(getVMCommandLine());
vmArgs.removeIf(a -> a.startsWith("-Djdk.graal."));
vmArgs.add("-XX:+UseJVMCICompiler");
vmArgs.add("-Djdk.graal.options.file=" + optionsFile);
vmArgs.add("-XX:+EagerJVMCI");
vmArgs.add("--version");
SubprocessUtil.Subprocess proc = SubprocessUtil.java(vmArgs);

if (proc.exitCode == 0) {
Assert.fail(String.format("Expected non-0 exit code%n%s", proc.preserveArgfile()));
}

String expect = "The 'jdk.graal.options.file' property is no longer supported";
if (!proc.output.stream().anyMatch(line -> line.contains(expect))) {
Assert.fail(String.format("Did not find '%s' in output of command:%n%s", expect, proc.preserveArgfile()));
}
} finally {
optionsFile.delete();
}
}

@Test
public void testPrintHelp() throws IOException {
OptionValues options = getInitialOptions();
Expand All @@ -49,4 +79,44 @@ public void testPrintHelp() throws IOException {
}
}
}

@Test
public void testDeprecation() throws IOException, InterruptedException {
List<String> vmArgs = withoutDebuggerArguments(getVMCommandLine());
vmArgs.removeIf(a -> a.startsWith("-Djdk.graal."));
vmArgs.add("-Dgraal.ShowConfiguration=info");
vmArgs.add("-Dgraal.PrintCompilation=true");
vmArgs.add("-XX:+EagerJVMCI");
vmArgs.add("--version");
SubprocessUtil.Subprocess proc = SubprocessUtil.java(vmArgs);

String expect = "WARNING: The 'graal.' property prefix for the Graal option";
long matches = proc.output.stream().filter(line -> line.contains(expect)).count();
if (matches != 1) {
Assert.fail(String.format("Did not find exactly 1 match for '%s' in output of command [matches: %d]:%n%s",
expect, matches, proc.preserveArgfile()));
}
}

@Test
public void testRemoved() throws IOException, InterruptedException {
List<String> vmArgs = withoutDebuggerArguments(getVMCommandLine());
vmArgs.removeIf(a -> a.startsWith("-Djdk.graal."));
vmArgs.add("-XX:+UseJVMCICompiler");
vmArgs.add("-Djdk.libgraal.PrintGC=true");
vmArgs.add("-XX:+EagerJVMCI");
vmArgs.add("--version");
SubprocessUtil.Subprocess proc = SubprocessUtil.java(vmArgs);

if (proc.exitCode == 0) {
Assert.fail(String.format("Expected non-0 exit code%n%s", proc.preserveArgfile()));
}

String expect = "Error parsing Graal options: The 'jdk.libgraal.' property prefix is no longer supported. Use jdk.graal.internal.";
long matches = proc.output.stream().filter(line -> line.contains(expect)).count();
if (matches != 1) {
Assert.fail(String.format("Did not find exactly 1 match for '%s' in output of command [matches: %d]:%n%s",
expect, matches, proc.preserveArgfile()));
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
package jdk.graal.compiler.hotspot;

import static jdk.graal.compiler.hotspot.HotSpotGraalOptionValues.GRAAL_OPTION_PROPERTY_PREFIX;
import static jdk.vm.ci.common.InitTimer.timer;
import static jdk.vm.ci.services.Services.IS_BUILDING_NATIVE_IMAGE;
import static jdk.vm.ci.services.Services.IS_IN_NATIVE_IMAGE;
Expand All @@ -38,7 +37,6 @@
import jdk.graal.compiler.options.OptionKey;
import jdk.graal.compiler.options.OptionType;
import jdk.graal.compiler.options.OptionValues;
import jdk.graal.compiler.options.OptionsParser;
import jdk.graal.compiler.phases.tiers.CompilerConfiguration;
import jdk.vm.ci.common.InitTimer;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
Expand Down Expand Up @@ -149,8 +147,7 @@ public void printProperties(PrintStream out) {
System.err.printf("Error parsing Graal options: %s%n", optionsFailure.getMessage());
return;
}
boolean all = Options.PrintPropertiesAll.getValue(options);
options.printHelp(OptionsParser.getOptionsLoader(), out, GRAAL_OPTION_PROPERTY_PREFIX, all);
HotSpotGraalOptionValues.printProperties(options, out);
}

static class Options {
Expand Down
Loading

0 comments on commit b0dcbb4

Please sign in to comment.