All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.oracle.truffle.sl.nodes.util.SLToTruffleStringNodeGen Maven / Gradle / Ivy

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.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.FromJavaStringNode;
import com.oracle.truffle.api.strings.TruffleString.FromLongNode;
import com.oracle.truffle.sl.nodes.SLTypes;
import com.oracle.truffle.sl.nodes.SLTypesGen;
import com.oracle.truffle.sl.runtime.SLBigInteger;
import com.oracle.truffle.sl.runtime.SLFunction;
import com.oracle.truffle.sl.runtime.SLNull;
import java.lang.invoke.VarHandle;
import java.util.Objects;

/**
 * Debug Info: 
 *   Specialization {@link SLToTruffleStringNode#fromNull}
 *     Activation probability: 0.19111
 *     With/without class size: 6/0 bytes
 *   Specialization {@link SLToTruffleStringNode#fromString}
 *     Activation probability: 0.17111
 *     With/without class size: 6/0 bytes
 *   Specialization {@link SLToTruffleStringNode#fromTruffleString}
 *     Activation probability: 0.15111
 *     With/without class size: 5/0 bytes
 *   Specialization {@link SLToTruffleStringNode#fromBoolean}
 *     Activation probability: 0.13111
 *     With/without class size: 5/0 bytes
 *   Specialization {@link SLToTruffleStringNode#fromLong}
 *     Activation probability: 0.11111
 *     With/without class size: 5/0 bytes
 *   Specialization {@link SLToTruffleStringNode#fromBigNumber}
 *     Activation probability: 0.09111
 *     With/without class size: 5/0 bytes
 *   Specialization {@link SLToTruffleStringNode#fromFunction}
 *     Activation probability: 0.07111
 *     With/without class size: 4/0 bytes
 *   Specialization {@link SLToTruffleStringNode#fromInterop}
 *     Activation probability: 0.05111
 *     With/without class size: 5/4 bytes
 *   Specialization {@link SLToTruffleStringNode#fromInterop}
 *     Activation probability: 0.03111
 *     With/without class size: 4/0 bytes
 * 
*/ @GeneratedBy(SLToTruffleStringNode.class) @SuppressWarnings({"javadoc", "unused"}) public final class SLToTruffleStringNodeGen { private static final Uncached UNCACHED = new Uncached(); private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class); @NeverDefault public static SLToTruffleStringNode getUncached() { return SLToTruffleStringNodeGen.UNCACHED; } /** * Required Fields:
    *
  • {@link Inlined#state_0_} *
  • {@link Inlined#fromJava} *
  • {@link Inlined#fromLong} *
  • {@link Inlined#fromInterop0_cache} *
*/ @NeverDefault public static SLToTruffleStringNode inline(@RequiredField(bits = 11, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class)@RequiredField(type = Node.class, value = ReferenceField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) { return new SLToTruffleStringNodeGen.Inlined(target); } @GeneratedBy(SLToTruffleStringNode.class) @DenyReplace private static final class Inlined extends SLToTruffleStringNode implements UnadoptableNode { /** * State Info:
         *   0: SpecializationActive {@link SLToTruffleStringNode#fromNull}
         *   1: SpecializationActive {@link SLToTruffleStringNode#fromString}
         *   2: SpecializationActive {@link SLToTruffleStringNode#fromTruffleString}
         *   3: SpecializationActive {@link SLToTruffleStringNode#fromBoolean}
         *   4: SpecializationActive {@link SLToTruffleStringNode#fromLong}
         *   5: SpecializationActive {@link SLToTruffleStringNode#fromBigNumber}
         *   6: SpecializationActive {@link SLToTruffleStringNode#fromFunction}
         *   7: SpecializationActive {@link SLToTruffleStringNode#fromInterop}
         *   8: SpecializationActive {@link SLToTruffleStringNode#fromInterop}
         *   9-10: ImplicitCast[type=SLBigInteger, index=1]
         * 
*/ private final StateField state_0_; private final ReferenceField fromJava; private final ReferenceField fromLong; private final ReferenceField fromInterop0_cache; @SuppressWarnings("unchecked") private Inlined(InlineTarget target) { assert target.getTargetClass().isAssignableFrom(SLToTruffleStringNode.class); this.state_0_ = target.getState(0, 11); this.fromJava = target.getReference(1, FromJavaStringNode.class); this.fromLong = target.getReference(2, FromLongNode.class); this.fromInterop0_cache = target.getReference(3, FromInterop0Data.class); } @ExplodeLoop @Override public TruffleString execute(Node arg0Value, Object arg1Value) { int state_0 = this.state_0_.get(arg0Value); if ((state_0 & 0b111111111) != 0 /* is SpecializationActive[SLToTruffleStringNode.fromNull(SLNull)] || SpecializationActive[SLToTruffleStringNode.fromString(String, FromJavaStringNode)] || SpecializationActive[SLToTruffleStringNode.fromTruffleString(TruffleString)] || SpecializationActive[SLToTruffleStringNode.fromBoolean(boolean)] || SpecializationActive[SLToTruffleStringNode.fromLong(long, FromLongNode)] || SpecializationActive[SLToTruffleStringNode.fromBigNumber(SLBigInteger, FromJavaStringNode)] || SpecializationActive[SLToTruffleStringNode.fromFunction(SLFunction)] || SpecializationActive[SLToTruffleStringNode.fromInterop(Object, InteropLibrary, FromLongNode, FromJavaStringNode)] || SpecializationActive[SLToTruffleStringNode.fromInterop(Object, InteropLibrary, FromLongNode, FromJavaStringNode)] */) { if ((state_0 & 0b1) != 0 /* is SpecializationActive[SLToTruffleStringNode.fromNull(SLNull)] */ && SLTypes.isSLNull(arg1Value)) { SLNull arg1Value_ = SLTypes.asSLNull(arg1Value); return SLToTruffleStringNode.fromNull(arg1Value_); } if ((state_0 & 0b10) != 0 /* is SpecializationActive[SLToTruffleStringNode.fromString(String, FromJavaStringNode)] */ && arg1Value instanceof String) { String arg1Value_ = (String) arg1Value; { FromJavaStringNode fromJava_ = this.fromJava.get(arg0Value); if (fromJava_ != null) { return SLToTruffleStringNode.fromString(arg1Value_, fromJava_); } } } if ((state_0 & 0b100) != 0 /* is SpecializationActive[SLToTruffleStringNode.fromTruffleString(TruffleString)] */ && arg1Value instanceof TruffleString) { TruffleString arg1Value_ = (TruffleString) arg1Value; return SLToTruffleStringNode.fromTruffleString(arg1Value_); } if ((state_0 & 0b1000) != 0 /* is SpecializationActive[SLToTruffleStringNode.fromBoolean(boolean)] */ && arg1Value instanceof Boolean) { boolean arg1Value_ = (boolean) arg1Value; return SLToTruffleStringNode.fromBoolean(arg1Value_); } if ((state_0 & 0b10000) != 0 /* is SpecializationActive[SLToTruffleStringNode.fromLong(long, FromLongNode)] */ && arg1Value instanceof Long) { long arg1Value_ = (long) arg1Value; { FromLongNode fromLong_ = this.fromLong.get(arg0Value); if (fromLong_ != null) { return SLToTruffleStringNode.fromLong(arg1Value_, fromLong_); } } } if ((state_0 & 0b100000) != 0 /* is SpecializationActive[SLToTruffleStringNode.fromBigNumber(SLBigInteger, FromJavaStringNode)] */ && SLTypesGen.isImplicitSLBigInteger((state_0 & 0b11000000000) >>> 9 /* get-int ImplicitCast[type=SLBigInteger, index=1] */, arg1Value)) { SLBigInteger arg1Value_ = SLTypesGen.asImplicitSLBigInteger((state_0 & 0b11000000000) >>> 9 /* get-int ImplicitCast[type=SLBigInteger, index=1] */, arg1Value); { FromJavaStringNode fromJava_1 = this.fromJava.get(arg0Value); if (fromJava_1 != null) { return SLToTruffleStringNode.fromBigNumber(arg1Value_, fromJava_1); } } } if ((state_0 & 0b1000000) != 0 /* is SpecializationActive[SLToTruffleStringNode.fromFunction(SLFunction)] */ && arg1Value instanceof SLFunction) { SLFunction arg1Value_ = (SLFunction) arg1Value; return SLToTruffleStringNode.fromFunction(arg1Value_); } if ((state_0 & 0b110000000) != 0 /* is SpecializationActive[SLToTruffleStringNode.fromInterop(Object, InteropLibrary, FromLongNode, FromJavaStringNode)] || SpecializationActive[SLToTruffleStringNode.fromInterop(Object, InteropLibrary, FromLongNode, FromJavaStringNode)] */) { if ((state_0 & 0b10000000) != 0 /* is SpecializationActive[SLToTruffleStringNode.fromInterop(Object, InteropLibrary, FromLongNode, FromJavaStringNode)] */) { FromInterop0Data s7_ = this.fromInterop0_cache.get(arg0Value); while (s7_ != null) { { FromLongNode fromLong_1 = this.fromLong.get(arg0Value); if (fromLong_1 != null) { FromJavaStringNode fromJava_2 = this.fromJava.get(arg0Value); if (fromJava_2 != null) { if ((s7_.interop_.accepts(arg1Value))) { return SLToTruffleStringNode.fromInterop(arg1Value, s7_.interop_, fromLong_1, fromJava_2); } } } } s7_ = s7_.next_; } } if ((state_0 & 0b100000000) != 0 /* is SpecializationActive[SLToTruffleStringNode.fromInterop(Object, InteropLibrary, FromLongNode, FromJavaStringNode)] */) { { FromLongNode fromLong_1 = this.fromLong.get(arg0Value); if (fromLong_1 != null) { FromJavaStringNode fromJava_2 = this.fromJava.get(arg0Value); if (fromJava_2 != null) { return this.fromInterop1Boundary(state_0, arg0Value, arg1Value, fromLong_1, fromJava_2); } } } } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value); } @SuppressWarnings("static-method") @TruffleBoundary private TruffleString fromInterop1Boundary(int state_0, Node arg0Value, Object arg1Value, FromLongNode fromLong_1, FromJavaStringNode fromJava_2) { EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent(); Node prev_ = encapsulating_.set(arg0Value); try { { InteropLibrary interop__ = (INTEROP_LIBRARY_.getUncached(arg1Value)); return SLToTruffleStringNode.fromInterop(arg1Value, interop__, fromLong_1, fromJava_2); } } finally { encapsulating_.set(prev_); } } private TruffleString executeAndSpecialize(Node arg0Value, Object arg1Value) { int state_0 = this.state_0_.get(arg0Value); if (SLTypes.isSLNull(arg1Value)) { SLNull arg1Value_ = SLTypes.asSLNull(arg1Value); state_0 = state_0 | 0b1 /* add SpecializationActive[SLToTruffleStringNode.fromNull(SLNull)] */; this.state_0_.set(arg0Value, state_0); return SLToTruffleStringNode.fromNull(arg1Value_); } if (arg1Value instanceof String) { String arg1Value_ = (String) arg1Value; FromJavaStringNode fromJava_; FromJavaStringNode fromJava__shared = this.fromJava.get(arg0Value); if (fromJava__shared != null) { fromJava_ = fromJava__shared; } else { fromJava_ = arg0Value.insert((FromJavaStringNode.create())); if (fromJava_ == null) { throw new IllegalStateException("A specialization returned a default value for a cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state."); } } if (this.fromJava.get(arg0Value) == null) { VarHandle.storeStoreFence(); this.fromJava.set(arg0Value, fromJava_); } state_0 = state_0 | 0b10 /* add SpecializationActive[SLToTruffleStringNode.fromString(String, FromJavaStringNode)] */; this.state_0_.set(arg0Value, state_0); return SLToTruffleStringNode.fromString(arg1Value_, fromJava_); } if (arg1Value instanceof TruffleString) { TruffleString arg1Value_ = (TruffleString) arg1Value; state_0 = state_0 | 0b100 /* add SpecializationActive[SLToTruffleStringNode.fromTruffleString(TruffleString)] */; this.state_0_.set(arg0Value, state_0); return SLToTruffleStringNode.fromTruffleString(arg1Value_); } if (arg1Value instanceof Boolean) { boolean arg1Value_ = (boolean) arg1Value; state_0 = state_0 | 0b1000 /* add SpecializationActive[SLToTruffleStringNode.fromBoolean(boolean)] */; this.state_0_.set(arg0Value, state_0); return SLToTruffleStringNode.fromBoolean(arg1Value_); } if (arg1Value instanceof Long) { long arg1Value_ = (long) arg1Value; FromLongNode fromLong_; FromLongNode fromLong__shared = this.fromLong.get(arg0Value); if (fromLong__shared != null) { fromLong_ = fromLong__shared; } else { fromLong_ = arg0Value.insert((FromLongNode.create())); if (fromLong_ == null) { throw new IllegalStateException("A specialization returned a default value for a cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state."); } } if (this.fromLong.get(arg0Value) == null) { VarHandle.storeStoreFence(); this.fromLong.set(arg0Value, fromLong_); } state_0 = state_0 | 0b10000 /* add SpecializationActive[SLToTruffleStringNode.fromLong(long, FromLongNode)] */; this.state_0_.set(arg0Value, state_0); return SLToTruffleStringNode.fromLong(arg1Value_, fromLong_); } { int sLBigIntegerCast1; if ((sLBigIntegerCast1 = SLTypesGen.specializeImplicitSLBigInteger(arg1Value)) != 0) { SLBigInteger arg1Value_ = SLTypesGen.asImplicitSLBigInteger(sLBigIntegerCast1, arg1Value); FromJavaStringNode fromJava_1; FromJavaStringNode fromJava_1_shared = this.fromJava.get(arg0Value); if (fromJava_1_shared != null) { fromJava_1 = fromJava_1_shared; } else { fromJava_1 = arg0Value.insert((FromJavaStringNode.create())); if (fromJava_1 == null) { throw new IllegalStateException("A specialization returned a default value for a cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state."); } } if (this.fromJava.get(arg0Value) == null) { VarHandle.storeStoreFence(); this.fromJava.set(arg0Value, fromJava_1); } state_0 = (state_0 | (sLBigIntegerCast1 << 9) /* set-int ImplicitCast[type=SLBigInteger, index=1] */); state_0 = state_0 | 0b100000 /* add SpecializationActive[SLToTruffleStringNode.fromBigNumber(SLBigInteger, FromJavaStringNode)] */; this.state_0_.set(arg0Value, state_0); return SLToTruffleStringNode.fromBigNumber(arg1Value_, fromJava_1); } } if (arg1Value instanceof SLFunction) { SLFunction arg1Value_ = (SLFunction) arg1Value; state_0 = state_0 | 0b1000000 /* add SpecializationActive[SLToTruffleStringNode.fromFunction(SLFunction)] */; this.state_0_.set(arg0Value, state_0); return SLToTruffleStringNode.fromFunction(arg1Value_); } if (((state_0 & 0b100000000)) == 0 /* is-not SpecializationActive[SLToTruffleStringNode.fromInterop(Object, InteropLibrary, FromLongNode, FromJavaStringNode)] */) { while (true) { int count7_ = 0; FromInterop0Data s7_ = this.fromInterop0_cache.getVolatile(arg0Value); FromInterop0Data s7_original = s7_; while (s7_ != null) { { FromLongNode fromLong_1 = this.fromLong.get(arg0Value); if (fromLong_1 != null) { FromJavaStringNode fromJava_2 = this.fromJava.get(arg0Value); if (fromJava_2 != null) { if ((s7_.interop_.accepts(arg1Value))) { break; } } } } count7_++; s7_ = s7_.next_; } if (s7_ == null) { // assert (s7_.interop_.accepts(arg1Value)); if (count7_ < (SLToTruffleStringNode.LIMIT)) { s7_ = arg0Value.insert(new FromInterop0Data(s7_original)); InteropLibrary interop__ = s7_.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."); s7_.interop_ = interop__; FromLongNode fromLong_1; FromLongNode fromLong_1_shared = this.fromLong.get(arg0Value); if (fromLong_1_shared != null) { fromLong_1 = fromLong_1_shared; } else { fromLong_1 = s7_.insert((FromLongNode.create())); if (fromLong_1 == null) { throw new IllegalStateException("A specialization returned a default value for a cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state."); } } if (this.fromLong.get(arg0Value) == null) { this.fromLong.set(arg0Value, fromLong_1); } FromJavaStringNode fromJava_2; FromJavaStringNode fromJava_2_shared = this.fromJava.get(arg0Value); if (fromJava_2_shared != null) { fromJava_2 = fromJava_2_shared; } else { fromJava_2 = s7_.insert((FromJavaStringNode.create())); if (fromJava_2 == null) { throw new IllegalStateException("A specialization returned a default value for a cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state."); } } if (this.fromJava.get(arg0Value) == null) { this.fromJava.set(arg0Value, fromJava_2); } if (!this.fromInterop0_cache.compareAndSet(arg0Value, s7_original, s7_)) { continue; } state_0 = state_0 | 0b10000000 /* add SpecializationActive[SLToTruffleStringNode.fromInterop(Object, InteropLibrary, FromLongNode, FromJavaStringNode)] */; this.state_0_.set(arg0Value, state_0); } } if (s7_ != null) { return SLToTruffleStringNode.fromInterop(arg1Value, s7_.interop_, this.fromLong.get(arg0Value), this.fromJava.get(arg0Value)); } break; } } { InteropLibrary interop__ = null; { EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent(); Node prev_ = encapsulating_.set(arg0Value); try { interop__ = (INTEROP_LIBRARY_.getUncached(arg1Value)); FromLongNode fromLong_1; FromLongNode fromLong_1_shared = this.fromLong.get(arg0Value); if (fromLong_1_shared != null) { fromLong_1 = fromLong_1_shared; } else { fromLong_1 = arg0Value.insert((FromLongNode.create())); if (fromLong_1 == null) { throw new IllegalStateException("A specialization returned a default value for a cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state."); } } if (this.fromLong.get(arg0Value) == null) { VarHandle.storeStoreFence(); this.fromLong.set(arg0Value, fromLong_1); } FromJavaStringNode fromJava_2; FromJavaStringNode fromJava_2_shared = this.fromJava.get(arg0Value); if (fromJava_2_shared != null) { fromJava_2 = fromJava_2_shared; } else { fromJava_2 = arg0Value.insert((FromJavaStringNode.create())); if (fromJava_2 == null) { throw new IllegalStateException("A specialization returned a default value for a cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state."); } } if (this.fromJava.get(arg0Value) == null) { VarHandle.storeStoreFence(); this.fromJava.set(arg0Value, fromJava_2); } this.fromInterop0_cache.set(arg0Value, null); state_0 = state_0 & 0xffffff7f /* remove SpecializationActive[SLToTruffleStringNode.fromInterop(Object, InteropLibrary, FromLongNode, FromJavaStringNode)] */; state_0 = state_0 | 0b100000000 /* add SpecializationActive[SLToTruffleStringNode.fromInterop(Object, InteropLibrary, FromLongNode, FromJavaStringNode)] */; this.state_0_.set(arg0Value, state_0); return SLToTruffleStringNode.fromInterop(arg1Value, interop__, fromLong_1, fromJava_2); } finally { encapsulating_.set(prev_); } } } } } @GeneratedBy(SLToTruffleStringNode.class) @DenyReplace private static final class FromInterop0Data extends Node implements SpecializationDataNode { @Child FromInterop0Data next_; /** * Source Info:
         *   Specialization: {@link SLToTruffleStringNode#fromInterop}
         *   Parameter: {@link InteropLibrary} interop
*/ @Child InteropLibrary interop_; FromInterop0Data(FromInterop0Data next_) { this.next_ = next_; } } @GeneratedBy(SLToTruffleStringNode.class) @DenyReplace private static final class Uncached extends SLToTruffleStringNode implements UnadoptableNode { @TruffleBoundary @Override public TruffleString execute(Node arg0Value, Object arg1Value) { if (SLTypes.isSLNull(arg1Value)) { SLNull arg1Value_ = SLTypes.asSLNull(arg1Value); return SLToTruffleStringNode.fromNull(arg1Value_); } if (arg1Value instanceof String) { String arg1Value_ = (String) arg1Value; return SLToTruffleStringNode.fromString(arg1Value_, (FromJavaStringNode.getUncached())); } if (arg1Value instanceof TruffleString) { TruffleString arg1Value_ = (TruffleString) arg1Value; return SLToTruffleStringNode.fromTruffleString(arg1Value_); } if (arg1Value instanceof Boolean) { boolean arg1Value_ = (boolean) arg1Value; return SLToTruffleStringNode.fromBoolean(arg1Value_); } if (arg1Value instanceof Long) { long arg1Value_ = (long) arg1Value; return SLToTruffleStringNode.fromLong(arg1Value_, (FromLongNode.getUncached())); } if (SLTypesGen.isImplicitSLBigInteger(arg1Value)) { SLBigInteger arg1Value_ = SLTypesGen.asImplicitSLBigInteger(arg1Value); return SLToTruffleStringNode.fromBigNumber(arg1Value_, (FromJavaStringNode.getUncached())); } if (arg1Value instanceof SLFunction) { SLFunction arg1Value_ = (SLFunction) arg1Value; return SLToTruffleStringNode.fromFunction(arg1Value_); } return SLToTruffleStringNode.fromInterop(arg1Value, (INTEROP_LIBRARY_.getUncached(arg1Value)), (FromLongNode.getUncached()), (FromJavaStringNode.getUncached())); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy