Search in sources :

Example 41 with Assumption

use of com.oracle.truffle.api.Assumption in project graal by oracle.

the class FrameDescriptor method invalidateNotInFrameAssumption.

private void invalidateNotInFrameAssumption(Object identifier) {
    if (identifierToNotInFrameAssumptionMap != null) {
        Assumption assumption = identifierToNotInFrameAssumptionMap.get(identifier);
        if (assumption != null) {
            assumption.invalidate();
            identifierToNotInFrameAssumptionMap.removeKey(identifier);
        }
    }
}
Also used : Assumption(com.oracle.truffle.api.Assumption)

Example 42 with Assumption

use of com.oracle.truffle.api.Assumption in project graal by oracle.

the class FrameDescriptor method getNotInFrameAssumption.

/**
 * Make an assumption that no slot with the specified identifier is present in this frame
 * descriptor. Invalidated when a frame slot with the identifier is added.
 *
 * @param identifier frame slot identifier
 * @return an assumption that this frame descriptor does not contain a slot with the identifier
 * @throws IllegalArgumentException if the frame descriptor contains a slot with the identifier
 * @since 0.8 or earlier
 */
public Assumption getNotInFrameAssumption(Object identifier) {
    if (identifierToSlotMap.containsKey(identifier)) {
        throw new IllegalArgumentException("Cannot get not-in-frame assumption for existing frame slot!");
    }
    if (identifierToNotInFrameAssumptionMap == null) {
        identifierToNotInFrameAssumptionMap = EconomicMap.create();
    } else {
        Assumption assumption = identifierToNotInFrameAssumptionMap.get(identifier);
        if (assumption != null) {
            return assumption;
        }
    }
    Assumption assumption = Truffle.getRuntime().createAssumption("identifier not in frame");
    identifierToNotInFrameAssumptionMap.put(identifier, assumption);
    return assumption;
}
Also used : Assumption(com.oracle.truffle.api.Assumption)

Aggregations

Assumption (com.oracle.truffle.api.Assumption)42 Test (org.junit.Test)25 UnionAssumption (com.oracle.truffle.api.utilities.UnionAssumption)8 CallTarget (com.oracle.truffle.api.CallTarget)5 FrameDescriptor (com.oracle.truffle.api.frame.FrameDescriptor)5 TestHelper.createCallTarget (com.oracle.truffle.api.dsl.test.TestHelper.createCallTarget)3 Field (java.lang.reflect.Field)3 OptimizedCallTarget (org.graalvm.compiler.truffle.runtime.OptimizedCallTarget)3 RootTestNode (org.graalvm.compiler.truffle.test.nodes.RootTestNode)3 CompilationFinal (com.oracle.truffle.api.CompilerDirectives.CompilationFinal)2 NodeField (com.oracle.truffle.api.dsl.NodeField)2 ExplodeLoop (com.oracle.truffle.api.nodes.ExplodeLoop)2 Node (com.oracle.truffle.api.nodes.Node)2 CodeExecutableElement (com.oracle.truffle.dsl.processor.java.model.CodeExecutableElement)2 CodeVariableElement (com.oracle.truffle.dsl.processor.java.model.CodeVariableElement)2 CompilerDirectives (com.oracle.truffle.api.CompilerDirectives)1 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)1 Truffle (com.oracle.truffle.api.Truffle)1 TruffleRuntime (com.oracle.truffle.api.TruffleRuntime)1 Cached (com.oracle.truffle.api.dsl.Cached)1