com.oracle.truffle.api.debug.SetThreadSuspensionEnabledNodeGen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truffle-api Show documentation
Show all versions of truffle-api Show documentation
Truffle is a multi-language framework for executing dynamic languages
that achieves high performance when combined with Graal.
// CheckStyle: start generated
package com.oracle.truffle.api.debug;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.debug.DebuggerSession.ThreadSuspension;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.nodes.ExplodeLoop.LoopExplosionKind;
import java.util.concurrent.locks.Lock;
@GeneratedBy(SetThreadSuspensionEnabledNode.class)
final class SetThreadSuspensionEnabledNodeGen extends SetThreadSuspensionEnabledNode {
@CompilationFinal private int state_;
@CompilationFinal private int exclude_;
@CompilationFinal private ExecuteCachedData executeCached_cache;
private SetThreadSuspensionEnabledNodeGen() {
}
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN)
@Override
protected void execute(boolean arg0Value, DebuggerSession[] arg1Value, long arg2Value) {
int state = state_;
if (state != 0 /* is-active executeCached(boolean, DebuggerSession[], long, long, ThreadSuspension) || executeGeneric(boolean, DebuggerSession[], long) */) {
if ((state & 0b1) != 0 /* is-active executeCached(boolean, DebuggerSession[], long, long, ThreadSuspension) */ && (arg1Value.length == 1)) {
ExecuteCachedData s1_ = this.executeCached_cache;
while (s1_ != null) {
if ((arg2Value == s1_.currentThreadId_)) {
executeCached(arg0Value, arg1Value, arg2Value, s1_.currentThreadId_, s1_.threadSuspension_);
return;
}
s1_ = s1_.next_;
}
}
if ((state & 0b10) != 0 /* is-active executeGeneric(boolean, DebuggerSession[], long) */) {
executeGeneric(arg0Value, arg1Value, arg2Value);
return;
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
executeAndSpecialize(arg0Value, arg1Value, arg2Value);
return;
}
private void executeAndSpecialize(boolean arg0Value, DebuggerSession[] arg1Value, long arg2Value) {
Lock lock = getLock();
boolean hasLock = true;
lock.lock();
int state = state_;
int exclude = exclude_;
try {
if ((exclude) == 0 /* is-not-excluded executeCached(boolean, DebuggerSession[], long, long, ThreadSuspension) */ && (arg1Value.length == 1)) {
int count1_ = 0;
ExecuteCachedData s1_ = this.executeCached_cache;
if ((state & 0b1) != 0 /* is-active executeCached(boolean, DebuggerSession[], long, long, ThreadSuspension) */) {
while (s1_ != null) {
if ((arg2Value == s1_.currentThreadId_)) {
break;
}
s1_ = s1_.next_;
count1_++;
}
}
if (s1_ == null) {
{
long currentThreadId__ = (SetThreadSuspensionEnabledNode.currentThreadId());
if ((arg2Value == currentThreadId__) && count1_ < (SetThreadSuspensionEnabledNode.CACHE_LIMIT)) {
s1_ = new ExecuteCachedData(executeCached_cache);
s1_.currentThreadId_ = currentThreadId__;
s1_.threadSuspension_ = (getThreadSuspension(arg1Value));
this.executeCached_cache = s1_;
this.state_ = state = state | 0b1 /* add-active executeCached(boolean, DebuggerSession[], long, long, ThreadSuspension) */;
}
}
}
if (s1_ != null) {
lock.unlock();
hasLock = false;
executeCached(arg0Value, arg1Value, arg2Value, s1_.currentThreadId_, s1_.threadSuspension_);
return;
}
}
this.exclude_ = exclude = exclude | 0b1 /* add-excluded executeCached(boolean, DebuggerSession[], long, long, ThreadSuspension) */;
this.executeCached_cache = null;
state = state & 0xfffffffe /* remove-active executeCached(boolean, DebuggerSession[], long, long, ThreadSuspension) */;
this.state_ = state = state | 0b10 /* add-active executeGeneric(boolean, DebuggerSession[], long) */;
lock.unlock();
hasLock = false;
executeGeneric(arg0Value, arg1Value, arg2Value);
return;
} finally {
if (hasLock) {
lock.unlock();
}
}
}
@Override
public NodeCost getCost() {
int state = state_;
if (state == 0b0) {
return NodeCost.UNINITIALIZED;
} else if ((state & (state - 1)) == 0 /* is-single-active */) {
ExecuteCachedData s1_ = this.executeCached_cache;
if ((s1_ == null || s1_.next_ == null)) {
return NodeCost.MONOMORPHIC;
}
}
return NodeCost.POLYMORPHIC;
}
public static SetThreadSuspensionEnabledNode create() {
return new SetThreadSuspensionEnabledNodeGen();
}
@GeneratedBy(SetThreadSuspensionEnabledNode.class)
private static final class ExecuteCachedData {
@CompilationFinal ExecuteCachedData next_;
@CompilationFinal long currentThreadId_;
@CompilationFinal ThreadSuspension threadSuspension_;
ExecuteCachedData(ExecuteCachedData next_) {
this.next_ = next_;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy