com.oracle.truffle.tools.agentscript.impl.AgentObjectGen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of insight-tool Show documentation
Show all versions of insight-tool Show documentation
The core module of the Insights Gathering Platform
The newest version!
// CheckStyle: start generated
package com.oracle.truffle.tools.agentscript.impl;
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.DenyReplace;
import com.oracle.truffle.api.nodes.UnadoptableNode;
import java.lang.invoke.VarHandle;
import java.util.Objects;
@GeneratedBy(AgentObject.class)
@SuppressWarnings("javadoc")
final class AgentObjectGen {
private static final LibraryFactory DYNAMIC_DISPATCH_LIBRARY_ = LibraryFactory.resolve(DynamicDispatchLibrary.class);
private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);
static {
LibraryExport.register(AgentObject.class, new InteropLibraryExports());
}
private AgentObjectGen() {
}
@GeneratedBy(AgentObject.class)
private static final class InteropLibraryExports extends LibraryExport {
private InteropLibraryExports() {
super(InteropLibrary.class, AgentObject.class, false, false, 0);
}
@Override
protected InteropLibrary createUncached(Object receiver) {
assert receiver instanceof AgentObject;
InteropLibrary uncached = new Uncached();
return uncached;
}
@Override
protected InteropLibrary createCached(Object receiver) {
assert receiver instanceof AgentObject;
return new Cached();
}
@GeneratedBy(AgentObject.class)
private static final class Cached extends InteropLibrary {
/**
* State Info:
* 0: SpecializationActive {@link AgentObject#invokeMember}
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link AgentObject#invokeMember}
* Parameter: {@link InteropLibrary} interop
*/
@Child private InteropLibrary interop_;
protected Cached() {
}
@Override
public boolean accepts(Object receiver) {
assert !(receiver instanceof AgentObject) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver instanceof AgentObject;
}
@Override
public boolean isMemberReadable(Object receiver, String member) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (((AgentObject) receiver)).isMemberReadable(member);
}
@Override
public boolean hasMembers(Object receiver) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return AgentObject.hasMembers((((AgentObject) receiver)));
}
@Override
public Object getMembers(Object receiver, boolean includeInternal) throws UnsupportedMessageException {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return AgentObject.getMembers((((AgentObject) receiver)), includeInternal);
}
@Override
public Object readMember(Object receiver, String member) throws UnsupportedMessageException, UnknownIdentifierException {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (((AgentObject) receiver)).readMember(member);
}
/**
* Debug Info:
* Specialization {@link AgentObject#invokeMember}
* Activation probability: 1.00000
* With/without class size: 24/4 bytes
*
*/
@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.";
assert assertAdopted();
AgentObject arg0Value = ((AgentObject) arg0Value_);
int state_0 = this.state_0_;
if (state_0 != 0 /* is SpecializationActive[AgentObject.invokeMember(AgentObject, String, Object[], InteropLibrary)] */) {
{
InteropLibrary interop__ = this.interop_;
if (interop__ != null) {
return AgentObject.invokeMember(arg0Value, arg1Value, arg2Value, interop__);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value, arg2Value);
}
private Object executeAndSpecialize(AgentObject arg0Value, String arg1Value, Object[] arg2Value) throws UnknownIdentifierException, UnsupportedMessageException {
int state_0 = this.state_0_;
InteropLibrary interop__ = this.insert((INTEROP_LIBRARY_.createDispatched(0)));
Objects.requireNonNull(interop__, "A specialization cache returned a 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 the default value.");
VarHandle.storeStoreFence();
this.interop_ = interop__;
state_0 = state_0 | 0b1 /* add SpecializationActive[AgentObject.invokeMember(AgentObject, String, Object[], InteropLibrary)] */;
this.state_0_ = state_0;
return AgentObject.invokeMember(arg0Value, arg1Value, arg2Value, interop__);
}
@Override
public boolean isMemberInvocable(Object receiver, String member) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return AgentObject.isMemberInvocable((((AgentObject) receiver)), member);
}
}
@GeneratedBy(AgentObject.class)
@DenyReplace
private static final class Uncached extends InteropLibrary implements UnadoptableNode {
protected Uncached() {
}
@Override
@TruffleBoundary
public boolean accepts(Object receiver) {
assert !(receiver instanceof AgentObject) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver instanceof AgentObject;
}
@TruffleBoundary
@Override
public boolean isMemberReadable(Object receiver, String member) {
// declared: true
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((AgentObject) receiver) .isMemberReadable(member);
}
@TruffleBoundary
@Override
public boolean hasMembers(Object receiver) {
// declared: true
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return AgentObject.hasMembers(((AgentObject) receiver) );
}
@TruffleBoundary
@Override
public Object getMembers(Object receiver, boolean includeInternal) throws UnsupportedMessageException {
// declared: true
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return AgentObject.getMembers(((AgentObject) receiver) , includeInternal);
}
@TruffleBoundary
@Override
public Object readMember(Object receiver, String member) throws UnsupportedMessageException, UnknownIdentifierException {
// declared: true
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((AgentObject) receiver) .readMember(member);
}
@TruffleBoundary
@Override
public Object invokeMember(Object arg0Value_, String arg1Value, Object... arg2Value) throws UnknownIdentifierException, UnsupportedMessageException {
// declared: true
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
AgentObject arg0Value = ((AgentObject) arg0Value_);
return AgentObject.invokeMember(arg0Value, arg1Value, arg2Value, (INTEROP_LIBRARY_.getUncached()));
}
@TruffleBoundary
@Override
public boolean isMemberInvocable(Object receiver, String member) {
// declared: true
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return AgentObject.isMemberInvocable(((AgentObject) receiver) , member);
}
}
}
}