com.oracle.truffle.api.interop.java.ArrayRemoveNodeGen 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.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import java.util.concurrent.locks.Lock;
@GeneratedBy(ArrayRemoveNode.class)
final class ArrayRemoveNodeGen extends ArrayRemoveNode {
@CompilationFinal private int state_;
@CompilationFinal private int exclude_;
private ArrayRemoveNodeGen() {
}
@Override
protected boolean executeWithTarget(JavaObject arg0Value, Object arg1Value) {
int state = state_;
if (state != 0 /* is-active doListIntIndex(JavaObject, int) || doListGeneric(JavaObject, Number) || notArray(JavaObject, Number) */) {
if ((state & 0b1) != 0 /* is-active doListIntIndex(JavaObject, int) */ && arg1Value instanceof Integer) {
int arg1Value_ = (int) arg1Value;
if ((ArrayRemoveNode.isList(arg0Value))) {
return doListIntIndex(arg0Value, arg1Value_);
}
}
if ((state & 0b110) != 0 /* is-active doListGeneric(JavaObject, Number) || notArray(JavaObject, Number) */ && arg1Value instanceof Number) {
Number arg1Value_ = (Number) arg1Value;
if ((state & 0b10) != 0 /* is-active doListGeneric(JavaObject, Number) */) {
if ((ArrayRemoveNode.isList(arg0Value))) {
return doListGeneric(arg0Value, arg1Value_);
}
}
if ((state & 0b100) != 0 /* is-active notArray(JavaObject, Number) */) {
if ((!(ArrayRemoveNode.isList(arg0Value)))) {
return ArrayRemoveNode.notArray(arg0Value, arg1Value_);
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private boolean executeAndSpecialize(JavaObject arg0Value, Object arg1Value) {
Lock lock = getLock();
boolean hasLock = true;
lock.lock();
int state = state_;
int exclude = exclude_;
try {
if ((exclude) == 0 /* is-not-excluded doListIntIndex(JavaObject, int) */ && arg1Value instanceof Integer) {
int arg1Value_ = (int) arg1Value;
if ((ArrayRemoveNode.isList(arg0Value))) {
this.state_ = state = state | 0b1 /* add-active doListIntIndex(JavaObject, int) */;
lock.unlock();
hasLock = false;
return doListIntIndex(arg0Value, arg1Value_);
}
}
if (arg1Value instanceof Number) {
Number arg1Value_ = (Number) arg1Value;
if ((ArrayRemoveNode.isList(arg0Value))) {
this.exclude_ = exclude = exclude | 0b1 /* add-excluded doListIntIndex(JavaObject, int) */;
state = state & 0xfffffffe /* remove-active doListIntIndex(JavaObject, int) */;
this.state_ = state = state | 0b10 /* add-active doListGeneric(JavaObject, Number) */;
lock.unlock();
hasLock = false;
return doListGeneric(arg0Value, arg1Value_);
}
if ((!(ArrayRemoveNode.isList(arg0Value)))) {
this.state_ = state = state | 0b100 /* add-active notArray(JavaObject, Number) */;
lock.unlock();
hasLock = false;
return ArrayRemoveNode.notArray(arg0Value, arg1Value_);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
} 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 */) {
return NodeCost.MONOMORPHIC;
}
return NodeCost.POLYMORPHIC;
}
public static ArrayRemoveNode create() {
return new ArrayRemoveNodeGen();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy