com.oracle.graal.python.nodes.call.CallDispatchNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.nodes.call;
import com.oracle.graal.python.builtins.objects.code.PCode;
import com.oracle.graal.python.builtins.objects.code.CodeNodes.GetCodeCallTargetNode;
import com.oracle.graal.python.builtins.objects.code.CodeNodesFactory.GetCodeCallTargetNodeGen;
import com.oracle.graal.python.builtins.objects.function.PBuiltinFunction;
import com.oracle.graal.python.builtins.objects.function.PFunction;
import com.oracle.graal.python.builtins.objects.object.PythonObject;
import com.oracle.graal.python.nodes.builtins.FunctionNodes.GetFunctionCodeNode;
import com.oracle.graal.python.nodes.builtins.FunctionNodesFactory.GetFunctionCodeNodeGen;
import com.oracle.graal.python.runtime.PythonOptions;
import com.oracle.truffle.api.Assumption;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.RootCallTarget;
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.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.frame.Frame;
import com.oracle.truffle.api.frame.VirtualFrame;
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.NodeCost;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles.Lookup;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link CallDispatchNode#callFunctionCached}
* Activation probability: 0.23929
* With/without class size: 10/8 bytes
* Specialization {@link CallDispatchNode#callFunctionCachedCode}
* Activation probability: 0.20714
* With/without class size: 12/17 bytes
* Specialization {@link CallDispatchNode#callFunctionCachedCt}
* Activation probability: 0.17500
* With/without class size: 10/13 bytes
* Specialization {@link CallDispatchNode#callBuiltinFunctionCached}
* Activation probability: 0.14286
* With/without class size: 8/8 bytes
* Specialization {@link CallDispatchNode#callBuiltinFunctionCachedCt}
* Activation probability: 0.11071
* With/without class size: 7/8 bytes
* Specialization {@link CallDispatchNode#callFunctionUncached}
* Activation probability: 0.07857
* With/without class size: 4/0 bytes
* Specialization {@link CallDispatchNode#callBuiltinFunctionUncached}
* Activation probability: 0.04643
* With/without class size: 4/0 bytes
*
*/
@GeneratedBy(CallDispatchNode.class)
@SuppressWarnings("javadoc")
public final class CallDispatchNodeGen extends CallDispatchNode {
private static final StateField CALL_FUNCTION_CACHED_CODE__CALL_DISPATCH_NODE_CALL_FUNCTION_CACHED_CODE_STATE_0_UPDATER = StateField.create(CallFunctionCachedCodeData.lookup_(), "callFunctionCachedCode_state_0_");
private static final StateField CALL_FUNCTION_CACHED_CT__CALL_DISPATCH_NODE_CALL_FUNCTION_CACHED_CT_STATE_0_UPDATER = StateField.create(CallFunctionCachedCtData.lookup_(), "callFunctionCachedCt_state_0_");
static final ReferenceField CALL_FUNCTION_CACHED_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "callFunctionCached_cache", CallFunctionCachedData.class);
static final ReferenceField CALL_FUNCTION_CACHED_CODE_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "callFunctionCachedCode_cache", CallFunctionCachedCodeData.class);
static final ReferenceField CALL_FUNCTION_CACHED_CT_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "callFunctionCachedCt_cache", CallFunctionCachedCtData.class);
static final ReferenceField CALL_BUILTIN_FUNCTION_CACHED_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "callBuiltinFunctionCached_cache", CallBuiltinFunctionCachedData.class);
static final ReferenceField CALL_BUILTIN_FUNCTION_CACHED_CT_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "callBuiltinFunctionCachedCt_cache", CallBuiltinFunctionCachedCtData.class);
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callFunctionCachedCode}
* Parameter: {@link GetFunctionCodeNode} getFunctionCodeNode
* Inline method: {@link GetFunctionCodeNodeGen#inline}
*/
private static final GetFunctionCodeNode INLINED_CALL_FUNCTION_CACHED_CODE_GET_FUNCTION_CODE_NODE_ = GetFunctionCodeNodeGen.inline(InlineTarget.create(GetFunctionCodeNode.class, CALL_FUNCTION_CACHED_CODE__CALL_DISPATCH_NODE_CALL_FUNCTION_CACHED_CODE_STATE_0_UPDATER.subUpdater(0, 2), ReferenceField.create(CallFunctionCachedCodeData.lookup_(), "callFunctionCachedCode_getFunctionCodeNode__field1_", Object.class)));
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callFunctionCachedCt}
* Parameter: {@link GetCodeCallTargetNode} getCt
* Inline method: {@link GetCodeCallTargetNodeGen#inline}
*/
private static final GetCodeCallTargetNode INLINED_CALL_FUNCTION_CACHED_CT_GET_CT_ = GetCodeCallTargetNodeGen.inline(InlineTarget.create(GetCodeCallTargetNode.class, CALL_FUNCTION_CACHED_CT__CALL_DISPATCH_NODE_CALL_FUNCTION_CACHED_CT_STATE_0_UPDATER.subUpdater(0, 4), ReferenceField.create(CallFunctionCachedCtData.lookup_(), "callFunctionCachedCt_getCt__field1_", Object.class)));
private static final Uncached UNCACHED = new Uncached();
/**
* State Info:
* 0: SpecializationActive {@link CallDispatchNode#callFunctionCached}
* 1: SpecializationActive {@link CallDispatchNode#callFunctionCachedCode}
* 2: SpecializationActive {@link CallDispatchNode#callFunctionCachedCt}
* 3: SpecializationActive {@link CallDispatchNode#callFunctionUncached}
* 4: SpecializationActive {@link CallDispatchNode#callBuiltinFunctionCached}
* 5: SpecializationActive {@link CallDispatchNode#callBuiltinFunctionUncached}
* 6: SpecializationActive {@link CallDispatchNode#callBuiltinFunctionCachedCt}
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callFunctionUncached}
* Parameter: {@link GenericInvokeNode} invoke
*/
@Child private GenericInvokeNode invoke;
@UnsafeAccessedField @Child private CallFunctionCachedData callFunctionCached_cache;
@UnsafeAccessedField @Child private CallFunctionCachedCodeData callFunctionCachedCode_cache;
@UnsafeAccessedField @Child private CallFunctionCachedCtData callFunctionCachedCt_cache;
@UnsafeAccessedField @Child private CallBuiltinFunctionCachedData callBuiltinFunctionCached_cache;
@UnsafeAccessedField @Child private CallBuiltinFunctionCachedCtData callBuiltinFunctionCachedCt_cache;
private CallDispatchNodeGen() {
}
@ExplodeLoop
@Override
protected Object executeInternal(Frame frameValue, PBuiltinFunction arg0Value, Object[] arg1Value) {
int state_0 = this.state_0_;
if ((state_0 & 0b1110000) != 0 /* is SpecializationActive[CallDispatchNode.callBuiltinFunctionCached(VirtualFrame, PBuiltinFunction, Object[], PBuiltinFunction, FunctionInvokeNode)] || SpecializationActive[CallDispatchNode.callBuiltinFunctionCachedCt(VirtualFrame, PBuiltinFunction, Object[], RootCallTarget, CallTargetInvokeNode)] || SpecializationActive[CallDispatchNode.callBuiltinFunctionUncached(Frame, PBuiltinFunction, Object[], GenericInvokeNode)] */) {
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[CallDispatchNode.callBuiltinFunctionCached(VirtualFrame, PBuiltinFunction, Object[], PBuiltinFunction, FunctionInvokeNode)] */) {
assert DSLSupport.assertIdempotence((isSingleContext()));
CallBuiltinFunctionCachedData s3_ = this.callBuiltinFunctionCached_cache;
while (s3_ != null) {
if ((arg0Value == s3_.cachedCallee_)) {
return CallDispatchNode.callBuiltinFunctionCached((VirtualFrame) frameValue, arg0Value, arg1Value, s3_.cachedCallee_, s3_.invoke_);
}
s3_ = s3_.next_;
}
}
if ((state_0 & 0b1000000) != 0 /* is SpecializationActive[CallDispatchNode.callBuiltinFunctionCachedCt(VirtualFrame, PBuiltinFunction, Object[], RootCallTarget, CallTargetInvokeNode)] */) {
CallBuiltinFunctionCachedCtData s4_ = this.callBuiltinFunctionCachedCt_cache;
while (s4_ != null) {
if ((arg0Value.getCallTarget() == s4_.ct_)) {
return CallDispatchNode.callBuiltinFunctionCachedCt((VirtualFrame) frameValue, arg0Value, arg1Value, s4_.ct_, s4_.invoke_);
}
s4_ = s4_.next_;
}
}
if ((state_0 & 0b100000) != 0 /* is SpecializationActive[CallDispatchNode.callBuiltinFunctionUncached(Frame, PBuiltinFunction, Object[], GenericInvokeNode)] */) {
{
GenericInvokeNode invoke_ = this.invoke;
if (invoke_ != null) {
return CallDispatchNode.callBuiltinFunctionUncached(frameValue, arg0Value, arg1Value, invoke_);
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(frameValue, arg0Value, arg1Value);
}
@ExplodeLoop
@Override
protected Object executeInternal(Frame frameValue, PFunction arg0Value, Object[] arg1Value) {
int state_0 = this.state_0_;
if ((state_0 & 0b1111) != 0 /* is SpecializationActive[CallDispatchNode.callFunctionCached(VirtualFrame, PFunction, Object[], PFunction, FunctionInvokeNode)] || SpecializationActive[CallDispatchNode.callFunctionCachedCode(VirtualFrame, PFunction, Object[], Node, PFunction, GetFunctionCodeNode, PCode, FunctionInvokeNode)] || SpecializationActive[CallDispatchNode.callFunctionCachedCt(VirtualFrame, PFunction, Object[], Node, RootCallTarget, GetCodeCallTargetNode, CallTargetInvokeNode)] || SpecializationActive[CallDispatchNode.callFunctionUncached(Frame, PFunction, Object[], GenericInvokeNode)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[CallDispatchNode.callFunctionCached(VirtualFrame, PFunction, Object[], PFunction, FunctionInvokeNode)] */) {
assert DSLSupport.assertIdempotence((isSingleContext()));
CallFunctionCachedData s0_ = this.callFunctionCached_cache;
while (s0_ != null) {
if (!Assumption.isValidAssumption(s0_.assumption0_)) {
CompilerDirectives.transferToInterpreterAndInvalidate();
removeCallFunctionCached_(s0_);
return executeAndSpecialize(frameValue, arg0Value, arg1Value);
}
if ((arg0Value == s0_.cachedCallee_)) {
return CallDispatchNode.callFunctionCached((VirtualFrame) frameValue, arg0Value, arg1Value, s0_.cachedCallee_, s0_.invoke_);
}
s0_ = s0_.next_;
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[CallDispatchNode.callFunctionCachedCode(VirtualFrame, PFunction, Object[], Node, PFunction, GetFunctionCodeNode, PCode, FunctionInvokeNode)] */) {
assert DSLSupport.assertIdempotence((isSingleContext()));
CallFunctionCachedCodeData s1_ = this.callFunctionCachedCode_cache;
while (s1_ != null) {
if ((arg0Value == s1_.cachedCallee_)) {
Node inliningTarget__ = (s1_);
if ((getCode(inliningTarget__, INLINED_CALL_FUNCTION_CACHED_CODE_GET_FUNCTION_CODE_NODE_, arg0Value) == s1_.cachedCode_)) {
return CallDispatchNode.callFunctionCachedCode((VirtualFrame) frameValue, arg0Value, arg1Value, inliningTarget__, s1_.cachedCallee_, INLINED_CALL_FUNCTION_CACHED_CODE_GET_FUNCTION_CODE_NODE_, s1_.cachedCode_, s1_.invoke_);
}
}
s1_ = s1_.next_;
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[CallDispatchNode.callFunctionCachedCt(VirtualFrame, PFunction, Object[], Node, RootCallTarget, GetCodeCallTargetNode, CallTargetInvokeNode)] */) {
CallFunctionCachedCtData s2_ = this.callFunctionCachedCt_cache;
while (s2_ != null) {
{
Node inliningTarget__1 = (s2_);
if ((INLINED_CALL_FUNCTION_CACHED_CT_GET_CT_.execute(inliningTarget__1, arg0Value.getCode()) == s2_.ct_)) {
return CallDispatchNode.callFunctionCachedCt((VirtualFrame) frameValue, arg0Value, arg1Value, inliningTarget__1, s2_.ct_, INLINED_CALL_FUNCTION_CACHED_CT_GET_CT_, s2_.invoke_);
}
}
s2_ = s2_.next_;
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[CallDispatchNode.callFunctionUncached(Frame, PFunction, Object[], GenericInvokeNode)] */) {
{
GenericInvokeNode invoke_1 = this.invoke;
if (invoke_1 != null) {
return CallDispatchNode.callFunctionUncached(frameValue, arg0Value, arg1Value, invoke_1);
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(frameValue, arg0Value, arg1Value);
}
private Object executeAndSpecialize(Frame frameValue, PythonObject arg0Value, Object[] arg1Value) {
int state_0 = this.state_0_;
int oldState_0 = state_0;
try {
if (arg0Value instanceof PFunction) {
PFunction arg0Value_ = (PFunction) arg0Value;
if (((state_0 & 0b1110)) == 0 /* is-not SpecializationActive[CallDispatchNode.callFunctionCachedCode(VirtualFrame, PFunction, Object[], Node, PFunction, GetFunctionCodeNode, PCode, FunctionInvokeNode)] && SpecializationActive[CallDispatchNode.callFunctionCachedCt(VirtualFrame, PFunction, Object[], Node, RootCallTarget, GetCodeCallTargetNode, CallTargetInvokeNode)] && SpecializationActive[CallDispatchNode.callFunctionUncached(Frame, PFunction, Object[], GenericInvokeNode)] */ && (isSingleContext())) {
while (true) {
int count0_ = 0;
CallFunctionCachedData s0_ = CALL_FUNCTION_CACHED_CACHE_UPDATER.getVolatile(this);
CallFunctionCachedData s0_original = s0_;
while (s0_ != null) {
if ((arg0Value_ == s0_.cachedCallee_) && Assumption.isValidAssumption(s0_.assumption0_)) {
break;
}
count0_++;
s0_ = s0_.next_;
}
if (s0_ == null) {
{
PFunction cachedCallee__ = (arg0Value_);
// assert (arg0Value_ == s0_.cachedCallee_);
Assumption assumption0 = (cachedCallee__.getCodeStableAssumption());
if (Assumption.isValidAssumption(assumption0)) {
if (count0_ < (PythonOptions.getCallSiteInlineCacheMaxDepth())) {
s0_ = this.insert(new CallFunctionCachedData(s0_original));
s0_.cachedCallee_ = cachedCallee__;
FunctionInvokeNode invoke__ = s0_.insert((CallDispatchNode.createInvokeNode(cachedCallee__)));
Objects.requireNonNull(invoke__, "Specialization 'callFunctionCached(VirtualFrame, PFunction, Object[], PFunction, FunctionInvokeNode)' cache 'invoke' 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'.");
s0_.invoke_ = invoke__;
s0_.assumption0_ = assumption0;
if (!CALL_FUNCTION_CACHED_CACHE_UPDATER.compareAndSet(this, s0_original, s0_)) {
continue;
}
state_0 = state_0 | 0b1 /* add SpecializationActive[CallDispatchNode.callFunctionCached(VirtualFrame, PFunction, Object[], PFunction, FunctionInvokeNode)] */;
this.state_0_ = state_0;
}
}
}
}
if (s0_ != null) {
return CallDispatchNode.callFunctionCached((VirtualFrame) frameValue, arg0Value_, arg1Value, s0_.cachedCallee_, s0_.invoke_);
}
break;
}
}
{
Node inliningTarget__ = null;
if (((state_0 & 0b1100)) == 0 /* is-not SpecializationActive[CallDispatchNode.callFunctionCachedCt(VirtualFrame, PFunction, Object[], Node, RootCallTarget, GetCodeCallTargetNode, CallTargetInvokeNode)] && SpecializationActive[CallDispatchNode.callFunctionUncached(Frame, PFunction, Object[], GenericInvokeNode)] */ && (isSingleContext())) {
while (true) {
int count1_ = 0;
CallFunctionCachedCodeData s1_ = CALL_FUNCTION_CACHED_CODE_CACHE_UPDATER.getVolatile(this);
CallFunctionCachedCodeData s1_original = s1_;
while (s1_ != null) {
if ((arg0Value_ == s1_.cachedCallee_)) {
inliningTarget__ = (s1_);
if ((getCode(inliningTarget__, INLINED_CALL_FUNCTION_CACHED_CODE_GET_FUNCTION_CODE_NODE_, arg0Value_) == s1_.cachedCode_)) {
break;
}
}
count1_++;
s1_ = s1_.next_;
}
if (s1_ == null) {
{
s1_ = this.insert(new CallFunctionCachedCodeData(s1_original));
inliningTarget__ = (s1_);
PCode cachedCode__ = (getCode(inliningTarget__, INLINED_CALL_FUNCTION_CACHED_CODE_GET_FUNCTION_CODE_NODE_, arg0Value_));
// assert (arg0Value_ == s1_.cachedCallee_);
if ((getCode(inliningTarget__, INLINED_CALL_FUNCTION_CACHED_CODE_GET_FUNCTION_CODE_NODE_, arg0Value_) == cachedCode__) && count1_ < (PythonOptions.getCallSiteInlineCacheMaxDepth())) {
s1_.cachedCallee_ = (arg0Value_);
s1_.cachedCode_ = cachedCode__;
FunctionInvokeNode invoke__1 = s1_.insert((CallDispatchNode.createInvokeNode(s1_.cachedCallee_)));
Objects.requireNonNull(invoke__1, "Specialization 'callFunctionCachedCode(VirtualFrame, PFunction, Object[], Node, PFunction, GetFunctionCodeNode, PCode, FunctionInvokeNode)' cache 'invoke' 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'.");
s1_.invoke_ = invoke__1;
if (!CALL_FUNCTION_CACHED_CODE_CACHE_UPDATER.compareAndSet(this, s1_original, s1_)) {
continue;
}
this.callFunctionCached_cache = null;
state_0 = state_0 & 0xfffffffe /* remove SpecializationActive[CallDispatchNode.callFunctionCached(VirtualFrame, PFunction, Object[], PFunction, FunctionInvokeNode)] */;
state_0 = state_0 | 0b10 /* add SpecializationActive[CallDispatchNode.callFunctionCachedCode(VirtualFrame, PFunction, Object[], Node, PFunction, GetFunctionCodeNode, PCode, FunctionInvokeNode)] */;
this.state_0_ = state_0;
} else {
s1_ = null;
}
}
}
if (s1_ != null) {
return CallDispatchNode.callFunctionCachedCode((VirtualFrame) frameValue, arg0Value_, arg1Value, inliningTarget__, s1_.cachedCallee_, INLINED_CALL_FUNCTION_CACHED_CODE_GET_FUNCTION_CODE_NODE_, s1_.cachedCode_, s1_.invoke_);
}
break;
}
}
}
{
Node inliningTarget__1 = null;
if (((state_0 & 0b1000)) == 0 /* is-not SpecializationActive[CallDispatchNode.callFunctionUncached(Frame, PFunction, Object[], GenericInvokeNode)] */) {
while (true) {
int count2_ = 0;
CallFunctionCachedCtData s2_ = CALL_FUNCTION_CACHED_CT_CACHE_UPDATER.getVolatile(this);
CallFunctionCachedCtData s2_original = s2_;
while (s2_ != null) {
{
inliningTarget__1 = (s2_);
if ((INLINED_CALL_FUNCTION_CACHED_CT_GET_CT_.execute(inliningTarget__1, arg0Value_.getCode()) == s2_.ct_)) {
break;
}
}
count2_++;
s2_ = s2_.next_;
}
if (s2_ == null) {
{
s2_ = this.insert(new CallFunctionCachedCtData(s2_original));
inliningTarget__1 = (s2_);
RootCallTarget ct__ = (CallDispatchNode.getCallTargetUncached(arg0Value_));
if ((INLINED_CALL_FUNCTION_CACHED_CT_GET_CT_.execute(inliningTarget__1, arg0Value_.getCode()) == ct__) && count2_ < (PythonOptions.getCallSiteInlineCacheMaxDepth())) {
s2_.ct_ = ct__;
CallTargetInvokeNode invoke__2 = s2_.insert((CallDispatchNode.createCtInvokeNode(arg0Value_)));
Objects.requireNonNull(invoke__2, "Specialization 'callFunctionCachedCt(VirtualFrame, PFunction, Object[], Node, RootCallTarget, GetCodeCallTargetNode, CallTargetInvokeNode)' cache 'invoke' 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_.invoke_ = invoke__2;
if (!CALL_FUNCTION_CACHED_CT_CACHE_UPDATER.compareAndSet(this, s2_original, s2_)) {
continue;
}
this.callFunctionCached_cache = null;
this.callFunctionCachedCode_cache = null;
state_0 = state_0 & 0xfffffffc /* remove SpecializationActive[CallDispatchNode.callFunctionCached(VirtualFrame, PFunction, Object[], PFunction, FunctionInvokeNode)], SpecializationActive[CallDispatchNode.callFunctionCachedCode(VirtualFrame, PFunction, Object[], Node, PFunction, GetFunctionCodeNode, PCode, FunctionInvokeNode)] */;
state_0 = state_0 | 0b100 /* add SpecializationActive[CallDispatchNode.callFunctionCachedCt(VirtualFrame, PFunction, Object[], Node, RootCallTarget, GetCodeCallTargetNode, CallTargetInvokeNode)] */;
this.state_0_ = state_0;
} else {
s2_ = null;
}
}
}
if (s2_ != null) {
return CallDispatchNode.callFunctionCachedCt((VirtualFrame) frameValue, arg0Value_, arg1Value, inliningTarget__1, s2_.ct_, INLINED_CALL_FUNCTION_CACHED_CT_GET_CT_, s2_.invoke_);
}
break;
}
}
}
}
if (arg0Value instanceof PBuiltinFunction) {
PBuiltinFunction arg0Value_ = (PBuiltinFunction) arg0Value;
if (((state_0 & 0b100000)) == 0 /* is-not SpecializationActive[CallDispatchNode.callBuiltinFunctionUncached(Frame, PBuiltinFunction, Object[], GenericInvokeNode)] */ && (isSingleContext())) {
while (true) {
int count3_ = 0;
CallBuiltinFunctionCachedData s3_ = CALL_BUILTIN_FUNCTION_CACHED_CACHE_UPDATER.getVolatile(this);
CallBuiltinFunctionCachedData s3_original = s3_;
while (s3_ != null) {
if ((arg0Value_ == s3_.cachedCallee_)) {
break;
}
count3_++;
s3_ = s3_.next_;
}
if (s3_ == null) {
// assert (arg0Value_ == s3_.cachedCallee_);
if (count3_ < (PythonOptions.getCallSiteInlineCacheMaxDepth())) {
s3_ = this.insert(new CallBuiltinFunctionCachedData(s3_original));
s3_.cachedCallee_ = (arg0Value_);
FunctionInvokeNode invoke__3 = s3_.insert((CallDispatchNode.createInvokeNode(s3_.cachedCallee_)));
Objects.requireNonNull(invoke__3, "Specialization 'callBuiltinFunctionCached(VirtualFrame, PBuiltinFunction, Object[], PBuiltinFunction, FunctionInvokeNode)' cache 'invoke' 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'.");
s3_.invoke_ = invoke__3;
if (!CALL_BUILTIN_FUNCTION_CACHED_CACHE_UPDATER.compareAndSet(this, s3_original, s3_)) {
continue;
}
state_0 = state_0 | 0b10000 /* add SpecializationActive[CallDispatchNode.callBuiltinFunctionCached(VirtualFrame, PBuiltinFunction, Object[], PBuiltinFunction, FunctionInvokeNode)] */;
this.state_0_ = state_0;
}
}
if (s3_ != null) {
return CallDispatchNode.callBuiltinFunctionCached((VirtualFrame) frameValue, arg0Value_, arg1Value, s3_.cachedCallee_, s3_.invoke_);
}
break;
}
}
if (((state_0 & 0b100000)) == 0 /* is-not SpecializationActive[CallDispatchNode.callBuiltinFunctionUncached(Frame, PBuiltinFunction, Object[], GenericInvokeNode)] */) {
while (true) {
int count4_ = 0;
CallBuiltinFunctionCachedCtData s4_ = CALL_BUILTIN_FUNCTION_CACHED_CT_CACHE_UPDATER.getVolatile(this);
CallBuiltinFunctionCachedCtData s4_original = s4_;
while (s4_ != null) {
if ((arg0Value_.getCallTarget() == s4_.ct_)) {
break;
}
count4_++;
s4_ = s4_.next_;
}
if (s4_ == null) {
{
RootCallTarget ct__1 = (arg0Value_.getCallTarget());
if ((arg0Value_.getCallTarget() == ct__1) && count4_ < (PythonOptions.getCallSiteInlineCacheMaxDepth())) {
s4_ = this.insert(new CallBuiltinFunctionCachedCtData(s4_original));
s4_.ct_ = ct__1;
CallTargetInvokeNode invoke__4 = s4_.insert((CallDispatchNode.createCtInvokeNode(arg0Value_)));
Objects.requireNonNull(invoke__4, "Specialization 'callBuiltinFunctionCachedCt(VirtualFrame, PBuiltinFunction, Object[], RootCallTarget, CallTargetInvokeNode)' cache 'invoke' 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'.");
s4_.invoke_ = invoke__4;
if (!CALL_BUILTIN_FUNCTION_CACHED_CT_CACHE_UPDATER.compareAndSet(this, s4_original, s4_)) {
continue;
}
state_0 = state_0 | 0b1000000 /* add SpecializationActive[CallDispatchNode.callBuiltinFunctionCachedCt(VirtualFrame, PBuiltinFunction, Object[], RootCallTarget, CallTargetInvokeNode)] */;
this.state_0_ = state_0;
}
}
}
if (s4_ != null) {
return CallDispatchNode.callBuiltinFunctionCachedCt((VirtualFrame) frameValue, arg0Value_, arg1Value, s4_.ct_, s4_.invoke_);
}
break;
}
}
}
if (arg0Value instanceof PFunction) {
PFunction arg0Value_ = (PFunction) arg0Value;
GenericInvokeNode invoke_1;
GenericInvokeNode invoke_1_shared = this.invoke;
if (invoke_1_shared != null) {
invoke_1 = invoke_1_shared;
} else {
invoke_1 = this.insert((GenericInvokeNode.create()));
if (invoke_1 == null) {
throw new IllegalStateException("Specialization 'callFunctionUncached(Frame, PFunction, Object[], GenericInvokeNode)' contains a shared cache with name 'invoke' 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.invoke == null) {
VarHandle.storeStoreFence();
this.invoke = invoke_1;
}
this.callFunctionCached_cache = null;
this.callFunctionCachedCode_cache = null;
this.callFunctionCachedCt_cache = null;
state_0 = state_0 & 0xfffffff8 /* remove SpecializationActive[CallDispatchNode.callFunctionCached(VirtualFrame, PFunction, Object[], PFunction, FunctionInvokeNode)], SpecializationActive[CallDispatchNode.callFunctionCachedCode(VirtualFrame, PFunction, Object[], Node, PFunction, GetFunctionCodeNode, PCode, FunctionInvokeNode)], SpecializationActive[CallDispatchNode.callFunctionCachedCt(VirtualFrame, PFunction, Object[], Node, RootCallTarget, GetCodeCallTargetNode, CallTargetInvokeNode)] */;
state_0 = state_0 | 0b1000 /* add SpecializationActive[CallDispatchNode.callFunctionUncached(Frame, PFunction, Object[], GenericInvokeNode)] */;
this.state_0_ = state_0;
return CallDispatchNode.callFunctionUncached(frameValue, arg0Value_, arg1Value, invoke_1);
}
if (arg0Value instanceof PBuiltinFunction) {
PBuiltinFunction arg0Value_ = (PBuiltinFunction) arg0Value;
GenericInvokeNode invoke_;
GenericInvokeNode invoke__shared = this.invoke;
if (invoke__shared != null) {
invoke_ = invoke__shared;
} else {
invoke_ = this.insert((GenericInvokeNode.create()));
if (invoke_ == null) {
throw new IllegalStateException("Specialization 'callBuiltinFunctionUncached(Frame, PBuiltinFunction, Object[], GenericInvokeNode)' contains a shared cache with name 'invoke' 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.invoke == null) {
VarHandle.storeStoreFence();
this.invoke = invoke_;
}
this.callBuiltinFunctionCached_cache = null;
this.callBuiltinFunctionCachedCt_cache = null;
state_0 = state_0 & 0xffffffaf /* remove SpecializationActive[CallDispatchNode.callBuiltinFunctionCached(VirtualFrame, PBuiltinFunction, Object[], PBuiltinFunction, FunctionInvokeNode)], SpecializationActive[CallDispatchNode.callBuiltinFunctionCachedCt(VirtualFrame, PBuiltinFunction, Object[], RootCallTarget, CallTargetInvokeNode)] */;
state_0 = state_0 | 0b100000 /* add SpecializationActive[CallDispatchNode.callBuiltinFunctionUncached(Frame, PBuiltinFunction, Object[], GenericInvokeNode)] */;
this.state_0_ = state_0;
return CallDispatchNode.callBuiltinFunctionUncached(frameValue, arg0Value_, arg1Value, invoke_);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
} finally {
if (oldState_0 != 0) {
checkForPolymorphicSpecialize(oldState_0);
}
}
}
private void checkForPolymorphicSpecialize(int oldState_0) {
if (((oldState_0 & 0b101000) == 0 && (state_0_ & 0b101000) != 0)) {
this.reportPolymorphicSpecialize();
}
}
@Override
public NodeCost getCost() {
int state_0 = this.state_0_;
if (state_0 == 0) {
return NodeCost.UNINITIALIZED;
} else {
if ((state_0 & (state_0 - 1)) == 0 /* is-single */) {
CallFunctionCachedData s0_ = this.callFunctionCached_cache;
CallFunctionCachedCodeData s1_ = this.callFunctionCachedCode_cache;
CallFunctionCachedCtData s2_ = this.callFunctionCachedCt_cache;
CallBuiltinFunctionCachedData s3_ = this.callBuiltinFunctionCached_cache;
CallBuiltinFunctionCachedCtData s4_ = this.callBuiltinFunctionCachedCt_cache;
if ((s0_ == null || s0_.next_ == null) && (s1_ == null || s1_.next_ == null) && (s2_ == null || s2_.next_ == null) && (s3_ == null || s3_.next_ == null) && (s4_ == null || s4_.next_ == null)) {
return NodeCost.MONOMORPHIC;
}
}
}
return NodeCost.POLYMORPHIC;
}
void removeCallFunctionCached_(CallFunctionCachedData s0_) {
while (true) {
CallFunctionCachedData cur = this.callFunctionCached_cache;
CallFunctionCachedData original = cur;
CallFunctionCachedData update = null;
while (cur != null) {
if (cur == s0_) {
if (cur == original) {
update = cur.next_;
} else {
update = original.remove(this, s0_);
}
break;
}
cur = cur.next_;
}
if (cur != null && !CALL_FUNCTION_CACHED_CACHE_UPDATER.compareAndSet(this, original, update)) {
continue;
}
break;
}
}
@NeverDefault
public static CallDispatchNode create() {
return new CallDispatchNodeGen();
}
@NeverDefault
public static CallDispatchNode getUncached() {
return CallDispatchNodeGen.UNCACHED;
}
@GeneratedBy(CallDispatchNode.class)
@DenyReplace
private static final class CallFunctionCachedData extends Node implements SpecializationDataNode {
@Child CallFunctionCachedData next_;
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callFunctionCached}
* Parameter: {@link PFunction} cachedCallee
*/
@CompilationFinal PFunction cachedCallee_;
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callFunctionCached}
* Parameter: {@link FunctionInvokeNode} invoke
*/
@Child FunctionInvokeNode invoke_;
@CompilationFinal Assumption assumption0_;
CallFunctionCachedData(CallFunctionCachedData next_) {
this.next_ = next_;
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
CallFunctionCachedData remove(Node parent, CallFunctionCachedData search) {
CallFunctionCachedData newNext = this.next_;
if (newNext != null) {
if (search == newNext) {
newNext = newNext.next_;
} else {
newNext = newNext.remove(this, search);
}
}
CallFunctionCachedData copy = parent.insert(new CallFunctionCachedData(newNext));
copy.cachedCallee_ = this.cachedCallee_;
copy.invoke_ = copy.insert(this.invoke_);
copy.assumption0_ = this.assumption0_;
return copy;
}
}
@GeneratedBy(CallDispatchNode.class)
@DenyReplace
private static final class CallFunctionCachedCodeData extends Node implements SpecializationDataNode {
@Child CallFunctionCachedCodeData next_;
/**
* State Info:
* 0-1: InlinedCache
* Specialization: {@link CallDispatchNode#callFunctionCachedCode}
* Parameter: {@link GetFunctionCodeNode} getFunctionCodeNode
* Inline method: {@link GetFunctionCodeNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int callFunctionCachedCode_state_0_;
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callFunctionCachedCode}
* Parameter: {@link PFunction} cachedCallee
*/
@CompilationFinal PFunction cachedCallee_;
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callFunctionCachedCode}
* Parameter: {@link GetFunctionCodeNode} getFunctionCodeNode
* Inline method: {@link GetFunctionCodeNodeGen#inline}
* Inline field: {@link Object} field1
*/
@CompilationFinal @UnsafeAccessedField @SuppressWarnings("unused") private Object callFunctionCachedCode_getFunctionCodeNode__field1_;
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callFunctionCachedCode}
* Parameter: {@link PCode} cachedCode
*/
@CompilationFinal PCode cachedCode_;
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callFunctionCachedCode}
* Parameter: {@link FunctionInvokeNode} invoke
*/
@Child FunctionInvokeNode invoke_;
CallFunctionCachedCodeData(CallFunctionCachedCodeData next_) {
this.next_ = next_;
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
private static Lookup lookup_() {
return MethodHandles.lookup();
}
}
@GeneratedBy(CallDispatchNode.class)
@DenyReplace
private static final class CallFunctionCachedCtData extends Node implements SpecializationDataNode {
@Child CallFunctionCachedCtData next_;
/**
* State Info:
* 0-3: InlinedCache
* Specialization: {@link CallDispatchNode#callFunctionCachedCt}
* Parameter: {@link GetCodeCallTargetNode} getCt
* Inline method: {@link GetCodeCallTargetNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int callFunctionCachedCt_state_0_;
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callFunctionCachedCt}
* Parameter: {@link RootCallTarget} ct
*/
@CompilationFinal RootCallTarget ct_;
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callFunctionCachedCt}
* Parameter: {@link GetCodeCallTargetNode} getCt
* Inline method: {@link GetCodeCallTargetNodeGen#inline}
* Inline field: {@link Object} field1
*/
@CompilationFinal @UnsafeAccessedField @SuppressWarnings("unused") private Object callFunctionCachedCt_getCt__field1_;
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callFunctionCachedCt}
* Parameter: {@link CallTargetInvokeNode} invoke
*/
@Child CallTargetInvokeNode invoke_;
CallFunctionCachedCtData(CallFunctionCachedCtData next_) {
this.next_ = next_;
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
private static Lookup lookup_() {
return MethodHandles.lookup();
}
}
@GeneratedBy(CallDispatchNode.class)
@DenyReplace
private static final class CallBuiltinFunctionCachedData extends Node implements SpecializationDataNode {
@Child CallBuiltinFunctionCachedData next_;
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callBuiltinFunctionCached}
* Parameter: {@link PBuiltinFunction} cachedCallee
*/
@CompilationFinal PBuiltinFunction cachedCallee_;
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callBuiltinFunctionCached}
* Parameter: {@link FunctionInvokeNode} invoke
*/
@Child FunctionInvokeNode invoke_;
CallBuiltinFunctionCachedData(CallBuiltinFunctionCachedData next_) {
this.next_ = next_;
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
}
@GeneratedBy(CallDispatchNode.class)
@DenyReplace
private static final class CallBuiltinFunctionCachedCtData extends Node implements SpecializationDataNode {
@Child CallBuiltinFunctionCachedCtData next_;
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callBuiltinFunctionCachedCt}
* Parameter: {@link RootCallTarget} ct
*/
@CompilationFinal RootCallTarget ct_;
/**
* Source Info:
* Specialization: {@link CallDispatchNode#callBuiltinFunctionCachedCt}
* Parameter: {@link CallTargetInvokeNode} invoke
*/
@Child CallTargetInvokeNode invoke_;
CallBuiltinFunctionCachedCtData(CallBuiltinFunctionCachedCtData next_) {
this.next_ = next_;
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
}
@GeneratedBy(CallDispatchNode.class)
@DenyReplace
private static final class Uncached extends CallDispatchNode {
@Override
protected Object executeInternal(Frame frameValue, PBuiltinFunction arg0Value, Object[] arg1Value) {
CompilerDirectives.transferToInterpreterAndInvalidate();
return CallDispatchNode.callBuiltinFunctionUncached(frameValue, arg0Value, arg1Value, (GenericInvokeNode.getUncached()));
}
@Override
protected Object executeInternal(Frame frameValue, PFunction arg0Value, Object[] arg1Value) {
CompilerDirectives.transferToInterpreterAndInvalidate();
return CallDispatchNode.callFunctionUncached(frameValue, arg0Value, arg1Value, (GenericInvokeNode.getUncached()));
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy