Search in sources :

Example 11 with LIRFrameState

use of org.graalvm.compiler.lir.LIRFrameState in project graal by oracle.

the class JVMCIInfopointErrorTest method testUndefinedVirtualObject.

@Test(expected = JVMCIError.class)
public void testUndefinedVirtualObject() {
    ResolvedJavaType obj = getMetaAccess().lookupJavaType(Object.class);
    test((tool, state, safepoint) -> {
        VirtualObject o0 = VirtualObject.get(obj, 0);
        o0.setValues(new JavaValue[0], new JavaKind[0]);
        VirtualObject o1 = VirtualObject.get(obj, 1);
        o1.setValues(new JavaValue[0], new JavaKind[0]);
        LIRFrameState newState = modifyTopFrame(state, new VirtualObject[] { o0 }, new JavaValue[] { o1 }, new JavaKind[] { JavaKind.Object }, 1, 0, 0);
        safepoint.accept(newState);
    });
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) VirtualObject(jdk.vm.ci.code.VirtualObject) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest) Test(org.junit.Test)

Example 12 with LIRFrameState

use of org.graalvm.compiler.lir.LIRFrameState in project graal by oracle.

the class JVMCIInfopointErrorTest method testUnexpectedTypeInRegister.

@Test(expected = JVMCIError.class)
public void testUnexpectedTypeInRegister() {
    test((tool, state, safepoint) -> {
        Variable var = tool.newVariable(LIRKind.fromJavaKind(tool.target().arch, JavaKind.Int));
        tool.append(new ValueDef(var));
        LIRFrameState newState = modifyTopFrame(state, new JavaValue[] { var }, new JavaKind[] { JavaKind.Illegal }, 1, 0, 0);
        safepoint.accept(newState);
    });
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) Variable(org.graalvm.compiler.lir.Variable) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest) Test(org.junit.Test)

Example 13 with LIRFrameState

use of org.graalvm.compiler.lir.LIRFrameState in project graal by oracle.

the class JVMCIInfopointErrorTest method testUnexpectedIllegalValue.

@Test(expected = JVMCIError.class)
public void testUnexpectedIllegalValue() {
    test((tool, state, safepoint) -> {
        LIRFrameState newState = modifyTopFrame(state, new JavaValue[] { Value.ILLEGAL }, new JavaKind[] { JavaKind.Int }, 1, 0, 0);
        safepoint.accept(newState);
    });
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest) Test(org.junit.Test)

Example 14 with LIRFrameState

use of org.graalvm.compiler.lir.LIRFrameState in project graal by oracle.

the class JVMCIInfopointErrorTest method testUnknownJavaValue.

@SuppressWarnings("try")
@Test(expected = Error.class)
public void testUnknownJavaValue() {
    DebugContext debug = DebugContext.create(getInitialOptions(), DebugHandlersFactory.LOADER);
    try (Scope s = debug.disable()) {
        /*
             * Expected: either AssertionError or GraalError, depending on whether the unit test run
             * is with assertions enabled or disabled.
             */
        test(debug, (tool, state, safepoint) -> {
            LIRFrameState newState = modifyTopFrame(state, new JavaValue[] { new UnknownJavaValue() }, new JavaKind[] { JavaKind.Int }, 1, 0, 0);
            safepoint.accept(newState);
        });
    }
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) Scope(org.graalvm.compiler.debug.DebugContext.Scope) DebugContext(org.graalvm.compiler.debug.DebugContext) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest) Test(org.junit.Test)

Example 15 with LIRFrameState

use of org.graalvm.compiler.lir.LIRFrameState in project graal by oracle.

the class JVMCIInfopointErrorTest method testInvalidVirtualObjectId.

@Test(expected = JVMCIError.class)
public void testInvalidVirtualObjectId() {
    ResolvedJavaType obj = getMetaAccess().lookupJavaType(Object.class);
    test((tool, state, safepoint) -> {
        VirtualObject o = VirtualObject.get(obj, 5);
        o.setValues(new JavaValue[0], new JavaKind[0]);
        safepoint.accept(new LIRFrameState(state.topFrame, new VirtualObject[] { o }, state.exceptionEdge));
    });
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) VirtualObject(jdk.vm.ci.code.VirtualObject) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest) Test(org.junit.Test)

Aggregations

LIRFrameState (org.graalvm.compiler.lir.LIRFrameState)33 GraalCompilerTest (org.graalvm.compiler.core.test.GraalCompilerTest)15 Test (org.junit.Test)15 Register (jdk.vm.ci.code.Register)7 Value (jdk.vm.ci.meta.Value)7 VirtualObject (jdk.vm.ci.code.VirtualObject)5 Variable (org.graalvm.compiler.lir.Variable)5 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)4 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)3 DebugContext (org.graalvm.compiler.debug.DebugContext)3 HotSpotForeignCallLinkage (org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage)3 HotSpotLIRGenerator (org.graalvm.compiler.hotspot.HotSpotLIRGenerator)3 SaveRegistersOp (org.graalvm.compiler.lir.StandardOp.SaveRegistersOp)3 BytecodeFrame (jdk.vm.ci.code.BytecodeFrame)2 CallingConvention (jdk.vm.ci.code.CallingConvention)2 HotSpotMetaspaceConstant (jdk.vm.ci.hotspot.HotSpotMetaspaceConstant)2 JavaValue (jdk.vm.ci.meta.JavaValue)2 HotSpotLIRGenerationResult (org.graalvm.compiler.hotspot.HotSpotLIRGenerationResult)2 HotSpotRegistersProvider (org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider)2 Stub (org.graalvm.compiler.hotspot.stubs.Stub)2