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

com.oracle.truffle.sl.runtime.SLBigNumberForeign Maven / Gradle / Ivy

There is a newer version: 1.0.0-rc7
Show newest version
package com.oracle.truffle.sl.runtime;

import com.oracle.truffle.api.CallTarget;
import com.oracle.truffle.api.Truffle;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.ForeignAccess;
import com.oracle.truffle.api.interop.ForeignAccess.Factory;
import com.oracle.truffle.api.interop.ForeignAccess.StandardFactory;
import com.oracle.truffle.api.interop.Message;
import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.api.interop.UnsupportedTypeException;
import com.oracle.truffle.api.nodes.RootNode;

/**
 * This foreign access factory is generated by {@link com.oracle.truffle.sl.runtime.SLBigNumber}.
 * You are supposed to use it for the receiver object {@link com.oracle.truffle.sl.runtime.SLBigNumber}.
 */
public final class SLBigNumberForeign implements StandardFactory, Factory {
    public static final ForeignAccess ACCESS = ForeignAccess.create(new SLBigNumberForeign(), null);
    @Deprecated public static ForeignAccess createAccess() { return ForeignAccess.create(new SLBigNumberForeign(), null); }

    private SLBigNumberForeign() { }

    @Override
    public boolean canHandle(TruffleObject obj) {
        return com.oracle.truffle.sl.runtime.SLBigNumber.isInstance(obj);
    }

    @Override
    public CallTarget accessIsNull() {
      return Truffle.getRuntime().createCallTarget(RootNode.createConstantNode(false));
    }
    @Override
    public CallTarget accessIsExecutable() {
      return Truffle.getRuntime().createCallTarget(RootNode.createConstantNode(false));
    }
    @Override
    public CallTarget accessIsInstantiable() {
      return Truffle.getRuntime().createCallTarget(RootNode.createConstantNode(false));
    }
    @Override
    public CallTarget accessIsBoxed() {
      return Truffle.getRuntime().createCallTarget(IsBoxedBigSubNode.createRoot());
    }
    @Override
    public CallTarget accessHasKeys() {
      return Truffle.getRuntime().createCallTarget(RootNode.createConstantNode(false));
    }
    @Override
    public CallTarget accessHasSize() {
      return Truffle.getRuntime().createCallTarget(RootNode.createConstantNode(false));
    }
    @Override
    public CallTarget accessGetSize() {
      return null;
    }
    @Override
    public CallTarget accessUnbox() {
      return com.oracle.truffle.api.Truffle.getRuntime().createCallTarget(UnboxBigSubNode.createRoot());
    }
    @Override
    public CallTarget accessRead() {
      return null;
    }
    @Override
    public CallTarget accessWrite() {
      return null;
    }
    @Override
    public CallTarget accessRemove() {
      return null;
    }
    @Override
    public CallTarget accessExecute(int argumentsLength) {
      return null;
    }
    @Override
    public CallTarget accessInvoke(int argumentsLength) {
      return null;
    }
    @Override
    public CallTarget accessNew(int argumentsLength) {
      return null;
    }
    @Override
    public CallTarget accessKeyInfo() {
      return null;
    }
    @Override
    public CallTarget accessKeys() {
      return null;
    }
    @Override
    public CallTarget accessIsPointer() {
      return Truffle.getRuntime().createCallTarget(RootNode.createConstantNode(false));
    }
    @Override
    public CallTarget accessAsPointer() {
      return null;
    }
    @Override
    public CallTarget accessToNative() {
      return null;
    }
    @Override
    public CallTarget accessMessage(Message unknown) {
      return null;
    }

    /**
     * This message resolution is generated by {@link com.oracle.truffle.sl.runtime.SLBigNumber.UnboxBigNode}.
     */
    abstract static class UnboxBigSubNode extends com.oracle.truffle.sl.runtime.SLBigNumber.UnboxBigNode {
        public abstract Object executeWithTarget(VirtualFrame frame, Object o0);
        @Specialization
        protected Object accessWithTarget(com.oracle.truffle.sl.runtime.SLBigNumber obj) {
            return access(obj);
        }
        private static final class UNBOXRootNode extends RootNode {
            protected UNBOXRootNode() {
                super(null);
            }

            @Child private UnboxBigSubNode node = com.oracle.truffle.sl.runtime.SLBigNumberForeignFactory.UnboxBigSubNodeGen.create();
            @Override
            public String getName() {
                return "Interop::UNBOX::com.oracle.truffle.sl.runtime.SLBigNumber";
            }

            @Override
            public Object execute(VirtualFrame frame) {
                Object receiver = ForeignAccess.getReceiver(frame);
                try {
                    return node.executeWithTarget(frame, receiver);
                } catch (UnsupportedSpecializationException e) {
                    if (e.getNode() instanceof UnboxBigSubNode) {
                      throw UnsupportedTypeException.raise(e, e.getSuppliedValues());
                    } else {
                      throw e;
                    }
                }
            }

        }
        public static RootNode createRoot() {
            return new UNBOXRootNode();
        }
    }

    /**
     * This message resolution is generated by {@link com.oracle.truffle.sl.runtime.SLBigNumber.IsBoxedBigNode}.
     */
    abstract static class IsBoxedBigSubNode extends com.oracle.truffle.sl.runtime.SLBigNumber.IsBoxedBigNode {
        public abstract Object executeWithTarget(VirtualFrame frame, Object o0);
        @Specialization
        protected Object accessWithTarget(com.oracle.truffle.sl.runtime.SLBigNumber obj) {
            return access(obj);
        }
        private static final class IS_BOXEDRootNode extends RootNode {
            protected IS_BOXEDRootNode() {
                super(null);
            }

            @Child private IsBoxedBigSubNode node = com.oracle.truffle.sl.runtime.SLBigNumberForeignFactory.IsBoxedBigSubNodeGen.create();
            @Override
            public String getName() {
                return "Interop::IS_BOXED::com.oracle.truffle.sl.runtime.SLBigNumber";
            }

            @Override
            public Object execute(VirtualFrame frame) {
                Object receiver = ForeignAccess.getReceiver(frame);
                try {
                    return node.executeWithTarget(frame, receiver);
                } catch (UnsupportedSpecializationException e) {
                    if (e.getNode() instanceof IsBoxedBigSubNode) {
                      throw UnsupportedTypeException.raise(e, e.getSuppliedValues());
                    } else {
                      throw e;
                    }
                }
            }

        }
        public static RootNode createRoot() {
            return new IS_BOXEDRootNode();
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy