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

org.truffleruby.cext.WrapNodeGen Maven / Gradle / Ivy

The newest version!
// CheckStyle: start generated
package org.truffleruby.cext;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
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.UnsupportedSpecializationException;
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.StateField;
import com.oracle.truffle.api.dsl.InlineSupport.UnsafeAccessedField;
import com.oracle.truffle.api.library.LibraryFactory;
import com.oracle.truffle.api.nodes.DenyReplace;
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.object.DynamicObjectLibrary;
import com.oracle.truffle.api.profiles.InlinedBranchProfile;
import com.oracle.truffle.api.strings.TruffleString.FromJavaStringNode;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.util.Objects;
import org.truffleruby.language.ImmutableRubyObject;
import org.truffleruby.language.Nil;
import org.truffleruby.language.NotProvided;
import org.truffleruby.language.RubyDynamicObject;
import org.truffleruby.language.RubyGuards;
import org.truffleruby.language.RubyTypes;
import org.truffleruby.language.RubyTypesGen;
import org.truffleruby.language.objects.ObjectIDOperations;

/**
 * Debug Info: 
 *   Specialization {@link WrapNode#wrapFixnum}
 *     Activation probability: 0.15909
 *     With/without class size: 5/0 bytes
 *   Specialization {@link WrapNode#wrapNonFixnum}
 *     Activation probability: 0.14545
 *     With/without class size: 5/0 bytes
 *   Specialization {@link WrapNode#wrapDouble}
 *     Activation probability: 0.13182
 *     With/without class size: 5/0 bytes
 *   Specialization {@link WrapNode#wrapBoolean}
 *     Activation probability: 0.11818
 *     With/without class size: 5/0 bytes
 *   Specialization {@link WrapNode#wrapUndef}
 *     Activation probability: 0.10455
 *     With/without class size: 5/0 bytes
 *   Specialization {@link WrapNode#wrapWrappedValue}
 *     Activation probability: 0.09091
 *     With/without class size: 5/4 bytes
 *   Specialization {@link WrapNode#wrapNil}
 *     Activation probability: 0.07727
 *     With/without class size: 4/0 bytes
 *   Specialization {@link WrapNode#wrapImmutable}
 *     Activation probability: 0.06364
 *     With/without class size: 5/0 bytes
 *   Specialization {@link WrapNode#wrapValue}
 *     Activation probability: 0.05000
 *     With/without class size: 5/4 bytes
 *   Specialization {@link WrapNode#wrapValue}
 *     Activation probability: 0.03636
 *     With/without class size: 4/0 bytes
 *   Specialization {@link WrapNode#wrapNonRubyObject}
 *     Activation probability: 0.02273
 *     With/without class size: 4/0 bytes
 * 
*/ @GeneratedBy(WrapNode.class) @SuppressWarnings({"javadoc", "unused"}) public final class WrapNodeGen extends WrapNode { private static final StateField STATE_0_UPDATER = StateField.create(MethodHandles.lookup(), "state_0_"); static final ReferenceField WRAP_VALUE0_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "wrapValue0_cache", WrapValue0Data.class); /** * Source Info:
     *   Specialization: {@link WrapNode#wrapImmutable}
     *   Parameter: {@link InlinedBranchProfile} noHandleProfile
     *   Inline method: {@link InlinedBranchProfile#inline}
*/ private static final InlinedBranchProfile INLINED_NO_HANDLE_PROFILE = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, STATE_0_UPDATER.subUpdater(13, 1))); private static final Uncached UNCACHED = new Uncached(); private static final LibraryFactory DYNAMIC_OBJECT_LIBRARY_ = LibraryFactory.resolve(DynamicObjectLibrary.class); /** * State Info:
     *   0: SpecializationActive {@link WrapNode#wrapFixnum}
     *   1: SpecializationActive {@link WrapNode#wrapNonFixnum}
     *   2: SpecializationActive {@link WrapNode#wrapDouble}
     *   3: SpecializationActive {@link WrapNode#wrapBoolean}
     *   4: SpecializationActive {@link WrapNode#wrapUndef}
     *   5: SpecializationActive {@link WrapNode#wrapWrappedValue}
     *   6: SpecializationActive {@link WrapNode#wrapNil}
     *   7: SpecializationActive {@link WrapNode#wrapImmutable}
     *   8: SpecializationActive {@link WrapNode#wrapValue}
     *   9: SpecializationActive {@link WrapNode#wrapValue}
     *   10: SpecializationActive {@link WrapNode#wrapNonRubyObject}
     *   11-12: ImplicitCast[type=long, index=0]
     *   13: InlinedCache
     *        Specialization: {@link WrapNode#wrapImmutable}
     *        Parameter: {@link InlinedBranchProfile} noHandleProfile
     *        Inline method: {@link InlinedBranchProfile#inline}
     * 
*/ @CompilationFinal @UnsafeAccessedField private int state_0_; /** * Source Info:
     *   Specialization: {@link WrapNode#wrapWrappedValue}
     *   Parameter: {@link FromJavaStringNode} fromJavaStringNode
*/ @Child private FromJavaStringNode wrapWrappedValue_fromJavaStringNode_; @UnsafeAccessedField @Child private WrapValue0Data wrapValue0_cache; private WrapNodeGen() { } @ExplodeLoop @Override public ValueWrapper execute(Object arg0Value) { int state_0 = this.state_0_; if ((state_0 & 0b11111111111) != 0 /* is SpecializationActive[WrapNode.wrapFixnum(long)] || SpecializationActive[WrapNode.wrapNonFixnum(long)] || SpecializationActive[WrapNode.wrapDouble(double)] || SpecializationActive[WrapNode.wrapBoolean(boolean)] || SpecializationActive[WrapNode.wrapUndef(NotProvided)] || SpecializationActive[WrapNode.wrapWrappedValue(ValueWrapper, FromJavaStringNode)] || SpecializationActive[WrapNode.wrapNil(Nil)] || SpecializationActive[WrapNode.wrapImmutable(ImmutableRubyObject, InlinedBranchProfile)] || SpecializationActive[WrapNode.wrapValue(RubyDynamicObject, DynamicObjectLibrary, InlinedBranchProfile, Node)] || SpecializationActive[WrapNode.wrapValue(RubyDynamicObject, DynamicObjectLibrary, InlinedBranchProfile, Node)] || SpecializationActive[WrapNode.wrapNonRubyObject(Object)] */) { if ((state_0 & 0b11) != 0 /* is SpecializationActive[WrapNode.wrapFixnum(long)] || SpecializationActive[WrapNode.wrapNonFixnum(long)] */ && RubyTypesGen.isImplicitLong((state_0 & 0b1100000000000) >>> 11 /* get-int ImplicitCast[type=long, index=0] */, arg0Value)) { long arg0Value_ = RubyTypesGen.asImplicitLong((state_0 & 0b1100000000000) >>> 11 /* get-int ImplicitCast[type=long, index=0] */, arg0Value); if ((state_0 & 0b1) != 0 /* is SpecializationActive[WrapNode.wrapFixnum(long)] */) { if ((ObjectIDOperations.isSmallFixnum(arg0Value_))) { return wrapFixnum(arg0Value_); } } if ((state_0 & 0b10) != 0 /* is SpecializationActive[WrapNode.wrapNonFixnum(long)] */) { if ((!(ObjectIDOperations.isSmallFixnum(arg0Value_)))) { return wrapNonFixnum(arg0Value_); } } } if ((state_0 & 0b100) != 0 /* is SpecializationActive[WrapNode.wrapDouble(double)] */ && arg0Value instanceof Double) { double arg0Value_ = (double) arg0Value; return wrapDouble(arg0Value_); } if ((state_0 & 0b1000) != 0 /* is SpecializationActive[WrapNode.wrapBoolean(boolean)] */ && arg0Value instanceof Boolean) { boolean arg0Value_ = (boolean) arg0Value; return wrapBoolean(arg0Value_); } if ((state_0 & 0b10000) != 0 /* is SpecializationActive[WrapNode.wrapUndef(NotProvided)] */ && RubyTypes.isNotProvided(arg0Value)) { NotProvided arg0Value_ = RubyTypes.asNotProvided(arg0Value); return wrapUndef(arg0Value_); } if ((state_0 & 0b100000) != 0 /* is SpecializationActive[WrapNode.wrapWrappedValue(ValueWrapper, FromJavaStringNode)] */ && arg0Value instanceof ValueWrapper) { ValueWrapper arg0Value_ = (ValueWrapper) arg0Value; { FromJavaStringNode fromJavaStringNode__ = this.wrapWrappedValue_fromJavaStringNode_; if (fromJavaStringNode__ != null) { return wrapWrappedValue(arg0Value_, fromJavaStringNode__); } } } if ((state_0 & 0b1000000) != 0 /* is SpecializationActive[WrapNode.wrapNil(Nil)] */ && RubyTypes.isNil(arg0Value)) { Nil arg0Value_ = RubyTypes.asNil(arg0Value); return wrapNil(arg0Value_); } if ((state_0 & 0b10000000) != 0 /* is SpecializationActive[WrapNode.wrapImmutable(ImmutableRubyObject, InlinedBranchProfile)] */ && arg0Value instanceof ImmutableRubyObject) { ImmutableRubyObject arg0Value_ = (ImmutableRubyObject) arg0Value; if ((!(RubyGuards.isNil(arg0Value_)))) { return wrapImmutable(arg0Value_, INLINED_NO_HANDLE_PROFILE); } } if ((state_0 & 0b1100000000) != 0 /* is SpecializationActive[WrapNode.wrapValue(RubyDynamicObject, DynamicObjectLibrary, InlinedBranchProfile, Node)] || SpecializationActive[WrapNode.wrapValue(RubyDynamicObject, DynamicObjectLibrary, InlinedBranchProfile, Node)] */ && arg0Value instanceof RubyDynamicObject) { RubyDynamicObject arg0Value_ = (RubyDynamicObject) arg0Value; if ((state_0 & 0b100000000) != 0 /* is SpecializationActive[WrapNode.wrapValue(RubyDynamicObject, DynamicObjectLibrary, InlinedBranchProfile, Node)] */) { WrapValue0Data s8_ = this.wrapValue0_cache; while (s8_ != null) { if ((s8_.objectLibrary_.accepts(arg0Value_))) { Node node__ = (this); return WrapNode.wrapValue(arg0Value_, s8_.objectLibrary_, INLINED_NO_HANDLE_PROFILE, node__); } s8_ = s8_.next_; } } if ((state_0 & 0b1000000000) != 0 /* is SpecializationActive[WrapNode.wrapValue(RubyDynamicObject, DynamicObjectLibrary, InlinedBranchProfile, Node)] */) { return this.wrapValue1Boundary(state_0, arg0Value_); } } if ((state_0 & 0b10000000000) != 0 /* is SpecializationActive[WrapNode.wrapNonRubyObject(Object)] */) { if ((RubyGuards.isForeignObject(arg0Value))) { return wrapNonRubyObject(arg0Value); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value); } @SuppressWarnings("static-method") @TruffleBoundary private ValueWrapper wrapValue1Boundary(int state_0, RubyDynamicObject arg0Value_) { { DynamicObjectLibrary objectLibrary__ = (DYNAMIC_OBJECT_LIBRARY_.getUncached(arg0Value_)); Node node__ = (this); return WrapNode.wrapValue(arg0Value_, objectLibrary__, INLINED_NO_HANDLE_PROFILE, node__); } } private ValueWrapper executeAndSpecialize(Object arg0Value) { int state_0 = this.state_0_; { int longCast0; if ((longCast0 = RubyTypesGen.specializeImplicitLong(arg0Value)) != 0) { long arg0Value_ = RubyTypesGen.asImplicitLong(longCast0, arg0Value); if ((ObjectIDOperations.isSmallFixnum(arg0Value_))) { state_0 = (state_0 | (longCast0 << 11) /* set-int ImplicitCast[type=long, index=0] */); state_0 = state_0 | 0b1 /* add SpecializationActive[WrapNode.wrapFixnum(long)] */; this.state_0_ = state_0; return wrapFixnum(arg0Value_); } if ((!(ObjectIDOperations.isSmallFixnum(arg0Value_)))) { state_0 = (state_0 | (longCast0 << 11) /* set-int ImplicitCast[type=long, index=0] */); state_0 = state_0 | 0b10 /* add SpecializationActive[WrapNode.wrapNonFixnum(long)] */; this.state_0_ = state_0; return wrapNonFixnum(arg0Value_); } } } if (arg0Value instanceof Double) { double arg0Value_ = (double) arg0Value; state_0 = state_0 | 0b100 /* add SpecializationActive[WrapNode.wrapDouble(double)] */; this.state_0_ = state_0; return wrapDouble(arg0Value_); } if (arg0Value instanceof Boolean) { boolean arg0Value_ = (boolean) arg0Value; state_0 = state_0 | 0b1000 /* add SpecializationActive[WrapNode.wrapBoolean(boolean)] */; this.state_0_ = state_0; return wrapBoolean(arg0Value_); } if (RubyTypes.isNotProvided(arg0Value)) { NotProvided arg0Value_ = RubyTypes.asNotProvided(arg0Value); state_0 = state_0 | 0b10000 /* add SpecializationActive[WrapNode.wrapUndef(NotProvided)] */; this.state_0_ = state_0; return wrapUndef(arg0Value_); } if (arg0Value instanceof ValueWrapper) { ValueWrapper arg0Value_ = (ValueWrapper) arg0Value; FromJavaStringNode fromJavaStringNode__ = this.insert((FromJavaStringNode.create())); Objects.requireNonNull(fromJavaStringNode__, "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.wrapWrappedValue_fromJavaStringNode_ = fromJavaStringNode__; state_0 = state_0 | 0b100000 /* add SpecializationActive[WrapNode.wrapWrappedValue(ValueWrapper, FromJavaStringNode)] */; this.state_0_ = state_0; return wrapWrappedValue(arg0Value_, fromJavaStringNode__); } if (RubyTypes.isNil(arg0Value)) { Nil arg0Value_ = RubyTypes.asNil(arg0Value); state_0 = state_0 | 0b1000000 /* add SpecializationActive[WrapNode.wrapNil(Nil)] */; this.state_0_ = state_0; return wrapNil(arg0Value_); } if (arg0Value instanceof ImmutableRubyObject) { ImmutableRubyObject arg0Value_ = (ImmutableRubyObject) arg0Value; if ((!(RubyGuards.isNil(arg0Value_)))) { state_0 = state_0 | 0b10000000 /* add SpecializationActive[WrapNode.wrapImmutable(ImmutableRubyObject, InlinedBranchProfile)] */; this.state_0_ = state_0; return wrapImmutable(arg0Value_, INLINED_NO_HANDLE_PROFILE); } } if (arg0Value instanceof RubyDynamicObject) { RubyDynamicObject arg0Value_ = (RubyDynamicObject) arg0Value; { Node node__ = null; if (((state_0 & 0b1000000000)) == 0 /* is-not SpecializationActive[WrapNode.wrapValue(RubyDynamicObject, DynamicObjectLibrary, InlinedBranchProfile, Node)] */) { while (true) { int count8_ = 0; WrapValue0Data s8_ = WRAP_VALUE0_CACHE_UPDATER.getVolatile(this); WrapValue0Data s8_original = s8_; while (s8_ != null) { if ((s8_.objectLibrary_.accepts(arg0Value_))) { node__ = (this); break; } count8_++; s8_ = s8_.next_; } if (s8_ == null) { // assert (s8_.objectLibrary_.accepts(arg0Value_)); if (count8_ < (getDynamicObjectCacheLimit())) { s8_ = this.insert(new WrapValue0Data(s8_original)); DynamicObjectLibrary objectLibrary__ = s8_.insert((DYNAMIC_OBJECT_LIBRARY_.create(arg0Value_))); Objects.requireNonNull(objectLibrary__, "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."); s8_.objectLibrary_ = objectLibrary__; node__ = (this); if (!WRAP_VALUE0_CACHE_UPDATER.compareAndSet(this, s8_original, s8_)) { continue; } state_0 = state_0 | 0b100000000 /* add SpecializationActive[WrapNode.wrapValue(RubyDynamicObject, DynamicObjectLibrary, InlinedBranchProfile, Node)] */; this.state_0_ = state_0; } } if (s8_ != null) { return WrapNode.wrapValue(arg0Value_, s8_.objectLibrary_, INLINED_NO_HANDLE_PROFILE, node__); } break; } } } { Node node__ = null; DynamicObjectLibrary objectLibrary__ = null; objectLibrary__ = (DYNAMIC_OBJECT_LIBRARY_.getUncached(arg0Value_)); node__ = (this); this.wrapValue0_cache = null; state_0 = state_0 & 0xfffffeff /* remove SpecializationActive[WrapNode.wrapValue(RubyDynamicObject, DynamicObjectLibrary, InlinedBranchProfile, Node)] */; state_0 = state_0 | 0b1000000000 /* add SpecializationActive[WrapNode.wrapValue(RubyDynamicObject, DynamicObjectLibrary, InlinedBranchProfile, Node)] */; this.state_0_ = state_0; return WrapNode.wrapValue(arg0Value_, objectLibrary__, INLINED_NO_HANDLE_PROFILE, node__); } } if ((RubyGuards.isForeignObject(arg0Value))) { state_0 = state_0 | 0b10000000000 /* add SpecializationActive[WrapNode.wrapNonRubyObject(Object)] */; this.state_0_ = state_0; return wrapNonRubyObject(arg0Value); } throw new UnsupportedSpecializationException(this, null, arg0Value); } @TruffleBoundary private static UnsupportedSpecializationException newUnsupportedSpecializationException1(Node thisNode_, Object arg0Value) { return new UnsupportedSpecializationException(thisNode_, null, arg0Value); } @NeverDefault public static WrapNode create() { return new WrapNodeGen(); } @NeverDefault public static WrapNode getUncached() { return WrapNodeGen.UNCACHED; } @GeneratedBy(WrapNode.class) @DenyReplace private static final class WrapValue0Data extends Node implements SpecializationDataNode { @Child WrapValue0Data next_; /** * Source Info:
         *   Specialization: {@link WrapNode#wrapValue}
         *   Parameter: {@link DynamicObjectLibrary} objectLibrary
*/ @Child DynamicObjectLibrary objectLibrary_; WrapValue0Data(WrapValue0Data next_) { this.next_ = next_; } } @GeneratedBy(WrapNode.class) @DenyReplace private static final class Uncached extends WrapNode implements UnadoptableNode { @TruffleBoundary @Override public ValueWrapper execute(Object arg0Value) { if (RubyTypesGen.isImplicitLong(arg0Value)) { long arg0Value_ = RubyTypesGen.asImplicitLong(arg0Value); if ((ObjectIDOperations.isSmallFixnum(arg0Value_))) { return wrapFixnum(arg0Value_); } if ((!(ObjectIDOperations.isSmallFixnum(arg0Value_)))) { return wrapNonFixnum(arg0Value_); } } if (arg0Value instanceof Double) { double arg0Value_ = (double) arg0Value; return wrapDouble(arg0Value_); } if (arg0Value instanceof Boolean) { boolean arg0Value_ = (boolean) arg0Value; return wrapBoolean(arg0Value_); } if (RubyTypes.isNotProvided(arg0Value)) { NotProvided arg0Value_ = RubyTypes.asNotProvided(arg0Value); return wrapUndef(arg0Value_); } if (arg0Value instanceof ValueWrapper) { ValueWrapper arg0Value_ = (ValueWrapper) arg0Value; return wrapWrappedValue(arg0Value_, (FromJavaStringNode.getUncached())); } if (RubyTypes.isNil(arg0Value)) { Nil arg0Value_ = RubyTypes.asNil(arg0Value); return wrapNil(arg0Value_); } if (arg0Value instanceof ImmutableRubyObject) { ImmutableRubyObject arg0Value_ = (ImmutableRubyObject) arg0Value; if ((!(RubyGuards.isNil(arg0Value_)))) { return wrapImmutable(arg0Value_, (InlinedBranchProfile.getUncached())); } } if (arg0Value instanceof RubyDynamicObject) { RubyDynamicObject arg0Value_ = (RubyDynamicObject) arg0Value; return WrapNode.wrapValue(arg0Value_, (DYNAMIC_OBJECT_LIBRARY_.getUncached(arg0Value_)), (InlinedBranchProfile.getUncached()), (this)); } if ((RubyGuards.isForeignObject(arg0Value))) { return wrapNonRubyObject(arg0Value); } throw newUnsupportedSpecializationException1(this, arg0Value); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy