com.oracle.truffle.tools.agentscript.impl.CurrentScopeViewGen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of insight Show documentation
Show all versions of insight Show documentation
The Ultimate 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.InteropLibrary;
import com.oracle.truffle.api.interop.UnsupportedMessageException;
import com.oracle.truffle.api.library.DynamicDispatchLibrary;
import com.oracle.truffle.api.library.Library;
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.NodeCost;
import com.oracle.truffle.api.utilities.FinalBitSet;
import java.lang.invoke.VarHandle;
import java.util.Objects;
@GeneratedBy(CurrentScopeView.class)
@SuppressWarnings("javadoc")
final class CurrentScopeViewGen {
private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);
private static final LibraryFactory DYNAMIC_DISPATCH_LIBRARY_ = LibraryFactory.resolve(DynamicDispatchLibrary.class);
static {
LibraryExport.register(CurrentScopeView.class, new InteropLibraryExports());
}
private CurrentScopeViewGen() {
}
@GeneratedBy(CurrentScopeView.class)
private static final class InteropLibraryExports extends LibraryExport {
static final FinalBitSet ENABLED_MESSAGES = createMessageBitSet(INTEROP_LIBRARY_, "hasMembers", "getMembers");
private InteropLibraryExports() {
super(InteropLibrary.class, CurrentScopeView.class, false, false, 0);
}
@Override
protected InteropLibrary createUncached(Object receiver) {
assert receiver instanceof CurrentScopeView;
InteropLibrary uncached = createDelegate(INTEROP_LIBRARY_, new Uncached());
return uncached;
}
@Override
protected InteropLibrary createCached(Object receiver) {
assert receiver instanceof CurrentScopeView;
return createDelegate(INTEROP_LIBRARY_, new Cached(receiver));
}
@GeneratedBy(CurrentScopeView.class)
private static final class Cached extends InteropLibrary implements DelegateExport {
@Child private InteropLibrary receiverScopeInteropLibrary_;
/**
* State Info:
* 0: SpecializationActive {@link CurrentScopeView#getMembers(CurrentScopeView, boolean, InteropLibrary, InteropLibrary)}
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link CurrentScopeView#getMembers(CurrentScopeView, boolean, InteropLibrary, InteropLibrary)}
* Parameter: {@link InteropLibrary} parentScopeLib
*/
@Child private InteropLibrary getMembersNode__getMembers_parentScopeLib_;
protected Cached(Object receiver) {
CurrentScopeView castReceiver = ((CurrentScopeView) receiver) ;
this.receiverScopeInteropLibrary_ = super.insert(INTEROP_LIBRARY_.create((castReceiver.scope)));
}
@Override
public FinalBitSet getDelegateExportMessages() {
return ENABLED_MESSAGES;
}
@Override
public Object readDelegateExport(Object receiver_) {
return ((CurrentScopeView) receiver_).scope;
}
@Override
public Library getDelegateExportLibrary(Object delegate) {
return this.receiverScopeInteropLibrary_;
}
@Override
public boolean accepts(Object receiver) {
assert !(receiver instanceof CurrentScopeView) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
if (!(receiver instanceof CurrentScopeView)) {
return false;
} else if (!this.receiverScopeInteropLibrary_.accepts((((CurrentScopeView) receiver).scope))) {
return false;
} else {
return true;
}
}
@Override
public boolean hasMembers(Object receiver) {
assert receiver instanceof CurrentScopeView : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (((CurrentScopeView) receiver)).hasMembers();
}
/**
* Debug Info:
* Specialization {@link CurrentScopeView#getMembers(CurrentScopeView, boolean, InteropLibrary, InteropLibrary)}
* Activation probability: 0.50000
* With/without class size: 14/4 bytes
*
*/
@Override
public Object getMembers(Object arg0Value_, boolean arg1Value) throws UnsupportedMessageException {
assert arg0Value_ instanceof CurrentScopeView : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
CurrentScopeView arg0Value = ((CurrentScopeView) arg0Value_);
int state_0 = this.state_0_;
if (state_0 != 0 /* is SpecializationActive[CurrentScopeView.getMembers(CurrentScopeView, boolean, InteropLibrary, InteropLibrary)] */) {
{
InteropLibrary parentScopeLib__ = this.getMembersNode__getMembers_parentScopeLib_;
if (parentScopeLib__ != null) {
InteropLibrary scopeLib__ = this.receiverScopeInteropLibrary_;
return arg0Value.getMembers(arg1Value, scopeLib__, parentScopeLib__);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return getMembersNode_AndSpecialize(arg0Value, arg1Value);
}
private Object getMembersNode_AndSpecialize(CurrentScopeView arg0Value, boolean arg1Value) throws UnsupportedMessageException {
int state_0 = this.state_0_;
{
InteropLibrary scopeLib__ = null;
scopeLib__ = this.receiverScopeInteropLibrary_;
InteropLibrary parentScopeLib__ = this.insert((INTEROP_LIBRARY_.createDispatched(5)));
Objects.requireNonNull(parentScopeLib__, "Specialization 'getMembers(CurrentScopeView, boolean, InteropLibrary, InteropLibrary)' cache 'parentScopeLib' 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.getMembersNode__getMembers_parentScopeLib_ = parentScopeLib__;
state_0 = state_0 | 0b1 /* add SpecializationActive[CurrentScopeView.getMembers(CurrentScopeView, boolean, InteropLibrary, InteropLibrary)] */;
this.state_0_ = state_0;
return arg0Value.getMembers(arg1Value, scopeLib__, parentScopeLib__);
}
}
@Override
public NodeCost getCost() {
int state_0 = this.state_0_;
if (state_0 == 0) {
return NodeCost.UNINITIALIZED;
} else {
return NodeCost.MONOMORPHIC;
}
}
}
@GeneratedBy(CurrentScopeView.class)
@DenyReplace
private static final class Uncached extends InteropLibrary implements DelegateExport {
protected Uncached() {
}
@Override
public FinalBitSet getDelegateExportMessages() {
return ENABLED_MESSAGES;
}
@Override
public Object readDelegateExport(Object receiver_) {
return (((CurrentScopeView) receiver_)).scope;
}
@Override
public Library getDelegateExportLibrary(Object delegate_) {
return INTEROP_LIBRARY_.getUncached(delegate_);
}
@Override
@TruffleBoundary
public boolean accepts(Object receiver) {
assert !(receiver instanceof CurrentScopeView) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver instanceof CurrentScopeView;
}
@Override
public boolean isAdoptable() {
return false;
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@TruffleBoundary
@Override
public boolean hasMembers(Object receiver) {
// declared: true
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((CurrentScopeView) receiver) .hasMembers();
}
@TruffleBoundary
@Override
public Object getMembers(Object arg0Value_, boolean arg1Value) throws UnsupportedMessageException {
// declared: true
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
CurrentScopeView arg0Value = ((CurrentScopeView) arg0Value_);
return arg0Value.getMembers(arg1Value, INTEROP_LIBRARY_.getUncached((arg0Value.scope)), (INTEROP_LIBRARY_.getUncached()));
}
}
}
}