com.oracle.truffle.nfi.backend.panama.PanamaSignatureGen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truffle-nfi-panama Show documentation
Show all versions of truffle-nfi-panama Show documentation
Implementation of the Truffle NFI using CLinker from project panama.
The newest version!
// CheckStyle: start generated
package com.oracle.truffle.nfi.backend.panama;
import com.oracle.truffle.api.Assumption;
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.dsl.DSLSupport.SpecializationDataNode;
import com.oracle.truffle.api.dsl.InlineSupport.InlineTarget;
import com.oracle.truffle.api.dsl.InlineSupport.ReferenceField;
import com.oracle.truffle.api.dsl.InlineSupport.StateField;
import com.oracle.truffle.api.dsl.InlineSupport.UnsafeAccessedField;
import com.oracle.truffle.api.interop.ArityException;
import com.oracle.truffle.api.interop.InteropLibrary;
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.EncapsulatingNodeReference;
import com.oracle.truffle.api.nodes.ExplodeLoop;
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.backend.panama.PanamaClosure.MonomorphicClosureInfo;
import com.oracle.truffle.nfi.backend.panama.PanamaClosure.PolymorphicClosureInfo;
import com.oracle.truffle.nfi.backend.panama.PanamaSignature.CachedSignatureInfo;
import com.oracle.truffle.nfi.backend.panama.PanamaSignature.Call;
import com.oracle.truffle.nfi.backend.panama.PanamaSignature.CreateClosure;
import com.oracle.truffle.nfi.backend.spi.NFIBackendSignatureLibrary;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles.Lookup;
import java.util.Objects;
@GeneratedBy(PanamaSignature.class)
@SuppressWarnings({"javadoc", "unused"})
final class PanamaSignatureGen {
private static final LibraryFactory DYNAMIC_DISPATCH_LIBRARY_ = LibraryFactory.resolve(DynamicDispatchLibrary.class);
private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);
static {
LibraryExport.register(PanamaSignature.class, new NFIBackendSignatureLibraryExports());
}
private PanamaSignatureGen() {
}
@GeneratedBy(PanamaSignature.class)
private static final class NFIBackendSignatureLibraryExports extends LibraryExport {
private NFIBackendSignatureLibraryExports() {
super(NFIBackendSignatureLibrary.class, PanamaSignature.class, false, false, 0);
}
@Override
protected NFIBackendSignatureLibrary createUncached(Object receiver) {
assert receiver instanceof PanamaSignature;
NFIBackendSignatureLibrary uncached = new Uncached();
return uncached;
}
@Override
protected NFIBackendSignatureLibrary createCached(Object receiver) {
assert receiver instanceof PanamaSignature;
return new Cached();
}
@GeneratedBy(PanamaSignature.class)
private static final class Cached extends NFIBackendSignatureLibrary {
private static final StateField CALL_GENERIC0__CALL_CALL_GENERIC0_STATE_0_UPDATER = StateField.create(CallCallGeneric0Data.lookup_(), "callGeneric0_state_0_");
private static final StateField STATE_0_Call_UPDATER = StateField.create(MethodHandles.lookup(), "state_0_");
static final ReferenceField CALL_CALL_GENERIC0_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "call_callGeneric0_cache", CallCallGeneric0Data.class);
/**
* Source Info:
* Specialization: {@link Call#callGeneric}
* Parameter: {@link InlinedBranchProfile} isExecutable
* Inline method: {@link InlinedBranchProfile#inline}
*/
private static final InlinedBranchProfile INLINED_CALL_CALL_GENERIC0_IS_EXECUTABLE_ = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, CALL_GENERIC0__CALL_CALL_GENERIC0_STATE_0_UPDATER.subUpdater(0, 1)));
/**
* Source Info:
* Specialization: {@link Call#callGeneric}
* Parameter: {@link InlinedBranchProfile} toNative
* Inline method: {@link InlinedBranchProfile#inline}
*/
private static final InlinedBranchProfile INLINED_CALL_CALL_GENERIC0_TO_NATIVE_ = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, CALL_GENERIC0__CALL_CALL_GENERIC0_STATE_0_UPDATER.subUpdater(1, 1)));
/**
* Source Info:
* Specialization: {@link Call#callGeneric}
* Parameter: {@link InlinedBranchProfile} error
* Inline method: {@link InlinedBranchProfile#inline}
*/
private static final InlinedBranchProfile INLINED_CALL_CALL_GENERIC0_ERROR_ = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, CALL_GENERIC0__CALL_CALL_GENERIC0_STATE_0_UPDATER.subUpdater(2, 1)));
/**
* Source Info:
* Specialization: {@link Call#callGeneric}
* Parameter: {@link InlinedBranchProfile} isExecutable
* Inline method: {@link InlinedBranchProfile#inline}
*/
private static final InlinedBranchProfile INLINED_CALL_CALL_GENERIC1_IS_EXECUTABLE_ = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, STATE_0_Call_UPDATER.subUpdater(6, 1)));
/**
* Source Info:
* Specialization: {@link Call#callGeneric}
* Parameter: {@link InlinedBranchProfile} toNative
* Inline method: {@link InlinedBranchProfile#inline}
*/
private static final InlinedBranchProfile INLINED_CALL_CALL_GENERIC1_TO_NATIVE_ = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, STATE_0_Call_UPDATER.subUpdater(7, 1)));
/**
* Source Info:
* Specialization: {@link Call#callGeneric}
* Parameter: {@link InlinedBranchProfile} error
* Inline method: {@link InlinedBranchProfile#inline}
*/
private static final InlinedBranchProfile INLINED_CALL_CALL_GENERIC1_ERROR_ = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, STATE_0_Call_UPDATER.subUpdater(8, 1)));
static final ReferenceField CREATE_CLOSURE_CACHED_EXECUTABLE_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "createClosure_cachedExecutable_cache", CreateClosureCachedExecutableData.class);
static final ReferenceField CREATE_CLOSURE_CACHED_SIGNATURE_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "createClosure_cachedSignature_cache", CreateClosureCachedSignatureData.class);
/**
* State Info:
* 0: SpecializationActive {@link Call#callPanama}
* 1: SpecializationActive {@link Call#callGeneric}
* 2: SpecializationActive {@link Call#callGeneric}
* 3: SpecializationActive {@link CreateClosure#doCachedExecutable}
* 4: SpecializationActive {@link CreateClosure#doCachedSignature}
* 5: SpecializationActive {@link CreateClosure#createClosure}
* 6: InlinedCache
* Specialization: {@link Call#callGeneric}
* Parameter: {@link InlinedBranchProfile} isExecutable
* Inline method: {@link InlinedBranchProfile#inline}
* 7: InlinedCache
* Specialization: {@link Call#callGeneric}
* Parameter: {@link InlinedBranchProfile} toNative
* Inline method: {@link InlinedBranchProfile#inline}
* 8: InlinedCache
* Specialization: {@link Call#callGeneric}
* Parameter: {@link InlinedBranchProfile} error
* Inline method: {@link InlinedBranchProfile#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int state_0_;
/**
* Source Info:
* Specialization: {@link Call#callPanama}
* Parameter: {@link FunctionExecuteNode} functionExecute
*/
@Child private FunctionExecuteNode call_callPanama_functionExecute_;
@UnsafeAccessedField @Child private CallCallGeneric0Data call_callGeneric0_cache;
/**
* Source Info:
* Specialization: {@link Call#callGeneric}
* Parameter: {@link FunctionExecuteNode} functionExecute
*/
@Child private FunctionExecuteNode call_callGeneric1_functionExecute_;
@UnsafeAccessedField @CompilationFinal private CreateClosureCachedExecutableData createClosure_cachedExecutable_cache;
@UnsafeAccessedField @CompilationFinal private CreateClosureCachedSignatureData createClosure_cachedSignature_cache;
protected Cached() {
}
@Override
public boolean accepts(Object receiver) {
assert !(receiver instanceof PanamaSignature) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver instanceof PanamaSignature;
}
/**
* Debug Info:
* Specialization {@link Call#callPanama}
* Activation probability: 0.24167
* With/without class size: 8/4 bytes
* Specialization {@link Call#callGeneric}
* Activation probability: 0.16667
* With/without class size: 9/9 bytes
* Specialization {@link Call#callGeneric}
* Activation probability: 0.09167
* With/without class size: 6/5 bytes
*
*/
@ExplodeLoop
@Override
public Object call(Object arg0Value_, Object arg1Value, Object... arg2Value) throws ArityException, UnsupportedTypeException, UnsupportedMessageException {
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted(this);
PanamaSignature arg0Value = ((PanamaSignature) arg0Value_);
int state_0 = this.state_0_;
if ((state_0 & 0b111) != 0 /* is SpecializationActive[PanamaSignature.Call.callPanama(PanamaSignature, PanamaSymbol, Object[], FunctionExecuteNode)] || SpecializationActive[PanamaSignature.Call.callGeneric(PanamaSignature, Object, Object[], InteropLibrary, Node, InlinedBranchProfile, InlinedBranchProfile, InlinedBranchProfile, FunctionExecuteNode)] || SpecializationActive[PanamaSignature.Call.callGeneric(PanamaSignature, Object, Object[], InteropLibrary, Node, InlinedBranchProfile, InlinedBranchProfile, InlinedBranchProfile, FunctionExecuteNode)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[PanamaSignature.Call.callPanama(PanamaSignature, PanamaSymbol, Object[], FunctionExecuteNode)] */ && arg1Value instanceof PanamaSymbol) {
PanamaSymbol arg1Value_ = (PanamaSymbol) arg1Value;
{
FunctionExecuteNode functionExecute__ = this.call_callPanama_functionExecute_;
if (functionExecute__ != null) {
return Call.callPanama(arg0Value, arg1Value_, arg2Value, functionExecute__);
}
}
}
if ((state_0 & 0b110) != 0 /* is SpecializationActive[PanamaSignature.Call.callGeneric(PanamaSignature, Object, Object[], InteropLibrary, Node, InlinedBranchProfile, InlinedBranchProfile, InlinedBranchProfile, FunctionExecuteNode)] || SpecializationActive[PanamaSignature.Call.callGeneric(PanamaSignature, Object, Object[], InteropLibrary, Node, InlinedBranchProfile, InlinedBranchProfile, InlinedBranchProfile, FunctionExecuteNode)] */) {
if ((state_0 & 0b10) != 0 /* is SpecializationActive[PanamaSignature.Call.callGeneric(PanamaSignature, Object, Object[], InteropLibrary, Node, InlinedBranchProfile, InlinedBranchProfile, InlinedBranchProfile, FunctionExecuteNode)] */) {
CallCallGeneric0Data s1_ = this.call_callGeneric0_cache;
while (s1_ != null) {
if ((s1_.interop_.accepts(arg1Value))) {
Node node__ = (s1_);
return Call.callGeneric(arg0Value, arg1Value, arg2Value, s1_.interop_, node__, INLINED_CALL_CALL_GENERIC0_IS_EXECUTABLE_, INLINED_CALL_CALL_GENERIC0_TO_NATIVE_, INLINED_CALL_CALL_GENERIC0_ERROR_, s1_.functionExecute_);
}
s1_ = s1_.next_;
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[PanamaSignature.Call.callGeneric(PanamaSignature, Object, Object[], InteropLibrary, Node, InlinedBranchProfile, InlinedBranchProfile, InlinedBranchProfile, FunctionExecuteNode)] */) {
{
FunctionExecuteNode functionExecute__1 = this.call_callGeneric1_functionExecute_;
if (functionExecute__1 != null) {
return this.call_CallGeneric1Boundary(state_0, arg0Value, arg1Value, arg2Value, functionExecute__1);
}
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return callAndSpecialize(arg0Value, arg1Value, arg2Value);
}
@SuppressWarnings("static-method")
@TruffleBoundary
private Object call_CallGeneric1Boundary(int state_0, PanamaSignature arg0Value, Object arg1Value, Object[] arg2Value, FunctionExecuteNode functionExecute__1) throws ArityException, UnsupportedTypeException, UnsupportedMessageException {
EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent();
Node prev_ = encapsulating_.set(this);
try {
{
InteropLibrary interop__ = (INTEROP_LIBRARY_.getUncached(arg1Value));
Node node__ = (this);
return Call.callGeneric(arg0Value, arg1Value, arg2Value, interop__, node__, INLINED_CALL_CALL_GENERIC1_IS_EXECUTABLE_, INLINED_CALL_CALL_GENERIC1_TO_NATIVE_, INLINED_CALL_CALL_GENERIC1_ERROR_, functionExecute__1);
}
} finally {
encapsulating_.set(prev_);
}
}
private Object callAndSpecialize(PanamaSignature arg0Value, Object arg1Value, Object[] arg2Value) throws ArityException, UnsupportedTypeException {
int state_0 = this.state_0_;
if (arg1Value instanceof PanamaSymbol) {
PanamaSymbol arg1Value_ = (PanamaSymbol) arg1Value;
FunctionExecuteNode functionExecute__ = this.insert((FunctionExecuteNodeGen.create()));
Objects.requireNonNull(functionExecute__, "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.call_callPanama_functionExecute_ = functionExecute__;
state_0 = state_0 | 0b1 /* add SpecializationActive[PanamaSignature.Call.callPanama(PanamaSignature, PanamaSymbol, Object[], FunctionExecuteNode)] */;
this.state_0_ = state_0;
return Call.callPanama(arg0Value, arg1Value_, arg2Value, functionExecute__);
}
{
Node node__ = null;
if (((state_0 & 0b100)) == 0 /* is-not SpecializationActive[PanamaSignature.Call.callGeneric(PanamaSignature, Object, Object[], InteropLibrary, Node, InlinedBranchProfile, InlinedBranchProfile, InlinedBranchProfile, FunctionExecuteNode)] */) {
while (true) {
int count1_ = 0;
CallCallGeneric0Data s1_ = CALL_CALL_GENERIC0_CACHE_UPDATER.getVolatile(this);
CallCallGeneric0Data s1_original = s1_;
while (s1_ != null) {
if ((s1_.interop_.accepts(arg1Value))) {
node__ = (s1_);
break;
}
count1_++;
s1_ = s1_.next_;
}
if (s1_ == null) {
// assert (s1_.interop_.accepts(arg1Value));
if (count1_ < (3)) {
s1_ = this.insert(new CallCallGeneric0Data(s1_original));
InteropLibrary interop__ = s1_.insert((INTEROP_LIBRARY_.create(arg1Value)));
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.");
s1_.interop_ = interop__;
node__ = (s1_);
FunctionExecuteNode functionExecute__1 = s1_.insert((FunctionExecuteNodeGen.create()));
Objects.requireNonNull(functionExecute__1, "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.");
s1_.functionExecute_ = functionExecute__1;
if (!CALL_CALL_GENERIC0_CACHE_UPDATER.compareAndSet(this, s1_original, s1_)) {
continue;
}
state_0 = state_0 | 0b10 /* add SpecializationActive[PanamaSignature.Call.callGeneric(PanamaSignature, Object, Object[], InteropLibrary, Node, InlinedBranchProfile, InlinedBranchProfile, InlinedBranchProfile, FunctionExecuteNode)] */;
this.state_0_ = state_0;
}
}
if (s1_ != null) {
return Call.callGeneric(arg0Value, arg1Value, arg2Value, s1_.interop_, node__, INLINED_CALL_CALL_GENERIC0_IS_EXECUTABLE_, INLINED_CALL_CALL_GENERIC0_TO_NATIVE_, INLINED_CALL_CALL_GENERIC0_ERROR_, s1_.functionExecute_);
}
break;
}
}
}
{
Node node__ = null;
InteropLibrary interop__ = null;
{
EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent();
Node prev_ = encapsulating_.set(this);
try {
interop__ = (INTEROP_LIBRARY_.getUncached(arg1Value));
node__ = (this);
FunctionExecuteNode functionExecute__1 = this.insert((FunctionExecuteNodeGen.create()));
Objects.requireNonNull(functionExecute__1, "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.call_callGeneric1_functionExecute_ = functionExecute__1;
this.call_callGeneric0_cache = null;
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[PanamaSignature.Call.callGeneric(PanamaSignature, Object, Object[], InteropLibrary, Node, InlinedBranchProfile, InlinedBranchProfile, InlinedBranchProfile, FunctionExecuteNode)] */;
state_0 = state_0 | 0b100 /* add SpecializationActive[PanamaSignature.Call.callGeneric(PanamaSignature, Object, Object[], InteropLibrary, Node, InlinedBranchProfile, InlinedBranchProfile, InlinedBranchProfile, FunctionExecuteNode)] */;
this.state_0_ = state_0;
return Call.callGeneric(arg0Value, arg1Value, arg2Value, interop__, node__, INLINED_CALL_CALL_GENERIC1_IS_EXECUTABLE_, INLINED_CALL_CALL_GENERIC1_TO_NATIVE_, INLINED_CALL_CALL_GENERIC1_ERROR_, functionExecute__1);
} finally {
encapsulating_.set(prev_);
}
}
}
}
/**
* Debug Info:
* Specialization {@link CreateClosure#doCachedExecutable}
* Activation probability: 0.24167
* With/without class size: 10/12 bytes
* Specialization {@link CreateClosure#doCachedSignature}
* Activation probability: 0.16667
* With/without class size: 8/8 bytes
* Specialization {@link CreateClosure#createClosure}
* Activation probability: 0.09167
* With/without class size: 5/0 bytes
*
*/
@ExplodeLoop
@Override
public Object createClosure(Object arg0Value_, Object arg1Value) {
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted(this);
PanamaSignature arg0Value = ((PanamaSignature) arg0Value_);
int state_0 = this.state_0_;
if ((state_0 & 0b111000) != 0 /* is SpecializationActive[PanamaSignature.CreateClosure.doCachedExecutable(PanamaSignature, Object, CachedSignatureInfo, Object, MonomorphicClosureInfo)] || SpecializationActive[PanamaSignature.CreateClosure.doCachedSignature(PanamaSignature, Object, CachedSignatureInfo, PolymorphicClosureInfo)] || SpecializationActive[PanamaSignature.CreateClosure.createClosure(PanamaSignature, Object)] */) {
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[PanamaSignature.CreateClosure.doCachedExecutable(PanamaSignature, Object, CachedSignatureInfo, Object, MonomorphicClosureInfo)] */) {
CreateClosureCachedExecutableData s0_ = this.createClosure_cachedExecutable_cache;
while (s0_ != null) {
if (!Assumption.isValidAssumption(s0_.assumption0_)) {
CompilerDirectives.transferToInterpreterAndInvalidate();
removeCachedExecutable_(s0_);
return createClosureAndSpecialize(arg0Value, arg1Value);
}
if ((arg0Value.signatureInfo == s0_.cachedSignatureInfo_) && (arg1Value == s0_.cachedExecutable_)) {
return CreateClosure.doCachedExecutable(arg0Value, arg1Value, s0_.cachedSignatureInfo_, s0_.cachedExecutable_, s0_.cachedClosureInfo_);
}
s0_ = s0_.next_;
}
}
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[PanamaSignature.CreateClosure.doCachedSignature(PanamaSignature, Object, CachedSignatureInfo, PolymorphicClosureInfo)] */) {
CreateClosureCachedSignatureData s1_ = this.createClosure_cachedSignature_cache;
while (s1_ != null) {
if ((arg0Value.signatureInfo == s1_.cachedSignatureInfo_)) {
return CreateClosure.doCachedSignature(arg0Value, arg1Value, s1_.cachedSignatureInfo_, s1_.cachedClosureInfo_);
}
s1_ = s1_.next_;
}
}
if ((state_0 & 0b100000) != 0 /* is SpecializationActive[PanamaSignature.CreateClosure.createClosure(PanamaSignature, Object)] */) {
return CreateClosure.createClosure(arg0Value, arg1Value);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return createClosureAndSpecialize(arg0Value, arg1Value);
}
private PanamaClosure createClosureAndSpecialize(PanamaSignature arg0Value, Object arg1Value) {
int state_0 = this.state_0_;
if (((state_0 & 0b110000)) == 0 /* is-not SpecializationActive[PanamaSignature.CreateClosure.doCachedSignature(PanamaSignature, Object, CachedSignatureInfo, PolymorphicClosureInfo)] && SpecializationActive[PanamaSignature.CreateClosure.createClosure(PanamaSignature, Object)] */) {
while (true) {
int count0_ = 0;
CreateClosureCachedExecutableData s0_ = CREATE_CLOSURE_CACHED_EXECUTABLE_CACHE_UPDATER.getVolatile(this);
CreateClosureCachedExecutableData s0_original = s0_;
while (s0_ != null) {
if ((arg0Value.signatureInfo == s0_.cachedSignatureInfo_) && (arg1Value == s0_.cachedExecutable_) && Assumption.isValidAssumption(s0_.assumption0_)) {
break;
}
count0_++;
s0_ = s0_.next_;
}
if (s0_ == null) {
// assert (arg0Value.signatureInfo == s0_.cachedSignatureInfo_);
// assert (arg1Value == s0_.cachedExecutable_);
{
Assumption assumption0 = (PanamaNFILanguage.getSingleContextAssumption());
if (Assumption.isValidAssumption(assumption0)) {
if (count0_ < (3)) {
s0_ = new CreateClosureCachedExecutableData(s0_original);
s0_.cachedSignatureInfo_ = (arg0Value.signatureInfo);
s0_.cachedExecutable_ = (arg1Value);
s0_.cachedClosureInfo_ = (MonomorphicClosureInfo.create(s0_.cachedSignatureInfo_, s0_.cachedExecutable_));
s0_.assumption0_ = assumption0;
if (!CREATE_CLOSURE_CACHED_EXECUTABLE_CACHE_UPDATER.compareAndSet(this, s0_original, s0_)) {
continue;
}
state_0 = state_0 | 0b1000 /* add SpecializationActive[PanamaSignature.CreateClosure.doCachedExecutable(PanamaSignature, Object, CachedSignatureInfo, Object, MonomorphicClosureInfo)] */;
this.state_0_ = state_0;
}
}
}
}
if (s0_ != null) {
return CreateClosure.doCachedExecutable(arg0Value, arg1Value, s0_.cachedSignatureInfo_, s0_.cachedExecutable_, s0_.cachedClosureInfo_);
}
break;
}
}
if (((state_0 & 0b100000)) == 0 /* is-not SpecializationActive[PanamaSignature.CreateClosure.createClosure(PanamaSignature, Object)] */) {
while (true) {
int count1_ = 0;
CreateClosureCachedSignatureData s1_ = CREATE_CLOSURE_CACHED_SIGNATURE_CACHE_UPDATER.getVolatile(this);
CreateClosureCachedSignatureData s1_original = s1_;
while (s1_ != null) {
if ((arg0Value.signatureInfo == s1_.cachedSignatureInfo_)) {
break;
}
count1_++;
s1_ = s1_.next_;
}
if (s1_ == null) {
// assert (arg0Value.signatureInfo == s1_.cachedSignatureInfo_);
if (count1_ < (3)) {
s1_ = new CreateClosureCachedSignatureData(s1_original);
s1_.cachedSignatureInfo_ = (arg0Value.signatureInfo);
s1_.cachedClosureInfo_ = (PolymorphicClosureInfo.create(s1_.cachedSignatureInfo_));
if (!CREATE_CLOSURE_CACHED_SIGNATURE_CACHE_UPDATER.compareAndSet(this, s1_original, s1_)) {
continue;
}
this.createClosure_cachedExecutable_cache = null;
state_0 = state_0 & 0xfffffff7 /* remove SpecializationActive[PanamaSignature.CreateClosure.doCachedExecutable(PanamaSignature, Object, CachedSignatureInfo, Object, MonomorphicClosureInfo)] */;
state_0 = state_0 | 0b10000 /* add SpecializationActive[PanamaSignature.CreateClosure.doCachedSignature(PanamaSignature, Object, CachedSignatureInfo, PolymorphicClosureInfo)] */;
this.state_0_ = state_0;
}
}
if (s1_ != null) {
return CreateClosure.doCachedSignature(arg0Value, arg1Value, s1_.cachedSignatureInfo_, s1_.cachedClosureInfo_);
}
break;
}
}
this.createClosure_cachedExecutable_cache = null;
this.createClosure_cachedSignature_cache = null;
state_0 = state_0 & 0xffffffe7 /* remove SpecializationActive[PanamaSignature.CreateClosure.doCachedExecutable(PanamaSignature, Object, CachedSignatureInfo, Object, MonomorphicClosureInfo)], SpecializationActive[PanamaSignature.CreateClosure.doCachedSignature(PanamaSignature, Object, CachedSignatureInfo, PolymorphicClosureInfo)] */;
state_0 = state_0 | 0b100000 /* add SpecializationActive[PanamaSignature.CreateClosure.createClosure(PanamaSignature, Object)] */;
this.state_0_ = state_0;
return CreateClosure.createClosure(arg0Value, arg1Value);
}
void removeCachedExecutable_(CreateClosureCachedExecutableData s0_) {
while (true) {
CreateClosureCachedExecutableData cur = this.createClosure_cachedExecutable_cache;
CreateClosureCachedExecutableData original = cur;
CreateClosureCachedExecutableData update = null;
while (cur != null) {
if (cur == s0_) {
if (cur == original) {
update = cur.next_;
} else {
update = original.remove(s0_);
}
break;
}
cur = cur.next_;
}
if (cur != null && !CREATE_CLOSURE_CACHED_EXECUTABLE_CACHE_UPDATER.compareAndSet(this, original, update)) {
continue;
}
break;
}
}
@GeneratedBy(PanamaSignature.class)
@DenyReplace
private static final class CallCallGeneric0Data extends Node implements SpecializationDataNode {
@Child CallCallGeneric0Data next_;
/**
* State Info:
* 0: InlinedCache
* Specialization: {@link Call#callGeneric}
* Parameter: {@link InlinedBranchProfile} isExecutable
* Inline method: {@link InlinedBranchProfile#inline}
* 1: InlinedCache
* Specialization: {@link Call#callGeneric}
* Parameter: {@link InlinedBranchProfile} toNative
* Inline method: {@link InlinedBranchProfile#inline}
* 2: InlinedCache
* Specialization: {@link Call#callGeneric}
* Parameter: {@link InlinedBranchProfile} error
* Inline method: {@link InlinedBranchProfile#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int callGeneric0_state_0_;
/**
* Source Info:
* Specialization: {@link Call#callGeneric}
* Parameter: {@link InteropLibrary} interop
*/
@Child InteropLibrary interop_;
/**
* Source Info:
* Specialization: {@link Call#callGeneric}
* Parameter: {@link FunctionExecuteNode} functionExecute
*/
@Child FunctionExecuteNode functionExecute_;
CallCallGeneric0Data(CallCallGeneric0Data next_) {
this.next_ = next_;
}
private static Lookup lookup_() {
return MethodHandles.lookup();
}
}
@GeneratedBy(PanamaSignature.class)
@DenyReplace
private static final class CreateClosureCachedExecutableData implements SpecializationDataNode {
@CompilationFinal final CreateClosureCachedExecutableData next_;
/**
* Source Info:
* Specialization: {@link CreateClosure#doCachedExecutable}
* Parameter: {@link CachedSignatureInfo} cachedSignatureInfo
*/
@CompilationFinal CachedSignatureInfo cachedSignatureInfo_;
/**
* Source Info:
* Specialization: {@link CreateClosure#doCachedExecutable}
* Parameter: {@link Object} cachedExecutable
*/
@CompilationFinal Object cachedExecutable_;
/**
* Source Info:
* Specialization: {@link CreateClosure#doCachedExecutable}
* Parameter: {@link MonomorphicClosureInfo} cachedClosureInfo
*/
@CompilationFinal MonomorphicClosureInfo cachedClosureInfo_;
@CompilationFinal Assumption assumption0_;
CreateClosureCachedExecutableData(CreateClosureCachedExecutableData next_) {
this.next_ = next_;
}
CreateClosureCachedExecutableData remove(CreateClosureCachedExecutableData search) {
CreateClosureCachedExecutableData newNext = this.next_;
if (newNext != null) {
if (search == newNext) {
newNext = newNext.next_;
} else {
newNext = newNext.remove(search);
}
}
CreateClosureCachedExecutableData copy = new CreateClosureCachedExecutableData(newNext);
copy.cachedSignatureInfo_ = this.cachedSignatureInfo_;
copy.cachedExecutable_ = this.cachedExecutable_;
copy.cachedClosureInfo_ = this.cachedClosureInfo_;
copy.assumption0_ = this.assumption0_;
return copy;
}
}
@GeneratedBy(PanamaSignature.class)
@DenyReplace
private static final class CreateClosureCachedSignatureData implements SpecializationDataNode {
@CompilationFinal final CreateClosureCachedSignatureData next_;
/**
* Source Info:
* Specialization: {@link CreateClosure#doCachedSignature}
* Parameter: {@link CachedSignatureInfo} cachedSignatureInfo
*/
@CompilationFinal CachedSignatureInfo cachedSignatureInfo_;
/**
* Source Info:
* Specialization: {@link CreateClosure#doCachedSignature}
* Parameter: {@link PolymorphicClosureInfo} cachedClosureInfo
*/
@CompilationFinal PolymorphicClosureInfo cachedClosureInfo_;
CreateClosureCachedSignatureData(CreateClosureCachedSignatureData next_) {
this.next_ = next_;
}
}
}
@GeneratedBy(PanamaSignature.class)
@DenyReplace
private static final class Uncached extends NFIBackendSignatureLibrary implements UnadoptableNode {
protected Uncached() {
}
@Override
@TruffleBoundary
public boolean accepts(Object receiver) {
assert !(receiver instanceof PanamaSignature) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver instanceof PanamaSignature;
}
@TruffleBoundary
@Override
public Object call(Object arg0Value_, Object arg1Value, Object... arg2Value) throws ArityException, UnsupportedTypeException {
// declared: true
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
PanamaSignature arg0Value = ((PanamaSignature) arg0Value_);
if (arg1Value instanceof PanamaSymbol) {
PanamaSymbol arg1Value_ = (PanamaSymbol) arg1Value;
return Call.callPanama(arg0Value, arg1Value_, arg2Value, (FunctionExecuteNodeGen.getUncached()));
}
return Call.callGeneric(arg0Value, arg1Value, arg2Value, (INTEROP_LIBRARY_.getUncached(arg1Value)), (this), (InlinedBranchProfile.getUncached()), (InlinedBranchProfile.getUncached()), (InlinedBranchProfile.getUncached()), (FunctionExecuteNodeGen.getUncached()));
}
@TruffleBoundary
@Override
public Object createClosure(Object arg0Value_, Object arg1Value) {
// declared: true
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
PanamaSignature arg0Value = ((PanamaSignature) arg0Value_);
return CreateClosure.createClosure(arg0Value, arg1Value);
}
}
}
}