Skip to content

Commit 52fe667

Browse files
committed
[GR-40843] Partial evaluation tests failing on JDK 19.
PullRequest: graal/12650
2 parents e209f26 + c595416 commit 52fe667

File tree

5 files changed

+37
-25
lines changed

5 files changed

+37
-25
lines changed

compiler/src/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/jfr/TestGetEventWriter.java

+37-11
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,19 @@
2424
*/
2525
package org.graalvm.compiler.core.test.jfr;
2626

27+
import java.io.IOException;
2728
import java.lang.reflect.Constructor;
2829
import java.lang.reflect.InvocationTargetException;
30+
import java.util.List;
2931

3032
import org.graalvm.compiler.core.common.PermanentBailoutException;
31-
import org.graalvm.compiler.core.test.GraalCompilerTest;
33+
import org.graalvm.compiler.core.test.SubprocessTest;
3234
import org.graalvm.compiler.serviceprovider.GraalServices;
3335
import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
3436
import org.graalvm.compiler.test.AddExports;
37+
import org.graalvm.compiler.test.SubprocessUtil;
3538
import org.junit.Assert;
3639
import org.junit.Assume;
37-
import org.junit.BeforeClass;
3840
import org.junit.Test;
3941
import org.objectweb.asm.AnnotationVisitor;
4042
import org.objectweb.asm.ClassWriter;
@@ -52,12 +54,14 @@
5254
* {@code jdk.jfr.Event.commit()} method.
5355
*
5456
* See the documentation attached to {@code jdk.jfr.internal.event.EventWriter} for more detail.
57+
*
58+
* This test must run in a separate JVM process. It enables JFR instrumentation, which affects
59+
* Truffle PartialEvaluationTests.
5560
*/
5661
@AddExports("jdk.jfr/jdk.jfr.internal.event")
57-
public class TestGetEventWriter extends GraalCompilerTest {
62+
public class TestGetEventWriter extends SubprocessTest {
5863

59-
@BeforeClass
60-
public static void beforeClass() throws Throwable {
64+
private static void initializeJFR() {
6165
Assume.assumeTrue("JDK-8282420 came in JDK 19", JavaVersionUtil.JAVA_SPEC >= 19);
6266
Assume.assumeTrue("Requires JDK-8290075", GraalServices.hasLookupMethodWithCaller());
6367
try (Recording r = new Recording()) {
@@ -78,6 +82,34 @@ static class InitializationEvent extends Event {
7882
}
7983

8084
@Test
85+
public void test() throws IOException, InterruptedException {
86+
Assume.assumeTrue("JDK-8282420 came in JDK 19", JavaVersionUtil.JAVA_SPEC >= 19);
87+
launchSubprocess(() -> {
88+
try {
89+
initializeJFR();
90+
testInitializationEvent();
91+
testNonEvent();
92+
testRegisteredTrueEvent();
93+
testRegisteredFalseEvent();
94+
testMyCommitRegisteredTrue();
95+
testMyCommitRegisteredFalse();
96+
testStaticCommit();
97+
} catch (Throwable t) {
98+
throw rethrowSilently(RuntimeException.class, t);
99+
}
100+
});
101+
}
102+
103+
@Override
104+
public void configSubprocess(List<String> vmArgs) {
105+
vmArgs.add(SubprocessUtil.PACKAGE_OPENING_OPTIONS);
106+
}
107+
108+
@SuppressWarnings({"unused", "unchecked"})
109+
private static <E extends Throwable> E rethrowSilently(Class<E> type, Throwable ex) throws E {
110+
throw (E) ex;
111+
}
112+
81113
public void testInitializationEvent() {
82114
InitializationEvent event = new InitializationEvent();
83115
ResolvedJavaMethod method = getResolvedJavaMethod(event.getClass(), "commit");
@@ -90,15 +122,13 @@ public void testInitializationEvent() {
90122
// API. It has its own stand-alone "commit()V", which is not an override, that
91123
// attempts to resolve and link against EventWriterFactory. This user implementation
92124
// is not blessed for linkage.
93-
@Test
94125
public void testNonEvent() throws Throwable {
95126
testEvent("Non", "java/lang/Object", null, "commit", false);
96127
}
97128

98129
// The user has defined a class which overrides and implements the "commit()V"
99130
// method declared final in jdk.jfr.Event.
100131
// This user implementation is not blessed for linkage.
101-
@Test
102132
public void testRegisteredTrueEvent() throws Throwable {
103133
testEvent("Registered", "jdk/jfr/Event", true, "commit", false);
104134
}
@@ -111,15 +141,13 @@ public void testRegisteredTrueEvent() throws Throwable {
111141
// classify it as being outside of the JFR system. Attempting to register
112142
// such a class throws an IllegalArgumentException. The user-defined
113143
// "commit()V" method is still not blessed for linkage, even after registration.
114-
@Test
115144
public void testRegisteredFalseEvent() throws Throwable {
116145
testEvent("Registered", "jdk/jfr/Event", false, "commit", false);
117146
}
118147

119148
// The user has implemented another method, "myCommit()V", not an override nor
120149
// overload. that attempts to resolve and link EventWriterFactory. This will fail,
121150
// because "myCommit()V" is not blessed for linkage.
122-
@Test
123151
public void testMyCommitRegisteredTrue() throws Throwable {
124152
testEvent("MyCommit", "jdk/jfr/Event", true, "myCommit", false);
125153
}
@@ -129,15 +157,13 @@ public void testMyCommitRegisteredTrue() throws Throwable {
129157
// Since the user has not defined any final methods in jdk.jfr.Event,
130158
// the class is not excluded wholesale from the JFR system.
131159
// Invoking the real "commit()V", installed by the framework, is OK.
132-
@Test
133160
public void testMyCommitRegisteredFalse() throws Throwable {
134161
testEvent("MyCommit", "jdk/jfr/Event", false, "myCommit", false);
135162
}
136163

137164
// Events located in the boot class loader can create a static
138165
// commit-method to emit events. It must not be used by code
139166
// outside of the boot class loader.
140-
@Test
141167
public void testStaticCommit() throws Throwable {
142168
testEvent("StaticCommit", "jdk/jfr/Event", null, "commit", true);
143169
}

compiler/src/org.graalvm.compiler.truffle.test/src/org/graalvm/compiler/truffle/test/ControlFlowExceptionPartialEvaluationTest.java

-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.graalvm.compiler.truffle.test.nodes.AbstractTestNode;
2828
import org.graalvm.compiler.truffle.test.nodes.RootTestNode;
2929
import org.graalvm.polyglot.Context;
30-
import org.junit.Assume;
3130
import org.junit.Test;
3231

3332
import com.oracle.truffle.api.CallTarget;
@@ -44,10 +43,6 @@ public static Object constant42() {
4443
return 42;
4544
}
4645

47-
public ControlFlowExceptionPartialEvaluationTest() {
48-
Assume.assumeTrue("GR-40843", Runtime.version().feature() < 19);
49-
}
50-
5146
@Test
5247
public void catchControlFlowException() {
5348
FrameDescriptor fd = new FrameDescriptor();

compiler/src/org.graalvm.compiler.truffle.test/src/org/graalvm/compiler/truffle/test/ExecutionListenerCompilerTest.java

-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
import org.graalvm.polyglot.management.ExecutionEvent;
3131
import org.graalvm.polyglot.management.ExecutionListener;
32-
import org.junit.Assume;
3332
import org.junit.Before;
3433
import org.junit.Test;
3534

@@ -49,10 +48,6 @@
4948

5049
public class ExecutionListenerCompilerTest extends PartialEvaluationTest {
5150

52-
public ExecutionListenerCompilerTest() {
53-
Assume.assumeTrue("GR-40843", Runtime.version().feature() < 19);
54-
}
55-
5651
static final SourceSection DUMMY_SECTION = com.oracle.truffle.api.source.Source.newBuilder(ProxyLanguage.ID, "", "").name("").build().createSection(0, 0);
5752

5853
ProxyLanguage langauge;

compiler/src/org.graalvm.compiler.truffle.test/src/org/graalvm/compiler/truffle/test/NodeLibraryCompilerTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
import org.graalvm.polyglot.Context;
3030
import org.graalvm.polyglot.Engine;
31-
import org.junit.Assume;
3231
import org.junit.Before;
3332
import org.junit.Test;
3433

@@ -79,7 +78,6 @@ public void setup() {
7978

8079
@Test
8180
public void testScopeRead() {
82-
Assume.assumeTrue("GR-40843", Runtime.version().feature() < 19);
8381
var builder = FrameDescriptor.newBuilder();
8482
int varSlot = builder.addSlot(FrameSlotKind.Illegal, "var", null);
8583
FrameDescriptor frameDescriptor = builder.build();

compiler/src/org.graalvm.compiler.truffle.test/src/org/graalvm/compiler/truffle/test/TruffleExceptionPartialEvaluationTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import org.graalvm.compiler.truffle.test.nodes.AbstractTestNode;
2828
import org.graalvm.compiler.truffle.test.nodes.RootTestNode;
29-
import org.junit.Assume;
3029
import org.junit.Test;
3130

3231
import com.oracle.truffle.api.CallTarget;
@@ -57,7 +56,6 @@ public static Object constant0() {
5756

5857
@Test
5958
public void testTruffleException() {
60-
Assume.assumeTrue("GR-40843", Runtime.version().feature() < 19);
6159
assertPartialEvalEquals(TruffleExceptionPartialEvaluationTest::constant42, createCallerChain(0, 0));
6260
assertPartialEvalEquals(TruffleExceptionPartialEvaluationTest::constant42, createCallerChain(3, 0));
6361
assertPartialEvalEquals(TruffleExceptionPartialEvaluationTest::constant42, createCallerChain(0, 3));

0 commit comments

Comments
 (0)