com.oracle.truffle.nfi.SignatureMembersGen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truffle-nfi Show documentation
Show all versions of truffle-nfi Show documentation
Native function interface for the Truffle framework.
// CheckStyle: start generated
package com.oracle.truffle.nfi;
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.dsl.InlineSupport.InlineTarget;
import com.oracle.truffle.api.dsl.InlineSupport.StateField;
import com.oracle.truffle.api.dsl.InlineSupport.UnsafeAccessedField;
import com.oracle.truffle.api.interop.InteropLibrary;
import com.oracle.truffle.api.interop.InvalidArrayIndexException;
import com.oracle.truffle.api.interop.UnsupportedMessageException;
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.DenyReplace;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.UnadoptableNode;
import com.oracle.truffle.api.profiles.InlinedBranchProfile;
import com.oracle.truffle.nfi.NFISignature.SignatureMembers;
import java.lang.invoke.MethodHandles;
@GeneratedBy(SignatureMembers.class)
@SuppressWarnings("javadoc")
final class SignatureMembersGen {
private static final LibraryFactory DYNAMIC_DISPATCH_LIBRARY_ = LibraryFactory.resolve(DynamicDispatchLibrary.class);
static {
LibraryExport.register(SignatureMembers.class, new InteropLibraryExports());
}
private SignatureMembersGen() {
}
@GeneratedBy(SignatureMembers.class)
private static final class InteropLibraryExports extends LibraryExport {
private InteropLibraryExports() {
super(InteropLibrary.class, SignatureMembers.class, false, false, 0);
}
@Override
protected InteropLibrary createUncached(Object receiver) {
assert receiver instanceof SignatureMembers;
InteropLibrary uncached = new Uncached();
return uncached;
}
@Override
protected InteropLibrary createCached(Object receiver) {
assert receiver instanceof SignatureMembers;
return new Cached();
}
@GeneratedBy(SignatureMembers.class)
private static final class Cached extends InteropLibrary {
private static final StateField STATE_0_ReadArrayElementNode__UPDATER = StateField.create(MethodHandles.lookup(), "state_0_");
/**
* Source Info:
* Specialization: {@link SignatureMembers#readArrayElement(SignatureMembers, long, Node, InlinedBranchProfile)}
* Parameter: {@link InlinedBranchProfile} ioob
* Inline method: {@link InlinedBranchProfile#inline}
*/
private static final InlinedBranchProfile INLINED_IOOB_ = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, STATE_0_ReadArrayElementNode__UPDATER.subUpdater(0, 1)));
/**
* State Info:
* 0: InlinedCache
* Specialization: {@link SignatureMembers#readArrayElement}
* Parameter: {@link InlinedBranchProfile} ioob
* Inline method: {@link InlinedBranchProfile#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int state_0_;
protected Cached() {
}
@Override
public boolean accepts(Object receiver) {
assert !(receiver instanceof SignatureMembers) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver instanceof SignatureMembers;
}
@Override
public boolean hasArrayElements(Object receiver) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (((SignatureMembers) receiver)).hasArrayElements();
}
/**
* Debug Info:
* Specialization {@link SignatureMembers#readArrayElement(SignatureMembers, long, Node, InlinedBranchProfile)}
* Activation probability: 1.00000
* With/without class size: 24/1 bytes
*
*/
@Override
public Object readArrayElement(Object arg0Value_, long arg1Value) throws UnsupportedMessageException, InvalidArrayIndexException {
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
SignatureMembers arg0Value = ((SignatureMembers) arg0Value_);
{
Node node__ = (this);
return arg0Value.readArrayElement(arg1Value, node__, INLINED_IOOB_);
}
}
@Override
public long getArraySize(Object receiver) throws UnsupportedMessageException {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (((SignatureMembers) receiver)).getArraySize();
}
@Override
public boolean isArrayElementReadable(Object receiver, long index) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (((SignatureMembers) receiver)).isArrayElementReadable(index);
}
}
@GeneratedBy(SignatureMembers.class)
@DenyReplace
private static final class Uncached extends InteropLibrary implements UnadoptableNode {
protected Uncached() {
}
@Override
@TruffleBoundary
public boolean accepts(Object receiver) {
assert !(receiver instanceof SignatureMembers) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver instanceof SignatureMembers;
}
@TruffleBoundary
@Override
public boolean hasArrayElements(Object receiver) {
// declared: true
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((SignatureMembers) receiver) .hasArrayElements();
}
@TruffleBoundary
@Override
public Object readArrayElement(Object arg0Value_, long arg1Value) throws InvalidArrayIndexException {
// declared: true
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
SignatureMembers arg0Value = ((SignatureMembers) arg0Value_);
return arg0Value.readArrayElement(arg1Value, (this), (InlinedBranchProfile.getUncached()));
}
@TruffleBoundary
@Override
public long getArraySize(Object receiver) throws UnsupportedMessageException {
// declared: true
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((SignatureMembers) receiver) .getArraySize();
}
@TruffleBoundary
@Override
public boolean isArrayElementReadable(Object receiver, long index) {
// declared: true
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((SignatureMembers) receiver) .isArrayElementReadable(index);
}
}
}
}