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
This commit is contained in:
Doug Simon 2023-05-25 16:26:26 +00:00
parent 98acce13d5
commit 89b3c375ac
7 changed files with 42 additions and 10 deletions

View File

@ -51,6 +51,10 @@ public interface InspectedFrame {
/**
* This method will materialize all virtual objects, deoptimize the stack frame and make sure
* that subsequent execution of the deoptimized frame uses the materialized values.
*
* @see StackIntrospection#canMaterializeVirtualObjects
* @throws IllegalArgumentException if stack introspection does not support
* materialization of virtual objects for this frame
*/
void materializeVirtualObjects(boolean invalidateCode);

View File

@ -43,4 +43,12 @@ public interface StackIntrospection {
* should stop), or null if the whole stack was iterated.
*/
<T> T iterateFrames(ResolvedJavaMethod[] initialMethods, ResolvedJavaMethod[] matchingMethods, int initialSkip, InspectedFrameVisitor<T> visitor);
/**
* Determines if {@link InspectedFrame#materializeVirtualObjects(boolean)} can be called for frames
* visited by {@link #iterateFrames}.
*/
default boolean canMaterializeVirtualObjects() {
return true;
}
}

View File

@ -63,6 +63,9 @@ public class HotSpotStackFrameReference implements InspectedFrame {
@Override
public void materializeVirtualObjects(boolean invalidateCode) {
if (Thread.currentThread().isVirtual()) {
throw new IllegalArgumentException("cannot materialize frames of a virtual thread");
}
compilerToVM.materializeVirtualObjects(this, invalidateCode);
}

View File

@ -39,4 +39,10 @@ public class HotSpotStackIntrospection implements StackIntrospection {
CompilerToVM compilerToVM = runtime.getCompilerToVM();
return compilerToVM.iterateFrames(initialMethods, matchingMethods, initialSkip, visitor);
}
@Override
public boolean canMaterializeVirtualObjects() {
// Virtual threads do not support materializing locals (JDK-8307125)
return !Thread.currentThread().isVirtual();
}
}

View File

@ -24,7 +24,6 @@
####
# Bugs
compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java 8307125 generic-all
serviceability/AsyncGetCallTrace/MyPackage/ASGCTBaseTest.java 8308026 generic-all
serviceability/jvmti/GetThreadListStackTraces/OneGetThreadListStackTraces.java 8308027 generic-all
serviceability/jvmti/Heap/IterateHeapWithEscapeAnalysisEnabled.java 8264699 generic-all

View File

@ -277,11 +277,6 @@ public class CompilerToVMHelper {
return CTVM.iterateFrames(initialMethods, matchingMethods, initialSkip, visitor);
}
public static void materializeVirtualObjects(
HotSpotStackFrameReference stackFrame, boolean invalidate) {
CTVM.materializeVirtualObjects(stackFrame, invalidate);
}
public static int getVtableIndexForInterfaceMethod(HotSpotResolvedObjectType type,
HotSpotResolvedJavaMethod method) {
return CTVM.getVtableIndexForInterfaceMethod((HotSpotResolvedObjectTypeImpl) type, (HotSpotResolvedJavaMethodImpl) method);

View File

@ -157,7 +157,11 @@ public class MaterializeVirtualObjectTest {
throw new SkippedException("Test needs compilation level 4");
}
new MaterializeVirtualObjectTest().test();
try {
new MaterializeVirtualObjectTest().test();
} catch (MaterializationNotSupported e) {
Asserts.assertTrue(Thread.currentThread().isVirtual());
}
}
private static String getName() {
@ -168,7 +172,6 @@ public class MaterializeVirtualObjectTest {
}
private void test() {
System.out.println(getName());
Asserts.assertFalse(WB.isMethodCompiled(MATERIALIZED_METHOD),
getName() + " : materialized method is compiled");
Asserts.assertFalse(WB.isMethodCompiled(NOT_MATERIALIZED_METHOD),
@ -230,6 +233,14 @@ public class MaterializeVirtualObjectTest {
}
}
private static void materializeVirtualObjects(InspectedFrame f, boolean invalidateCode) {
try {
f.materializeVirtualObjects(invalidateCode);
} catch (IllegalArgumentException e) {
throw new MaterializationNotSupported(e);
}
}
private void checkStructure(boolean materialize) {
boolean[] framesSeen = new boolean[2];
Object[] helpers = new Object[1];
@ -248,7 +259,7 @@ public class MaterializeVirtualObjectTest {
Asserts.assertEQ(((Helper) f.getLocal(3)).string, "foo", "innerHelper.string should be foo");
helpers[0] = f.getLocal(1);
if (materialize) {
f.materializeVirtualObjects(false);
materializeVirtualObjects(f, false);
}
return null; //continue
} else {
@ -306,7 +317,7 @@ public class MaterializeVirtualObjectTest {
Asserts.assertTrue(notMaterialized.hasVirtualObjects(), getName()
+ ": notMaterialized frame has no virtual object before materialization");
// materialize
CompilerToVMHelper.materializeVirtualObjects(materialized, INVALIDATE);
materializeVirtualObjects(materialized, INVALIDATE);
// check that only not materialized frame has virtual objects
Asserts.assertFalse(materialized.hasVirtualObjects(), getName()
+ " : materialized has virtual object after materialization");
@ -331,4 +342,10 @@ public class MaterializeVirtualObjectTest {
this.string = s;
}
}
static class MaterializationNotSupported extends RuntimeException {
public MaterializationNotSupported(Throwable cause) {
super(cause);
}
}
}