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

com.oracle.truffle.tck.ComplexNumberBEntryMessageResolutionForeign Maven / Gradle / Ivy

Go to download

A collection of tests that can certify language implementation to be compliant with most recent requirements of the Truffle infrastructure and tooling.

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

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.tck.ComplexNumberBEntryMessageResolution}.
 * You are supposed to use it for the receiver object {@link com.oracle.truffle.tck.ComplexNumberBEntry}.
 */
final class ComplexNumberBEntryMessageResolutionForeign implements StandardFactory, Factory {
    public static final ForeignAccess ACCESS = ForeignAccess.create(new ComplexNumberBEntryMessageResolutionForeign(), null);
    @Deprecated public static ForeignAccess createAccess() { return ForeignAccess.create(new ComplexNumberBEntryMessageResolutionForeign(), null); }

    private ComplexNumberBEntryMessageResolutionForeign() { }

    @Override
    public boolean canHandle(TruffleObject obj) {
        return com.oracle.truffle.tck.ComplexNumberBEntry.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(RootNode.createConstantNode(false));
    }
    @Override
    public CallTarget accessHasKeys() {
      return Truffle.getRuntime().createCallTarget(ComplexNumbersBEntryHasKeysSubNode.createRoot());
    }
    @Override
    public CallTarget accessHasSize() {
      return Truffle.getRuntime().createCallTarget(RootNode.createConstantNode(false));
    }
    @Override
    public CallTarget accessGetSize() {
      return null;
    }
    @Override
    public CallTarget accessUnbox() {
      return null;
    }
    @Override
    public CallTarget accessRead() {
      return com.oracle.truffle.api.Truffle.getRuntime().createCallTarget(ComplexNumbersBEntryReadSubNode.createRoot());
    }
    @Override
    public CallTarget accessWrite() {
      return com.oracle.truffle.api.Truffle.getRuntime().createCallTarget(ComplexNumbersBEntryWriteSubNode.createRoot());
    }
    @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 com.oracle.truffle.api.Truffle.getRuntime().createCallTarget(ComplexNumbersBEntryKeysSubNode.createRoot());
    }
    @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.tck.ComplexNumberBEntryMessageResolution.ComplexNumbersBEntryWriteNode}.
     */
    abstract static class ComplexNumbersBEntryWriteSubNode extends com.oracle.truffle.tck.ComplexNumberBEntryMessageResolution.ComplexNumbersBEntryWriteNode {
        public abstract Object executeWithTarget(VirtualFrame frame, Object o0, Object o1, Object o2);
        @Specialization
        protected Object accessWithTarget(com.oracle.truffle.tck.ComplexNumberBEntry complexNumber, java.lang.String name, java.lang.Number value) {
            return access(complexNumber, name, value);
        }
        private static final class WRITERootNode extends RootNode {
            protected WRITERootNode() {
                super(null);
            }

            @Child private ComplexNumbersBEntryWriteSubNode node = com.oracle.truffle.tck.ComplexNumberBEntryMessageResolutionForeignFactory.ComplexNumbersBEntryWriteSubNodeGen.create();
            @Override
            public String getName() {
                return "Interop::WRITE::com.oracle.truffle.tck.ComplexNumberBEntry";
            }

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

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

    /**
     * This message resolution is generated by {@link com.oracle.truffle.tck.ComplexNumberBEntryMessageResolution.ComplexNumbersBEntryHasKeysNode}.
     */
    abstract static class ComplexNumbersBEntryHasKeysSubNode extends com.oracle.truffle.tck.ComplexNumberBEntryMessageResolution.ComplexNumbersBEntryHasKeysNode {
        public abstract Object executeWithTarget(VirtualFrame frame, Object o0);
        @Specialization
        protected Object accessWithTarget(com.oracle.truffle.tck.ComplexNumberBEntry complexNumber) {
            return access(complexNumber);
        }
        private static final class HAS_KEYSRootNode extends RootNode {
            protected HAS_KEYSRootNode() {
                super(null);
            }

            @Child private ComplexNumbersBEntryHasKeysSubNode node = com.oracle.truffle.tck.ComplexNumberBEntryMessageResolutionForeignFactory.ComplexNumbersBEntryHasKeysSubNodeGen.create();
            @Override
            public String getName() {
                return "Interop::HAS_KEYS::com.oracle.truffle.tck.ComplexNumberBEntry";
            }

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

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

    /**
     * This message resolution is generated by {@link com.oracle.truffle.tck.ComplexNumberBEntryMessageResolution.ComplexNumbersBEntryReadNode}.
     */
    abstract static class ComplexNumbersBEntryReadSubNode extends com.oracle.truffle.tck.ComplexNumberBEntryMessageResolution.ComplexNumbersBEntryReadNode {
        public abstract Object executeWithTarget(VirtualFrame frame, Object o0, Object o1);
        @Specialization
        protected Object accessWithTarget(com.oracle.truffle.tck.ComplexNumberBEntry complexNumber, java.lang.String name) {
            return access(complexNumber, name);
        }
        private static final class READRootNode extends RootNode {
            protected READRootNode() {
                super(null);
            }

            @Child private ComplexNumbersBEntryReadSubNode node = com.oracle.truffle.tck.ComplexNumberBEntryMessageResolutionForeignFactory.ComplexNumbersBEntryReadSubNodeGen.create();
            @Override
            public String getName() {
                return "Interop::READ::com.oracle.truffle.tck.ComplexNumberBEntry";
            }

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

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

    /**
     * This message resolution is generated by {@link com.oracle.truffle.tck.ComplexNumberBEntryMessageResolution.ComplexNumbersBEntryKeysNode}.
     */
    abstract static class ComplexNumbersBEntryKeysSubNode extends com.oracle.truffle.tck.ComplexNumberBEntryMessageResolution.ComplexNumbersBEntryKeysNode {
        public abstract Object executeWithTarget(VirtualFrame frame, Object o0);
        @Specialization
        protected Object accessWithTarget(com.oracle.truffle.tck.ComplexNumberBEntry complexNumber) {
            return access(complexNumber);
        }
        private static final class KEYSRootNode extends RootNode {
            protected KEYSRootNode() {
                super(null);
            }

            @Child private ComplexNumbersBEntryKeysSubNode node = com.oracle.truffle.tck.ComplexNumberBEntryMessageResolutionForeignFactory.ComplexNumbersBEntryKeysSubNodeGen.create();
            @Override
            public String getName() {
                return "Interop::KEYS::com.oracle.truffle.tck.ComplexNumberBEntry";
            }

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy