Package org.perl6.nqp.sixmodel

Examples of org.perl6.nqp.sixmodel.SixModelObject


import org.perl6.nqp.sixmodel.TypeObject;

public class Lexotic extends REPR {
    public SixModelObject type_object_for(ThreadContext tc, SixModelObject HOW) {
        STable st = new STable(this, HOW);
        SixModelObject obj = new TypeObject();
        obj.st = st;
        st.WHAT = obj;
        return st.WHAT;
    }
View Full Code Here


    }
    public static SixModelObject popcompsc(ThreadContext tc) {
        if (tc.compilingSCs == null)
            throw ExceptionHandling.dieInternal(tc, "No current compiling SC.");
        int idx = tc.compilingSCs.size() - 1;
        SixModelObject result = tc.compilingSCs.get(idx);
        tc.compilingSCs.remove(idx);
        if (idx == 0)
            tc.compilingSCs = null;
        return result;
    }
View Full Code Here

        if (cscSize == 0 || tc.scwbDisableDepth > 0)
            return;

        /* See if the object is actually owned by another, and it's the
         * owner we need to repossess. */
        SixModelObject owner = obj.sc.owned_objects.get(obj);
        if (owner != null)
            obj = owner;

        SerializationContext compSC = tc.compilingSCs.get(cscSize - 1).referencedSC;
        if (obj.sc != compSC) {
View Full Code Here

        return seconds;
    }

    public static SixModelObject getenvhash(ThreadContext tc) {
        SixModelObject hashType = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.hashType;
        SixModelObject strType = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.strBoxType;
        SixModelObject res = hashType.st.REPR.allocate(tc, hashType.st);

        Map<String, String> env = System.getenv();
        for (String envName : env.keySet())
            res.bind_key_boxed(tc, envName, box_s(env.get(envName), strType, tc));

        return res;
    }
View Full Code Here

            throw ExceptionHandling.dieInternal(tc, t);
        }
    }

    public static SixModelObject jvmgetproperties(ThreadContext tc) {
        SixModelObject hashType = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.hashType;
        SixModelObject strType = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.strBoxType;
        SixModelObject res = hashType.st.REPR.allocate(tc, hashType.st);

        Properties env = System.getProperties();
        for (String envName : env.stringPropertyNames()) {
            String propVal = env.getProperty(envName);
            if (envName.equals("os.name")) {
                // Normalize OS name (some cases likely missing).
                String pvlc = propVal.toLowerCase();
                if (pvlc.indexOf("win") >= 0)
                    propVal = "MSWin32";
                else if (pvlc.indexOf("mac os x") >= 0)
                    propVal = "darwin";
            }
            res.bind_key_boxed(tc, envName, box_s(propVal, strType, tc));
        }

        return res;
    }
View Full Code Here

            tc.VMThread = vmthread;
            invokeArgless(tc, code);
        }
    }
    public static SixModelObject newthread(SixModelObject code, long appLifetime, ThreadContext tc) {
        SixModelObject thread = tc.gc.Thread.st.REPR.allocate(tc, tc.gc.Thread.st);
        ((VMThreadInstance)thread).thread = new Thread(new CodeRunnable(tc.gc, thread, code));
        ((VMThreadInstance)thread).thread.setDaemon(appLifetime != 0);
        return thread;
    }
View Full Code Here

        Thread.yield();
        return 0;
    }

    public static SixModelObject currentthread(ThreadContext tc) {
        SixModelObject thread = tc.VMThread;
        if (thread == null) {
            thread = tc.gc.Thread.st.REPR.allocate(tc, tc.gc.Thread.st);
            ((VMThreadInstance)thread).thread = Thread.currentThread();
            tc.VMThread = thread;
        }
View Full Code Here

    }

    /* Exception related. */
    public static void die_s_c(String msg, ThreadContext tc) {
        // Construct exception object.
        SixModelObject exType = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.exceptionType;
        VMExceptionInstance exObj = (VMExceptionInstance)exType.st.REPR.allocate(tc, exType.st);
        exObj.message = msg;
        exObj.category = ExceptionHandling.EX_CAT_CATCH;
        exObj.origin = tc.curFrame;
        exObj.nativeTrace = (new Throwable()).getStackTrace();
View Full Code Here

        else {
            throw ExceptionHandling.dieInternal(tc, "setpayload needs an object with VMException representation");
        }
    }
    public static SixModelObject newexception(ThreadContext tc) {
        SixModelObject exType = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.exceptionType;
        SixModelObject exObj = (VMExceptionInstance)exType.st.REPR.allocate(tc, exType.st);
        return exObj;
    }
View Full Code Here

        SixModelObject exObj = (VMExceptionInstance)exType.st.REPR.allocate(tc, exType.st);
        return exObj;
    }
    public static SixModelObject backtracestrings(SixModelObject obj, ThreadContext tc) {
        if (obj instanceof VMExceptionInstance) {
            SixModelObject Array = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.listType;
            SixModelObject Str = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.strBoxType;
            SixModelObject result = Array.st.REPR.allocate(tc, Array.st);

            List<String> lines = ExceptionHandling.backtraceStrings(((VMExceptionInstance)obj));
            for (int i = 0; i < lines.size(); i++)
                result.bind_pos_boxed(tc, i, box_s(lines.get(i), Str, tc));

            return result;
        }
        else {
            throw ExceptionHandling.dieInternal(tc, "backtracestring needs an object with VMException representation");
View Full Code Here

TOP

Related Classes of org.perl6.nqp.sixmodel.SixModelObject

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.