com.oracle.truffle.api.interop.java.WriteFieldNodeGen 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 java.util.concurrent.locks.Lock;
@GeneratedBy(WriteFieldNode.class)
final class WriteFieldNodeGen extends WriteFieldNode {
@CompilationFinal private int state_;
@CompilationFinal private int exclude_;
@CompilationFinal private CachedData cached_cache;
private WriteFieldNodeGen() {
}
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN)
@Override
public void execute(JavaFieldDesc arg0Value, JavaObject arg1Value, Object arg2Value) {
int state = state_;
if (state != 0 /* is-active doCached(SingleFieldDesc, JavaObject, Object, SingleFieldDesc) || doUncached(SingleFieldDesc, JavaObject, Object) */ && arg0Value instanceof SingleFieldDesc) {
SingleFieldDesc arg0Value_ = (SingleFieldDesc) arg0Value;
if ((state & 0b1) != 0 /* is-active doCached(SingleFieldDesc, JavaObject, Object, SingleFieldDesc) */) {
CachedData s1_ = this.cached_cache;
while (s1_ != null) {
if ((arg0Value_ == s1_.cachedField_)) {
doCached(arg0Value_, arg1Value, arg2Value, s1_.cachedField_);
return;
}
s1_ = s1_.next_;
}
}
if ((state & 0b10) != 0 /* is-active doUncached(SingleFieldDesc, JavaObject, Object) */) {
doUncached(arg0Value_, arg1Value, arg2Value);
return;
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
executeAndSpecialize(arg0Value, arg1Value, arg2Value);
return;
}
private void executeAndSpecialize(JavaFieldDesc arg0Value, JavaObject arg1Value, Object arg2Value) {
Lock lock = getLock();
boolean hasLock = true;
lock.lock();
int state = state_;
int exclude = exclude_;
try {
if (arg0Value instanceof SingleFieldDesc) {
SingleFieldDesc arg0Value_ = (SingleFieldDesc) arg0Value;
if ((exclude) == 0 /* is-not-excluded doCached(SingleFieldDesc, JavaObject, Object, SingleFieldDesc) */) {
int count1_ = 0;
CachedData s1_ = this.cached_cache;
if ((state & 0b1) != 0 /* is-active doCached(SingleFieldDesc, JavaObject, Object, SingleFieldDesc) */) {
while (s1_ != null) {
if ((arg0Value_ == s1_.cachedField_)) {
break;
}
s1_ = s1_.next_;
count1_++;
}
}
if (s1_ == null) {
// assert (arg0Value_ == s1_.cachedField_);
if (count1_ < (WriteFieldNode.LIMIT)) {
s1_ = new CachedData(cached_cache);
s1_.cachedField_ = (arg0Value_);
this.cached_cache = s1_;
this.state_ = state = state | 0b1 /* add-active doCached(SingleFieldDesc, JavaObject, Object, SingleFieldDesc) */;
}
}
if (s1_ != null) {
lock.unlock();
hasLock = false;
doCached(arg0Value_, arg1Value, arg2Value, s1_.cachedField_);
return;
}
}
this.exclude_ = exclude = exclude | 0b1 /* add-excluded doCached(SingleFieldDesc, JavaObject, Object, SingleFieldDesc) */;
this.cached_cache = null;
state = state & 0xfffffffe /* remove-active doCached(SingleFieldDesc, JavaObject, Object, SingleFieldDesc) */;
this.state_ = state = state | 0b10 /* add-active doUncached(SingleFieldDesc, JavaObject, Object) */;
lock.unlock();
hasLock = false;
doUncached(arg0Value_, arg1Value, arg2Value);
return;
}
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new UnsupportedSpecializationException(this, new Node[] {null, null, null}, arg0Value, arg1Value, arg2Value);
} 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 */) {
CachedData s1_ = this.cached_cache;
if ((s1_ == null || s1_.next_ == null)) {
return NodeCost.MONOMORPHIC;
}
}
return NodeCost.POLYMORPHIC;
}
public static WriteFieldNode create() {
return new WriteFieldNodeGen();
}
@GeneratedBy(WriteFieldNode.class)
private static final class CachedData {
@CompilationFinal CachedData next_;
@CompilationFinal SingleFieldDesc cachedField_;
CachedData(CachedData next_) {
this.next_ = next_;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy