org.pkl.thirdparty.truffle.host.ScopedObjectGen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pkl-config-java-all Show documentation
Show all versions of pkl-config-java-all Show documentation
Shaded fat Jar for pkl-config-java, a Java config library based on the Pkl config language.
// CheckStyle: start generated
package org.pkl.thirdparty.truffle.host;
import org.pkl.thirdparty.truffle.api.CompilerDirectives;
import org.pkl.thirdparty.truffle.api.CompilerDirectives.CompilationFinal;
import org.pkl.thirdparty.truffle.api.CompilerDirectives.TruffleBoundary;
import org.pkl.thirdparty.truffle.api.dsl.GeneratedBy;
import org.pkl.thirdparty.truffle.api.dsl.InlineSupport.InlineTarget;
import org.pkl.thirdparty.truffle.api.dsl.InlineSupport.StateField;
import org.pkl.thirdparty.truffle.api.dsl.InlineSupport.UnsafeAccessedField;
import org.pkl.thirdparty.truffle.api.library.DynamicDispatchLibrary;
import org.pkl.thirdparty.truffle.api.library.LibraryExport;
import org.pkl.thirdparty.truffle.api.library.LibraryFactory;
import org.pkl.thirdparty.truffle.api.library.Message;
import org.pkl.thirdparty.truffle.api.library.ReflectionLibrary;
import org.pkl.thirdparty.truffle.api.nodes.DenyReplace;
import org.pkl.thirdparty.truffle.api.nodes.Node;
import org.pkl.thirdparty.truffle.api.nodes.NodeCost;
import org.pkl.thirdparty.truffle.api.profiles.InlinedBranchProfile;
import org.pkl.thirdparty.truffle.host.HostMethodScope.ScopedObject;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.util.Objects;
@GeneratedBy(ScopedObject.class)
@SuppressWarnings("javadoc")
final class ScopedObjectGen {
private static final LibraryFactory DYNAMIC_DISPATCH_LIBRARY_ = LibraryFactory.resolve(DynamicDispatchLibrary.class);
private static final LibraryFactory REFLECTION_LIBRARY_ = LibraryFactory.resolve(ReflectionLibrary.class);
static {
LibraryExport.register(ScopedObject.class, new ReflectionLibraryExports());
}
private ScopedObjectGen() {
}
@GeneratedBy(ScopedObject.class)
private static final class ReflectionLibraryExports extends LibraryExport {
private ReflectionLibraryExports() {
super(ReflectionLibrary.class, ScopedObject.class, false, false, 0);
}
@Override
protected ReflectionLibrary createUncached(Object receiver) {
assert receiver instanceof ScopedObject;
ReflectionLibrary uncached = new Uncached();
return uncached;
}
@Override
protected ReflectionLibrary createCached(Object receiver) {
assert receiver instanceof ScopedObject;
return new Cached();
}
@GeneratedBy(ScopedObject.class)
private static final class Cached extends ReflectionLibrary {
private static final StateField STATE_0_UPDATER = StateField.create(MethodHandles.lookup(), "state_0_");
/**
* Source Info:
* Specialization: {@link ScopedObject#send(ScopedObject, Message, Object[], Node, ReflectionLibrary, InlinedBranchProfile, InlinedBranchProfile)}
* Parameter: {@link InlinedBranchProfile} seenError
* Inline method: {@link InlinedBranchProfile#inline}
*/
private static final InlinedBranchProfile INLINED_SEEN_ERROR_ = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, STATE_0_UPDATER.subUpdater(1, 1)));
/**
* Source Info:
* Specialization: {@link ScopedObject#send(ScopedObject, Message, Object[], Node, ReflectionLibrary, InlinedBranchProfile, InlinedBranchProfile)}
* Parameter: {@link InlinedBranchProfile} seenOther
* Inline method: {@link InlinedBranchProfile#inline}
*/
private static final InlinedBranchProfile INLINED_SEEN_OTHER_ = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, STATE_0_UPDATER.subUpdater(2, 1)));
/**
* State Info:
* 0: SpecializationActive {@link ScopedObject#send(ScopedObject, Message, Object[], Node, ReflectionLibrary, InlinedBranchProfile, InlinedBranchProfile)}
* 1: InlinedCache
* Specialization: {@link ScopedObject#send}
* Parameter: {@link InlinedBranchProfile} seenError
* Inline method: {@link InlinedBranchProfile#inline}
* 2: InlinedCache
* Specialization: {@link ScopedObject#send}
* Parameter: {@link InlinedBranchProfile} seenOther
* Inline method: {@link InlinedBranchProfile#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int state_0_;
/**
* Source Info:
* Specialization: {@link ScopedObject#send(ScopedObject, Message, Object[], Node, ReflectionLibrary, InlinedBranchProfile, InlinedBranchProfile)}
* Parameter: {@link ReflectionLibrary} library
*/
@Child private ReflectionLibrary library_;
protected Cached() {
}
@Override
public boolean accepts(Object receiver) {
assert !(receiver instanceof ScopedObject) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver instanceof ScopedObject;
}
/**
* Debug Info:
* Specialization {@link ScopedObject#send(ScopedObject, Message, Object[], Node, ReflectionLibrary, InlinedBranchProfile, InlinedBranchProfile)}
* Activation probability: 1.00000
* With/without class size: 28/5 bytes
*
*/
@Override
public Object send(Object arg0Value_, Message arg1Value, Object... arg2Value) throws Exception {
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
assert getRootNode() != null : "Invalid library usage. Cached library must be adopted by a RootNode before it is executed.";
ScopedObject arg0Value = ((ScopedObject) arg0Value_);
int state_0 = this.state_0_;
if ((state_0 & 0b1) != 0 /* is SpecializationActive[ScopedObject.send(ScopedObject, Message, Object[], Node, ReflectionLibrary, InlinedBranchProfile, InlinedBranchProfile)] */) {
{
ReflectionLibrary library__ = this.library_;
if (library__ != null) {
Node node__ = (this);
return arg0Value.send(arg1Value, arg2Value, node__, library__, INLINED_SEEN_ERROR_, INLINED_SEEN_OTHER_);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value, arg2Value);
}
private Object executeAndSpecialize(ScopedObject arg0Value, Message arg1Value, Object[] arg2Value) throws Exception {
int state_0 = this.state_0_;
{
Node node__ = null;
node__ = (this);
ReflectionLibrary library__ = this.insert((REFLECTION_LIBRARY_.createDispatched(5)));
Objects.requireNonNull(library__, "Specialization 'send(ScopedObject, Message, Object[], Node, ReflectionLibrary, InlinedBranchProfile, InlinedBranchProfile)' cache 'library' 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.library_ = library__;
state_0 = state_0 | 0b1 /* add SpecializationActive[ScopedObject.send(ScopedObject, Message, Object[], Node, ReflectionLibrary, InlinedBranchProfile, InlinedBranchProfile)] */;
this.state_0_ = state_0;
return arg0Value.send(arg1Value, arg2Value, node__, library__, INLINED_SEEN_ERROR_, INLINED_SEEN_OTHER_);
}
}
@Override
public NodeCost getCost() {
int state_0 = this.state_0_;
if ((state_0 & 0b1) == 0) {
return NodeCost.UNINITIALIZED;
} else {
return NodeCost.MONOMORPHIC;
}
}
}
@GeneratedBy(ScopedObject.class)
@DenyReplace
private static final class Uncached extends ReflectionLibrary {
protected Uncached() {
}
@Override
@TruffleBoundary
public boolean accepts(Object receiver) {
assert !(receiver instanceof ScopedObject) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver instanceof ScopedObject;
}
@Override
public boolean isAdoptable() {
return false;
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@TruffleBoundary
@Override
public Object send(Object arg0Value_, Message arg1Value, Object... arg2Value) throws Exception {
// declared: true
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
ScopedObject arg0Value = ((ScopedObject) arg0Value_);
return arg0Value.send(arg1Value, arg2Value, (this), (REFLECTION_LIBRARY_.getUncached()), (InlinedBranchProfile.getUncached()), (InlinedBranchProfile.getUncached()));
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy