com.oracle.truffle.api.interop.LegacyNodeExportsGen 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.api.interop;
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.frame.Frame;
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.Node;
import com.oracle.truffle.api.nodes.NodeCost;
@GeneratedBy(LegacyNodeExports.class)
final class LegacyNodeExportsGen {
private static final LibraryFactory DYNAMIC_DISPATCH_LIBRARY_ = LibraryFactory.resolve(DynamicDispatchLibrary.class);
static {
LibraryExport.register(LegacyNodeExports.class, new NodeLibraryExports());
}
private LegacyNodeExportsGen() {
}
@GeneratedBy(LegacyNodeExports.class)
private static final class NodeLibraryExports extends LibraryExport {
private NodeLibraryExports() {
super(NodeLibrary.class, Node.class, true);
}
@Override
protected NodeLibrary createUncached(Object receiver) {
assert receiver instanceof Node;
NodeLibrary uncached = new Uncached(receiver);
return uncached;
}
@Override
protected NodeLibrary createCached(Object receiver) {
assert receiver instanceof Node;
return new Cached(receiver);
}
@GeneratedBy(LegacyNodeExports.class)
private static final class Cached extends NodeLibrary {
private final Class extends Node> receiverClass_;
Cached(Object originalReceiver) {
Node receiver = ((Node) originalReceiver) ;
this.receiverClass_ = receiver.getClass();
}
@Override
public boolean accepts(Object receiver) {
assert receiver.getClass() != this.receiverClass_ || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver.getClass() == this.receiverClass_;
}
@Override
public boolean hasScope(Object receiver, Frame frame) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return LegacyNodeExports.hasScope((CompilerDirectives.castExact(receiver, receiverClass_)), frame);
}
@Override
public Object getScope(Object receiver, Frame frame, boolean nodeEnter) throws UnsupportedMessageException {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return LegacyNodeExports.getScope((CompilerDirectives.castExact(receiver, receiverClass_)), frame, nodeEnter);
}
@Override
public boolean hasReceiverMember(Object receiver, Frame frame) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return LegacyNodeExports.hasReceiverMember((CompilerDirectives.castExact(receiver, receiverClass_)), frame);
}
@Override
public Object getReceiverMember(Object receiver, Frame frame) throws UnsupportedMessageException {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return LegacyNodeExports.getReceiverMember((CompilerDirectives.castExact(receiver, receiverClass_)), frame);
}
@Override
public boolean hasRootInstance(Object receiver, Frame frame) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return LegacyNodeExports.hasRootInstance((CompilerDirectives.castExact(receiver, receiverClass_)), frame);
}
@Override
public Object getRootInstance(Object receiver, Frame frame) throws UnsupportedMessageException {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return LegacyNodeExports.getRootInstance((CompilerDirectives.castExact(receiver, receiverClass_)), frame);
}
@Override
public Object getView(Object receiver, Frame frame, Object value) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return LegacyNodeExports.getView((CompilerDirectives.castExact(receiver, receiverClass_)), frame, value);
}
}
@GeneratedBy(LegacyNodeExports.class)
private static final class Uncached extends NodeLibrary {
private final Class extends Node> receiverClass_;
Uncached(Object receiver) {
this.receiverClass_ = ((Node) receiver).getClass();
}
@TruffleBoundary
@Override
public boolean accepts(Object receiver) {
assert receiver.getClass() != this.receiverClass_ || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver.getClass() == this.receiverClass_;
}
@Override
public boolean isAdoptable() {
return false;
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@TruffleBoundary
@Override
public boolean hasScope(Object receiver, Frame frame) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return LegacyNodeExports.hasScope(((Node) receiver) , frame);
}
@TruffleBoundary
@Override
public Object getScope(Object receiver, Frame frame, boolean nodeEnter) throws UnsupportedMessageException {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return LegacyNodeExports.getScope(((Node) receiver) , frame, nodeEnter);
}
@TruffleBoundary
@Override
public boolean hasReceiverMember(Object receiver, Frame frame) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return LegacyNodeExports.hasReceiverMember(((Node) receiver) , frame);
}
@TruffleBoundary
@Override
public Object getReceiverMember(Object receiver, Frame frame) throws UnsupportedMessageException {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return LegacyNodeExports.getReceiverMember(((Node) receiver) , frame);
}
@TruffleBoundary
@Override
public boolean hasRootInstance(Object receiver, Frame frame) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return LegacyNodeExports.hasRootInstance(((Node) receiver) , frame);
}
@TruffleBoundary
@Override
public Object getRootInstance(Object receiver, Frame frame) throws UnsupportedMessageException {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return LegacyNodeExports.getRootInstance(((Node) receiver) , frame);
}
@TruffleBoundary
@Override
public Object getView(Object receiver, Frame frame, Object value) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return LegacyNodeExports.getView(((Node) receiver) , frame, value);
}
}
}
}