Package org.perl6.nqp.runtime

Examples of org.perl6.nqp.runtime.CallSiteDescriptor


            cf.leave();
        }
    }

    public void attr_name(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd, Object[] args) {
        CallFrame cf = new CallFrame(tc, cr);
        try {
            csd = Ops.checkarity(cf, csd, args, 1, 1);
            args = tc.flatArgs;
            SixModelObject self = Ops.posparam_o(cf, csd, args, 0);
            Ops.return_s(((KnowHOWAttributeInstance)self).name, cf);
        }
        finally {
            cf.leave();
        }
    }
View Full Code Here


            cf.leave();
        }
    }

    public void attr_type(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd, Object[] args) {
        CallFrame cf = new CallFrame(tc, cr);
        try {
            csd = Ops.checkarity(cf, csd, args, 1, 1);
            args = tc.flatArgs;
            SixModelObject self = Ops.posparam_o(cf, csd, args, 0);
            Ops.return_o(((KnowHOWAttributeInstance)self).type, cf);
        }
        finally {
            cf.leave();
        }
    }
View Full Code Here

            cf.leave();
        }
    }

    public void attr_box_target(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd, Object[] args) {
        CallFrame cf = new CallFrame(tc, cr);
        try {
            csd = Ops.checkarity(cf, csd, args, 1, 1);
            args = tc.flatArgs;
            SixModelObject self = Ops.posparam_o(cf, csd, args, 0);
            Ops.return_i(((KnowHOWAttributeInstance)self).box_target, cf);
        }
        finally {
            cf.leave();
        }
    }
View Full Code Here

            /* Resolve the reference to the static code object this context is for. */
            CodeRef staticCode = readCodeRef();

            /* Create a context and set it up. */
            CallFrame ctx = new CallFrame();
            ctx.tc = tc;
            ctx.codeRef = staticCode;
            StaticCodeInfo sci = staticCode.staticInfo;
            if (sci.oLexicalNames != null)
                ctx.oLex = sci.oLexStatic.clone();
View Full Code Here

        nqpComp = Ops.getcomp(hll, t);
    }

    private SixModelObject eval(String nqp) {
        Ops.invokeDirect(t, Ops.findmethod(t, nqpComp, "compile"),
                new CallSiteDescriptor(new byte[] { ARG_OBJ, ARG_STR }, null),
                new Object[] { nqpComp, nqp });

        Ops.invokeDirect(t, Ops.result_o(t.resultFrame()), Ops.emptyCallSite, Ops.emptyArgList);
        return Ops.result_o(t.resultFrame());
    }
View Full Code Here

        case UTF8STR:
        case UTF16STR: {
            /* TODO: Handle encodings. */
            SixModelObject meth = Ops.findmethod(o, "cstr", tc);
            if (meth != null) {
                Ops.invokeDirect(tc, meth, new CallSiteDescriptor(new byte[] { ARG_OBJ }, null), new Object[] { o });
                CStrInstance cstr = (CStrInstance) Ops.decont(Ops.result_o(tc.resultFrame()), tc);
                return cstr.cstr;
            }
            else {
                return o.get_str(tc);
View Full Code Here

            this.argumentTypes = argumentTypes;
            this.argumentInfo = argumentInfo;

            byte[] desc = new byte[argumentTypes.length];
            Arrays.fill(desc, ARG_OBJ);
            this.callsite = new CallSiteDescriptor(desc, null);
        }
View Full Code Here

        SixModelObject meth = Ops.findmethod(st.WHAT, "of", tc);
        if (meth == null)
            ExceptionHandling.dieInternal(tc, "CArray representation expects an 'of' method, specifying the element type");

        Ops.invokeDirect(tc, meth, new CallSiteDescriptor(new byte[] { ARG_OBJ }, null), new Object[] { st.WHAT });
        data.elem_type = Ops.decont(Ops.result_o(tc.resultFrame()), tc);
        if (data.elem_type == null)
            ExceptionHandling.dieInternal(tc, "CArray representation expects a non-null return value from the 'of' method, specifying the element type");

        StorageSpec ss = data.elem_type.st.REPR.get_storage_spec(tc, data.elem_type.st);
View Full Code Here

        SixModelObject meth = Ops.findmethod(st.WHAT, "of", tc);
        if (meth == null)
            ExceptionHandling.dieInternal(tc, "CArray representation expects an 'of' method, specifying the element type");

        Ops.invokeDirect(tc, meth, new CallSiteDescriptor(new byte[] { ARG_OBJ }, null), new Object[] { st.WHAT });
        data.elem_type = Ops.decont(Ops.result_o(tc.resultFrame()), tc);
        if (data.elem_type == null)
            ExceptionHandling.dieInternal(tc, "CArray representation expects a non-null return value from the 'of' method, specifying the element type");

        StorageSpec ss = data.elem_type.st.REPR.get_storage_spec(tc, data.elem_type.st);
View Full Code Here

        long[][] hnull = new long[0][];
        MethodType mt = MethodType.methodType(void.class, ThreadContext.class,
                CodeRef.class, CallSiteDescriptor.class, Object[].class);
        Lookup l = MethodHandles.lookup();
        try {
            refs[0] = new CodeRef(this, l.findVirtual(KnowHOWMethods.class, "new_type", mt).bindTo(this),
                    "new_type", "new_type", snull, snull, snull, snull, hnull, (short)0);
            refs[1] = new CodeRef(this, l.findVirtual(KnowHOWMethods.class, "add_method", mt).bindTo(this),
                    "add_method", "add_method", snull, snull, snull, snull, hnull, (short)0);
            refs[2] = new CodeRef(this, l.findVirtual(KnowHOWMethods.class, "add_attribute", mt).bindTo(this),
                    "add_attribute", "add_attribute", snull, snull, snull, snull, hnull, (short)0);
            refs[3] = new CodeRef(this, l.findVirtual(KnowHOWMethods.class, "compose", mt).bindTo(this),
                    "compose", "compose", snull, snull, snull, snull, hnull, (short)0);
            refs[4] = new CodeRef(this, l.findVirtual(KnowHOWMethods.class, "attributes", mt).bindTo(this),
                    "attributes", "attributes", snull, snull, snull, snull, hnull, (short)0);
            refs[5] = new CodeRef(this, l.findVirtual(KnowHOWMethods.class, "methods", mt).bindTo(this),
                    "methods", "methods", snull, snull, snull, snull, hnull, (short)0);
            refs[6] = new CodeRef(this, l.findVirtual(KnowHOWMethods.class, "name", mt).bindTo(this),
                    "name", "name", snull, snull, snull, snull, hnull, (short)0);
            refs[7] = new CodeRef(this, l.findVirtual(KnowHOWMethods.class, "attr_new", mt).bindTo(this),
                    "new", "attr_new", snull, snull, snull, snull, hnull, (short)0);
            refs[8] = new CodeRef(this, l.findVirtual(KnowHOWMethods.class, "attr_compose", mt).bindTo(this),
                    "compose", "attr_compose", snull, snull, snull, snull, hnull, (short)0);
            refs[9] = new CodeRef(this, l.findVirtual(KnowHOWMethods.class, "attr_name", mt).bindTo(this),
                    "name", "attr_name", snull, snull, snull, snull, hnull, (short)0);
            refs[10] = new CodeRef(this, l.findVirtual(KnowHOWMethods.class, "attr_type", mt).bindTo(this),
                    "type", "attr_type", snull, snull, snull, snull, hnull, (short)0);
            refs[11] = new CodeRef(this, l.findVirtual(KnowHOWMethods.class, "attr_box_target", mt).bindTo(this),
                    "box_target", "attr_box_target", snull, snull, snull, snull, hnull, (short)0);
        }
        catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

TOP

Related Classes of org.perl6.nqp.runtime.CallSiteDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.