All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.oracle.truffle.js.runtime.SymbolGen 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.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.DenyReplace;
import com.oracle.truffle.api.nodes.UnadoptableNode;
import com.oracle.truffle.api.utilities.TriState;
import com.oracle.truffle.js.runtime.Symbol.IsIdenticalOrUndefined;

@GeneratedBy(Symbol.class)
@SuppressWarnings({"javadoc", "unused"})
final class SymbolGen {

    private static final LibraryFactory DYNAMIC_DISPATCH_LIBRARY_ = LibraryFactory.resolve(DynamicDispatchLibrary.class);

    static  {
        LibraryExport.register(Symbol.class, new InteropLibraryExports());
    }

    private SymbolGen() {
    }

    @GeneratedBy(Symbol.class)
    private static final class InteropLibraryExports extends LibraryExport {

        private InteropLibraryExports() {
            super(InteropLibrary.class, Symbol.class, false, false, 0);
        }

        @Override
        protected InteropLibrary createUncached(Object receiver) {
            assert receiver instanceof Symbol;
            InteropLibrary uncached = new Uncached();
            return uncached;
        }

        @Override
        protected InteropLibrary createCached(Object receiver) {
            assert receiver instanceof Symbol;
            return new Cached();
        }

        @GeneratedBy(Symbol.class)
        private static final class Cached extends InteropLibrary {

            /**
             * State Info: 
             *   0: SpecializationActive {@link IsIdenticalOrUndefined#doHostObject}
             *   1: SpecializationActive {@link IsIdenticalOrUndefined#doOther}
             * 
*/ @CompilationFinal private int state_0_; protected Cached() { } @Override public boolean accepts(Object receiver) { assert !(receiver instanceof Symbol) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected."; return receiver instanceof Symbol; } @SuppressWarnings("static-method") private boolean fallbackGuard_(int state_0, Symbol arg0Value, Object arg1Value) { if (!((state_0 & 0b1) != 0 /* is SpecializationActive[Symbol.IsIdenticalOrUndefined.doHostObject(Symbol, Symbol)] */) && arg1Value instanceof Symbol) { return false; } return true; } /** * Debug Info:
             *   Specialization {@link IsIdenticalOrUndefined#doHostObject}
             *     Activation probability: 0.65000
             *     With/without class size: 11/0 bytes
             *   Specialization {@link IsIdenticalOrUndefined#doOther}
             *     Activation probability: 0.35000
             *     With/without class size: 8/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(); Symbol arg0Value = ((Symbol) arg0Value_); int state_0 = this.state_0_; if (state_0 != 0 /* is SpecializationActive[Symbol.IsIdenticalOrUndefined.doHostObject(Symbol, Symbol)] || SpecializationActive[Symbol.IsIdenticalOrUndefined.doOther(Symbol, Object)] */) { if ((state_0 & 0b1) != 0 /* is SpecializationActive[Symbol.IsIdenticalOrUndefined.doHostObject(Symbol, Symbol)] */ && arg1Value instanceof Symbol) { Symbol arg1Value_ = (Symbol) arg1Value; return IsIdenticalOrUndefined.doHostObject(arg0Value, arg1Value_); } if ((state_0 & 0b10) != 0 /* is SpecializationActive[Symbol.IsIdenticalOrUndefined.doOther(Symbol, Object)] */) { if (fallbackGuard_(state_0, arg0Value, arg1Value)) { return IsIdenticalOrUndefined.doOther(arg0Value, arg1Value); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value); } private TriState executeAndSpecialize(Symbol arg0Value, Object arg1Value) { int state_0 = this.state_0_; if (arg1Value instanceof Symbol) { Symbol arg1Value_ = (Symbol) arg1Value; state_0 = state_0 | 0b1 /* add SpecializationActive[Symbol.IsIdenticalOrUndefined.doHostObject(Symbol, Symbol)] */; this.state_0_ = state_0; return IsIdenticalOrUndefined.doHostObject(arg0Value, arg1Value_); } state_0 = state_0 | 0b10 /* add SpecializationActive[Symbol.IsIdenticalOrUndefined.doOther(Symbol, Object)] */; this.state_0_ = state_0; return IsIdenticalOrUndefined.doOther(arg0Value, arg1Value); } @Override public boolean hasLanguage(Object receiver) { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return (((Symbol) receiver)).hasLanguage(); } @Override public Class> getLanguage(Object receiver) throws UnsupportedMessageException { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return (((Symbol) receiver)).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 (((Symbol) receiver)).toDisplayString(allowSideEffects); } @Override public boolean hasMetaObject(Object receiver) { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return (((Symbol) receiver)).hasMetaObject(); } @Override public Object getMetaObject(Object receiver) throws UnsupportedMessageException { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return (((Symbol) receiver)).getMetaObject(); } @TruffleBoundary @Override public int identityHashCode(Object receiver) throws UnsupportedMessageException { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return (((Symbol) receiver)).identityHashCode(); } } @GeneratedBy(Symbol.class) @DenyReplace private static final class Uncached extends InteropLibrary implements UnadoptableNode { protected Uncached() { } @Override @TruffleBoundary public boolean accepts(Object receiver) { assert !(receiver instanceof Symbol) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected."; return receiver instanceof Symbol; } @TruffleBoundary @Override public TriState isIdenticalOrUndefined(Object arg0Value_, Object arg1Value) { // declared: true assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver."; Symbol arg0Value = ((Symbol) arg0Value_); if (arg1Value instanceof Symbol) { Symbol arg1Value_ = (Symbol) arg1Value; return IsIdenticalOrUndefined.doHostObject(arg0Value, arg1Value_); } return IsIdenticalOrUndefined.doOther(arg0Value, arg1Value); } @TruffleBoundary @Override public boolean hasLanguage(Object receiver) { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return ((Symbol) receiver) .hasLanguage(); } @TruffleBoundary @Override public Class> getLanguage(Object receiver) throws UnsupportedMessageException { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return ((Symbol) 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 ((Symbol) receiver) .toDisplayString(allowSideEffects); } @TruffleBoundary @Override public boolean hasMetaObject(Object receiver) { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return ((Symbol) receiver) .hasMetaObject(); } @TruffleBoundary @Override public Object getMetaObject(Object receiver) throws UnsupportedMessageException { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return ((Symbol) receiver) .getMetaObject(); } @TruffleBoundary @Override public int identityHashCode(Object receiver) throws UnsupportedMessageException { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return ((Symbol) receiver) .identityHashCode(); } } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy