use of com.oracle.truffle.api.Assumption in project graal by oracle.
the class UnionAssumptionTest method testBothInvalidateCheck.
@Test(expected = InvalidAssumptionException.class)
public void testBothInvalidateCheck() throws InvalidAssumptionException {
final Assumption first = Truffle.getRuntime().createAssumption("first");
final Assumption second = Truffle.getRuntime().createAssumption("second");
final UnionAssumption union = new UnionAssumption(first, second);
first.invalidate();
second.invalidate();
union.check();
}
use of com.oracle.truffle.api.Assumption in project graal by oracle.
the class UnionAssumptionTest method testBothInvalidateIsValid.
@Test
public void testBothInvalidateIsValid() {
final Assumption first = Truffle.getRuntime().createAssumption("first");
final Assumption second = Truffle.getRuntime().createAssumption("second");
final UnionAssumption union = new UnionAssumption(first, second);
first.invalidate();
second.invalidate();
assertFalse(union.isValid());
}
use of com.oracle.truffle.api.Assumption in project graal by oracle.
the class AssumedValue method set.
/**
* Set a new value, which will be picked up the next time {@link #get} is called.
*
* @since 0.8 or earlier
*/
public void set(T newValue) {
CompilerDirectives.transferToInterpreter();
value = newValue;
Assumption newAssumption = Truffle.getRuntime().createAssumption(name);
Assumption oldAssumption = ASSUMPTION_UPDATER.getAndSet(this, newAssumption);
oldAssumption.invalidate();
}
use of com.oracle.truffle.api.Assumption in project graal by oracle.
the class CyclicAssumptionSnippets method invalidate.
/**
* @since 0.33
*/
@TruffleBoundary
public void invalidate(String message) {
Assumption newAssumption = Truffle.getRuntime().createAssumption(name);
Assumption oldAssumption = ASSUMPTION_UPDATER.getAndSet(this, newAssumption);
oldAssumption.invalidate(message);
}
use of com.oracle.truffle.api.Assumption in project graal by oracle.
the class FlatNodeGenFactory method createIsValid.
private Element createIsValid(TypeMirror assumptionType) {
CodeExecutableElement isValid = new CodeExecutableElement(modifiers(PRIVATE, STATIC), getType(boolean.class), "isValid_");
CodeTreeBuilder builder = isValid.createBuilder();
if (assumptionType.getKind() == TypeKind.ARRAY) {
isValid.addAnnotationMirror(new CodeAnnotationMirror(context.getDeclaredType(ExplodeLoop.class)));
isValid.addParameter(new CodeVariableElement(getType(Assumption[].class), "assumptions"));
builder.startIf().string("assumptions == null").end().startBlock().returnFalse().end();
builder.startFor().startGroup().type(((ArrayType) assumptionType).getComponentType()).string(" assumption : assumptions").end().end();
builder.startBlock();
builder.startIf().string("assumption == null || !assumption.isValid()").end();
builder.startBlock();
builder.returnFalse();
builder.end();
builder.end();
builder.returnTrue();
} else {
isValid.addParameter(new CodeVariableElement(getType(Assumption.class), "assumption"));
builder.startReturn().string("assumption != null && assumption.isValid()").end();
}
return isValid;
}
Aggregations