use of com.oracle.truffle.api.Assumption in project graal by oracle.
the class UnionAssumptionTest method testIsValid.
@Test
public void testIsValid() {
final Assumption first = Truffle.getRuntime().createAssumption("first");
final Assumption second = Truffle.getRuntime().createAssumption("second");
final UnionAssumption union = new UnionAssumption(first, second);
assertTrue(union.isValid());
}
use of com.oracle.truffle.api.Assumption in project graal by oracle.
the class DispatchOutputStream method outListChanged.
private void outListChanged() {
Assumption changed = outListUnchanged;
outListUnchanged = Truffle.getRuntime().createAssumption("Unchanged list");
changed.invalidate();
}
use of com.oracle.truffle.api.Assumption in project graal by oracle.
the class ContextObject method addListener.
void addListener(AllocationListener l) {
CompilerAsserts.neverPartOfCompilation();
boolean hadListeners;
synchronized (this) {
if (listeners == null) {
listeners = new AllocationListener[] { l };
hadListeners = false;
} else {
int index = listeners.length;
AllocationListener[] newListeners = Arrays.copyOf(listeners, index + 1);
newListeners[index] = l;
listeners = newListeners;
hadListeners = true;
}
Assumption assumption = listenersNotChangedAssumption;
listenersNotChangedAssumption = Truffle.getRuntime().createAssumption();
assumption.invalidate();
}
if (!hadListeners) {
propSupport.firePropertyChange(PROPERTY_ACTIVE, false, true);
}
}
use of com.oracle.truffle.api.Assumption in project graal by oracle.
the class ProbeNode method lazyUpdatedImpl.
private EventChainNode lazyUpdatedImpl(VirtualFrame frame) {
EventChainNode oldChain;
EventChainNode nextChain;
Lock lock = getLock();
lock.lock();
try {
Assumption localVersion = this.version;
if (localVersion != null && localVersion.isValid()) {
return this.chain;
}
nextChain = handler.createBindings(frame, ProbeNode.this);
if (nextChain == null) {
// chain is null -> remove wrapper;
// Note: never set child nodes to null, can cause races
InstrumentationHandler.removeWrapper(ProbeNode.this);
return null;
}
oldChain = this.chain;
this.chain = insert(nextChain);
this.version = Truffle.getRuntime().createAssumption("Instruments unchanged");
} finally {
lock.unlock();
}
if (oldChain != null) {
oldChain.onDispose(context, frame);
}
return nextChain;
}
use of com.oracle.truffle.api.Assumption in project graal by oracle.
the class ShapeImpl method getLeafAssumption.
/**
* @since 0.17 or earlier
*/
@Override
public final Assumption getLeafAssumption() {
Assumption assumption = leafAssumption;
if (assumption != null) {
return assumption;
} else {
CompilerDirectives.transferToInterpreterAndInvalidate();
Assumption prev;
Assumption next;
do {
prev = LEAF_ASSUMPTION_UPDATER.get(this);
if (prev != null) {
return prev;
} else {
boolean isLeafShape = transitionMap == null;
next = isLeafShape ? createLeafAssumption() : NeverValidAssumption.INSTANCE;
}
} while (!LEAF_ASSUMPTION_UPDATER.compareAndSet(this, prev, next));
return next;
}
}
Aggregations