Search in sources :

Example 26 with LIRFrameState

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

the class JVMCIInfopointErrorTest method testUnexpectedNull.

@Test(expected = JVMCIError.class)
public void testUnexpectedNull() {
    test((tool, state, safepoint) -> {
        LIRFrameState newState = modifyTopFrame(state, new JavaValue[] { JavaConstant.NULL_POINTER }, 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 27 with LIRFrameState

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

the class JVMCIInfopointErrorTest method testWrongConstantType.

@Test(expected = JVMCIError.class)
public void testWrongConstantType() {
    test((tool, state, safepoint) -> {
        LIRFrameState newState = modifyTopFrame(state, new JavaValue[] { JavaConstant.INT_0 }, new JavaKind[] { JavaKind.Object }, 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 28 with LIRFrameState

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

the class JVMCIInfopointErrorTest method testMissingIllegalAfterDouble.

@Test(expected = Error.class)
public void testMissingIllegalAfterDouble() {
    /*
         * Expected: either AssertionError or GraalError, depending on whether the unit test run is
         * with assertions enabled or disabled.
         */
    test((tool, state, safepoint) -> {
        LIRFrameState newState = modifyTopFrame(state, new JavaValue[] { JavaConstant.DOUBLE_0, JavaConstant.INT_0 }, new JavaKind[] { JavaKind.Double, JavaKind.Int }, 2, 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 29 with LIRFrameState

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

the class JVMCIInfopointErrorTest method testUnexpectedVirtualObject.

@Test(expected = JVMCIError.class)
public void testUnexpectedVirtualObject() {
    ResolvedJavaType obj = getMetaAccess().lookupJavaType(Object.class);
    test((tool, state, safepoint) -> {
        VirtualObject o = VirtualObject.get(obj, 0);
        o.setValues(new JavaValue[0], new JavaKind[0]);
        LIRFrameState newState = modifyTopFrame(state, new VirtualObject[] { o }, new JavaValue[] { o }, new JavaKind[] { JavaKind.Int }, 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 30 with LIRFrameState

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

the class HotSpotBackend method updateStub.

/**
 * Updates a given stub with respect to the registers it destroys.
 * <p>
 * Any entry in {@code calleeSaveInfo} that {@linkplain SaveRegistersOp#supportsRemove()
 * supports} pruning will have {@code destroyedRegisters}
 * {@linkplain SaveRegistersOp#remove(EconomicSet) removed} as these registers are declared as
 * temporaries in the stub's {@linkplain ForeignCallLinkage linkage} (and thus will be saved by
 * the stub's caller).
 *
 * @param stub the stub to update
 * @param destroyedRegisters the registers destroyed by the stub
 * @param calleeSaveInfo a map from debug infos to the operations that provide their
 *            {@linkplain RegisterSaveLayout callee-save information}
 * @param frameMap used to {@linkplain FrameMap#offsetForStackSlot(StackSlot) convert} a virtual
 *            slot to a frame slot index
 */
protected void updateStub(Stub stub, EconomicSet<Register> destroyedRegisters, EconomicMap<LIRFrameState, SaveRegistersOp> calleeSaveInfo, FrameMap frameMap) {
    stub.initDestroyedCallerRegisters(destroyedRegisters);
    MapCursor<LIRFrameState, SaveRegistersOp> cursor = calleeSaveInfo.getEntries();
    while (cursor.advance()) {
        SaveRegistersOp save = cursor.getValue();
        if (save.supportsRemove()) {
            save.remove(destroyedRegisters);
        }
        if (cursor.getKey() != LIRFrameState.NO_STATE) {
            cursor.getKey().debugInfo().setCalleeSaveInfo(save.getMap(frameMap));
        }
    }
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) SaveRegistersOp(org.graalvm.compiler.lir.StandardOp.SaveRegistersOp)

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