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

com.oracle.truffle.js.builtins.PolyglotBuiltinsFactory Maven / Gradle / Ivy

// CheckStyle: start generated
package com.oracle.truffle.js.builtins;

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.NeverDefault;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
import com.oracle.truffle.api.dsl.DSLSupport.SpecializationDataNode;
import com.oracle.truffle.api.dsl.InlineSupport.ReferenceField;
import com.oracle.truffle.api.dsl.InlineSupport.UnsafeAccessedField;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.InteropLibrary;
import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.api.library.LibraryFactory;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.IndirectCallNode;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.strings.TruffleString;
import com.oracle.truffle.api.strings.TruffleString.EqualNode;
import com.oracle.truffle.api.strings.TruffleString.SwitchEncodingNode;
import com.oracle.truffle.api.strings.TruffleString.ToJavaStringNode;
import com.oracle.truffle.js.builtins.PolyglotBuiltins.PolyglotEvalFileNode;
import com.oracle.truffle.js.builtins.PolyglotBuiltins.PolyglotEvalNode;
import com.oracle.truffle.js.builtins.PolyglotBuiltins.PolyglotExportNode;
import com.oracle.truffle.js.builtins.PolyglotBuiltins.PolyglotImportNode;
import com.oracle.truffle.js.nodes.JSGuards;
import com.oracle.truffle.js.nodes.JavaScriptNode;
import com.oracle.truffle.js.nodes.function.JSBuiltin;
import com.oracle.truffle.js.nodes.interop.ImportValueNode;
import com.oracle.truffle.js.runtime.JSConfig;
import com.oracle.truffle.js.runtime.JSContext;
import com.oracle.truffle.js.runtime.Strings;
import com.oracle.truffle.js.runtime.util.Pair;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.util.Objects;

@GeneratedBy(PolyglotBuiltins.class)
@SuppressWarnings("javadoc")
public final class PolyglotBuiltinsFactory {

    private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);

    /**
     * Debug Info: 
     *   Specialization {@link PolyglotExportNode#doString}
     *     Activation probability: 0.48333
     *     With/without class size: 9/0 bytes
     *   Specialization {@link PolyglotExportNode#doMaybeUnbox}
     *     Activation probability: 0.33333
     *     With/without class size: 10/4 bytes
     *   Specialization {@link PolyglotExportNode#doInvalid}
     *     Activation probability: 0.18333
     *     With/without class size: 6/0 bytes
     * 
*/ @GeneratedBy(PolyglotExportNode.class) @SuppressWarnings("javadoc") static final class PolyglotExportNodeGen extends PolyglotExportNode { @Child private JavaScriptNode arguments0_; @Child private JavaScriptNode arguments1_; /** * State Info:
         *   0: SpecializationActive {@link PolyglotExportNode#doString}
         *   1: SpecializationActive {@link PolyglotExportNode#doMaybeUnbox}
         *   2: SpecializationActive {@link PolyglotExportNode#doInvalid}
         * 
*/ @CompilationFinal private int state_0_; /** * Source Info:
         *   Specialization: {@link PolyglotExportNode#doString}
         *   Parameter: {@link InteropLibrary} interop
*/ @Child private InteropLibrary interop; /** * Source Info:
         *   Specialization: {@link PolyglotExportNode#doMaybeUnbox}
         *   Parameter: {@link SwitchEncodingNode} switchEncoding
*/ @Child private SwitchEncodingNode maybeUnbox_switchEncoding_; private PolyglotExportNodeGen(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) { super(context, builtin); this.arguments0_ = arguments != null && 0 < arguments.length ? arguments[0] : null; this.arguments1_ = arguments != null && 1 < arguments.length ? arguments[1] : null; } @Override public JavaScriptNode[] getArguments() { return new JavaScriptNode[] {this.arguments0_, this.arguments1_}; } @Override public Object execute(VirtualFrame frameValue) { int state_0 = this.state_0_; Object arguments0Value_ = this.arguments0_.execute(frameValue); Object arguments1Value_ = this.arguments1_.execute(frameValue); if (state_0 != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotExportNode.doString(TruffleString, Object, InteropLibrary)] || SpecializationActive[PolyglotBuiltins.PolyglotExportNode.doMaybeUnbox(TruffleObject, Object, InteropLibrary, SwitchEncodingNode)] || SpecializationActive[PolyglotBuiltins.PolyglotExportNode.doInvalid(Object, Object)] */) { if ((state_0 & 0b1) != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotExportNode.doString(TruffleString, Object, InteropLibrary)] */ && arguments0Value_ instanceof TruffleString) { TruffleString arguments0Value__ = (TruffleString) arguments0Value_; { InteropLibrary interop_ = this.interop; if (interop_ != null) { return doString(arguments0Value__, arguments1Value_, interop_); } } } if ((state_0 & 0b10) != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotExportNode.doMaybeUnbox(TruffleObject, Object, InteropLibrary, SwitchEncodingNode)] */ && arguments0Value_ instanceof TruffleObject) { TruffleObject arguments0Value__ = (TruffleObject) arguments0Value_; { InteropLibrary interop_1 = this.interop; if (interop_1 != null) { SwitchEncodingNode switchEncoding__ = this.maybeUnbox_switchEncoding_; if (switchEncoding__ != null) { if ((!(JSGuards.isString(arguments0Value__)))) { return doMaybeUnbox(arguments0Value__, arguments1Value_, interop_1, switchEncoding__); } } } } } if ((state_0 & 0b100) != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotExportNode.doInvalid(Object, Object)] */) { if ((!(JSGuards.isString(arguments0Value_)))) { return doInvalid(arguments0Value_, arguments1Value_); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arguments0Value_, arguments1Value_); } private Object executeAndSpecialize(Object arguments0Value, Object arguments1Value) { int state_0 = this.state_0_; if (arguments0Value instanceof TruffleString) { TruffleString arguments0Value_ = (TruffleString) arguments0Value; InteropLibrary interop_; InteropLibrary interop__shared = this.interop; if (interop__shared != null) { interop_ = interop__shared; } else { interop_ = this.insert((INTEROP_LIBRARY_.createDispatched(JSConfig.InteropLibraryLimit))); if (interop_ == 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.interop == null) { VarHandle.storeStoreFence(); this.interop = interop_; } state_0 = state_0 | 0b1 /* add SpecializationActive[PolyglotBuiltins.PolyglotExportNode.doString(TruffleString, Object, InteropLibrary)] */; this.state_0_ = state_0; return doString(arguments0Value_, arguments1Value, interop_); } if (arguments0Value instanceof TruffleObject) { TruffleObject arguments0Value_ = (TruffleObject) arguments0Value; if ((!(JSGuards.isString(arguments0Value_)))) { InteropLibrary interop_1; InteropLibrary interop_1_shared = this.interop; if (interop_1_shared != null) { interop_1 = interop_1_shared; } else { interop_1 = this.insert((INTEROP_LIBRARY_.createDispatched(JSConfig.InteropLibraryLimit))); if (interop_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.interop == null) { VarHandle.storeStoreFence(); this.interop = interop_1; } SwitchEncodingNode switchEncoding__ = this.insert((SwitchEncodingNode.create())); Objects.requireNonNull(switchEncoding__, "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.maybeUnbox_switchEncoding_ = switchEncoding__; state_0 = state_0 | 0b10 /* add SpecializationActive[PolyglotBuiltins.PolyglotExportNode.doMaybeUnbox(TruffleObject, Object, InteropLibrary, SwitchEncodingNode)] */; this.state_0_ = state_0; return doMaybeUnbox(arguments0Value_, arguments1Value, interop_1, switchEncoding__); } } if ((!(JSGuards.isString(arguments0Value)))) { state_0 = state_0 | 0b100 /* add SpecializationActive[PolyglotBuiltins.PolyglotExportNode.doInvalid(Object, Object)] */; this.state_0_ = state_0; return doInvalid(arguments0Value, arguments1Value); } throw new UnsupportedSpecializationException(this, new Node[] {this.arguments0_, this.arguments1_}, arguments0Value, arguments1Value); } @NeverDefault public static PolyglotExportNode create(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) { return new PolyglotExportNodeGen(context, builtin, arguments); } } /** * Debug Info:
     *   Specialization {@link PolyglotImportNode#doString}
     *     Activation probability: 0.48333
     *     With/without class size: 9/0 bytes
     *   Specialization {@link PolyglotImportNode#doMaybeUnbox}
     *     Activation probability: 0.33333
     *     With/without class size: 10/4 bytes
     *   Specialization {@link PolyglotImportNode#doInvalid}
     *     Activation probability: 0.18333
     *     With/without class size: 6/0 bytes
     * 
*/ @GeneratedBy(PolyglotImportNode.class) @SuppressWarnings("javadoc") static final class PolyglotImportNodeGen extends PolyglotImportNode { @Child private JavaScriptNode arguments0_; /** * State Info:
         *   0: SpecializationActive {@link PolyglotImportNode#doString}
         *   1: SpecializationActive {@link PolyglotImportNode#doMaybeUnbox}
         *   2: SpecializationActive {@link PolyglotImportNode#doInvalid}
         * 
*/ @CompilationFinal private int state_0_; /** * Source Info:
         *   Specialization: {@link PolyglotImportNode#doString}
         *   Parameter: {@link InteropLibrary} interop
*/ @Child private InteropLibrary interop; /** * Source Info:
         *   Specialization: {@link PolyglotImportNode#doString}
         *   Parameter: {@link ImportValueNode} importValueNode
*/ @Child private ImportValueNode importValueNode; /** * Source Info:
         *   Specialization: {@link PolyglotImportNode#doString}
         *   Parameter: {@link ToJavaStringNode} toJavaStringNode
*/ @Child private ToJavaStringNode toJavaStringNode; /** * Source Info:
         *   Specialization: {@link PolyglotImportNode#doMaybeUnbox}
         *   Parameter: {@link SwitchEncodingNode} switchEncoding
*/ @Child private SwitchEncodingNode maybeUnbox_switchEncoding_; private PolyglotImportNodeGen(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) { super(context, builtin); this.arguments0_ = arguments != null && 0 < arguments.length ? arguments[0] : null; } @Override public JavaScriptNode[] getArguments() { return new JavaScriptNode[] {this.arguments0_}; } @Override public Object execute(VirtualFrame frameValue) { int state_0 = this.state_0_; Object arguments0Value_ = this.arguments0_.execute(frameValue); if (state_0 != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotImportNode.doString(TruffleString, InteropLibrary, ImportValueNode, ToJavaStringNode)] || SpecializationActive[PolyglotBuiltins.PolyglotImportNode.doMaybeUnbox(TruffleObject, InteropLibrary, ImportValueNode, ToJavaStringNode, SwitchEncodingNode)] || SpecializationActive[PolyglotBuiltins.PolyglotImportNode.doInvalid(Object)] */) { if ((state_0 & 0b1) != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotImportNode.doString(TruffleString, InteropLibrary, ImportValueNode, ToJavaStringNode)] */ && arguments0Value_ instanceof TruffleString) { TruffleString arguments0Value__ = (TruffleString) arguments0Value_; { InteropLibrary interop_ = this.interop; if (interop_ != null) { ImportValueNode importValueNode_ = this.importValueNode; if (importValueNode_ != null) { ToJavaStringNode toJavaStringNode_ = this.toJavaStringNode; if (toJavaStringNode_ != null) { return doString(arguments0Value__, interop_, importValueNode_, toJavaStringNode_); } } } } } if ((state_0 & 0b10) != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotImportNode.doMaybeUnbox(TruffleObject, InteropLibrary, ImportValueNode, ToJavaStringNode, SwitchEncodingNode)] */ && arguments0Value_ instanceof TruffleObject) { TruffleObject arguments0Value__ = (TruffleObject) arguments0Value_; { InteropLibrary interop_1 = this.interop; if (interop_1 != null) { ImportValueNode importValueNode_1 = this.importValueNode; if (importValueNode_1 != null) { ToJavaStringNode toJavaStringNode_1 = this.toJavaStringNode; if (toJavaStringNode_1 != null) { SwitchEncodingNode switchEncoding__ = this.maybeUnbox_switchEncoding_; if (switchEncoding__ != null) { if ((!(JSGuards.isString(arguments0Value__)))) { return doMaybeUnbox(arguments0Value__, interop_1, importValueNode_1, toJavaStringNode_1, switchEncoding__); } } } } } } } if ((state_0 & 0b100) != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotImportNode.doInvalid(Object)] */) { if ((!(JSGuards.isString(arguments0Value_))) && (!(JSGuards.isTruffleObject(arguments0Value_)))) { return doInvalid(arguments0Value_); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arguments0Value_); } private Object executeAndSpecialize(Object arguments0Value) { int state_0 = this.state_0_; if (arguments0Value instanceof TruffleString) { TruffleString arguments0Value_ = (TruffleString) arguments0Value; InteropLibrary interop_; InteropLibrary interop__shared = this.interop; if (interop__shared != null) { interop_ = interop__shared; } else { interop_ = this.insert((INTEROP_LIBRARY_.createDispatched(JSConfig.InteropLibraryLimit))); if (interop_ == 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.interop == null) { VarHandle.storeStoreFence(); this.interop = interop_; } ImportValueNode importValueNode_; ImportValueNode importValueNode__shared = this.importValueNode; if (importValueNode__shared != null) { importValueNode_ = importValueNode__shared; } else { importValueNode_ = this.insert((ImportValueNode.create())); if (importValueNode_ == 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.importValueNode == null) { VarHandle.storeStoreFence(); this.importValueNode = importValueNode_; } ToJavaStringNode toJavaStringNode_; ToJavaStringNode toJavaStringNode__shared = this.toJavaStringNode; if (toJavaStringNode__shared != null) { toJavaStringNode_ = toJavaStringNode__shared; } else { toJavaStringNode_ = this.insert((ToJavaStringNode.create())); if (toJavaStringNode_ == 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.toJavaStringNode == null) { VarHandle.storeStoreFence(); this.toJavaStringNode = toJavaStringNode_; } state_0 = state_0 | 0b1 /* add SpecializationActive[PolyglotBuiltins.PolyglotImportNode.doString(TruffleString, InteropLibrary, ImportValueNode, ToJavaStringNode)] */; this.state_0_ = state_0; return doString(arguments0Value_, interop_, importValueNode_, toJavaStringNode_); } if (arguments0Value instanceof TruffleObject) { TruffleObject arguments0Value_ = (TruffleObject) arguments0Value; if ((!(JSGuards.isString(arguments0Value_)))) { InteropLibrary interop_1; InteropLibrary interop_1_shared = this.interop; if (interop_1_shared != null) { interop_1 = interop_1_shared; } else { interop_1 = this.insert((INTEROP_LIBRARY_.createDispatched(JSConfig.InteropLibraryLimit))); if (interop_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.interop == null) { VarHandle.storeStoreFence(); this.interop = interop_1; } ImportValueNode importValueNode_1; ImportValueNode importValueNode_1_shared = this.importValueNode; if (importValueNode_1_shared != null) { importValueNode_1 = importValueNode_1_shared; } else { importValueNode_1 = this.insert((ImportValueNode.create())); if (importValueNode_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.importValueNode == null) { VarHandle.storeStoreFence(); this.importValueNode = importValueNode_1; } ToJavaStringNode toJavaStringNode_1; ToJavaStringNode toJavaStringNode_1_shared = this.toJavaStringNode; if (toJavaStringNode_1_shared != null) { toJavaStringNode_1 = toJavaStringNode_1_shared; } else { toJavaStringNode_1 = this.insert((ToJavaStringNode.create())); if (toJavaStringNode_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.toJavaStringNode == null) { VarHandle.storeStoreFence(); this.toJavaStringNode = toJavaStringNode_1; } SwitchEncodingNode switchEncoding__ = this.insert((SwitchEncodingNode.create())); Objects.requireNonNull(switchEncoding__, "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.maybeUnbox_switchEncoding_ = switchEncoding__; state_0 = state_0 | 0b10 /* add SpecializationActive[PolyglotBuiltins.PolyglotImportNode.doMaybeUnbox(TruffleObject, InteropLibrary, ImportValueNode, ToJavaStringNode, SwitchEncodingNode)] */; this.state_0_ = state_0; return doMaybeUnbox(arguments0Value_, interop_1, importValueNode_1, toJavaStringNode_1, switchEncoding__); } } if ((!(JSGuards.isString(arguments0Value))) && (!(JSGuards.isTruffleObject(arguments0Value)))) { state_0 = state_0 | 0b100 /* add SpecializationActive[PolyglotBuiltins.PolyglotImportNode.doInvalid(Object)] */; this.state_0_ = state_0; return doInvalid(arguments0Value); } throw new UnsupportedSpecializationException(this, new Node[] {this.arguments0_}, arguments0Value); } @NeverDefault public static PolyglotImportNode create(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) { return new PolyglotImportNodeGen(context, builtin, arguments); } } /** * Debug Info:
     *   Specialization {@link PolyglotEvalNode#evalCachedLanguage}
     *     Activation probability: 0.48333
     *     With/without class size: 17/12 bytes
     *   Specialization {@link PolyglotEvalNode#evalString}
     *     Activation probability: 0.33333
     *     With/without class size: 8/0 bytes
     *   Specialization {@link PolyglotEvalNode#eval}
     *     Activation probability: 0.18333
     *     With/without class size: 6/0 bytes
     * 
*/ @GeneratedBy(PolyglotEvalNode.class) @SuppressWarnings("javadoc") static final class PolyglotEvalNodeGen extends PolyglotEvalNode { static final ReferenceField EVAL_CACHED_LANGUAGE_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "evalCachedLanguage_cache", EvalCachedLanguageData.class); @Child private JavaScriptNode arguments0_; @Child private JavaScriptNode arguments1_; /** * State Info:
         *   0: SpecializationActive {@link PolyglotEvalNode#evalCachedLanguage}
         *   1: SpecializationActive {@link PolyglotEvalNode#evalString}
         *   2: SpecializationActive {@link PolyglotEvalNode#eval}
         * 
*/ @CompilationFinal private int state_0_; /** * Source Info:
         *   Specialization: {@link PolyglotEvalNode#evalCachedLanguage}
         *   Parameter: {@link ToJavaStringNode} toJavaStringNode
*/ @Child private ToJavaStringNode toJavaStringNode; /** * Source Info:
         *   Specialization: {@link PolyglotEvalNode#evalCachedLanguage}
         *   Parameter: {@link IndirectCallNode} callNode
*/ @Child private IndirectCallNode callNode; @UnsafeAccessedField @Child private EvalCachedLanguageData evalCachedLanguage_cache; private PolyglotEvalNodeGen(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) { super(context, builtin); this.arguments0_ = arguments != null && 0 < arguments.length ? arguments[0] : null; this.arguments1_ = arguments != null && 1 < arguments.length ? arguments[1] : null; } @Override public JavaScriptNode[] getArguments() { return new JavaScriptNode[] {this.arguments0_, this.arguments1_}; } @Override public Object execute(VirtualFrame frameValue) { int state_0 = this.state_0_; Object arguments0Value_ = this.arguments0_.execute(frameValue); Object arguments1Value_ = this.arguments1_.execute(frameValue); if (state_0 != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotEvalNode.evalCachedLanguage(TruffleString, TruffleString, TruffleString, EqualNode, ToJavaStringNode, Pair, IndirectCallNode)] || SpecializationActive[PolyglotBuiltins.PolyglotEvalNode.evalString(TruffleString, TruffleString, ToJavaStringNode, IndirectCallNode)] || SpecializationActive[PolyglotBuiltins.PolyglotEvalNode.eval(Object, Object)] */) { if ((state_0 & 0b11) != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotEvalNode.evalCachedLanguage(TruffleString, TruffleString, TruffleString, EqualNode, ToJavaStringNode, Pair, IndirectCallNode)] || SpecializationActive[PolyglotBuiltins.PolyglotEvalNode.evalString(TruffleString, TruffleString, ToJavaStringNode, IndirectCallNode)] */ && arguments0Value_ instanceof TruffleString) { TruffleString arguments0Value__ = (TruffleString) arguments0Value_; if (arguments1Value_ instanceof TruffleString) { TruffleString arguments1Value__ = (TruffleString) arguments1Value_; if ((state_0 & 0b1) != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotEvalNode.evalCachedLanguage(TruffleString, TruffleString, TruffleString, EqualNode, ToJavaStringNode, Pair, IndirectCallNode)] */) { EvalCachedLanguageData s0_ = this.evalCachedLanguage_cache; if (s0_ != null) { { ToJavaStringNode toJavaStringNode_ = this.toJavaStringNode; if (toJavaStringNode_ != null) { IndirectCallNode callNode_ = this.callNode; if (callNode_ != null) { if ((Strings.equals(s0_.strEq_, arguments0Value__, s0_.cachedLanguage_))) { return evalCachedLanguage(arguments0Value__, arguments1Value__, s0_.cachedLanguage_, s0_.strEq_, toJavaStringNode_, s0_.languagePair_, callNode_); } } } } } } if ((state_0 & 0b10) != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotEvalNode.evalString(TruffleString, TruffleString, ToJavaStringNode, IndirectCallNode)] */) { { ToJavaStringNode toJavaStringNode_1 = this.toJavaStringNode; if (toJavaStringNode_1 != null) { IndirectCallNode callNode_1 = this.callNode; if (callNode_1 != null) { return evalString(arguments0Value__, arguments1Value__, toJavaStringNode_1, callNode_1); } } } } } } if ((state_0 & 0b100) != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotEvalNode.eval(Object, Object)] */) { if ((!(JSGuards.isString(arguments0Value_)) || !(JSGuards.isString(arguments1Value_)))) { return eval(arguments0Value_, arguments1Value_); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arguments0Value_, arguments1Value_); } @SuppressWarnings("unused") private Object executeAndSpecialize(Object arguments0Value, Object arguments1Value) { int state_0 = this.state_0_; if (arguments0Value instanceof TruffleString) { TruffleString arguments0Value_ = (TruffleString) arguments0Value; if (arguments1Value instanceof TruffleString) { TruffleString arguments1Value_ = (TruffleString) arguments1Value; if (((state_0 & 0b10)) == 0 /* is-not SpecializationActive[PolyglotBuiltins.PolyglotEvalNode.evalString(TruffleString, TruffleString, ToJavaStringNode, IndirectCallNode)] */) { while (true) { int count0_ = 0; EvalCachedLanguageData s0_ = EVAL_CACHED_LANGUAGE_CACHE_UPDATER.getVolatile(this); EvalCachedLanguageData s0_original = s0_; while (s0_ != null) { { ToJavaStringNode toJavaStringNode_ = this.toJavaStringNode; if (toJavaStringNode_ != null) { IndirectCallNode callNode_ = this.callNode; if (callNode_ != null) { if ((Strings.equals(s0_.strEq_, arguments0Value_, s0_.cachedLanguage_))) { break; } } } } count0_++; s0_ = null; break; } if (s0_ == null && count0_ < 1) { { TruffleString cachedLanguage__ = (arguments0Value_); EqualNode strEq__ = this.insert((EqualNode.create())); if ((Strings.equals(strEq__, arguments0Value_, cachedLanguage__))) { s0_ = this.insert(new EvalCachedLanguageData()); s0_.cachedLanguage_ = cachedLanguage__; Objects.requireNonNull(s0_.insert(strEq__), "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."); s0_.strEq_ = strEq__; ToJavaStringNode toJavaStringNode_; ToJavaStringNode toJavaStringNode__shared = this.toJavaStringNode; if (toJavaStringNode__shared != null) { toJavaStringNode_ = toJavaStringNode__shared; } else { toJavaStringNode_ = s0_.insert((ToJavaStringNode.create())); if (toJavaStringNode_ == 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.toJavaStringNode == null) { this.toJavaStringNode = toJavaStringNode_; } Pair languagePair__ = (getLanguageIdAndMimeType(toJavaStringNode_, arguments0Value_)); Objects.requireNonNull(languagePair__, "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."); s0_.languagePair_ = languagePair__; IndirectCallNode callNode_; IndirectCallNode callNode__shared = this.callNode; if (callNode__shared != null) { callNode_ = callNode__shared; } else { callNode_ = s0_.insert((IndirectCallNode.create())); if (callNode_ == 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.callNode == null) { this.callNode = callNode_; } if (!EVAL_CACHED_LANGUAGE_CACHE_UPDATER.compareAndSet(this, s0_original, s0_)) { continue; } state_0 = state_0 | 0b1 /* add SpecializationActive[PolyglotBuiltins.PolyglotEvalNode.evalCachedLanguage(TruffleString, TruffleString, TruffleString, EqualNode, ToJavaStringNode, Pair, IndirectCallNode)] */; this.state_0_ = state_0; } } } if (s0_ != null) { return evalCachedLanguage(arguments0Value_, arguments1Value_, s0_.cachedLanguage_, s0_.strEq_, this.toJavaStringNode, s0_.languagePair_, this.callNode); } break; } } ToJavaStringNode toJavaStringNode_1; ToJavaStringNode toJavaStringNode_1_shared = this.toJavaStringNode; if (toJavaStringNode_1_shared != null) { toJavaStringNode_1 = toJavaStringNode_1_shared; } else { toJavaStringNode_1 = this.insert((ToJavaStringNode.create())); if (toJavaStringNode_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.toJavaStringNode == null) { VarHandle.storeStoreFence(); this.toJavaStringNode = toJavaStringNode_1; } IndirectCallNode callNode_1; IndirectCallNode callNode_1_shared = this.callNode; if (callNode_1_shared != null) { callNode_1 = callNode_1_shared; } else { callNode_1 = this.insert((IndirectCallNode.create())); if (callNode_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.callNode == null) { VarHandle.storeStoreFence(); this.callNode = callNode_1; } this.evalCachedLanguage_cache = null; state_0 = state_0 & 0xfffffffe /* remove SpecializationActive[PolyglotBuiltins.PolyglotEvalNode.evalCachedLanguage(TruffleString, TruffleString, TruffleString, EqualNode, ToJavaStringNode, Pair, IndirectCallNode)] */; state_0 = state_0 | 0b10 /* add SpecializationActive[PolyglotBuiltins.PolyglotEvalNode.evalString(TruffleString, TruffleString, ToJavaStringNode, IndirectCallNode)] */; this.state_0_ = state_0; return evalString(arguments0Value_, arguments1Value_, toJavaStringNode_1, callNode_1); } } if ((!(JSGuards.isString(arguments0Value)) || !(JSGuards.isString(arguments1Value)))) { state_0 = state_0 | 0b100 /* add SpecializationActive[PolyglotBuiltins.PolyglotEvalNode.eval(Object, Object)] */; this.state_0_ = state_0; return eval(arguments0Value, arguments1Value); } throw new UnsupportedSpecializationException(this, new Node[] {this.arguments0_, this.arguments1_}, arguments0Value, arguments1Value); } @NeverDefault public static PolyglotEvalNode create(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) { return new PolyglotEvalNodeGen(context, builtin, arguments); } @GeneratedBy(PolyglotEvalNode.class) @DenyReplace private static final class EvalCachedLanguageData extends Node implements SpecializationDataNode { /** * Source Info:
             *   Specialization: {@link PolyglotEvalNode#evalCachedLanguage}
             *   Parameter: {@link TruffleString} cachedLanguage
*/ @CompilationFinal TruffleString cachedLanguage_; /** * Source Info:
             *   Specialization: {@link PolyglotEvalNode#evalCachedLanguage}
             *   Parameter: {@link EqualNode} strEq
*/ @Child EqualNode strEq_; /** * Source Info:
             *   Specialization: {@link PolyglotEvalNode#evalCachedLanguage}
             *   Parameter: {@link Pair} languagePair
*/ @CompilationFinal Pair languagePair_; EvalCachedLanguageData() { } } } /** * Debug Info:
     *   Specialization {@link PolyglotEvalFileNode#evalFileCachedLanguage}
     *     Activation probability: 0.48333
     *     With/without class size: 17/12 bytes
     *   Specialization {@link PolyglotEvalFileNode#evalFileString}
     *     Activation probability: 0.33333
     *     With/without class size: 8/0 bytes
     *   Specialization {@link PolyglotEvalFileNode#eval}
     *     Activation probability: 0.18333
     *     With/without class size: 6/0 bytes
     * 
*/ @GeneratedBy(PolyglotEvalFileNode.class) @SuppressWarnings("javadoc") static final class PolyglotEvalFileNodeGen extends PolyglotEvalFileNode { static final ReferenceField EVAL_FILE_CACHED_LANGUAGE_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "evalFileCachedLanguage_cache", EvalFileCachedLanguageData.class); @Child private JavaScriptNode arguments0_; @Child private JavaScriptNode arguments1_; /** * State Info:
         *   0: SpecializationActive {@link PolyglotEvalFileNode#evalFileCachedLanguage}
         *   1: SpecializationActive {@link PolyglotEvalFileNode#evalFileString}
         *   2: SpecializationActive {@link PolyglotEvalFileNode#eval}
         * 
*/ @CompilationFinal private int state_0_; /** * Source Info:
         *   Specialization: {@link PolyglotEvalFileNode#evalFileCachedLanguage}
         *   Parameter: {@link ToJavaStringNode} toJavaStringNode
*/ @Child private ToJavaStringNode toJavaStringNode; /** * Source Info:
         *   Specialization: {@link PolyglotEvalFileNode#evalFileCachedLanguage}
         *   Parameter: {@link IndirectCallNode} callNode
*/ @Child private IndirectCallNode callNode; @UnsafeAccessedField @Child private EvalFileCachedLanguageData evalFileCachedLanguage_cache; private PolyglotEvalFileNodeGen(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) { super(context, builtin); this.arguments0_ = arguments != null && 0 < arguments.length ? arguments[0] : null; this.arguments1_ = arguments != null && 1 < arguments.length ? arguments[1] : null; } @Override public JavaScriptNode[] getArguments() { return new JavaScriptNode[] {this.arguments0_, this.arguments1_}; } @Override public Object execute(VirtualFrame frameValue) { int state_0 = this.state_0_; Object arguments0Value_ = this.arguments0_.execute(frameValue); Object arguments1Value_ = this.arguments1_.execute(frameValue); if (state_0 != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotEvalFileNode.evalFileCachedLanguage(TruffleString, TruffleString, TruffleString, EqualNode, ToJavaStringNode, Pair, IndirectCallNode)] || SpecializationActive[PolyglotBuiltins.PolyglotEvalFileNode.evalFileString(TruffleString, TruffleString, ToJavaStringNode, IndirectCallNode)] || SpecializationActive[PolyglotBuiltins.PolyglotEvalFileNode.eval(Object, Object)] */) { if ((state_0 & 0b11) != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotEvalFileNode.evalFileCachedLanguage(TruffleString, TruffleString, TruffleString, EqualNode, ToJavaStringNode, Pair, IndirectCallNode)] || SpecializationActive[PolyglotBuiltins.PolyglotEvalFileNode.evalFileString(TruffleString, TruffleString, ToJavaStringNode, IndirectCallNode)] */ && arguments0Value_ instanceof TruffleString) { TruffleString arguments0Value__ = (TruffleString) arguments0Value_; if (arguments1Value_ instanceof TruffleString) { TruffleString arguments1Value__ = (TruffleString) arguments1Value_; if ((state_0 & 0b1) != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotEvalFileNode.evalFileCachedLanguage(TruffleString, TruffleString, TruffleString, EqualNode, ToJavaStringNode, Pair, IndirectCallNode)] */) { EvalFileCachedLanguageData s0_ = this.evalFileCachedLanguage_cache; if (s0_ != null) { { ToJavaStringNode toJavaStringNode_ = this.toJavaStringNode; if (toJavaStringNode_ != null) { IndirectCallNode callNode_ = this.callNode; if (callNode_ != null) { if ((Strings.equals(s0_.strEq_, arguments0Value__, s0_.cachedLanguage_))) { return evalFileCachedLanguage(arguments0Value__, arguments1Value__, s0_.cachedLanguage_, s0_.strEq_, toJavaStringNode_, s0_.languagePair_, callNode_); } } } } } } if ((state_0 & 0b10) != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotEvalFileNode.evalFileString(TruffleString, TruffleString, ToJavaStringNode, IndirectCallNode)] */) { { ToJavaStringNode toJavaStringNode_1 = this.toJavaStringNode; if (toJavaStringNode_1 != null) { IndirectCallNode callNode_1 = this.callNode; if (callNode_1 != null) { return evalFileString(arguments0Value__, arguments1Value__, toJavaStringNode_1, callNode_1); } } } } } } if ((state_0 & 0b100) != 0 /* is SpecializationActive[PolyglotBuiltins.PolyglotEvalFileNode.eval(Object, Object)] */) { if ((!(JSGuards.isString(arguments0Value_)) || !(JSGuards.isString(arguments1Value_)))) { return eval(arguments0Value_, arguments1Value_); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arguments0Value_, arguments1Value_); } @SuppressWarnings("unused") private Object executeAndSpecialize(Object arguments0Value, Object arguments1Value) { int state_0 = this.state_0_; if (arguments0Value instanceof TruffleString) { TruffleString arguments0Value_ = (TruffleString) arguments0Value; if (arguments1Value instanceof TruffleString) { TruffleString arguments1Value_ = (TruffleString) arguments1Value; if (((state_0 & 0b10)) == 0 /* is-not SpecializationActive[PolyglotBuiltins.PolyglotEvalFileNode.evalFileString(TruffleString, TruffleString, ToJavaStringNode, IndirectCallNode)] */) { while (true) { int count0_ = 0; EvalFileCachedLanguageData s0_ = EVAL_FILE_CACHED_LANGUAGE_CACHE_UPDATER.getVolatile(this); EvalFileCachedLanguageData s0_original = s0_; while (s0_ != null) { { ToJavaStringNode toJavaStringNode_ = this.toJavaStringNode; if (toJavaStringNode_ != null) { IndirectCallNode callNode_ = this.callNode; if (callNode_ != null) { if ((Strings.equals(s0_.strEq_, arguments0Value_, s0_.cachedLanguage_))) { break; } } } } count0_++; s0_ = null; break; } if (s0_ == null && count0_ < 1) { { TruffleString cachedLanguage__ = (arguments0Value_); EqualNode strEq__ = this.insert((EqualNode.create())); if ((Strings.equals(strEq__, arguments0Value_, cachedLanguage__))) { s0_ = this.insert(new EvalFileCachedLanguageData()); s0_.cachedLanguage_ = cachedLanguage__; Objects.requireNonNull(s0_.insert(strEq__), "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."); s0_.strEq_ = strEq__; ToJavaStringNode toJavaStringNode_; ToJavaStringNode toJavaStringNode__shared = this.toJavaStringNode; if (toJavaStringNode__shared != null) { toJavaStringNode_ = toJavaStringNode__shared; } else { toJavaStringNode_ = s0_.insert((ToJavaStringNode.create())); if (toJavaStringNode_ == 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.toJavaStringNode == null) { this.toJavaStringNode = toJavaStringNode_; } Pair languagePair__ = (getLanguageIdAndMimeType(toJavaStringNode_, arguments0Value_)); Objects.requireNonNull(languagePair__, "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."); s0_.languagePair_ = languagePair__; IndirectCallNode callNode_; IndirectCallNode callNode__shared = this.callNode; if (callNode__shared != null) { callNode_ = callNode__shared; } else { callNode_ = s0_.insert((IndirectCallNode.create())); if (callNode_ == 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.callNode == null) { this.callNode = callNode_; } if (!EVAL_FILE_CACHED_LANGUAGE_CACHE_UPDATER.compareAndSet(this, s0_original, s0_)) { continue; } state_0 = state_0 | 0b1 /* add SpecializationActive[PolyglotBuiltins.PolyglotEvalFileNode.evalFileCachedLanguage(TruffleString, TruffleString, TruffleString, EqualNode, ToJavaStringNode, Pair, IndirectCallNode)] */; this.state_0_ = state_0; } } } if (s0_ != null) { return evalFileCachedLanguage(arguments0Value_, arguments1Value_, s0_.cachedLanguage_, s0_.strEq_, this.toJavaStringNode, s0_.languagePair_, this.callNode); } break; } } ToJavaStringNode toJavaStringNode_1; ToJavaStringNode toJavaStringNode_1_shared = this.toJavaStringNode; if (toJavaStringNode_1_shared != null) { toJavaStringNode_1 = toJavaStringNode_1_shared; } else { toJavaStringNode_1 = this.insert((ToJavaStringNode.create())); if (toJavaStringNode_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.toJavaStringNode == null) { VarHandle.storeStoreFence(); this.toJavaStringNode = toJavaStringNode_1; } IndirectCallNode callNode_1; IndirectCallNode callNode_1_shared = this.callNode; if (callNode_1_shared != null) { callNode_1 = callNode_1_shared; } else { callNode_1 = this.insert((IndirectCallNode.create())); if (callNode_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.callNode == null) { VarHandle.storeStoreFence(); this.callNode = callNode_1; } this.evalFileCachedLanguage_cache = null; state_0 = state_0 & 0xfffffffe /* remove SpecializationActive[PolyglotBuiltins.PolyglotEvalFileNode.evalFileCachedLanguage(TruffleString, TruffleString, TruffleString, EqualNode, ToJavaStringNode, Pair, IndirectCallNode)] */; state_0 = state_0 | 0b10 /* add SpecializationActive[PolyglotBuiltins.PolyglotEvalFileNode.evalFileString(TruffleString, TruffleString, ToJavaStringNode, IndirectCallNode)] */; this.state_0_ = state_0; return evalFileString(arguments0Value_, arguments1Value_, toJavaStringNode_1, callNode_1); } } if ((!(JSGuards.isString(arguments0Value)) || !(JSGuards.isString(arguments1Value)))) { state_0 = state_0 | 0b100 /* add SpecializationActive[PolyglotBuiltins.PolyglotEvalFileNode.eval(Object, Object)] */; this.state_0_ = state_0; return eval(arguments0Value, arguments1Value); } throw new UnsupportedSpecializationException(this, new Node[] {this.arguments0_, this.arguments1_}, arguments0Value, arguments1Value); } @NeverDefault public static PolyglotEvalFileNode create(JSContext context, JSBuiltin builtin, JavaScriptNode[] arguments) { return new PolyglotEvalFileNodeGen(context, builtin, arguments); } @GeneratedBy(PolyglotEvalFileNode.class) @DenyReplace private static final class EvalFileCachedLanguageData extends Node implements SpecializationDataNode { /** * Source Info:
             *   Specialization: {@link PolyglotEvalFileNode#evalFileCachedLanguage}
             *   Parameter: {@link TruffleString} cachedLanguage
*/ @CompilationFinal TruffleString cachedLanguage_; /** * Source Info:
             *   Specialization: {@link PolyglotEvalFileNode#evalFileCachedLanguage}
             *   Parameter: {@link EqualNode} strEq
*/ @Child EqualNode strEq_; /** * Source Info:
             *   Specialization: {@link PolyglotEvalFileNode#evalFileCachedLanguage}
             *   Parameter: {@link Pair} languagePair
*/ @CompilationFinal Pair languagePair_; EvalFileCachedLanguageData() { } } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy