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

com.oracle.truffle.js.nodes.cast.JSToNumericNodeGen Maven / Gradle / Ivy

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

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.dsl.DSLSupport;
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.InlineSupport.InlineTarget;
import com.oracle.truffle.api.dsl.InlineSupport.RequiredField;
import com.oracle.truffle.api.dsl.InlineSupport.StateField;
import com.oracle.truffle.api.dsl.InlineSupport.UnsafeAccessedField;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.UnadoptableNode;
import com.oracle.truffle.js.nodes.JSGuards;
import com.oracle.truffle.js.nodes.JSTypesGen;
import com.oracle.truffle.js.nodes.JavaScriptNode;
import com.oracle.truffle.js.runtime.BigInt;
import com.oracle.truffle.js.runtime.builtins.JSOverloadedOperatorsObject;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.util.Objects;

/**
 * Debug Info: 
 *   Specialization {@link JSToNumericNode#doInt}
 *     Activation probability: 0.23929
 *     With/without class size: 6/0 bytes
 *   Specialization {@link JSToNumericNode#doDouble}
 *     Activation probability: 0.20714
 *     With/without class size: 6/0 bytes
 *   Specialization {@link JSToNumericNode#doBigInt}
 *     Activation probability: 0.17500
 *     With/without class size: 6/0 bytes
 *   Specialization {@link JSToNumericNode#doForeignBigInt}
 *     Activation probability: 0.14286
 *     With/without class size: 5/0 bytes
 *   Specialization {@link JSToNumericNode#doOverloaded}
 *     Activation probability: 0.11071
 *     With/without class size: 5/0 bytes
 *   Specialization {@link JSToNumericNode#doToNumericOperandOther}
 *     Activation probability: 0.07857
 *     With/without class size: 5/0 bytes
 *   Specialization {@link JSToNumericNode#doToNumericOther}
 *     Activation probability: 0.04643
 *     With/without class size: 4/0 bytes
 * 
*/ @GeneratedBy(JSToNumericNode.class) @SuppressWarnings({"javadoc", "unused"}) public final class JSToNumericNodeGen extends JSToNumericNode { private static final StateField STATE_0_UPDATER = StateField.create(MethodHandles.lookup(), "state_0_"); /** * Source Info:
     *   Specialization: {@link JSToNumericNode#doToNumericOperandOther}
     *   Parameter: {@link PrimitiveToNumericOrNullNode} numericOrNullNode
     *   Inline method: {@link PrimitiveToNumericOrNullNodeGen#inline}
*/ private static final PrimitiveToNumericOrNullNode INLINED_NUMERIC_OR_NULL_NODE = PrimitiveToNumericOrNullNodeGen.inline(InlineTarget.create(PrimitiveToNumericOrNullNode.class, STATE_0_UPDATER.subUpdater(10, 4))); /** * State Info:
     *   0: SpecializationActive {@link JSToNumericNode#doInt}
     *   1: SpecializationActive {@link JSToNumericNode#doDouble}
     *   2: SpecializationActive {@link JSToNumericNode#doBigInt}
     *   3: SpecializationActive {@link JSToNumericNode#doForeignBigInt}
     *   4: SpecializationActive {@link JSToNumericNode#doOverloaded}
     *   5: SpecializationActive {@link JSToNumericNode#doToNumericOperandOther}
     *   6: SpecializationActive {@link JSToNumericNode#doToNumericOther}
     *   7-9: ImplicitCast[type=double, index=0]
     *   10-13: InlinedCache
     *        Specialization: {@link JSToNumericNode#doToNumericOperandOther}
     *        Parameter: {@link PrimitiveToNumericOrNullNode} numericOrNullNode
     *        Inline method: {@link PrimitiveToNumericOrNullNodeGen#inline}
     * 
*/ @CompilationFinal @UnsafeAccessedField private int state_0_; /** * Source Info:
     *   Specialization: {@link JSToNumericNode#doToNumericOperandOther}
     *   Parameter: {@link JSToPrimitiveNode} toPrimitiveNode
*/ @Child private JSToPrimitiveNode toPrimitiveNode; /** * Source Info:
     *   Specialization: {@link JSToNumericNode#doToNumericOperandOther}
     *   Parameter: {@link JSToNumberNode} toNumberNode
*/ @Child private JSToNumberNode toNumberNode; private JSToNumericNodeGen(boolean toNumericOperand) { super(toNumericOperand); } @Override public Object execute(Object arg0Value) { int state_0 = this.state_0_; if ((state_0 & 0b1111111) != 0 /* is SpecializationActive[JSToNumericNode.doInt(int)] || SpecializationActive[JSToNumericNode.doDouble(double)] || SpecializationActive[JSToNumericNode.doBigInt(BigInt)] || SpecializationActive[JSToNumericNode.doForeignBigInt(BigInt)] || SpecializationActive[JSToNumericNode.doOverloaded(JSOverloadedOperatorsObject)] || SpecializationActive[JSToNumericNode.doToNumericOperandOther(Object, JSToPrimitiveNode, PrimitiveToNumericOrNullNode, JSToNumberNode)] || SpecializationActive[JSToNumericNode.doToNumericOther(Object, JSToPrimitiveNode, PrimitiveToNumericOrNullNode, JSToNumberNode)] */) { if ((state_0 & 0b1) != 0 /* is SpecializationActive[JSToNumericNode.doInt(int)] */ && arg0Value instanceof Integer) { int arg0Value_ = (int) arg0Value; return JSToNumericNode.doInt(arg0Value_); } if ((state_0 & 0b10) != 0 /* is SpecializationActive[JSToNumericNode.doDouble(double)] */ && JSTypesGen.isImplicitDouble((state_0 & 0b1110000000) >>> 7 /* get-int ImplicitCast[type=double, index=0] */, arg0Value)) { double arg0Value_ = JSTypesGen.asImplicitDouble((state_0 & 0b1110000000) >>> 7 /* get-int ImplicitCast[type=double, index=0] */, arg0Value); return JSToNumericNode.doDouble(arg0Value_); } if ((state_0 & 0b1100) != 0 /* is SpecializationActive[JSToNumericNode.doBigInt(BigInt)] || SpecializationActive[JSToNumericNode.doForeignBigInt(BigInt)] */ && arg0Value instanceof BigInt) { BigInt arg0Value_ = (BigInt) arg0Value; if ((state_0 & 0b100) != 0 /* is SpecializationActive[JSToNumericNode.doBigInt(BigInt)] */) { if ((!(arg0Value_.isForeign()))) { return JSToNumericNode.doBigInt(arg0Value_); } } if ((state_0 & 0b1000) != 0 /* is SpecializationActive[JSToNumericNode.doForeignBigInt(BigInt)] */) { if ((arg0Value_.isForeign())) { return JSToNumericNode.doForeignBigInt(arg0Value_); } } } if ((state_0 & 0b10000) != 0 /* is SpecializationActive[JSToNumericNode.doOverloaded(JSOverloadedOperatorsObject)] */ && arg0Value instanceof JSOverloadedOperatorsObject) { JSOverloadedOperatorsObject arg0Value_ = (JSOverloadedOperatorsObject) arg0Value; assert DSLSupport.assertIdempotence((isToNumericOperand())); return doOverloaded(arg0Value_); } if ((state_0 & 0b1100000) != 0 /* is SpecializationActive[JSToNumericNode.doToNumericOperandOther(Object, JSToPrimitiveNode, PrimitiveToNumericOrNullNode, JSToNumberNode)] || SpecializationActive[JSToNumericNode.doToNumericOther(Object, JSToPrimitiveNode, PrimitiveToNumericOrNullNode, JSToNumberNode)] */) { if ((state_0 & 0b100000) != 0 /* is SpecializationActive[JSToNumericNode.doToNumericOperandOther(Object, JSToPrimitiveNode, PrimitiveToNumericOrNullNode, JSToNumberNode)] */) { { JSToPrimitiveNode toPrimitiveNode_ = this.toPrimitiveNode; if (toPrimitiveNode_ != null) { JSToNumberNode toNumberNode_ = this.toNumberNode; if (toNumberNode_ != null) { assert DSLSupport.assertIdempotence((isToNumericOperand())); if ((!(hasOverloadedOperators(arg0Value)))) { return doToNumericOperandOther(arg0Value, toPrimitiveNode_, INLINED_NUMERIC_OR_NULL_NODE, toNumberNode_); } } } } } if ((state_0 & 0b1000000) != 0 /* is SpecializationActive[JSToNumericNode.doToNumericOther(Object, JSToPrimitiveNode, PrimitiveToNumericOrNullNode, JSToNumberNode)] */) { { JSToPrimitiveNode toPrimitiveNode_1 = this.toPrimitiveNode; if (toPrimitiveNode_1 != null) { JSToNumberNode toNumberNode_1 = this.toNumberNode; if (toNumberNode_1 != null) { assert DSLSupport.assertIdempotence((!(isToNumericOperand()))); if ((!(JSGuards.isBigInt(arg0Value)))) { return doToNumericOther(arg0Value, toPrimitiveNode_1, INLINED_NUMERIC_OR_NULL_NODE, toNumberNode_1); } } } } } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value); } private Object executeAndSpecialize(Object arg0Value) { int state_0 = this.state_0_; if (arg0Value instanceof Integer) { int arg0Value_ = (int) arg0Value; state_0 = state_0 | 0b1 /* add SpecializationActive[JSToNumericNode.doInt(int)] */; this.state_0_ = state_0; return JSToNumericNode.doInt(arg0Value_); } { int doubleCast0; if ((doubleCast0 = JSTypesGen.specializeImplicitDouble(arg0Value)) != 0) { double arg0Value_ = JSTypesGen.asImplicitDouble(doubleCast0, arg0Value); state_0 = (state_0 | (doubleCast0 << 7) /* set-int ImplicitCast[type=double, index=0] */); state_0 = state_0 | 0b10 /* add SpecializationActive[JSToNumericNode.doDouble(double)] */; this.state_0_ = state_0; return JSToNumericNode.doDouble(arg0Value_); } } if (arg0Value instanceof BigInt) { BigInt arg0Value_ = (BigInt) arg0Value; if ((!(arg0Value_.isForeign()))) { state_0 = state_0 | 0b100 /* add SpecializationActive[JSToNumericNode.doBigInt(BigInt)] */; this.state_0_ = state_0; return JSToNumericNode.doBigInt(arg0Value_); } if ((arg0Value_.isForeign())) { state_0 = state_0 | 0b1000 /* add SpecializationActive[JSToNumericNode.doForeignBigInt(BigInt)] */; this.state_0_ = state_0; return JSToNumericNode.doForeignBigInt(arg0Value_); } } if (arg0Value instanceof JSOverloadedOperatorsObject) { JSOverloadedOperatorsObject arg0Value_ = (JSOverloadedOperatorsObject) arg0Value; if ((isToNumericOperand())) { state_0 = state_0 | 0b10000 /* add SpecializationActive[JSToNumericNode.doOverloaded(JSOverloadedOperatorsObject)] */; this.state_0_ = state_0; return doOverloaded(arg0Value_); } } if ((isToNumericOperand()) && (!(hasOverloadedOperators(arg0Value)))) { JSToPrimitiveNode toPrimitiveNode_; JSToPrimitiveNode toPrimitiveNode__shared = this.toPrimitiveNode; if (toPrimitiveNode__shared != null) { toPrimitiveNode_ = toPrimitiveNode__shared; } else { toPrimitiveNode_ = this.insert((JSToPrimitiveNode.createHintNumber())); if (toPrimitiveNode_ == 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.toPrimitiveNode == null) { VarHandle.storeStoreFence(); this.toPrimitiveNode = toPrimitiveNode_; } JSToNumberNode toNumberNode_; JSToNumberNode toNumberNode__shared = this.toNumberNode; if (toNumberNode__shared != null) { toNumberNode_ = toNumberNode__shared; } else { toNumberNode_ = this.insert((JSToNumberNode.create())); if (toNumberNode_ == 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.toNumberNode == null) { VarHandle.storeStoreFence(); this.toNumberNode = toNumberNode_; } state_0 = state_0 | 0b100000 /* add SpecializationActive[JSToNumericNode.doToNumericOperandOther(Object, JSToPrimitiveNode, PrimitiveToNumericOrNullNode, JSToNumberNode)] */; this.state_0_ = state_0; return doToNumericOperandOther(arg0Value, toPrimitiveNode_, INLINED_NUMERIC_OR_NULL_NODE, toNumberNode_); } if ((!(isToNumericOperand())) && (!(JSGuards.isBigInt(arg0Value)))) { JSToPrimitiveNode toPrimitiveNode_1; JSToPrimitiveNode toPrimitiveNode_1_shared = this.toPrimitiveNode; if (toPrimitiveNode_1_shared != null) { toPrimitiveNode_1 = toPrimitiveNode_1_shared; } else { toPrimitiveNode_1 = this.insert((JSToPrimitiveNode.createHintNumber())); if (toPrimitiveNode_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.toPrimitiveNode == null) { VarHandle.storeStoreFence(); this.toPrimitiveNode = toPrimitiveNode_1; } JSToNumberNode toNumberNode_1; JSToNumberNode toNumberNode_1_shared = this.toNumberNode; if (toNumberNode_1_shared != null) { toNumberNode_1 = toNumberNode_1_shared; } else { toNumberNode_1 = this.insert((JSToNumberNode.create())); if (toNumberNode_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.toNumberNode == null) { VarHandle.storeStoreFence(); this.toNumberNode = toNumberNode_1; } state_0 = state_0 | 0b1000000 /* add SpecializationActive[JSToNumericNode.doToNumericOther(Object, JSToPrimitiveNode, PrimitiveToNumericOrNullNode, JSToNumberNode)] */; this.state_0_ = state_0; return doToNumericOther(arg0Value, toPrimitiveNode_1, INLINED_NUMERIC_OR_NULL_NODE, toNumberNode_1); } throw new UnsupportedSpecializationException(this, null, arg0Value); } @NeverDefault public static JSToNumericNode create(boolean toNumericOperand) { return new JSToNumericNodeGen(toNumericOperand); } /** * Debug Info:
     *   Specialization {@link JSToNumericWrapperNode#doDefault}
     *     Activation probability: 1.00000
     *     With/without class size: 24/4 bytes
     * 
*/ @GeneratedBy(JSToNumericWrapperNode.class) @SuppressWarnings("javadoc") public static final class JSToNumericWrapperNodeGen extends JSToNumericWrapperNode { /** * State Info:
         *   0: SpecializationActive {@link JSToNumericWrapperNode#doDefault}
         * 
*/ @CompilationFinal private int state_0_; /** * Source Info:
         *   Specialization: {@link JSToNumericWrapperNode#doDefault}
         *   Parameter: {@link JSToNumericNode} toNumericNode
*/ @Child private JSToNumericNode toNumericNode_; private JSToNumericWrapperNodeGen(JavaScriptNode operand, boolean toNumericOperand) { super(operand, toNumericOperand); } @Override public Object execute(VirtualFrame frameValue) { int state_0 = this.state_0_; Object operandNodeValue_ = super.operandNode.execute(frameValue); if (state_0 != 0 /* is SpecializationActive[JSToNumericNode.JSToNumericWrapperNode.doDefault(Object, JSToNumericNode)] */) { { JSToNumericNode toNumericNode__ = this.toNumericNode_; if (toNumericNode__ != null) { return JSToNumericWrapperNode.doDefault(operandNodeValue_, toNumericNode__); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(operandNodeValue_); } @Override public void executeVoid(VirtualFrame frameValue) { execute(frameValue); return; } private Object executeAndSpecialize(Object operandNodeValue) { int state_0 = this.state_0_; JSToNumericNode toNumericNode__ = this.insert((JSToNumericNode.create(toNumericOperand))); Objects.requireNonNull(toNumericNode__, "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.toNumericNode_ = toNumericNode__; state_0 = state_0 | 0b1 /* add SpecializationActive[JSToNumericNode.JSToNumericWrapperNode.doDefault(Object, JSToNumericNode)] */; this.state_0_ = state_0; return JSToNumericWrapperNode.doDefault(operandNodeValue, toNumericNode__); } @NeverDefault public static JSToNumericWrapperNode create(JavaScriptNode operand, boolean toNumericOperand) { return new JSToNumericWrapperNodeGen(operand, toNumericOperand); } } /** * Debug Info:
     *   Specialization {@link PrimitiveToNumericOrNullNode#doBigInt}
     *     Activation probability: 0.38500
     *     With/without class size: 8/0 bytes
     *   Specialization {@link PrimitiveToNumericOrNullNode#doForeignBigInt}
     *     Activation probability: 0.29500
     *     With/without class size: 7/0 bytes
     *   Specialization {@link PrimitiveToNumericOrNullNode#doLong}
     *     Activation probability: 0.20500
     *     With/without class size: 6/0 bytes
     *   Specialization {@link PrimitiveToNumericOrNullNode#doOther}
     *     Activation probability: 0.11500
     *     With/without class size: 5/0 bytes
     * 
*/ @GeneratedBy(PrimitiveToNumericOrNullNode.class) @SuppressWarnings("javadoc") protected static final class PrimitiveToNumericOrNullNodeGen { /** * Required Fields:
    *
  • {@link Inlined#state_0_} *
*/ @NeverDefault public static PrimitiveToNumericOrNullNode inline(@RequiredField(bits = 4, value = StateField.class) InlineTarget target) { return new PrimitiveToNumericOrNullNodeGen.Inlined(target); } @GeneratedBy(PrimitiveToNumericOrNullNode.class) @DenyReplace private static final class Inlined extends PrimitiveToNumericOrNullNode implements UnadoptableNode { /** * State Info:
             *   0: SpecializationActive {@link PrimitiveToNumericOrNullNode#doBigInt}
             *   1: SpecializationActive {@link PrimitiveToNumericOrNullNode#doForeignBigInt}
             *   2: SpecializationActive {@link PrimitiveToNumericOrNullNode#doLong}
             *   3: SpecializationActive {@link PrimitiveToNumericOrNullNode#doOther}
             * 
*/ private final StateField state_0_; private Inlined(InlineTarget target) { assert target.getTargetClass().isAssignableFrom(PrimitiveToNumericOrNullNode.class); this.state_0_ = target.getState(0, 4); } @SuppressWarnings("static-method") private boolean fallbackGuard_(int state_0, Node arg0Value, Object arg1Value) { if (arg1Value instanceof BigInt) { { BigInt arg1Value_ = (BigInt) arg1Value; if ((!(arg1Value_.isForeign()))) { return false; } } { BigInt arg1Value_ = (BigInt) arg1Value; if ((arg1Value_.isForeign())) { return false; } } } if (!((state_0 & 0b100) != 0 /* is SpecializationActive[JSToNumericNode.PrimitiveToNumericOrNullNode.doLong(long)] */) && arg1Value instanceof Long) { return false; } return true; } @Override public Object execute(Node arg0Value, Object arg1Value) { int state_0 = this.state_0_.get(arg0Value); if (state_0 != 0 /* is SpecializationActive[JSToNumericNode.PrimitiveToNumericOrNullNode.doBigInt(BigInt)] || SpecializationActive[JSToNumericNode.PrimitiveToNumericOrNullNode.doForeignBigInt(BigInt)] || SpecializationActive[JSToNumericNode.PrimitiveToNumericOrNullNode.doLong(long)] || SpecializationActive[JSToNumericNode.PrimitiveToNumericOrNullNode.doOther(Object)] */) { if ((state_0 & 0b11) != 0 /* is SpecializationActive[JSToNumericNode.PrimitiveToNumericOrNullNode.doBigInt(BigInt)] || SpecializationActive[JSToNumericNode.PrimitiveToNumericOrNullNode.doForeignBigInt(BigInt)] */ && arg1Value instanceof BigInt) { BigInt arg1Value_ = (BigInt) arg1Value; if ((state_0 & 0b1) != 0 /* is SpecializationActive[JSToNumericNode.PrimitiveToNumericOrNullNode.doBigInt(BigInt)] */) { if ((!(arg1Value_.isForeign()))) { return PrimitiveToNumericOrNullNode.doBigInt(arg1Value_); } } if ((state_0 & 0b10) != 0 /* is SpecializationActive[JSToNumericNode.PrimitiveToNumericOrNullNode.doForeignBigInt(BigInt)] */) { if ((arg1Value_.isForeign())) { return PrimitiveToNumericOrNullNode.doForeignBigInt(arg1Value_); } } } if ((state_0 & 0b100) != 0 /* is SpecializationActive[JSToNumericNode.PrimitiveToNumericOrNullNode.doLong(long)] */ && arg1Value instanceof Long) { long arg1Value_ = (long) arg1Value; return PrimitiveToNumericOrNullNode.doLong(arg1Value_); } if ((state_0 & 0b1000) != 0 /* is SpecializationActive[JSToNumericNode.PrimitiveToNumericOrNullNode.doOther(Object)] */) { if (fallbackGuard_(state_0, arg0Value, arg1Value)) { return PrimitiveToNumericOrNullNode.doOther(arg1Value); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value); } private Object executeAndSpecialize(Node arg0Value, Object arg1Value) { int state_0 = this.state_0_.get(arg0Value); if (arg1Value instanceof BigInt) { BigInt arg1Value_ = (BigInt) arg1Value; if ((!(arg1Value_.isForeign()))) { state_0 = state_0 | 0b1 /* add SpecializationActive[JSToNumericNode.PrimitiveToNumericOrNullNode.doBigInt(BigInt)] */; this.state_0_.set(arg0Value, state_0); return PrimitiveToNumericOrNullNode.doBigInt(arg1Value_); } if ((arg1Value_.isForeign())) { state_0 = state_0 | 0b10 /* add SpecializationActive[JSToNumericNode.PrimitiveToNumericOrNullNode.doForeignBigInt(BigInt)] */; this.state_0_.set(arg0Value, state_0); return PrimitiveToNumericOrNullNode.doForeignBigInt(arg1Value_); } } if (arg1Value instanceof Long) { long arg1Value_ = (long) arg1Value; state_0 = state_0 | 0b100 /* add SpecializationActive[JSToNumericNode.PrimitiveToNumericOrNullNode.doLong(long)] */; this.state_0_.set(arg0Value, state_0); return PrimitiveToNumericOrNullNode.doLong(arg1Value_); } state_0 = state_0 | 0b1000 /* add SpecializationActive[JSToNumericNode.PrimitiveToNumericOrNullNode.doOther(Object)] */; this.state_0_.set(arg0Value, state_0); return PrimitiveToNumericOrNullNode.doOther(arg1Value); } } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy