Skip to content

Commit 89b3c37

Browse files
author
Doug Simon
committed
8307125: compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java hits assert(!Continuation::is_frame_in_continuation(thread(), fr())) failed: No support for deferred values in continuations
Reviewed-by: never
1 parent 98acce1 commit 89b3c37

File tree

7 files changed

+42
-10
lines changed

7 files changed

+42
-10
lines changed

src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/stack/InspectedFrame.java

+4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ public interface InspectedFrame {
5151
/**
5252
* This method will materialize all virtual objects, deoptimize the stack frame and make sure
5353
* that subsequent execution of the deoptimized frame uses the materialized values.
54+
*
55+
* @see StackIntrospection#canMaterializeVirtualObjects
56+
* @throws IllegalArgumentException if stack introspection does not support
57+
* materialization of virtual objects for this frame
5458
*/
5559
void materializeVirtualObjects(boolean invalidateCode);
5660

src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/stack/StackIntrospection.java

+8
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,12 @@ public interface StackIntrospection {
4343
* should stop), or null if the whole stack was iterated.
4444
*/
4545
<T> T iterateFrames(ResolvedJavaMethod[] initialMethods, ResolvedJavaMethod[] matchingMethods, int initialSkip, InspectedFrameVisitor<T> visitor);
46+
47+
/**
48+
* Determines if {@link InspectedFrame#materializeVirtualObjects(boolean)} can be called for frames
49+
* visited by {@link #iterateFrames}.
50+
*/
51+
default boolean canMaterializeVirtualObjects() {
52+
return true;
53+
}
4654
}

src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotStackFrameReference.java

+3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ public boolean isVirtual(int index) {
6363

6464
@Override
6565
public void materializeVirtualObjects(boolean invalidateCode) {
66+
if (Thread.currentThread().isVirtual()) {
67+
throw new IllegalArgumentException("cannot materialize frames of a virtual thread");
68+
}
6669
compilerToVM.materializeVirtualObjects(this, invalidateCode);
6770
}
6871

src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotStackIntrospection.java

+6
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,10 @@ public <T> T iterateFrames(ResolvedJavaMethod[] initialMethods, ResolvedJavaMeth
3939
CompilerToVM compilerToVM = runtime.getCompilerToVM();
4040
return compilerToVM.iterateFrames(initialMethods, matchingMethods, initialSkip, visitor);
4141
}
42+
43+
@Override
44+
public boolean canMaterializeVirtualObjects() {
45+
// Virtual threads do not support materializing locals (JDK-8307125)
46+
return !Thread.currentThread().isVirtual();
47+
}
4248
}

test/hotspot/jtreg/ProblemList-Virtual.txt

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
####
2525
# Bugs
2626

27-
compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java 8307125 generic-all
2827
serviceability/AsyncGetCallTrace/MyPackage/ASGCTBaseTest.java 8308026 generic-all
2928
serviceability/jvmti/GetThreadListStackTraces/OneGetThreadListStackTraces.java 8308027 generic-all
3029
serviceability/jvmti/Heap/IterateHeapWithEscapeAnalysisEnabled.java 8264699 generic-all

test/hotspot/jtreg/compiler/jvmci/common/patches/jdk.internal.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java

-5
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,6 @@ public static <T> T iterateFrames(
277277
return CTVM.iterateFrames(initialMethods, matchingMethods, initialSkip, visitor);
278278
}
279279

280-
public static void materializeVirtualObjects(
281-
HotSpotStackFrameReference stackFrame, boolean invalidate) {
282-
CTVM.materializeVirtualObjects(stackFrame, invalidate);
283-
}
284-
285280
public static int getVtableIndexForInterfaceMethod(HotSpotResolvedObjectType type,
286281
HotSpotResolvedJavaMethod method) {
287282
return CTVM.getVtableIndexForInterfaceMethod((HotSpotResolvedObjectTypeImpl) type, (HotSpotResolvedJavaMethodImpl) method);

test/hotspot/jtreg/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java

+21-4
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,11 @@ public static void main(String[] args) {
157157
throw new SkippedException("Test needs compilation level 4");
158158
}
159159

160-
new MaterializeVirtualObjectTest().test();
160+
try {
161+
new MaterializeVirtualObjectTest().test();
162+
} catch (MaterializationNotSupported e) {
163+
Asserts.assertTrue(Thread.currentThread().isVirtual());
164+
}
161165
}
162166

163167
private static String getName() {
@@ -168,7 +172,6 @@ private static String getName() {
168172
}
169173

170174
private void test() {
171-
System.out.println(getName());
172175
Asserts.assertFalse(WB.isMethodCompiled(MATERIALIZED_METHOD),
173176
getName() + " : materialized method is compiled");
174177
Asserts.assertFalse(WB.isMethodCompiled(NOT_MATERIALIZED_METHOD),
@@ -230,6 +233,14 @@ private void recurse(int depth, int iteration) {
230233
}
231234
}
232235

236+
private static void materializeVirtualObjects(InspectedFrame f, boolean invalidateCode) {
237+
try {
238+
f.materializeVirtualObjects(invalidateCode);
239+
} catch (IllegalArgumentException e) {
240+
throw new MaterializationNotSupported(e);
241+
}
242+
}
243+
233244
private void checkStructure(boolean materialize) {
234245
boolean[] framesSeen = new boolean[2];
235246
Object[] helpers = new Object[1];
@@ -248,7 +259,7 @@ private void checkStructure(boolean materialize) {
248259
Asserts.assertEQ(((Helper) f.getLocal(3)).string, "foo", "innerHelper.string should be foo");
249260
helpers[0] = f.getLocal(1);
250261
if (materialize) {
251-
f.materializeVirtualObjects(false);
262+
materializeVirtualObjects(f, false);
252263
}
253264
return null; //continue
254265
} else {
@@ -306,7 +317,7 @@ private void check(int iteration) {
306317
Asserts.assertTrue(notMaterialized.hasVirtualObjects(), getName()
307318
+ ": notMaterialized frame has no virtual object before materialization");
308319
// materialize
309-
CompilerToVMHelper.materializeVirtualObjects(materialized, INVALIDATE);
320+
materializeVirtualObjects(materialized, INVALIDATE);
310321
// check that only not materialized frame has virtual objects
311322
Asserts.assertFalse(materialized.hasVirtualObjects(), getName()
312323
+ " : materialized has virtual object after materialization");
@@ -331,4 +342,10 @@ public Helper(String s) {
331342
this.string = s;
332343
}
333344
}
345+
346+
static class MaterializationNotSupported extends RuntimeException {
347+
public MaterializationNotSupported(Throwable cause) {
348+
super(cause);
349+
}
350+
}
334351
}

0 commit comments

Comments
 (0)