Skip to content

Commit

Permalink
Merge master jdk-17.0.13+4 into openj9-staging
Browse files Browse the repository at this point in the history
Signed-off-by: J9 Build <j9build@ca.ibm.com>
  • Loading branch information
j9build committed Aug 22, 2024
2 parents eb870f1 + 0683b19 commit 437758b
Show file tree
Hide file tree
Showing 162 changed files with 1,214 additions and 399 deletions.
1 change: 1 addition & 0 deletions .jcheck/conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version=17.0.13

[checks]
error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists
warning=issuestitle,binary

[repository]
tags=(?:jdk-(?:[1-9]([0-9]*)(?:\.(?:0|[1-9][0-9]*)){0,4})(?:\+(?:(?:[0-9]+))|(?:-ga)))|(?:jdk[4-9](?:u\d{1,3})?-(?:(?:b\d{2,3})|(?:ga)))|(?:hs\d\d(?:\.\d{1,2})?-b\d\d)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ private void onCertificate(ServerHandshakeContext shc,
ClientAuthType.CLIENT_AUTH_REQUESTED) {
// unexpected or require client authentication
throw shc.conContext.fatal(Alert.BAD_CERTIFICATE,
"Empty server certificate chain");
"Empty client certificate chain");
} else {
return;
}
Expand All @@ -405,7 +405,7 @@ private void onCertificate(ServerHandshakeContext shc,
}
} catch (CertificateException ce) {
throw shc.conContext.fatal(Alert.BAD_CERTIFICATE,
"Failed to parse server certificates", ce);
"Failed to parse client certificates", ce);
}

checkClientCerts(shc, x509Certs);
Expand Down Expand Up @@ -1247,7 +1247,7 @@ private static X509Certificate[] checkClientCerts(
}
} catch (CertificateException ce) {
throw shc.conContext.fatal(Alert.BAD_CERTIFICATE,
"Failed to parse server certificates", ce);
"Failed to parse client certificates", ce);
}

// find out the types of client authentication used
Expand Down
10 changes: 4 additions & 6 deletions test/hotspot/jtreg/compiler/codecache/CheckCodeCacheInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
* @library /test/lib
* @requires vm.debug
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* compiler.codecache.CheckCodeCacheInfo
* @run driver compiler.codecache.CheckCodeCacheInfo
*/

package compiler.codecache;
Expand Down Expand Up @@ -69,9 +67,9 @@ public class CheckCodeCacheInfo {
public static void main(String[] args) throws Exception {
ProcessBuilder pb;

pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintCodeCache",
"-XX:+Verbose",
"-version");
pb = ProcessTools.createTestJvm("-XX:+PrintCodeCache",
"-XX:+Verbose",
"-version");
OutputAnalyzer out = new OutputAnalyzer(pb.start());
out.shouldHaveExitValue(0);
out.stdoutShouldMatch(VERBOSE_REGEXP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
* @test
* @bug 8276036 8277213 8277441
* @summary test for the value of full_count in the message of insufficient codecache
* @requires vm.compMode != "Xint"
* @library /test/lib
*/
public class CodeCacheFullCountTest {
Expand All @@ -54,7 +55,7 @@ public static void wasteCodeCache() throws Exception {
}

public static void runTest() throws Throwable {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
ProcessBuilder pb = ProcessTools.createTestJvm(
"-XX:ReservedCodeCacheSize=2496k", "-XX:-UseCodeCacheFlushing", "CodeCacheFullCountTest", "WasteCodeCache");
OutputAnalyzer oa = ProcessTools.executeProcess(pb);
// Ignore adapter creation failures
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* @test
* @bug 8015774
* @summary Verify SegmentedCodeCache option's processing
* @requires vm.flagless
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.compiler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* @key randomness
* @bug 8015774
* @summary Verify processing of options related to code heaps sizing.
* @requires vm.flagless
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.compiler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* @test
* @bug 8015774
* @summary Verify that PrintCodeCache option print correct information.
* @requires vm.flagless
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.compiler
Expand Down
32 changes: 17 additions & 15 deletions test/hotspot/jtreg/compiler/lib/ir_framework/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ The framework is intended to be used in JTreg tests. The JTreg header of the tes
* @library /test/lib /
* @run driver my.package.MySimpleTest
*/

package my.package;

import compiler.lib.ir_framework.*;

public class MySimpleTest {

public static void main(String[] args) {
TestFramework.run(); // The framework runs all tests of this class.
}

@Test
@IR(failOn = IRNode.STORE) // Fail if the IR of myTest() contains any stores.
public void myTest() {
Expand All @@ -29,14 +29,14 @@ The framework is intended to be used in JTreg tests. The JTreg header of the tes
}

There are various ways how to set up and run a test within the `main()` method of a JTreg test. These are described and can be found in the [TestFramework](./TestFramework.java) class.

## 2. Features
The framework offers various annotations and flags to control how your test code should be invoked and being checked. This section gives an overview over all these features.

### 2.1 Different Tests
There are three kinds of tests depending on how much control is needed over the test invocation.
#### Base Tests
The simplest form of testing provides a single `@Test` annotated method which the framework will invoke as part of the testing. The test method has no or well-defined arguments that the framework can automatically provide.
The simplest form of testing provides a single `@Test` annotated method which the framework will invoke as part of the testing. The test method has no or well-defined arguments that the framework can automatically provide.

More information on base tests with a precise definition can be found in the Javadocs of [Test](./Test.java). Concrete examples on how to specify a base test can be found in [BaseTestsExample](../../../testlibrary_tests/ir_framework/examples/BaseTestExample.java).

Expand All @@ -57,12 +57,12 @@ The user has the possibility to add an additional `@IR` annotation to any `@Test

- A `failOn` check that verifies that the provided regex is not matched in the C2 IR.
- A `counts` check that verifies that the provided regex is matched a user defined number of times in the C2 IR.

A regex can either be a custom string or any of the default regexes provided by the framework in [IRNode](./IRNode.java) for some commonly used IR nodes (also provides the possibility of composite regexes).

An IR verification cannot always be performed. For example, a JTreg test could be run with _-Xint_ or not a debug build (_-XX:+PrintIdeal_ and _-XX:+PrintOptoAssembly_ are debug build flags). But also CI tier testing could add additional JTreg VM and Javaoptions flags which could make an IR rule unstable.
An IR verification cannot always be performed. For example, a JTreg test could be run with _-Xint_ or not a debug build (_-XX:+PrintIdeal_ and _-XX:+PrintOptoAssembly_ are debug build flags). But also CI tier testing could add additional JTreg VM and Javaoptions flags which could make an IR rule unstable.

In general, the framework will only perform IR verification if the used VM flags allow a C2 compilation and if non-critical additional JTreg VM and Javaoptions are provided (see whiteflag list in [TestFramework](./TestFramework.java)). The user test code, however, can specify any flags which still allow an IR verification to be performed if a C2 compilation is done (expected flags by user defined `@IR` annotations).
In general, the framework will only perform IR verification if the used VM flags allow a C2 compilation and if non-critical additional JTreg VM and Javaoptions are provided (see whiteflag list in [TestFramework](./TestFramework.java)). The user test code, however, can specify any flags which still allow an IR verification to be performed if a C2 compilation is done (expected flags by user defined `@IR` annotations).

An `@IR` annotation allows additional preconditions/restrictions on the currently present VM flags to enable or disable rules when certain flags are present or have a specific value (see `applyIfXX` properties of an `@IR` annotation).

Expand Down Expand Up @@ -90,6 +90,7 @@ The framework provides various stress and debug flags. They should mainly be use
- `-DExclude=test3`: Provide a list of `@Test` method names which should be excluded from execution.
- `-DScenarios=1,2`: Provide a list of scenario indexes to specify which scenarios should be executed.
- `-DWarmup=200`: Provide a new default value of the number of warm-up iterations (framework default is 2000). This might have an influence on the resulting IR and could lead to matching failures (the user can also set a fixed default warm-up value in a test with `testFrameworkObject.setDefaultWarmup(200)`).
- `-DReportStdout=true`: Print the standard output of the test VM.
- `-DVerbose=true`: Enable more fain-grained logging (slows the execution down).
- `-DReproduce=true`: Flag to use when directly running a test VM to bypass dependencies to the driver VM state (for example, when reproducing an issue).
- `-DPrintTimes=true`: Print the execution time measurements of each executed test.
Expand All @@ -99,25 +100,26 @@ The framework provides various stress and debug flags. They should mainly be use
- `-DShuffleTests=false`: Disables the random execution order of all tests (such a shuffling is always done by default).
- `-DDumpReplay=true`: Add the `DumpReplay` directive to the test VM.
- `-DGCAfter=true`: Perform `System.gc()` after each test (slows the execution down).
- `-TestCompilationTimeout=20`: Change the default waiting time (default: 10s) for a compilation of a normal `@Test` annotated method.
- `-DTestCompilationTimeout=20`: Change the default waiting time (default: 10s) for a compilation of a normal `@Test` annotated method.
- `-DWaitForCompilationTimeout=20`: Change the default waiting time (default: 10s) for a compilation of a `@Test` annotated method with compilation level [WAIT\_FOR\_COMPILATION](./CompLevel.java).
- `-DIgnoreCompilerControls=false`: Ignore all compiler controls applied in the framework. This includes any compiler control annotations (`@DontCompile`, `@DontInline`, `@ForceCompile`, `@ForceInline`, `@ForceCompileStaticInitializer`), the exclusion of `@Run` and `@Check` methods from compilation, and the directive to not inline `@Test` annotated methods.

- `-DIgnoreCompilerControls=true`: Ignore all compiler controls applied in the framework. This includes any compiler control annotations (`@DontCompile`, `@DontInline`, `@ForceCompile`, `@ForceInline`, `@ForceCompileStaticInitializer`), the exclusion of `@Run` and `@Check` methods from compilation, and the directive to not inline `@Test` annotated methods.
- `-DExcludeRandom=true`: Randomly exclude some methods from compilation.
- `-DPreferCommandLineFlags=true`: Prefer flags set via the command line over flags specified by the tests.

## 3. Test Framework Execution
This section gives an overview of how the framework is executing a JTreg test that calls the framework from within its `main()` method.

The framework will spawn a new "test VM" to execute the user defined tests. The test VM collects all tests of the test class specified by the user code in `main()` and ensures that there is no violation of the required format by the framework. In a next step, the framework does the following for each test in general:
1. Warm the test up for a predefined number of times (default 2000). This can also be adapted for all tests by using `testFrameworkobject.setDefaultWarmup(100)` or for individual tests with an additional [@Warmup](./Warmup.java) annotation.
1. Warm the test up for a predefined number of times (default 2000). This can also be adapted for all tests by using `testFrameworkobject.setDefaultWarmup(100)` or for individual tests with an additional [@Warmup](./Warmup.java) annotation.
2. After the warm-up is finished, the framework compiles the associated `@Test` annotated method at the specified compilation level (default: C2).
3. After the compilation, the test is invoked one more time.

Once the test VM terminates, IR verification (if possible) is performed on the output of the test VM. If any test throws an exception during its execution or if IR matching fails, the failures are collected and reported in a pretty format. Check the standard error and output for more information and how to reproduce these failures.

Some of the steps above can be different due to the kind of the test or due to using non-default annotation properties. These details and differences are described in the Javadocs for the three tests (see section 2.1 Different Tests).

More information about the internals and the workflow of the framework can be found in the Javadocs of [TestFramework](./TestFramework.java).
More information about the internals and the workflow of the framework can be found in the Javadocs of [TestFramework](./TestFramework.java).

## 4. Internal Framework Tests
There are various tests to verify the correctness of the test framework. These tests can be found in [ir_framework](../../../testlibrary_tests/ir_framework) and can directly be run with JTreg. The tests are part of the normal JTreg tests of HotSpot and should be run upon changing the framework code as a minimal form of testing.

Expand Down
16 changes: 8 additions & 8 deletions test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 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
Expand Down Expand Up @@ -40,13 +40,13 @@
public class TestDisableDefaultGC {
public static void main(String[] args) throws Exception {
// Start VM, disabling all possible default GCs
ProcessBuilder pb = GCArguments.createJavaProcessBuilder("-XX:-UseSerialGC",
"-XX:-UseParallelGC",
"-XX:-UseG1GC",
"-XX:-UseZGC",
"-XX:+UnlockExperimentalVMOptions",
"-XX:-UseShenandoahGC",
"-version");
ProcessBuilder pb = GCArguments.createTestJvm("-XX:-UseSerialGC",
"-XX:-UseParallelGC",
"-XX:-UseG1GC",
"-XX:-UseZGC",
"-XX:+UnlockExperimentalVMOptions",
"-XX:-UseShenandoahGC",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldMatch("Garbage collector not selected");
output.shouldHaveExitValue(1);
Expand Down
16 changes: 6 additions & 10 deletions test/hotspot/jtreg/vmTestbase/nsk/share/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ public class Log extends FinalizableObject {

/**
* Is log-mode verbose?
* Default value is <code>false</code>.
* Always enabled.
*/
private boolean verbose = false;
private final boolean verbose = true;

/**
* Should log messages prefixed with timestamps?
* Default value is <code>false</code>.
* Always enabled.
*/
private boolean timestamp = false;
private final boolean timestamp = true;

/**
* Names for trace levels
Expand Down Expand Up @@ -212,7 +212,6 @@ public Log(PrintStream stream) {
*/
public Log(PrintStream stream, boolean verbose) {
this(stream);
this.verbose = verbose;
}

/**
Expand All @@ -223,7 +222,6 @@ public Log(PrintStream stream, boolean verbose) {
public Log(PrintStream stream, ArgumentParser argsParser) {
this(stream, argsParser.verbose());
traceLevel = argsParser.getTraceLevel();
timestamp = argsParser.isTimestamp();
}

/////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -267,10 +265,9 @@ public void enableVerboseOnError(boolean enable) {
* Enable or disable verbose mode for printing messages.
*/
public void enableVerbose(boolean enable) {
if (!verbose) {
flushLogBuffer();
if (!enable) {
throw new RuntimeException("The non-verbose logging is not supported.");
}
verbose = enable;
}

public int getTraceLevel() {
Expand Down Expand Up @@ -472,7 +469,6 @@ private void logExceptionForFailureAnalysis(String msg) {
protected synchronized void logTo(PrintStream stream) {
finalize(); // flush older log stream
out = stream;
verbose = true;
}

/////////////////////////////////////////////////////////////////
Expand Down
16 changes: 13 additions & 3 deletions test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageUtils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 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
Expand Down Expand Up @@ -234,11 +234,21 @@ public static int eatMemory(ExecutionController stresser, GarbageProducer gp, lo
long.class,
OOM_TYPE.class);

private static MethodHandle eat;

static {
try {
eat = MethodHandles.lookup().findStatic(GarbageUtils.class, "eatMemoryImpl", mt);
} catch (Exception nsme) {
// Can't run the test for some unexpected reason
throw new RuntimeException(nsme);
}
}


public static int eatMemory(ExecutionController stresser, GarbageProducer gp, long initialFactor, long minMemoryChunk, long factor, OOM_TYPE type) {
try {
// Using a methodhandle invoke of eatMemoryImpl to prevent inlining of it
MethodHandles.Lookup lookup = MethodHandles.lookup();
MethodHandle eat = lookup.findStatic(GarbageUtils.class, "eatMemoryImpl", mt);
return (int) eat.invoke(stresser, gp, initialFactor, minMemoryChunk, factor, type);
} catch (OutOfMemoryError e) {
return numberOfOOMEs++;
Expand Down
Loading

0 comments on commit 437758b

Please sign in to comment.