Package org.perl6.nqp.sixmodel.reprs

Examples of org.perl6.nqp.sixmodel.reprs.VMArrayInstance_i8


            public void completed(AsynchronousSocketChannel channel, AsyncTaskInstance task) {
                listenChan.accept(task, this);
                ThreadContext curTC = tc.gc.getCurrentThreadContext();

                AsyncSocketHandle handle = new AsyncSocketHandle(curTC, channel);
                IOHandleInstance ioHandle = (IOHandleInstance) IOType.st.REPR.allocate(curTC,
                        IOType.st);
                ioHandle.handle = handle;

                SixModelObject result = Array.st.REPR.allocate(curTC, Array.st);
                result.push_boxed(curTC, task.schedulee);
View Full Code Here


            @Override
            public void completed(Void v, AsyncTaskInstance task) {
                ThreadContext curTC = tc.gc.getCurrentThreadContext();

                IOHandleInstance ioHandle = (IOHandleInstance) IOType.st.REPR.allocate(curTC,
                        IOType.st);
                ioHandle.handle = task.handle;
                callback(curTC, task, ioHandle, Str);
            }
View Full Code Here

            /* ...then an array of hashes per attribute... */
            SixModelObject attr_info_list = tc.gc.BOOTArray.st.REPR.allocate(tc, tc.gc.BOOTArray.st);
            type_info.push_boxed(tc, attr_info_list);
            List<SixModelObject> attributes = ((KnowHOWREPRInstance)self).attributes;
            for (int i = 0; i < attributes.size(); i++) {
                KnowHOWAttributeInstance attribute = (KnowHOWAttributeInstance)attributes.get(i);
                SixModelObject attr_info = tc.gc.BOOTHash.st.REPR.allocate(tc, tc.gc.BOOTHash.st);
                SixModelObject name_obj = tc.gc.BOOTStr.st.REPR.allocate(tc, tc.gc.BOOTStr.st);
                name_obj.set_str(tc, attribute.name);
                attr_info.bind_key_boxed(tc, "name", name_obj);
                attr_info.bind_key_boxed(tc, "type", attribute.type);
View Full Code Here

            SixModelObject type_arg = Ops.namedparam_opt_o(cf, csd, args, "type");
            long bt_arg = Ops.namedparam_opt_i(cf, csd, args, "box_target");
   
            /* Allocate attribute object. */
            REPR repr = REPRRegistry.getByName("KnowHOWAttribute");
            KnowHOWAttributeInstance obj = (KnowHOWAttributeInstance)repr.allocate(tc, self.st);
           
            /* Populate it. */
            obj.name = name_arg;
            obj.type = type_arg != null ? type_arg : tc.gc.KnowHOW;
            obj.box_target = bt_arg == 0 ? 0 : 1;
View Full Code Here

        /* We create a KnowHOW instance that can describe itself. This means
         * (once we tie the knot) that .HOW.HOW.HOW.HOW etc will always return
         * that, which closes the model up. */
        STable st = new STable(REPR, null);
        st.WHAT = knowhow;
        KnowHOWREPRInstance knowhow_how = (KnowHOWREPRInstance)REPR.allocate(tc, st);
        st.HOW = knowhow_how;
        knowhow_how.st = st;
       
        /* Add various methods to the KnowHOW's HOW. */
        knowhow_how.methods.put("new_type", knowhowUnit.lookupCodeRef("new_type"));
View Full Code Here

    }

    private static void bootstrapKnowHOWAttribute(ThreadContext tc, CompilationUnit knowhowUnit) {       
        /* Create meta-object. */
        SixModelObject knowhow_how = tc.gc.KnowHOW.st.HOW;
        KnowHOWREPRInstance meta_obj = (KnowHOWREPRInstance)knowhow_how.st.REPR.allocate(tc, knowhow_how.st);
       
        /* Add methods. */
        meta_obj.methods.put("new", knowhowUnit.lookupCodeRef("attr_new"));
        meta_obj.methods.put("compose", knowhowUnit.lookupCodeRef("attr_compose"));
        meta_obj.methods.put("name", knowhowUnit.lookupCodeRef("attr_name"));
View Full Code Here

        tc.gc.KnowHOWAttribute = type_obj;
    }
   
    private static SixModelObject bootType(ThreadContext tc, String typeName, String reprName) {
        SixModelObject knowhow_how = tc.gc.KnowHOW.st.HOW;
        KnowHOWREPRInstance meta_obj = (KnowHOWREPRInstance)knowhow_how.st.REPR.allocate(tc, knowhow_how.st);
        meta_obj.name = typeName;
        REPR repr = REPRRegistry.getByName(reprName);
        SixModelObject type_obj = repr.type_object_for(tc, meta_obj);
        type_obj.st.MethodCache = meta_obj.methods;
        type_obj.st.ModeFlags = STable.METHOD_CACHE_AUTHORITATIVE;
View Full Code Here

public class Buffers {

    public static void stashBytes(ThreadContext tc, SixModelObject res, byte[] bytes) {
        if (res instanceof VMArrayInstance_i8) {
            VMArrayInstance_i8 arr = (VMArrayInstance_i8)res;
            arr.elems = bytes.length;
            arr.start = 0;
            arr.slots = bytes;
        }
        else {
View Full Code Here

    }

    public static ByteBuffer unstashBytes(SixModelObject buf, ThreadContext tc) {
        ByteBuffer bb;
        if (buf instanceof VMArrayInstance_i8) {
            VMArrayInstance_i8 bufi8 = (VMArrayInstance_i8)buf;
            bb = bufi8.slots != null
                ? ByteBuffer.wrap(bufi8.slots, bufi8.start, bufi8.elems)
                : ByteBuffer.allocate(0);
        }
        else if (buf instanceof VMArrayInstance_u8) {
View Full Code Here

    public static SixModelObject readfh(SixModelObject io, SixModelObject res, long bytes, ThreadContext tc) {
        if (io instanceof IOHandleInstance) {
            IOHandleInstance h = (IOHandleInstance)io;
            if (h.handle instanceof IIOSyncReadable) {
                if (res instanceof VMArrayInstance_i8) {
                    VMArrayInstance_i8 arr = (VMArrayInstance_i8)res;

                    byte[] array = ((IIOSyncReadable)h.handle).read(tc, (int)bytes);
                    arr.elems = array.length;
                    arr.start = 0;
                    arr.slots = array;
View Full Code Here

TOP

Related Classes of org.perl6.nqp.sixmodel.reprs.VMArrayInstance_i8

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.