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

com.oracle.graal.python.nodes.object.SetDictNodeGen Maven / Gradle / Ivy

There is a newer version: 24.1.1
Show newest version
// CheckStyle: start generated
package com.oracle.graal.python.nodes.object;

import com.oracle.graal.python.builtins.objects.cext.PythonAbstractNativeObject;
import com.oracle.graal.python.builtins.objects.cext.capi.CExtNodes.PCallCapiFunction;
import com.oracle.graal.python.builtins.objects.cext.capi.ExternalFunctionNodes.CheckPrimitiveFunctionResultNode;
import com.oracle.graal.python.builtins.objects.cext.capi.ExternalFunctionNodesFactory.CheckPrimitiveFunctionResultNodeGen;
import com.oracle.graal.python.builtins.objects.cext.capi.transitions.CApiTransitions.PythonToNativeNode;
import com.oracle.graal.python.builtins.objects.cext.capi.transitions.CApiTransitionsFactory.PythonToNativeNodeGen;
import com.oracle.graal.python.builtins.objects.dict.PDict;
import com.oracle.graal.python.builtins.objects.object.PythonObject;
import com.oracle.graal.python.builtins.objects.type.PythonClass;
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.InlineSupport;
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.RequiredField;
import com.oracle.truffle.api.dsl.InlineSupport.StateField;
import com.oracle.truffle.api.library.LibraryFactory;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.object.DynamicObjectLibrary;
import com.oracle.truffle.api.profiles.InlinedBranchProfile;
import java.lang.invoke.VarHandle;
import java.util.Objects;

/**
 * Debug Info: 
 *   Specialization {@link SetDictNode#doPythonClass}
 *     Activation probability: 0.48333
 *     With/without class size: 13/1 bytes
 *   Specialization {@link SetDictNode#doPythonObjectNotClass}
 *     Activation probability: 0.33333
 *     With/without class size: 8/0 bytes
 *   Specialization {@link SetDictNode#doNativeObject}
 *     Activation probability: 0.18333
 *     With/without class size: 9/16 bytes
 * 
*/ @GeneratedBy(SetDictNode.class) @SuppressWarnings("javadoc") public final class SetDictNodeGen { private static final Uncached UNCACHED = new Uncached(); private static final LibraryFactory DYNAMIC_OBJECT_LIBRARY_ = LibraryFactory.resolve(DynamicObjectLibrary.class); @NeverDefault public static SetDictNode getUncached() { return SetDictNodeGen.UNCACHED; } /** * Required Fields:
    *
  • {@link Inlined#state_0_} *
  • {@link Inlined#dylib} *
  • {@link Inlined#nativeObject_cache} *
*/ @NeverDefault public static SetDictNode inline(@RequiredField(bits = 4, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) { return new SetDictNodeGen.Inlined(target); } @GeneratedBy(SetDictNode.class) @DenyReplace private static final class Inlined extends SetDictNode { /** * State Info:
         *   0: SpecializationActive {@link SetDictNode#doPythonClass}
         *   1: SpecializationActive {@link SetDictNode#doPythonObjectNotClass}
         *   2: SpecializationActive {@link SetDictNode#doNativeObject}
         *   3: InlinedCache
         *        Specialization: {@link SetDictNode#doPythonClass}
         *        Parameter: {@link InlinedBranchProfile} hasMroShapeProfile
         *        Inline method: {@link InlinedBranchProfile#inline}
         * 
*/ private final StateField state_0_; private final ReferenceField dylib; private final ReferenceField nativeObject_cache; /** * Source Info:
         *   Specialization: {@link SetDictNode#doPythonClass}
         *   Parameter: {@link InlinedBranchProfile} hasMroShapeProfile
         *   Inline method: {@link InlinedBranchProfile#inline}
*/ private final InlinedBranchProfile pythonClass_hasMroShapeProfile_; @SuppressWarnings("unchecked") private Inlined(InlineTarget target) { assert target.getTargetClass().isAssignableFrom(SetDictNode.class); this.state_0_ = target.getState(0, 4); this.dylib = target.getReference(1, DynamicObjectLibrary.class); this.nativeObject_cache = target.getReference(2, NativeObjectData.class); this.pythonClass_hasMroShapeProfile_ = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, state_0_.subUpdater(3, 1))); } @Override public void execute(Node arg0Value, Object arg1Value, PDict arg2Value) { int state_0 = this.state_0_.get(arg0Value); if ((state_0 & 0b111) != 0 /* is SpecializationActive[SetDictNode.doPythonClass(Node, PythonClass, PDict, DynamicObjectLibrary, InlinedBranchProfile)] || SpecializationActive[SetDictNode.doPythonObjectNotClass(PythonObject, PDict, DynamicObjectLibrary)] || SpecializationActive[SetDictNode.doNativeObject(PythonAbstractNativeObject, PDict, PythonToNativeNode, PythonToNativeNode, PCallCapiFunction, CheckPrimitiveFunctionResultNode)] */) { if ((state_0 & 0b1) != 0 /* is SpecializationActive[SetDictNode.doPythonClass(Node, PythonClass, PDict, DynamicObjectLibrary, InlinedBranchProfile)] */ && arg1Value instanceof PythonClass) { PythonClass arg1Value_ = (PythonClass) arg1Value; { DynamicObjectLibrary dylib_ = this.dylib.get(arg0Value); if (dylib_ != null) { assert InlineSupport.validate(arg0Value, this.state_0_); SetDictNode.doPythonClass(arg0Value, arg1Value_, arg2Value, dylib_, this.pythonClass_hasMroShapeProfile_); return; } } } if ((state_0 & 0b10) != 0 /* is SpecializationActive[SetDictNode.doPythonObjectNotClass(PythonObject, PDict, DynamicObjectLibrary)] */ && arg1Value instanceof PythonObject) { PythonObject arg1Value_ = (PythonObject) arg1Value; { DynamicObjectLibrary dylib_1 = this.dylib.get(arg0Value); if (dylib_1 != null) { if ((!(SetDictNode.isPythonClass(arg1Value_)))) { SetDictNode.doPythonObjectNotClass(arg1Value_, arg2Value, dylib_1); return; } } } } if ((state_0 & 0b100) != 0 /* is SpecializationActive[SetDictNode.doNativeObject(PythonAbstractNativeObject, PDict, PythonToNativeNode, PythonToNativeNode, PCallCapiFunction, CheckPrimitiveFunctionResultNode)] */ && arg1Value instanceof PythonAbstractNativeObject) { PythonAbstractNativeObject arg1Value_ = (PythonAbstractNativeObject) arg1Value; NativeObjectData s2_ = this.nativeObject_cache.get(arg0Value); if (s2_ != null) { doNativeObject(arg1Value_, arg2Value, s2_.objectToSulong_, s2_.dictToSulong_, s2_.callGetDictNode_, s2_.checkResult_); return; } } } CompilerDirectives.transferToInterpreterAndInvalidate(); executeAndSpecialize(arg0Value, arg1Value, arg2Value); return; } private void executeAndSpecialize(Node arg0Value, Object arg1Value, PDict arg2Value) { int state_0 = this.state_0_.get(arg0Value); if (arg1Value instanceof PythonClass) { PythonClass arg1Value_ = (PythonClass) arg1Value; DynamicObjectLibrary dylib_; DynamicObjectLibrary dylib__shared = this.dylib.get(arg0Value); if (dylib__shared != null) { dylib_ = dylib__shared; } else { dylib_ = arg0Value.insert((DYNAMIC_OBJECT_LIBRARY_.createDispatched(4))); if (dylib_ == null) { throw new IllegalStateException("Specialization 'doPythonClass(Node, PythonClass, PDict, DynamicObjectLibrary, InlinedBranchProfile)' contains a shared cache with name 'dylib' that returned a default value for the cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state."); } } if (this.dylib.get(arg0Value) == null) { VarHandle.storeStoreFence(); this.dylib.set(arg0Value, dylib_); } state_0 = state_0 | 0b1 /* add SpecializationActive[SetDictNode.doPythonClass(Node, PythonClass, PDict, DynamicObjectLibrary, InlinedBranchProfile)] */; this.state_0_.set(arg0Value, state_0); assert InlineSupport.validate(arg0Value, this.state_0_); SetDictNode.doPythonClass(arg0Value, arg1Value_, arg2Value, dylib_, this.pythonClass_hasMroShapeProfile_); return; } if (arg1Value instanceof PythonObject) { PythonObject arg1Value_ = (PythonObject) arg1Value; if ((!(SetDictNode.isPythonClass(arg1Value_)))) { DynamicObjectLibrary dylib_1; DynamicObjectLibrary dylib_1_shared = this.dylib.get(arg0Value); if (dylib_1_shared != null) { dylib_1 = dylib_1_shared; } else { dylib_1 = arg0Value.insert((DYNAMIC_OBJECT_LIBRARY_.createDispatched(4))); if (dylib_1 == null) { throw new IllegalStateException("Specialization 'doPythonObjectNotClass(PythonObject, PDict, DynamicObjectLibrary)' contains a shared cache with name 'dylib' that returned a default value for the cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state."); } } if (this.dylib.get(arg0Value) == null) { VarHandle.storeStoreFence(); this.dylib.set(arg0Value, dylib_1); } state_0 = state_0 | 0b10 /* add SpecializationActive[SetDictNode.doPythonObjectNotClass(PythonObject, PDict, DynamicObjectLibrary)] */; this.state_0_.set(arg0Value, state_0); SetDictNode.doPythonObjectNotClass(arg1Value_, arg2Value, dylib_1); return; } } if (arg1Value instanceof PythonAbstractNativeObject) { PythonAbstractNativeObject arg1Value_ = (PythonAbstractNativeObject) arg1Value; NativeObjectData s2_ = arg0Value.insert(new NativeObjectData()); PythonToNativeNode objectToSulong__ = s2_.insert((PythonToNativeNodeGen.create())); Objects.requireNonNull(objectToSulong__, "Specialization 'doNativeObject(PythonAbstractNativeObject, PDict, PythonToNativeNode, PythonToNativeNode, PCallCapiFunction, CheckPrimitiveFunctionResultNode)' cache 'objectToSulong' returned a 'null' 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 'null'."); s2_.objectToSulong_ = objectToSulong__; PythonToNativeNode dictToSulong__ = s2_.insert((PythonToNativeNodeGen.create())); Objects.requireNonNull(dictToSulong__, "Specialization 'doNativeObject(PythonAbstractNativeObject, PDict, PythonToNativeNode, PythonToNativeNode, PCallCapiFunction, CheckPrimitiveFunctionResultNode)' cache 'dictToSulong' returned a 'null' 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 'null'."); s2_.dictToSulong_ = dictToSulong__; PCallCapiFunction callGetDictNode__ = s2_.insert((PCallCapiFunction.create())); Objects.requireNonNull(callGetDictNode__, "Specialization 'doNativeObject(PythonAbstractNativeObject, PDict, PythonToNativeNode, PythonToNativeNode, PCallCapiFunction, CheckPrimitiveFunctionResultNode)' cache 'callGetDictNode' returned a 'null' 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 'null'."); s2_.callGetDictNode_ = callGetDictNode__; CheckPrimitiveFunctionResultNode checkResult__ = s2_.insert((CheckPrimitiveFunctionResultNodeGen.create())); Objects.requireNonNull(checkResult__, "Specialization 'doNativeObject(PythonAbstractNativeObject, PDict, PythonToNativeNode, PythonToNativeNode, PCallCapiFunction, CheckPrimitiveFunctionResultNode)' cache 'checkResult' returned a 'null' 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 'null'."); s2_.checkResult_ = checkResult__; VarHandle.storeStoreFence(); this.nativeObject_cache.set(arg0Value, s2_); state_0 = state_0 | 0b100 /* add SpecializationActive[SetDictNode.doNativeObject(PythonAbstractNativeObject, PDict, PythonToNativeNode, PythonToNativeNode, PCallCapiFunction, CheckPrimitiveFunctionResultNode)] */; this.state_0_.set(arg0Value, state_0); doNativeObject(arg1Value_, arg2Value, objectToSulong__, dictToSulong__, callGetDictNode__, checkResult__); return; } throw new UnsupportedSpecializationException(this, new Node[] {null, null, null}, arg0Value, arg1Value, arg2Value); } @Override public boolean isAdoptable() { return false; } } @GeneratedBy(SetDictNode.class) @DenyReplace private static final class NativeObjectData extends Node implements SpecializationDataNode { /** * Source Info:
         *   Specialization: {@link SetDictNode#doNativeObject}
         *   Parameter: {@link PythonToNativeNode} objectToSulong
*/ @Child PythonToNativeNode objectToSulong_; /** * Source Info:
         *   Specialization: {@link SetDictNode#doNativeObject}
         *   Parameter: {@link PythonToNativeNode} dictToSulong
*/ @Child PythonToNativeNode dictToSulong_; /** * Source Info:
         *   Specialization: {@link SetDictNode#doNativeObject}
         *   Parameter: {@link PCallCapiFunction} callGetDictNode
*/ @Child PCallCapiFunction callGetDictNode_; /** * Source Info:
         *   Specialization: {@link SetDictNode#doNativeObject}
         *   Parameter: {@link CheckPrimitiveFunctionResultNode} checkResult
*/ @Child CheckPrimitiveFunctionResultNode checkResult_; NativeObjectData() { } @Override public NodeCost getCost() { return NodeCost.NONE; } } @GeneratedBy(SetDictNode.class) @DenyReplace private static final class Uncached extends SetDictNode { @TruffleBoundary @Override public void execute(Node arg0Value, Object arg1Value, PDict arg2Value) { if (arg1Value instanceof PythonClass) { PythonClass arg1Value_ = (PythonClass) arg1Value; SetDictNode.doPythonClass(arg0Value, arg1Value_, arg2Value, (DYNAMIC_OBJECT_LIBRARY_.getUncached()), (InlinedBranchProfile.getUncached())); return; } if (arg1Value instanceof PythonObject) { PythonObject arg1Value_ = (PythonObject) arg1Value; if ((!(SetDictNode.isPythonClass(arg1Value_)))) { SetDictNode.doPythonObjectNotClass(arg1Value_, arg2Value, (DYNAMIC_OBJECT_LIBRARY_.getUncached())); return; } } if (arg1Value instanceof PythonAbstractNativeObject) { PythonAbstractNativeObject arg1Value_ = (PythonAbstractNativeObject) arg1Value; doNativeObject(arg1Value_, arg2Value, (PythonToNativeNodeGen.getUncached()), (PythonToNativeNodeGen.getUncached()), (PCallCapiFunction.getUncached()), (CheckPrimitiveFunctionResultNodeGen.getUncached())); return; } throw new UnsupportedSpecializationException(this, new Node[] {null, null, null}, arg0Value, arg1Value, arg2Value); } @Override public NodeCost getCost() { return NodeCost.MEGAMORPHIC; } @Override public boolean isAdoptable() { return false; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy