com.oracle.truffle.js.runtime.GraalJSExceptionGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.truffle.js.runtime;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.TruffleLanguage;
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.UnsupportedSpecializationException;
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.LibraryExport;
import com.oracle.truffle.api.library.LibraryFactory;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.UnadoptableNode;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.api.utilities.TriState;
import com.oracle.truffle.js.runtime.GraalJSException.IsIdenticalOrUndefined;
import com.oracle.truffle.js.runtime.objects.JSDynamicObject;
import java.lang.invoke.VarHandle;
@GeneratedBy(GraalJSException.class)
@SuppressWarnings("javadoc")
public final class GraalJSExceptionGen {
private static final LibraryFactory DYNAMIC_DISPATCH_LIBRARY_ = LibraryFactory.resolve(DynamicDispatchLibrary.class);
private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);
static {
LibraryExport.register(GraalJSException.class, new InteropLibraryExports());
}
private GraalJSExceptionGen() {
}
@GeneratedBy(GraalJSException.class)
public static class InteropLibraryExports extends LibraryExport {
private InteropLibraryExports() {
super(InteropLibrary.class, GraalJSException.class, false, false, 0);
}
@Override
protected InteropLibrary createUncached(Object receiver) {
assert receiver instanceof GraalJSException;
InteropLibrary uncached = new Uncached(receiver);
return uncached;
}
@Override
protected InteropLibrary createCached(Object receiver) {
assert receiver instanceof GraalJSException;
return new Cached(receiver);
}
@GeneratedBy(GraalJSException.class)
public static class Cached extends InteropLibrary {
private final Class extends GraalJSException> receiverClass_;
/**
* State Info:
* 0: SpecializationActive {@link IsIdenticalOrUndefined#doException}
* 1: SpecializationActive {@link IsIdenticalOrUndefined#doJSObject}
* 2: SpecializationActive {@link IsIdenticalOrUndefined#doOther}
* 3: SpecializationActive {@link GraalJSException#identityHashCode(GraalJSException, InteropLibrary)}
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link IsIdenticalOrUndefined#doException}
* Parameter: {@link InteropLibrary} thisLib
*/
@Child private InteropLibrary thisLib;
/**
* Source Info:
* Specialization: {@link IsIdenticalOrUndefined#doException}
* Parameter: {@link InteropLibrary} otherLib
*/
@Child private InteropLibrary otherLib;
protected Cached(Object receiver) {
GraalJSException castReceiver = ((GraalJSException) receiver) ;
this.receiverClass_ = castReceiver.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 CompilerDirectives.isExact(receiver, this.receiverClass_);
}
/**
* Debug Info:
* Specialization {@link IsIdenticalOrUndefined#doException}
* Activation probability: 0.24167
* With/without class size: 6/0 bytes
* Specialization {@link IsIdenticalOrUndefined#doJSObject}
* Activation probability: 0.16667
* With/without class size: 6/0 bytes
* Specialization {@link IsIdenticalOrUndefined#doOther}
* Activation probability: 0.09167
* With/without class size: 5/0 bytes
*
*/
@Override
protected TriState isIdenticalOrUndefined(Object arg0Value_, Object arg1Value) {
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
GraalJSException arg0Value = CompilerDirectives.castExact(arg0Value_, receiverClass_);
int state_0 = this.state_0_;
if ((state_0 & 0b111) != 0 /* is SpecializationActive[GraalJSException.IsIdenticalOrUndefined.doException(GraalJSException, GraalJSException, InteropLibrary, InteropLibrary)] || SpecializationActive[GraalJSException.IsIdenticalOrUndefined.doJSObject(GraalJSException, JSDynamicObject)] || SpecializationActive[GraalJSException.IsIdenticalOrUndefined.doOther(GraalJSException, Object, InteropLibrary, InteropLibrary)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[GraalJSException.IsIdenticalOrUndefined.doException(GraalJSException, GraalJSException, InteropLibrary, InteropLibrary)] */ && arg1Value instanceof GraalJSException) {
GraalJSException arg1Value_ = (GraalJSException) arg1Value;
{
InteropLibrary thisLib_ = this.thisLib;
if (thisLib_ != null) {
InteropLibrary otherLib_ = this.otherLib;
if (otherLib_ != null) {
return IsIdenticalOrUndefined.doException(arg0Value, arg1Value_, thisLib_, otherLib_);
}
}
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[GraalJSException.IsIdenticalOrUndefined.doJSObject(GraalJSException, JSDynamicObject)] */ && arg1Value instanceof JSDynamicObject) {
JSDynamicObject arg1Value_ = (JSDynamicObject) arg1Value;
return IsIdenticalOrUndefined.doJSObject(arg0Value, arg1Value_);
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[GraalJSException.IsIdenticalOrUndefined.doOther(GraalJSException, Object, InteropLibrary, InteropLibrary)] */) {
{
InteropLibrary thisLib_1 = this.thisLib;
if (thisLib_1 != null) {
InteropLibrary otherLib_1 = this.otherLib;
if (otherLib_1 != null) {
if ((!(IsIdenticalOrUndefined.isGraalJSException(arg1Value)))) {
return IsIdenticalOrUndefined.doOther(arg0Value, arg1Value, thisLib_1, otherLib_1);
}
}
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return isIdenticalOrUndefinedAndSpecialize(arg0Value, arg1Value);
}
private TriState isIdenticalOrUndefinedAndSpecialize(GraalJSException arg0Value, Object arg1Value) {
int state_0 = this.state_0_;
if (arg1Value instanceof GraalJSException) {
GraalJSException arg1Value_ = (GraalJSException) arg1Value;
InteropLibrary thisLib_;
InteropLibrary thisLib__shared = this.thisLib;
if (thisLib__shared != null) {
thisLib_ = thisLib__shared;
} else {
thisLib_ = this.insert((INTEROP_LIBRARY_.createDispatched(JSConfig.InteropLibraryLimit)));
if (thisLib_ == null) {
throw new IllegalStateException("A specialization returned a default value for a cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state.");
}
}
if (this.thisLib == null) {
VarHandle.storeStoreFence();
this.thisLib = thisLib_;
}
InteropLibrary otherLib_;
InteropLibrary otherLib__shared = this.otherLib;
if (otherLib__shared != null) {
otherLib_ = otherLib__shared;
} else {
otherLib_ = this.insert((INTEROP_LIBRARY_.createDispatched(JSConfig.InteropLibraryLimit)));
if (otherLib_ == null) {
throw new IllegalStateException("A specialization returned a default value for a cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state.");
}
}
if (this.otherLib == null) {
VarHandle.storeStoreFence();
this.otherLib = otherLib_;
}
state_0 = state_0 | 0b1 /* add SpecializationActive[GraalJSException.IsIdenticalOrUndefined.doException(GraalJSException, GraalJSException, InteropLibrary, InteropLibrary)] */;
this.state_0_ = state_0;
return IsIdenticalOrUndefined.doException(arg0Value, arg1Value_, thisLib_, otherLib_);
}
if (((state_0 & 0b100)) == 0 /* is-not SpecializationActive[GraalJSException.IsIdenticalOrUndefined.doOther(GraalJSException, Object, InteropLibrary, InteropLibrary)] */ && arg1Value instanceof JSDynamicObject) {
JSDynamicObject arg1Value_ = (JSDynamicObject) arg1Value;
state_0 = state_0 | 0b10 /* add SpecializationActive[GraalJSException.IsIdenticalOrUndefined.doJSObject(GraalJSException, JSDynamicObject)] */;
this.state_0_ = state_0;
return IsIdenticalOrUndefined.doJSObject(arg0Value, arg1Value_);
}
if ((!(IsIdenticalOrUndefined.isGraalJSException(arg1Value)))) {
InteropLibrary thisLib_1;
InteropLibrary thisLib_1_shared = this.thisLib;
if (thisLib_1_shared != null) {
thisLib_1 = thisLib_1_shared;
} else {
thisLib_1 = this.insert((INTEROP_LIBRARY_.createDispatched(JSConfig.InteropLibraryLimit)));
if (thisLib_1 == null) {
throw new IllegalStateException("A specialization returned a default value for a cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state.");
}
}
if (this.thisLib == null) {
VarHandle.storeStoreFence();
this.thisLib = thisLib_1;
}
InteropLibrary otherLib_1;
InteropLibrary otherLib_1_shared = this.otherLib;
if (otherLib_1_shared != null) {
otherLib_1 = otherLib_1_shared;
} else {
otherLib_1 = this.insert((INTEROP_LIBRARY_.createDispatched(JSConfig.InteropLibraryLimit)));
if (otherLib_1 == null) {
throw new IllegalStateException("A specialization returned a default value for a cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state.");
}
}
if (this.otherLib == null) {
VarHandle.storeStoreFence();
this.otherLib = otherLib_1;
}
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[GraalJSException.IsIdenticalOrUndefined.doJSObject(GraalJSException, JSDynamicObject)] */;
state_0 = state_0 | 0b100 /* add SpecializationActive[GraalJSException.IsIdenticalOrUndefined.doOther(GraalJSException, Object, InteropLibrary, InteropLibrary)] */;
this.state_0_ = state_0;
return IsIdenticalOrUndefined.doOther(arg0Value, arg1Value, thisLib_1, otherLib_1);
}
throw new UnsupportedSpecializationException(this, null, arg0Value, arg1Value);
}
@Override
public boolean hasSourceLocation(Object receiver) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (CompilerDirectives.castExact(receiver, receiverClass_)).hasSourceLocation();
}
@Override
public SourceSection getSourceLocation(Object receiver) throws UnsupportedMessageException {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (CompilerDirectives.castExact(receiver, receiverClass_)).getSourceLocationInterop();
}
@Override
public boolean hasLanguage(Object receiver) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (CompilerDirectives.castExact(receiver, receiverClass_)).hasLanguage();
}
@Override
public Class extends TruffleLanguage>> getLanguage(Object receiver) throws UnsupportedMessageException {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (CompilerDirectives.castExact(receiver, receiverClass_)).getLanguage();
}
@Override
public Object toDisplayString(Object receiver, boolean allowSideEffects) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (CompilerDirectives.castExact(receiver, receiverClass_)).toDisplayString(allowSideEffects);
}
/**
* Debug Info:
* Specialization {@link GraalJSException#identityHashCode(GraalJSException, InteropLibrary)}
* Activation probability: 0.50000
* With/without class size: 10/0 bytes
*
*/
@Override
public int identityHashCode(Object arg0Value_) throws UnsupportedMessageException {
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
GraalJSException arg0Value = CompilerDirectives.castExact(arg0Value_, receiverClass_);
int state_0 = this.state_0_;
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[GraalJSException.identityHashCode(GraalJSException, InteropLibrary)] */) {
{
InteropLibrary thisLib_ = this.thisLib;
if (thisLib_ != null) {
return arg0Value.identityHashCode(thisLib_);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return identityHashCodeNode_AndSpecialize(arg0Value);
}
private int identityHashCodeNode_AndSpecialize(GraalJSException arg0Value) throws UnsupportedMessageException {
int state_0 = this.state_0_;
InteropLibrary thisLib_;
InteropLibrary thisLib__shared = this.thisLib;
if (thisLib__shared != null) {
thisLib_ = thisLib__shared;
} else {
thisLib_ = this.insert((INTEROP_LIBRARY_.createDispatched(JSConfig.InteropLibraryLimit)));
if (thisLib_ == null) {
throw new IllegalStateException("A specialization returned a default value for a cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state.");
}
}
if (this.thisLib == null) {
VarHandle.storeStoreFence();
this.thisLib = thisLib_;
}
state_0 = state_0 | 0b1000 /* add SpecializationActive[GraalJSException.identityHashCode(GraalJSException, InteropLibrary)] */;
this.state_0_ = state_0;
return arg0Value.identityHashCode(thisLib_);
}
}
@GeneratedBy(GraalJSException.class)
public static class Uncached extends InteropLibrary implements UnadoptableNode {
private final Class extends GraalJSException> receiverClass_;
protected Uncached(Object receiver) {
this.receiverClass_ = ((GraalJSException) receiver).getClass();
}
@Override
@TruffleBoundary
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 CompilerDirectives.isExact(receiver, this.receiverClass_);
}
@TruffleBoundary
@Override
public TriState isIdenticalOrUndefined(Object arg0Value_, Object arg1Value) {
// declared: true
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
GraalJSException arg0Value = ((GraalJSException) arg0Value_);
if (arg1Value instanceof GraalJSException) {
GraalJSException arg1Value_ = (GraalJSException) arg1Value;
return IsIdenticalOrUndefined.doException(arg0Value, arg1Value_, (INTEROP_LIBRARY_.getUncached()), (INTEROP_LIBRARY_.getUncached()));
}
if ((!(IsIdenticalOrUndefined.isGraalJSException(arg1Value)))) {
return IsIdenticalOrUndefined.doOther(arg0Value, arg1Value, (INTEROP_LIBRARY_.getUncached()), (INTEROP_LIBRARY_.getUncached()));
}
throw newUnsupportedSpecializationException2(this, arg0Value, arg1Value);
}
@TruffleBoundary
@Override
public boolean hasSourceLocation(Object receiver) {
// declared: true
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((GraalJSException) receiver) .hasSourceLocation();
}
@TruffleBoundary
@Override
public SourceSection getSourceLocation(Object receiver) throws UnsupportedMessageException {
// declared: true
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((GraalJSException) receiver) .getSourceLocationInterop();
}
@TruffleBoundary
@Override
public boolean hasLanguage(Object receiver) {
// declared: true
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((GraalJSException) receiver) .hasLanguage();
}
@TruffleBoundary
@Override
public Class extends TruffleLanguage>> getLanguage(Object receiver) throws UnsupportedMessageException {
// declared: true
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((GraalJSException) receiver) .getLanguage();
}
@TruffleBoundary
@Override
public Object toDisplayString(Object receiver, boolean allowSideEffects) {
// declared: true
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((GraalJSException) receiver) .toDisplayString(allowSideEffects);
}
@TruffleBoundary
@Override
public int identityHashCode(Object arg0Value_) throws UnsupportedMessageException {
// declared: true
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
GraalJSException arg0Value = ((GraalJSException) arg0Value_);
return arg0Value.identityHashCode((INTEROP_LIBRARY_.getUncached()));
}
@TruffleBoundary
private static UnsupportedSpecializationException newUnsupportedSpecializationException2(Node thisNode_, Object arg0Value, Object arg1Value) {
return new UnsupportedSpecializationException(thisNode_, null, arg0Value, arg1Value);
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy