com.oracle.truffle.tck.ComplexWriteNodeSubNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.truffle.tck;
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.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import java.util.concurrent.locks.Lock;
@GeneratedBy(ComplexWriteNodeSub.class)
final class ComplexWriteNodeSubNodeGen extends ComplexWriteNodeSub {
@CompilationFinal private int state_ = 1;
private ComplexWriteNodeSubNodeGen() {
}
@Override
public Object executeWithTarget(VirtualFrame frameValue, Object arg0Value, Object arg1Value, Object arg2Value) {
int state = state_;
if ((state & 0b110) != 0 /* is-active accessWithTarget(ComplexNumber, String, Number) || accessWithTarget(ComplexNumber, int, Number) */ && arg0Value instanceof ComplexNumber) {
ComplexNumber arg0Value_ = (ComplexNumber) arg0Value;
if (arg2Value instanceof Number) {
Number arg2Value_ = (Number) arg2Value;
if ((state & 0b10) != 0 /* is-active accessWithTarget(ComplexNumber, String, Number) */ && arg1Value instanceof String) {
String arg1Value_ = (String) arg1Value;
return accessWithTarget(arg0Value_, arg1Value_, arg2Value_);
}
if ((state & 0b100) != 0 /* is-active accessWithTarget(ComplexNumber, int, Number) */ && arg1Value instanceof Integer) {
int arg1Value_ = (int) arg1Value;
return accessWithTarget(arg0Value_, arg1Value_, arg2Value_);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value, arg2Value);
}
private Object executeAndSpecialize(Object arg0Value, Object arg1Value, Object arg2Value) {
Lock lock = getLock();
boolean hasLock = true;
lock.lock();
try {
int state = state_ & 0xfffffffe/* mask-active uninitialized*/;
if (arg0Value instanceof ComplexNumber) {
ComplexNumber arg0Value_ = (ComplexNumber) arg0Value;
if (arg2Value instanceof Number) {
Number arg2Value_ = (Number) arg2Value;
if (arg1Value instanceof String) {
String arg1Value_ = (String) arg1Value;
this.state_ = state | 0b10 /* add-active accessWithTarget(ComplexNumber, String, Number) */;
lock.unlock();
hasLock = false;
return accessWithTarget(arg0Value_, arg1Value_, arg2Value_);
}
if (arg1Value instanceof Integer) {
int arg1Value_ = (int) arg1Value;
this.state_ = state | 0b100 /* add-active accessWithTarget(ComplexNumber, int, Number) */;
lock.unlock();
hasLock = false;
return accessWithTarget(arg0Value_, arg1Value_, arg2Value_);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new UnsupportedSpecializationException(this, new Node[] {});
} finally {
if (hasLock) {
lock.unlock();
}
}
}
@Override
public NodeCost getCost() {
int state = state_ & 0xfffffffe/* mask-active uninitialized*/;
if (state == 0b0) {
return NodeCost.UNINITIALIZED;
} else if (((state & 0b110) & ((state & 0b110) - 1)) == 0 /* is-single-active */) {
return NodeCost.MONOMORPHIC;
}
return NodeCost.POLYMORPHIC;
}
public static ComplexWriteNodeSub create() {
return new ComplexWriteNodeSubNodeGen();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy