org.pkl.thirdparty.truffle.polyglot.PolyglotToHostNodeGen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pkl-tools Show documentation
Show all versions of pkl-tools Show documentation
Fat Jar containing pkl-cli, pkl-codegen-java, pkl-codegen-kotlin, pkl-config-java, pkl-core, pkl-doc, and their shaded third-party dependencies.
// CheckStyle: start generated
package org.pkl.thirdparty.truffle.polyglot;
import org.pkl.thirdparty.truffle.api.CompilerDirectives;
import org.pkl.thirdparty.truffle.api.dsl.GeneratedBy;
import org.pkl.thirdparty.truffle.api.dsl.InlineSupport;
import org.pkl.thirdparty.truffle.api.dsl.NeverDefault;
import org.pkl.thirdparty.truffle.api.dsl.InlineSupport.InlineTarget;
import org.pkl.thirdparty.truffle.api.dsl.InlineSupport.ReferenceField;
import org.pkl.thirdparty.truffle.api.dsl.InlineSupport.RequiredField;
import org.pkl.thirdparty.truffle.api.dsl.InlineSupport.StateField;
import org.pkl.thirdparty.truffle.api.nodes.DenyReplace;
import org.pkl.thirdparty.truffle.api.nodes.Node;
import java.lang.invoke.VarHandle;
import java.lang.reflect.Type;
import java.util.Objects;
import org.pkl.thirdparty.graalvm.polyglot.impl.AbstractPolyglotImpl.AbstractHostLanguageService;
/**
* Debug Info:
* Specialization {@link PolyglotToHostNode#doDefault}
* Activation probability: 1.00000
* With/without class size: 32/9 bytes
*
*/
@GeneratedBy(PolyglotToHostNode.class)
@SuppressWarnings("javadoc")
final class PolyglotToHostNodeGen {
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#host_}
*
- {@link Inlined#toHostNode__field1_}
*
*/
@NeverDefault
public static PolyglotToHostNode inline(@RequiredField(bits = 4, value = StateField.class)@RequiredField(type = Object.class, value = ReferenceField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new PolyglotToHostNodeGen.Inlined(target);
}
@GeneratedBy(PolyglotToHostNode.class)
@DenyReplace
private static final class Inlined extends PolyglotToHostNode {
/**
* State Info:
* 0: SpecializationActive {@link PolyglotToHostNode#doDefault}
* 1-3: InlinedCache
* Specialization: {@link PolyglotToHostNode#doDefault}
* Parameter: {@link Node} toHostNode
* Inline method: {@link PolyglotToHostNode#inlineToHost}
*
*/
private final StateField state_0_;
private final ReferenceField host_;
private final ReferenceField toHostNode__field1_;
/**
* Source Info:
* Specialization: {@link PolyglotToHostNode#doDefault}
* Parameter: {@link Node} toHostNode
* Inline method: {@link PolyglotToHostNode#inlineToHost}
*/
private final Node toHostNode_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(PolyglotToHostNode.class);
this.state_0_ = target.getState(0, 4);
this.host_ = target.getReference(1, AbstractHostLanguageService.class);
this.toHostNode__field1_ = target.getReference(2, Node.class);
this.toHostNode_ = PolyglotToHostNode.inlineToHost(InlineTarget.create(Node.class, state_0_.subUpdater(1, 3), toHostNode__field1_));
}
@Override
Object execute(Node arg0Value, PolyglotLanguageContext arg1Value, Object arg2Value, Class> arg3Value, Type arg4Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b1) != 0 /* is SpecializationActive[PolyglotToHostNode.doDefault(Node, PolyglotLanguageContext, Object, Class<>, Type, AbstractHostLanguageService, Node)] */) {
{
AbstractHostLanguageService host__ = this.host_.get(arg0Value);
if (host__ != null) {
assert InlineSupport.validate(arg0Value, this.state_0_, this.toHostNode__field1_);
return PolyglotToHostNode.doDefault(arg0Value, arg1Value, arg2Value, arg3Value, arg4Value, host__, this.toHostNode_);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value, arg2Value, arg3Value, arg4Value);
}
private Object executeAndSpecialize(Node arg0Value, PolyglotLanguageContext arg1Value, Object arg2Value, Class> arg3Value, Type arg4Value) {
int state_0 = this.state_0_.get(arg0Value);
AbstractHostLanguageService host__ = (arg1Value.context.engine.host);
Objects.requireNonNull(host__, "Specialization 'doDefault(Node, PolyglotLanguageContext, Object, Class<>, Type, AbstractHostLanguageService, Node)' cache 'host' 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'.");
VarHandle.storeStoreFence();
this.host_.set(arg0Value, host__);
state_0 = state_0 | 0b1 /* add SpecializationActive[PolyglotToHostNode.doDefault(Node, PolyglotLanguageContext, Object, Class<>, Type, AbstractHostLanguageService, Node)] */;
this.state_0_.set(arg0Value, state_0);
assert InlineSupport.validate(arg0Value, this.state_0_, this.toHostNode__field1_);
return PolyglotToHostNode.doDefault(arg0Value, arg1Value, arg2Value, arg3Value, arg4Value, host__, this.toHostNode_);
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy