com.oracle.truffle.polyglot.HostAdapterSuperMembersGen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truffle-api Show documentation
Show all versions of truffle-api Show documentation
Truffle is a multi-language framework for executing dynamic languages
that achieves high performance when combined with Graal.
// CheckStyle: start generated
package com.oracle.truffle.polyglot;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.interop.ArityException;
import com.oracle.truffle.api.interop.InteropLibrary;
import com.oracle.truffle.api.interop.UnknownIdentifierException;
import com.oracle.truffle.api.interop.UnsupportedMessageException;
import com.oracle.truffle.api.interop.UnsupportedTypeException;
import com.oracle.truffle.api.library.DynamicDispatchLibrary;
import com.oracle.truffle.api.library.LibraryExport;
import com.oracle.truffle.api.library.LibraryFactory;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.polyglot.HostAdapterSuperMembers.NameCache;
import java.util.concurrent.locks.Lock;
@GeneratedBy(HostAdapterSuperMembers.class)
final class HostAdapterSuperMembersGen {
private static final LibraryFactory DYNAMIC_DISPATCH_LIBRARY_ = LibraryFactory.resolve(DynamicDispatchLibrary.class);
private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);
static {
LibraryExport.register(HostAdapterSuperMembers.class, new InteropLibraryExports());
}
private HostAdapterSuperMembersGen() {
}
@GeneratedBy(HostAdapterSuperMembers.class)
private static final class InteropLibraryExports extends LibraryExport {
private InteropLibraryExports() {
super(InteropLibrary.class, HostAdapterSuperMembers.class, false);
}
@Override
protected InteropLibrary createUncached(Object receiver) {
assert receiver instanceof HostAdapterSuperMembers;
InteropLibrary uncached = new Uncached();
return uncached;
}
@Override
protected InteropLibrary createCached(Object receiver) {
assert receiver instanceof HostAdapterSuperMembers;
return new Cached(receiver);
}
@GeneratedBy(HostAdapterSuperMembers.class)
private static final class Cached extends InteropLibrary {
@Child private InteropLibrary receiverAdapterInteropLibrary_;
@CompilationFinal private volatile int state_;
@CompilationFinal private NameCache cache;
Cached(Object originalReceiver) {
HostAdapterSuperMembers receiver = ((HostAdapterSuperMembers) originalReceiver) ;
this.receiverAdapterInteropLibrary_ = super.insert(INTEROP_LIBRARY_.create((receiver.adapter)));
}
@Override
public boolean accepts(Object receiver) {
assert !(receiver instanceof HostAdapterSuperMembers) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
if (!(receiver instanceof HostAdapterSuperMembers)) {
return false;
} else if (!this.receiverAdapterInteropLibrary_.accepts((((HostAdapterSuperMembers) receiver).adapter))) {
return false;
} else {
return true;
}
}
@Override
public boolean hasMembers(Object receiver) {
assert receiver instanceof HostAdapterSuperMembers : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (((HostAdapterSuperMembers) receiver)).hasMembers();
}
@Override
public Object readMember(Object arg0Value_, String arg1Value) throws UnsupportedMessageException, UnknownIdentifierException {
assert arg0Value_ instanceof HostAdapterSuperMembers : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
HostAdapterSuperMembers arg0Value = ((HostAdapterSuperMembers) arg0Value_);
int state = state_;
if ((state & 0b1) != 0 /* is-active readMember(HostAdapterSuperMembers, String, NameCache, InteropLibrary) */) {
{
InteropLibrary readMemberNode__interop__ = this.receiverAdapterInteropLibrary_;
return arg0Value.readMember(arg1Value, this.cache, readMemberNode__interop__);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return readMemberNode_AndSpecialize(arg0Value, arg1Value);
}
private Object readMemberNode_AndSpecialize(HostAdapterSuperMembers arg0Value, String arg1Value) throws UnsupportedMessageException, UnknownIdentifierException {
Lock lock = getLock();
boolean hasLock = true;
lock.lock();
int state = state_;
try {
{
InteropLibrary readMemberNode__interop__ = null;
if (this.cache == null) {
this.cache = (NameCache.create());
}
readMemberNode__interop__ = this.receiverAdapterInteropLibrary_;
this.state_ = state = state | 0b1 /* add-active readMember(HostAdapterSuperMembers, String, NameCache, InteropLibrary) */;
lock.unlock();
hasLock = false;
return arg0Value.readMember(arg1Value, this.cache, readMemberNode__interop__);
}
} finally {
if (hasLock) {
lock.unlock();
}
}
}
@Override
public NodeCost getCost() {
int state = state_;
if ((state & 0b1) == 0b0) {
return NodeCost.UNINITIALIZED;
} else {
return NodeCost.MONOMORPHIC;
}
}
@Override
public Object invokeMember(Object arg0Value_, String arg1Value, Object... arg2Value) throws UnsupportedMessageException, ArityException, UnknownIdentifierException, UnsupportedTypeException {
assert arg0Value_ instanceof HostAdapterSuperMembers : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
HostAdapterSuperMembers arg0Value = ((HostAdapterSuperMembers) arg0Value_);
int state = state_;
if ((state & 0b10) != 0 /* is-active invokeMember(HostAdapterSuperMembers, String, Object[], NameCache, InteropLibrary) */) {
{
InteropLibrary invokeMemberNode__interop__ = this.receiverAdapterInteropLibrary_;
return arg0Value.invokeMember(arg1Value, arg2Value, this.cache, invokeMemberNode__interop__);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return invokeMemberNode_AndSpecialize(arg0Value, arg1Value, arg2Value);
}
private Object invokeMemberNode_AndSpecialize(HostAdapterSuperMembers arg0Value, String arg1Value, Object[] arg2Value) throws UnsupportedMessageException, ArityException, UnknownIdentifierException, UnsupportedTypeException {
Lock lock = getLock();
boolean hasLock = true;
lock.lock();
int state = state_;
try {
{
InteropLibrary invokeMemberNode__interop__ = null;
if (this.cache == null) {
this.cache = (NameCache.create());
}
invokeMemberNode__interop__ = this.receiverAdapterInteropLibrary_;
this.state_ = state = state | 0b10 /* add-active invokeMember(HostAdapterSuperMembers, String, Object[], NameCache, InteropLibrary) */;
lock.unlock();
hasLock = false;
return arg0Value.invokeMember(arg1Value, arg2Value, this.cache, invokeMemberNode__interop__);
}
} finally {
if (hasLock) {
lock.unlock();
}
}
}
@Override
public boolean isMemberReadable(Object arg0Value_, String arg1Value) {
assert arg0Value_ instanceof HostAdapterSuperMembers : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
HostAdapterSuperMembers arg0Value = ((HostAdapterSuperMembers) arg0Value_);
int state = state_;
if ((state & 0b100) != 0 /* is-active isMemberReadable(HostAdapterSuperMembers, String, NameCache, InteropLibrary) */) {
{
InteropLibrary isMemberReadableNode__interop__ = this.receiverAdapterInteropLibrary_;
return arg0Value.isMemberReadable(arg1Value, this.cache, isMemberReadableNode__interop__);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return isMemberReadableNode_AndSpecialize(arg0Value, arg1Value);
}
private boolean isMemberReadableNode_AndSpecialize(HostAdapterSuperMembers arg0Value, String arg1Value) {
Lock lock = getLock();
boolean hasLock = true;
lock.lock();
int state = state_;
try {
{
InteropLibrary isMemberReadableNode__interop__ = null;
if (this.cache == null) {
this.cache = (NameCache.create());
}
isMemberReadableNode__interop__ = this.receiverAdapterInteropLibrary_;
this.state_ = state = state | 0b100 /* add-active isMemberReadable(HostAdapterSuperMembers, String, NameCache, InteropLibrary) */;
lock.unlock();
hasLock = false;
return arg0Value.isMemberReadable(arg1Value, this.cache, isMemberReadableNode__interop__);
}
} finally {
if (hasLock) {
lock.unlock();
}
}
}
@Override
public boolean isMemberInvocable(Object arg0Value_, String arg1Value) {
assert arg0Value_ instanceof HostAdapterSuperMembers : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
HostAdapterSuperMembers arg0Value = ((HostAdapterSuperMembers) arg0Value_);
int state = state_;
if ((state & 0b1000) != 0 /* is-active isMemberInvocable(HostAdapterSuperMembers, String, NameCache, InteropLibrary) */) {
{
InteropLibrary isMemberInvocableNode__interop__ = this.receiverAdapterInteropLibrary_;
return arg0Value.isMemberInvocable(arg1Value, this.cache, isMemberInvocableNode__interop__);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return isMemberInvocableNode_AndSpecialize(arg0Value, arg1Value);
}
private boolean isMemberInvocableNode_AndSpecialize(HostAdapterSuperMembers arg0Value, String arg1Value) {
Lock lock = getLock();
boolean hasLock = true;
lock.lock();
int state = state_;
try {
{
InteropLibrary isMemberInvocableNode__interop__ = null;
if (this.cache == null) {
this.cache = (NameCache.create());
}
isMemberInvocableNode__interop__ = this.receiverAdapterInteropLibrary_;
this.state_ = state = state | 0b1000 /* add-active isMemberInvocable(HostAdapterSuperMembers, String, NameCache, InteropLibrary) */;
lock.unlock();
hasLock = false;
return arg0Value.isMemberInvocable(arg1Value, this.cache, isMemberInvocableNode__interop__);
}
} finally {
if (hasLock) {
lock.unlock();
}
}
}
@Override
public Object getMembers(Object receiver, boolean includeInternal) throws UnsupportedMessageException {
assert receiver instanceof HostAdapterSuperMembers : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (((HostAdapterSuperMembers) receiver)).getMembers(includeInternal);
}
}
@GeneratedBy(HostAdapterSuperMembers.class)
private static final class Uncached extends InteropLibrary {
Uncached() {
}
@TruffleBoundary
@Override
public boolean accepts(Object receiver) {
assert !(receiver instanceof HostAdapterSuperMembers) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver instanceof HostAdapterSuperMembers;
}
@Override
public boolean isAdoptable() {
return false;
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@TruffleBoundary
@Override
public boolean hasMembers(Object receiver) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((HostAdapterSuperMembers) receiver) .hasMembers();
}
@TruffleBoundary
@Override
public Object readMember(Object arg0Value_, String arg1Value) throws UnsupportedMessageException, UnknownIdentifierException {
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
HostAdapterSuperMembers arg0Value = ((HostAdapterSuperMembers) arg0Value_);
return arg0Value.readMember(arg1Value, (NameCache.getUncached()), INTEROP_LIBRARY_.getUncached((arg0Value.adapter)));
}
@TruffleBoundary
@Override
public Object invokeMember(Object arg0Value_, String arg1Value, Object... arg2Value) throws UnsupportedMessageException, ArityException, UnknownIdentifierException, UnsupportedTypeException {
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
HostAdapterSuperMembers arg0Value = ((HostAdapterSuperMembers) arg0Value_);
return arg0Value.invokeMember(arg1Value, arg2Value, (NameCache.getUncached()), INTEROP_LIBRARY_.getUncached((arg0Value.adapter)));
}
@TruffleBoundary
@Override
public boolean isMemberReadable(Object arg0Value_, String arg1Value) {
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
HostAdapterSuperMembers arg0Value = ((HostAdapterSuperMembers) arg0Value_);
return arg0Value.isMemberReadable(arg1Value, (NameCache.getUncached()), INTEROP_LIBRARY_.getUncached((arg0Value.adapter)));
}
@TruffleBoundary
@Override
public boolean isMemberInvocable(Object arg0Value_, String arg1Value) {
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
HostAdapterSuperMembers arg0Value = ((HostAdapterSuperMembers) arg0Value_);
return arg0Value.isMemberInvocable(arg1Value, (NameCache.getUncached()), INTEROP_LIBRARY_.getUncached((arg0Value.adapter)));
}
@TruffleBoundary
@Override
public Object getMembers(Object receiver, boolean includeInternal) throws UnsupportedMessageException {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((HostAdapterSuperMembers) receiver) .getMembers(includeInternal);
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy