com.oracle.truffle.sl.nodes.util.SLToMemberNodeGen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truffle-sl Show documentation
Show all versions of truffle-sl Show documentation
Truffle SL is an example language implemented using the Truffle API.
The newest version!
// CheckStyle: start generated
package com.oracle.truffle.sl.nodes.util;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.dsl.NeverDefault;
import com.oracle.truffle.api.dsl.DSLSupport.SpecializationDataNode;
import com.oracle.truffle.api.dsl.InlineSupport.InlineTarget;
import com.oracle.truffle.api.dsl.InlineSupport.ReferenceField;
import com.oracle.truffle.api.dsl.InlineSupport.RequiredField;
import com.oracle.truffle.api.dsl.InlineSupport.StateField;
import com.oracle.truffle.api.interop.InteropLibrary;
import com.oracle.truffle.api.interop.UnknownIdentifierException;
import com.oracle.truffle.api.library.LibraryFactory;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.EncapsulatingNodeReference;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.UnadoptableNode;
import com.oracle.truffle.api.strings.TruffleString;
import com.oracle.truffle.api.strings.TruffleString.ToJavaStringNode;
import com.oracle.truffle.sl.nodes.SLTypesGen;
import com.oracle.truffle.sl.runtime.SLBigInteger;
import java.lang.invoke.VarHandle;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link SLToMemberNode#fromString}
* Activation probability: 0.23929
* With/without class size: 6/0 bytes
* Specialization {@link SLToMemberNode#fromTruffleString}
* Activation probability: 0.20714
* With/without class size: 8/4 bytes
* Specialization {@link SLToMemberNode#fromBoolean}
* Activation probability: 0.17500
* With/without class size: 6/0 bytes
* Specialization {@link SLToMemberNode#fromLong}
* Activation probability: 0.14286
* With/without class size: 5/0 bytes
* Specialization {@link SLToMemberNode#fromBigNumber}
* Activation probability: 0.11071
* With/without class size: 5/0 bytes
* Specialization {@link SLToMemberNode#fromInterop}
* Activation probability: 0.07857
* With/without class size: 5/4 bytes
* Specialization {@link SLToMemberNode#fromInterop}
* Activation probability: 0.04643
* With/without class size: 4/0 bytes
*
*/
@GeneratedBy(SLToMemberNode.class)
@SuppressWarnings({"javadoc", "unused"})
public final class SLToMemberNodeGen {
private static final Uncached UNCACHED = new Uncached();
private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);
@NeverDefault
public static SLToMemberNode getUncached() {
return SLToMemberNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#fromTruffleString_toJavaStringNode_}
*
- {@link Inlined#fromInterop0_cache}
*
*/
@NeverDefault
public static SLToMemberNode inline(@RequiredField(bits = 9, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new SLToMemberNodeGen.Inlined(target);
}
@GeneratedBy(SLToMemberNode.class)
@DenyReplace
private static final class Inlined extends SLToMemberNode implements UnadoptableNode {
/**
* State Info:
* 0: SpecializationActive {@link SLToMemberNode#fromString}
* 1: SpecializationActive {@link SLToMemberNode#fromTruffleString}
* 2: SpecializationActive {@link SLToMemberNode#fromBoolean}
* 3: SpecializationActive {@link SLToMemberNode#fromLong}
* 4: SpecializationActive {@link SLToMemberNode#fromBigNumber}
* 5: SpecializationActive {@link SLToMemberNode#fromInterop}
* 6: SpecializationActive {@link SLToMemberNode#fromInterop}
* 7-8: ImplicitCast[type=SLBigInteger, index=1]
*
*/
private final StateField state_0_;
private final ReferenceField fromTruffleString_toJavaStringNode_;
private final ReferenceField fromInterop0_cache;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(SLToMemberNode.class);
this.state_0_ = target.getState(0, 9);
this.fromTruffleString_toJavaStringNode_ = target.getReference(1, ToJavaStringNode.class);
this.fromInterop0_cache = target.getReference(2, FromInterop0Data.class);
}
@ExplodeLoop
@Override
public String execute(Node arg0Value, Object arg1Value) throws UnknownIdentifierException {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b1111111) != 0 /* is SpecializationActive[SLToMemberNode.fromString(String)] || SpecializationActive[SLToMemberNode.fromTruffleString(TruffleString, ToJavaStringNode)] || SpecializationActive[SLToMemberNode.fromBoolean(boolean)] || SpecializationActive[SLToMemberNode.fromLong(long)] || SpecializationActive[SLToMemberNode.fromBigNumber(SLBigInteger)] || SpecializationActive[SLToMemberNode.fromInterop(Object, InteropLibrary)] || SpecializationActive[SLToMemberNode.fromInterop(Object, InteropLibrary)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[SLToMemberNode.fromString(String)] */ && arg1Value instanceof String) {
String arg1Value_ = (String) arg1Value;
return SLToMemberNode.fromString(arg1Value_);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[SLToMemberNode.fromTruffleString(TruffleString, ToJavaStringNode)] */ && arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
{
ToJavaStringNode toJavaStringNode__ = this.fromTruffleString_toJavaStringNode_.get(arg0Value);
if (toJavaStringNode__ != null) {
return SLToMemberNode.fromTruffleString(arg1Value_, toJavaStringNode__);
}
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[SLToMemberNode.fromBoolean(boolean)] */ && arg1Value instanceof Boolean) {
boolean arg1Value_ = (boolean) arg1Value;
return SLToMemberNode.fromBoolean(arg1Value_);
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[SLToMemberNode.fromLong(long)] */ && arg1Value instanceof Long) {
long arg1Value_ = (long) arg1Value;
return SLToMemberNode.fromLong(arg1Value_);
}
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[SLToMemberNode.fromBigNumber(SLBigInteger)] */ && SLTypesGen.isImplicitSLBigInteger((state_0 & 0b110000000) >>> 7 /* get-int ImplicitCast[type=SLBigInteger, index=1] */, arg1Value)) {
SLBigInteger arg1Value_ = SLTypesGen.asImplicitSLBigInteger((state_0 & 0b110000000) >>> 7 /* get-int ImplicitCast[type=SLBigInteger, index=1] */, arg1Value);
return SLToMemberNode.fromBigNumber(arg1Value_);
}
if ((state_0 & 0b1100000) != 0 /* is SpecializationActive[SLToMemberNode.fromInterop(Object, InteropLibrary)] || SpecializationActive[SLToMemberNode.fromInterop(Object, InteropLibrary)] */) {
if ((state_0 & 0b100000) != 0 /* is SpecializationActive[SLToMemberNode.fromInterop(Object, InteropLibrary)] */) {
FromInterop0Data s5_ = this.fromInterop0_cache.get(arg0Value);
while (s5_ != null) {
if ((s5_.interop_.accepts(arg1Value))) {
return SLToMemberNode.fromInterop(arg1Value, s5_.interop_);
}
s5_ = s5_.next_;
}
}
if ((state_0 & 0b1000000) != 0 /* is SpecializationActive[SLToMemberNode.fromInterop(Object, InteropLibrary)] */) {
return this.fromInterop1Boundary(state_0, arg0Value, arg1Value);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
@SuppressWarnings("static-method")
@TruffleBoundary
private String fromInterop1Boundary(int state_0, Node arg0Value, Object arg1Value) throws UnknownIdentifierException {
EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent();
Node prev_ = encapsulating_.set(arg0Value);
try {
{
InteropLibrary interop__ = (INTEROP_LIBRARY_.getUncached(arg1Value));
return SLToMemberNode.fromInterop(arg1Value, interop__);
}
} finally {
encapsulating_.set(prev_);
}
}
private String executeAndSpecialize(Node arg0Value, Object arg1Value) throws UnknownIdentifierException {
int state_0 = this.state_0_.get(arg0Value);
if (arg1Value instanceof String) {
String arg1Value_ = (String) arg1Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[SLToMemberNode.fromString(String)] */;
this.state_0_.set(arg0Value, state_0);
return SLToMemberNode.fromString(arg1Value_);
}
if (arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
ToJavaStringNode toJavaStringNode__ = arg0Value.insert((ToJavaStringNode.create()));
Objects.requireNonNull(toJavaStringNode__, "A specialization cache returned a default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns the default value.");
VarHandle.storeStoreFence();
this.fromTruffleString_toJavaStringNode_.set(arg0Value, toJavaStringNode__);
state_0 = state_0 | 0b10 /* add SpecializationActive[SLToMemberNode.fromTruffleString(TruffleString, ToJavaStringNode)] */;
this.state_0_.set(arg0Value, state_0);
return SLToMemberNode.fromTruffleString(arg1Value_, toJavaStringNode__);
}
if (arg1Value instanceof Boolean) {
boolean arg1Value_ = (boolean) arg1Value;
state_0 = state_0 | 0b100 /* add SpecializationActive[SLToMemberNode.fromBoolean(boolean)] */;
this.state_0_.set(arg0Value, state_0);
return SLToMemberNode.fromBoolean(arg1Value_);
}
if (arg1Value instanceof Long) {
long arg1Value_ = (long) arg1Value;
state_0 = state_0 | 0b1000 /* add SpecializationActive[SLToMemberNode.fromLong(long)] */;
this.state_0_.set(arg0Value, state_0);
return SLToMemberNode.fromLong(arg1Value_);
}
{
int sLBigIntegerCast1;
if ((sLBigIntegerCast1 = SLTypesGen.specializeImplicitSLBigInteger(arg1Value)) != 0) {
SLBigInteger arg1Value_ = SLTypesGen.asImplicitSLBigInteger(sLBigIntegerCast1, arg1Value);
state_0 = (state_0 | (sLBigIntegerCast1 << 7) /* set-int ImplicitCast[type=SLBigInteger, index=1] */);
state_0 = state_0 | 0b10000 /* add SpecializationActive[SLToMemberNode.fromBigNumber(SLBigInteger)] */;
this.state_0_.set(arg0Value, state_0);
return SLToMemberNode.fromBigNumber(arg1Value_);
}
}
if (((state_0 & 0b1000000)) == 0 /* is-not SpecializationActive[SLToMemberNode.fromInterop(Object, InteropLibrary)] */) {
while (true) {
int count5_ = 0;
FromInterop0Data s5_ = this.fromInterop0_cache.getVolatile(arg0Value);
FromInterop0Data s5_original = s5_;
while (s5_ != null) {
if ((s5_.interop_.accepts(arg1Value))) {
break;
}
count5_++;
s5_ = s5_.next_;
}
if (s5_ == null) {
// assert (s5_.interop_.accepts(arg1Value));
if (count5_ < (SLToMemberNode.LIMIT)) {
s5_ = arg0Value.insert(new FromInterop0Data(s5_original));
InteropLibrary interop__ = s5_.insert((INTEROP_LIBRARY_.create(arg1Value)));
Objects.requireNonNull(interop__, "A specialization cache returned a default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns the default value.");
s5_.interop_ = interop__;
if (!this.fromInterop0_cache.compareAndSet(arg0Value, s5_original, s5_)) {
continue;
}
state_0 = state_0 | 0b100000 /* add SpecializationActive[SLToMemberNode.fromInterop(Object, InteropLibrary)] */;
this.state_0_.set(arg0Value, state_0);
}
}
if (s5_ != null) {
return SLToMemberNode.fromInterop(arg1Value, s5_.interop_);
}
break;
}
}
{
InteropLibrary interop__ = null;
{
EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent();
Node prev_ = encapsulating_.set(arg0Value);
try {
interop__ = (INTEROP_LIBRARY_.getUncached(arg1Value));
this.fromInterop0_cache.set(arg0Value, null);
state_0 = state_0 & 0xffffffdf /* remove SpecializationActive[SLToMemberNode.fromInterop(Object, InteropLibrary)] */;
state_0 = state_0 | 0b1000000 /* add SpecializationActive[SLToMemberNode.fromInterop(Object, InteropLibrary)] */;
this.state_0_.set(arg0Value, state_0);
return SLToMemberNode.fromInterop(arg1Value, interop__);
} finally {
encapsulating_.set(prev_);
}
}
}
}
}
@GeneratedBy(SLToMemberNode.class)
@DenyReplace
private static final class FromInterop0Data extends Node implements SpecializationDataNode {
@Child FromInterop0Data next_;
/**
* Source Info:
* Specialization: {@link SLToMemberNode#fromInterop}
* Parameter: {@link InteropLibrary} interop
*/
@Child InteropLibrary interop_;
FromInterop0Data(FromInterop0Data next_) {
this.next_ = next_;
}
}
@GeneratedBy(SLToMemberNode.class)
@DenyReplace
private static final class Uncached extends SLToMemberNode implements UnadoptableNode {
@TruffleBoundary
@Override
public String execute(Node arg0Value, Object arg1Value) throws UnknownIdentifierException {
if (arg1Value instanceof String) {
String arg1Value_ = (String) arg1Value;
return SLToMemberNode.fromString(arg1Value_);
}
if (arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
return SLToMemberNode.fromTruffleString(arg1Value_, (ToJavaStringNode.getUncached()));
}
if (arg1Value instanceof Boolean) {
boolean arg1Value_ = (boolean) arg1Value;
return SLToMemberNode.fromBoolean(arg1Value_);
}
if (arg1Value instanceof Long) {
long arg1Value_ = (long) arg1Value;
return SLToMemberNode.fromLong(arg1Value_);
}
if (SLTypesGen.isImplicitSLBigInteger(arg1Value)) {
SLBigInteger arg1Value_ = SLTypesGen.asImplicitSLBigInteger(arg1Value);
return SLToMemberNode.fromBigNumber(arg1Value_);
}
return SLToMemberNode.fromInterop(arg1Value, (INTEROP_LIBRARY_.getUncached(arg1Value)));
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy