com.oracle.truffle.api.interop.java.ExecuteMethodNodeGen 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.interop.java;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.nodes.ExplodeLoop.LoopExplosionKind;
import com.oracle.truffle.api.profiles.ConditionProfile;
import com.oracle.truffle.api.profiles.ValueProfile;
import java.lang.reflect.Type;
import java.util.concurrent.locks.Lock;
@GeneratedBy(ExecuteMethodNode.class)
final class ExecuteMethodNodeGen extends ExecuteMethodNode {
@CompilationFinal private int state_;
@CompilationFinal private int exclude_;
@Child private FixedData fixed_cache;
@Child private VarArgsData varArgs_cache;
@Child private ToJavaNode singleUncached_toJavaNode_;
@CompilationFinal private ConditionProfile singleUncached_isVarArgsProfile_;
@Child private OverloadedCachedData overloadedCached_cache;
@Child private ToJavaNode overloadedUncached_toJavaNode_;
@CompilationFinal private ConditionProfile overloadedUncached_isVarArgsProfile_;
private ExecuteMethodNodeGen() {
}
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN)
@Override
protected Object executeImpl(JavaMethodDesc arg0Value, Object arg1Value, Object[] arg2Value, Object arg3Value) {
int state = state_;
if (state != 0 /* is-active doFixed(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode[], ValueProfile) || doVarArgs(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode, ValueProfile) || doSingleUncached(SingleMethodDesc, Object, Object[], Object, ToJavaNode, ConditionProfile) || doOverloadedCached(OverloadedMethodDesc, Object, Object[], Object, OverloadedMethodDesc, ToJavaNode, Type[], SingleMethodDesc, boolean, ValueProfile) || doOverloadedUncached(OverloadedMethodDesc, Object, Object[], Object, ToJavaNode, ConditionProfile) */) {
if ((state & 0b111) != 0 /* is-active doFixed(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode[], ValueProfile) || doVarArgs(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode, ValueProfile) || doSingleUncached(SingleMethodDesc, Object, Object[], Object, ToJavaNode, ConditionProfile) */ && arg0Value instanceof SingleMethodDesc) {
SingleMethodDesc arg0Value_ = (SingleMethodDesc) arg0Value;
if ((state & 0b1) != 0 /* is-active doFixed(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode[], ValueProfile) */ && (!(arg0Value_.isVarArgs()))) {
FixedData s1_ = this.fixed_cache;
while (s1_ != null) {
if ((arg0Value_ == s1_.cachedMethod_)) {
return doFixed(arg0Value_, arg1Value, arg2Value, arg3Value, s1_.cachedMethod_, s1_.toJavaNodes_, s1_.receiverProfile_);
}
s1_ = s1_.next_;
}
}
if ((state & 0b10) != 0 /* is-active doVarArgs(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode, ValueProfile) */ && (arg0Value_.isVarArgs())) {
VarArgsData s2_ = this.varArgs_cache;
while (s2_ != null) {
if ((arg0Value_ == s2_.cachedMethod_)) {
return doVarArgs(arg0Value_, arg1Value, arg2Value, arg3Value, s2_.cachedMethod_, s2_.toJavaNode_, s2_.receiverProfile_);
}
s2_ = s2_.next_;
}
}
if ((state & 0b100) != 0 /* is-active doSingleUncached(SingleMethodDesc, Object, Object[], Object, ToJavaNode, ConditionProfile) */) {
return doSingleUncached(arg0Value_, arg1Value, arg2Value, arg3Value, this.singleUncached_toJavaNode_, this.singleUncached_isVarArgsProfile_);
}
}
if ((state & 0b11000) != 0 /* is-active doOverloadedCached(OverloadedMethodDesc, Object, Object[], Object, OverloadedMethodDesc, ToJavaNode, Type[], SingleMethodDesc, boolean, ValueProfile) || doOverloadedUncached(OverloadedMethodDesc, Object, Object[], Object, ToJavaNode, ConditionProfile) */ && arg0Value instanceof OverloadedMethodDesc) {
OverloadedMethodDesc arg0Value_ = (OverloadedMethodDesc) arg0Value;
if ((state & 0b1000) != 0 /* is-active doOverloadedCached(OverloadedMethodDesc, Object, Object[], Object, OverloadedMethodDesc, ToJavaNode, Type[], SingleMethodDesc, boolean, ValueProfile) */) {
OverloadedCachedData s4_ = this.overloadedCached_cache;
while (s4_ != null) {
if ((arg0Value_ == s4_.cachedMethod_) && (ExecuteMethodNode.checkArgTypes(arg2Value, s4_.cachedArgTypes_, s4_.toJavaNode_, s4_.asVarArgs_))) {
return doOverloadedCached(arg0Value_, arg1Value, arg2Value, arg3Value, s4_.cachedMethod_, s4_.toJavaNode_, s4_.cachedArgTypes_, s4_.overload_, s4_.asVarArgs_, s4_.receiverProfile_);
}
s4_ = s4_.next_;
}
}
if ((state & 0b10000) != 0 /* is-active doOverloadedUncached(OverloadedMethodDesc, Object, Object[], Object, ToJavaNode, ConditionProfile) */) {
return doOverloadedUncached(arg0Value_, arg1Value, arg2Value, arg3Value, this.overloadedUncached_toJavaNode_, this.overloadedUncached_isVarArgsProfile_);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value, arg2Value, arg3Value);
}
private Object executeAndSpecialize(JavaMethodDesc arg0Value, Object arg1Value, Object[] arg2Value, Object arg3Value) {
Lock lock = getLock();
boolean hasLock = true;
lock.lock();
int state = state_;
int exclude = exclude_;
try {
if (arg0Value instanceof SingleMethodDesc) {
SingleMethodDesc arg0Value_ = (SingleMethodDesc) arg0Value;
if (((exclude & 0b1)) == 0 /* is-not-excluded doFixed(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode[], ValueProfile) */ && (!(arg0Value_.isVarArgs()))) {
int count1_ = 0;
FixedData s1_ = this.fixed_cache;
if ((state & 0b1) != 0 /* is-active doFixed(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode[], ValueProfile) */) {
while (s1_ != null) {
if ((arg0Value_ == s1_.cachedMethod_)) {
break;
}
s1_ = s1_.next_;
count1_++;
}
}
if (s1_ == null) {
// assert (arg0Value_ == s1_.cachedMethod_);
if (count1_ < (ExecuteMethodNode.LIMIT)) {
s1_ = new FixedData(fixed_cache);
s1_.cachedMethod_ = (arg0Value_);
s1_.toJavaNodes_ = (ExecuteMethodNode.createToJava(arg0Value_.getParameterCount()));
s1_.receiverProfile_ = (ValueProfile.createClassProfile());
this.fixed_cache = super.insert(s1_);
this.state_ = state = state | 0b1 /* add-active doFixed(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode[], ValueProfile) */;
}
}
if (s1_ != null) {
lock.unlock();
hasLock = false;
return doFixed(arg0Value_, arg1Value, arg2Value, arg3Value, s1_.cachedMethod_, s1_.toJavaNodes_, s1_.receiverProfile_);
}
}
if (((exclude & 0b10)) == 0 /* is-not-excluded doVarArgs(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode, ValueProfile) */ && (arg0Value_.isVarArgs())) {
int count2_ = 0;
VarArgsData s2_ = this.varArgs_cache;
if ((state & 0b10) != 0 /* is-active doVarArgs(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode, ValueProfile) */) {
while (s2_ != null) {
if ((arg0Value_ == s2_.cachedMethod_)) {
break;
}
s2_ = s2_.next_;
count2_++;
}
}
if (s2_ == null) {
// assert (arg0Value_ == s2_.cachedMethod_);
if (count2_ < (ExecuteMethodNode.LIMIT)) {
s2_ = new VarArgsData(varArgs_cache);
s2_.cachedMethod_ = (arg0Value_);
s2_.toJavaNode_ = (ToJavaNode.create());
s2_.receiverProfile_ = (ValueProfile.createClassProfile());
this.varArgs_cache = super.insert(s2_);
this.state_ = state = state | 0b10 /* add-active doVarArgs(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode, ValueProfile) */;
}
}
if (s2_ != null) {
lock.unlock();
hasLock = false;
return doVarArgs(arg0Value_, arg1Value, arg2Value, arg3Value, s2_.cachedMethod_, s2_.toJavaNode_, s2_.receiverProfile_);
}
}
this.singleUncached_toJavaNode_ = super.insert((ToJavaNode.create()));
this.singleUncached_isVarArgsProfile_ = (ConditionProfile.createBinaryProfile());
this.exclude_ = exclude = exclude | 0b11 /* add-excluded doFixed(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode[], ValueProfile), doVarArgs(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode, ValueProfile) */;
this.fixed_cache = null;
this.varArgs_cache = null;
state = state & 0xfffffffc /* remove-active doFixed(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode[], ValueProfile), doVarArgs(SingleMethodDesc, Object, Object[], Object, SingleMethodDesc, ToJavaNode, ValueProfile) */;
this.state_ = state = state | 0b100 /* add-active doSingleUncached(SingleMethodDesc, Object, Object[], Object, ToJavaNode, ConditionProfile) */;
lock.unlock();
hasLock = false;
return doSingleUncached(arg0Value_, arg1Value, arg2Value, arg3Value, this.singleUncached_toJavaNode_, this.singleUncached_isVarArgsProfile_);
}
if (arg0Value instanceof OverloadedMethodDesc) {
OverloadedMethodDesc arg0Value_ = (OverloadedMethodDesc) arg0Value;
if (((exclude & 0b100)) == 0 /* is-not-excluded doOverloadedCached(OverloadedMethodDesc, Object, Object[], Object, OverloadedMethodDesc, ToJavaNode, Type[], SingleMethodDesc, boolean, ValueProfile) */) {
int count4_ = 0;
OverloadedCachedData s4_ = this.overloadedCached_cache;
if ((state & 0b1000) != 0 /* is-active doOverloadedCached(OverloadedMethodDesc, Object, Object[], Object, OverloadedMethodDesc, ToJavaNode, Type[], SingleMethodDesc, boolean, ValueProfile) */) {
while (s4_ != null) {
if ((arg0Value_ == s4_.cachedMethod_) && (ExecuteMethodNode.checkArgTypes(arg2Value, s4_.cachedArgTypes_, s4_.toJavaNode_, s4_.asVarArgs_))) {
break;
}
s4_ = s4_.next_;
count4_++;
}
}
if (s4_ == null) {
{
ToJavaNode toJavaNode__ = (ToJavaNode.create());
Type[] cachedArgTypes__ = (ExecuteMethodNode.createArgTypesArray(arg2Value));
SingleMethodDesc overload__ = (ExecuteMethodNode.selectOverload(arg0Value_, arg2Value, arg3Value, cachedArgTypes__));
boolean asVarArgs__ = (ExecuteMethodNode.asVarArgs(arg2Value, overload__));
// assert (arg0Value_ == s4_.cachedMethod_);
if ((ExecuteMethodNode.checkArgTypes(arg2Value, cachedArgTypes__, toJavaNode__, asVarArgs__)) && count4_ < (ExecuteMethodNode.LIMIT)) {
s4_ = new OverloadedCachedData(overloadedCached_cache);
s4_.cachedMethod_ = (arg0Value_);
s4_.toJavaNode_ = toJavaNode__;
s4_.cachedArgTypes_ = cachedArgTypes__;
s4_.overload_ = overload__;
s4_.asVarArgs_ = asVarArgs__;
s4_.receiverProfile_ = (ValueProfile.createClassProfile());
this.overloadedCached_cache = super.insert(s4_);
this.state_ = state = state | 0b1000 /* add-active doOverloadedCached(OverloadedMethodDesc, Object, Object[], Object, OverloadedMethodDesc, ToJavaNode, Type[], SingleMethodDesc, boolean, ValueProfile) */;
}
}
}
if (s4_ != null) {
lock.unlock();
hasLock = false;
return doOverloadedCached(arg0Value_, arg1Value, arg2Value, arg3Value, s4_.cachedMethod_, s4_.toJavaNode_, s4_.cachedArgTypes_, s4_.overload_, s4_.asVarArgs_, s4_.receiverProfile_);
}
}
this.overloadedUncached_toJavaNode_ = super.insert((ToJavaNode.create()));
this.overloadedUncached_isVarArgsProfile_ = (ConditionProfile.createBinaryProfile());
this.exclude_ = exclude = exclude | 0b100 /* add-excluded doOverloadedCached(OverloadedMethodDesc, Object, Object[], Object, OverloadedMethodDesc, ToJavaNode, Type[], SingleMethodDesc, boolean, ValueProfile) */;
this.overloadedCached_cache = null;
state = state & 0xfffffff7 /* remove-active doOverloadedCached(OverloadedMethodDesc, Object, Object[], Object, OverloadedMethodDesc, ToJavaNode, Type[], SingleMethodDesc, boolean, ValueProfile) */;
this.state_ = state = state | 0b10000 /* add-active doOverloadedUncached(OverloadedMethodDesc, Object, Object[], Object, ToJavaNode, ConditionProfile) */;
lock.unlock();
hasLock = false;
return doOverloadedUncached(arg0Value_, arg1Value, arg2Value, arg3Value, this.overloadedUncached_toJavaNode_, this.overloadedUncached_isVarArgsProfile_);
}
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new UnsupportedSpecializationException(this, new Node[] {null, null, null, null}, arg0Value, arg1Value, arg2Value, arg3Value);
} 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 */) {
FixedData s1_ = this.fixed_cache;
VarArgsData s2_ = this.varArgs_cache;
OverloadedCachedData s4_ = this.overloadedCached_cache;
if ((s1_ == null || s1_.next_ == null) && (s2_ == null || s2_.next_ == null) && (s4_ == null || s4_.next_ == null)) {
return NodeCost.MONOMORPHIC;
}
}
return NodeCost.POLYMORPHIC;
}
public static ExecuteMethodNode create() {
return new ExecuteMethodNodeGen();
}
@GeneratedBy(ExecuteMethodNode.class)
private static final class FixedData extends Node {
@Child FixedData next_;
@CompilationFinal SingleMethodDesc cachedMethod_;
@Children ToJavaNode[] toJavaNodes_;
@CompilationFinal ValueProfile receiverProfile_;
FixedData(FixedData next_) {
this.next_ = next_;
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
}
@GeneratedBy(ExecuteMethodNode.class)
private static final class VarArgsData extends Node {
@Child VarArgsData next_;
@CompilationFinal SingleMethodDesc cachedMethod_;
@Child ToJavaNode toJavaNode_;
@CompilationFinal ValueProfile receiverProfile_;
VarArgsData(VarArgsData next_) {
this.next_ = next_;
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
}
@GeneratedBy(ExecuteMethodNode.class)
private static final class OverloadedCachedData extends Node {
@Child OverloadedCachedData next_;
@CompilationFinal OverloadedMethodDesc cachedMethod_;
@Child ToJavaNode toJavaNode_;
@CompilationFinal(dimensions = 1) Type[] cachedArgTypes_;
@CompilationFinal SingleMethodDesc overload_;
@CompilationFinal boolean asVarArgs_;
@CompilationFinal ValueProfile receiverProfile_;
OverloadedCachedData(OverloadedCachedData next_) {
this.next_ = next_;
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy