Examples of VmType


Examples of org.jnode.vm.classmgr.VmType

     */
    private void writeResolveAndLoadClassToReg(VmConstClass classRef,
                                               GPR dst) {
        // Resolve the class
        classRef.resolve(loader);
        final VmType type = classRef.getResolvedVmClass();
        final Label curInstrLabel = getCurInstrLabel();

        // Load the class from the statics table
        if (os.isCode32()) {
            helper.writeGetStaticsEntry(curInstrLabel, dst, type);
View Full Code Here

Examples of org.jnode.vm.classmgr.VmType

     */
    private final void writeResolveAndLoadClassToReg(VmConstClass classRef,
                                                     GPR dst) {
        // Resolve the class
        classRef.resolve(loader);
        final VmType type = classRef.getResolvedVmClass();
        final Label curInstrLabel = getCurInstrLabel();

        // Load the class from the statics table
        if (os.isCode32()) {
            helper.writeGetStaticsEntry(curInstrLabel, dst, type);
View Full Code Here

Examples of org.jnode.vm.classmgr.VmType

    private void testAssignableFrom(Class c1, Class c2) throws Exception {

        System.out.println("test " + c1.getName() + ", " + c2.getName() + " = " +
                c1.isAssignableFrom(c2));

        final VmType vmC1 = clc.loadClass(c1.getName(), true);
        final VmType vmC2 = clc.loadClass(c2.getName(), true);

        System.out.println("\t" + vmC1.getName() + "\t0x" + NumberUtils.hex(vmC1.getAccessFlags()) +
                "\tarray " + vmC1.isArray());
        System.out.println("\t" + vmC2.getName() + "\t0x" + NumberUtils.hex(vmC2.getAccessFlags()) +
                "\tarray " + vmC2.isArray());

        if (c1.isAssignableFrom(c2)) {
            Assert.assertTrue(c1.getName() + " is assignableFrom " + c2.getName(),
                    vmC1.isAssignableFrom(vmC2));
        } else {
            Assert.assertFalse(c1.getName() + " is not assignableFrom " + c2.getName(),
                    vmC1.isAssignableFrom(vmC2));
        }

        if (c2.isAssignableFrom(c1)) {
            Assert.assertTrue(c2.getName() + " is assignableFrom " + c1.getName(),
                    vmC2.isAssignableFrom(vmC1));
        } else {
            Assert.assertFalse(c2.getName() + " is not assignableFrom " + c1.getName(),
                    vmC2.isAssignableFrom(vmC1));
        }
    }
View Full Code Here

Examples of org.jnode.vm.classmgr.VmType

     */
    public EntryPoints(VmClassLoader loader, VmHeapManager heapManager, int magic) {
        try {
            this.magic = magic;
            // VmMember class
            final VmType vmMemberType = loader.loadClass(
                "org.jnode.vm.classmgr.VmMember", true);
            this.vmMemberDeclaringClassField = (VmInstanceField) testField(vmMemberType
                .getField("declaringClass"));

            // SoftByteCode
            this.vmSoftByteCodesClass = loader.loadClass(
                "org.jnode.vm.SoftByteCodes", true);
            anewarrayMethod = testMethod(vmSoftByteCodesClass.getMethod(
                "anewarray",
                "(Lorg/jnode/vm/classmgr/VmType;I)Ljava/lang/Object;"));
            allocArrayMethod = testMethod(vmSoftByteCodesClass.getMethod(
                "allocArray",
                "(Lorg/jnode/vm/classmgr/VmType;I)Ljava/lang/Object;"));
            allocMultiArrayMethod = testMethod(vmSoftByteCodesClass.getMethod(
                "allocMultiArray",
                "(Lorg/jnode/vm/classmgr/VmType;[I)Ljava/lang/Object;"));
            allocPrimitiveArrayMethod = testMethod(vmSoftByteCodesClass
                .getMethod("allocPrimitiveArray", "(Lorg/jnode/vm/classmgr/VmType;II)Ljava/lang/Object;"));
            resolveFieldMethod = testMethod(vmSoftByteCodesClass.getMethod("resolveField",
                "(Lorg/jnode/vm/classmgr/VmMethod;Lorg/jnode/vm/classmgr/VmConstFieldRef;Z)" +
                    "Lorg/jnode/vm/classmgr/VmField;"));
            resolveMethodMethod = testMethod(vmSoftByteCodesClass.getMethod("resolveMethod",
                "(Lorg/jnode/vm/classmgr/VmMethod;Lorg/jnode/vm/classmgr/VmConstMethodRef;)" +
                    "Lorg/jnode/vm/classmgr/VmMethod;"));
            resolveClassMethod = testMethod(vmSoftByteCodesClass.getMethod("resolveClass",
                "(Lorg/jnode/vm/classmgr/VmConstClass;)Lorg/jnode/vm/classmgr/VmType;"));
            allocObjectMethod = testMethod(vmSoftByteCodesClass.getMethod("allocObject",
                "(Lorg/jnode/vm/classmgr/VmType;I)Ljava/lang/Object;"));
            classCastFailedMethod = testMethod(vmSoftByteCodesClass.getMethod(
                "classCastFailed", "(Ljava/lang/Object;Lorg/jnode/vm/classmgr/VmType;)V"));
            throwArrayOutOfBounds = testMethod(vmSoftByteCodesClass.getMethod(
                "throwArrayOutOfBounds", "(Ljava/lang/Object;I)V"));
            getClassForVmTypeMethod = testMethod(vmSoftByteCodesClass.getMethod("getClassForVmType",
                "(Lorg/jnode/vm/classmgr/VmType;)Ljava/lang/Class;"));

            // Write barrier
            writeBarrier = (heapManager != null) ? heapManager
                .getWriteBarrier() : null;
            if (writeBarrier != null) {
                final VmType wbClass = loader.loadClass(writeBarrier.getClass().getName(), true);
                arrayStoreWriteBarrier = testMethod(wbClass.getMethod(
                    "arrayStoreWriteBarrier",
                    "(Ljava/lang/Object;ILjava/lang/Object;)V"));
                putfieldWriteBarrier = testMethod(wbClass.getMethod(
                    "putfieldWriteBarrier",
                    "(Ljava/lang/Object;ILjava/lang/Object;)V"));
                putstaticWriteBarrier = testMethod(wbClass.getMethod(
                    "putstaticWriteBarrier", "(ILjava/lang/Object;)V"));
            } else {
                arrayStoreWriteBarrier = null;
                putfieldWriteBarrier = null;
                putstaticWriteBarrier = null;
            }

            // MonitorManager
            this.vmMonitorManagerClass = loader.loadClass("org.jnode.vm.scheduler.MonitorManager", true);
            monitorEnterMethod = testMethod(vmMonitorManagerClass.getMethod("monitorEnter", "(Ljava/lang/Object;)V"));
            monitorExitMethod = testMethod(vmMonitorManagerClass.getMethod("monitorExit", "(Ljava/lang/Object;)V"));

            // MathSupport
            final VmType vmClass = loader.loadClass("org.jnode.vm.MathSupport", true);
            ldivMethod = testMethod(vmClass.getMethod("ldiv", "(JJ)J"));
            lremMethod = testMethod(vmClass.getMethod("lrem", "(JJ)J"));

            // VmInstanceField
            this.vmInstanceFieldClass = loader.loadClass("org.jnode.vm.classmgr.VmInstanceField", true);
            vmFieldOffsetField = (VmInstanceField) testField(vmInstanceFieldClass.getField("offset"));

            // VmStaticField
            this.vmStaticFieldClass = loader.loadClass("org.jnode.vm.classmgr.VmStaticField", true);
            vmFieldStaticsIndexField = (VmInstanceField) testField(vmStaticFieldClass.getField("staticsIndex"));

            // VmInstanceMethod
            this.vmInstanceMethodClass = loader.loadClass("org.jnode.vm.classmgr.VmInstanceMethod", true);
            vmMethodTibOffsetField = (VmInstanceField) testField(vmInstanceMethodClass.getField("tibOffset"));

            // VmMethodCode
            this.vmMethodCodeClass = loader.loadClass("org.jnode.vm.classmgr.VmMethodCode", true);
            vmMethodSelectorField = (VmInstanceField) testField(vmInstanceMethodClass.getField("selector"));
            vmMethodNativeCodeField = (VmInstanceField) testField(vmInstanceMethodClass.getField("nativeCode"));

            // VmConstIMethodRef
            final VmType cimrClass = loader.loadClass("org.jnode.vm.classmgr.VmConstIMethodRef", true);
            this.vmConstIMethodRefSelectorField = (VmInstanceField) testField(cimrClass.getField("selector"));

            // VmProcessor
            final VmType processorClass = loader.loadClass("org.jnode.vm.scheduler.VmProcessor", true);
            vmThreadSwitchIndicatorOffset =
                ((VmInstanceField) testField(processorClass.getField("threadSwitchIndicator"))).getOffset();
            vmProcessorMeField = (VmInstanceField) testField(processorClass.getField("me"));
            vmProcessorStackEnd = (VmInstanceField) testField(processorClass.getField("stackEnd"));
            vmProcessorSharedStaticsTable = (VmInstanceField) testField(processorClass.getField("staticsTable"));
            vmProcessorIsolatedStaticsTable = (VmInstanceField) testField(processorClass
                .getField("isolatedStaticsTable"));

            // VmType
            final VmType typeClass = loader.loadClass("org.jnode.vm.classmgr.VmType", true);
            vmTypeInitialize = testMethod(typeClass.getMethod("initialize", "()V"));
            vmTypeModifiers = (VmInstanceField) testField(typeClass.getField("modifiers"));
            vmTypeState = (VmInstanceField) testField(typeClass.getField("state"));
            vmTypeCp = (VmInstanceField) testField(typeClass.getField("cp"));

            // VmCP
            final VmType cpClass = loader.loadClass("org.jnode.vm.classmgr.VmCP", true);
            vmCPCp = (VmInstanceField) testField(cpClass.getField("cp"));

            // VmProcessor
            // VmThread
            final VmType vmThreadClass = loader.loadClass("org.jnode.vm.scheduler.VmThread", true);
            systemExceptionMethod = testMethod(vmThreadClass.getMethod("systemException", "(II)Ljava/lang/Throwable;"));

            // VmMethod
            final VmType vmMethodClass = loader.loadClass("org.jnode.vm.classmgr.VmMethod", true);
            recompileMethod = testMethod(vmMethodClass.getDeclaredMethod("recompileMethod", "(II)V"));

        } catch (ClassNotFoundException ex) {
            throw new NoClassDefFoundError(ex.getMessage());
        }
    }
View Full Code Here

Examples of org.jnode.vm.classmgr.VmType

    public static void main(String[] args)
        throws Exception {

        final String className = (args.length > 0) ? args[0] : "java.lang.Object";
        final VmSystemClassLoader loader = new VmSystemClassLoader(new File(".").toURL(), new VmX86Architecture32());
        final VmType vmClass = loader.loadClass(className, true);

        for (int i = 0; i < vmClass.getNoDeclaredMethods(); i++) {
            TestCFG(vmClass.getDeclaredMethod(i));
        }
    }
View Full Code Here

Examples of org.jnode.vm.classmgr.VmType

    public static void main(String[] args) throws ClassNotFoundException {
        final String className = args[0];
        final String mname = (args.length > 1) ? args[1] : null;

        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        final VmType cls = VmType.fromClass(cl.loadClass(className));

        final int cnt = cls.getNoDeclaredMethods();
        for (int i = 0; i < cnt; i++) {
            final VmMethod method = cls.getDeclaredMethod(i);
            if ((mname == null) || method.getName().equals(mname)) {
                System.out.println("OptL: " + method.getNativeCodeOptLevel());
                System.out.println("Code: " + method.getDefaultCompiledCode());
            }
        }
View Full Code Here

Examples of org.jnode.vm.classmgr.VmType

            }
            final VmProcessor proc = VmProcessor.current();
            final VmStackReader reader = proc.getArchitecture()
                .getStackReader();

            final VmType exClass = VmMagic.getObjectType(ex);
            final VmMethod method = reader.getMethod(frame);
            if (method == null) {
                Unsafe.debug("Unknown method in class " + ex.getClass().getName());
                return null;
            }

            // if (interpreted) {
            /*
             * Screen.debug("{ex at pc:"); Screen.debug(pc); Screen.debug(" of " +
             * method.getBytecodeSize()); Screen.debug(method.getName());
             */
            // }
            final int count;
            final VmByteCode bc = method.getBytecode();
            final VmCompiledCode cc = reader.getCompiledCode(frame);
            if (bc != null) {
                count = bc.getNoExceptionHandlers();
            } else {
                count = 0;
            }
            // Screen.debug("eCount=" + count);
            for (int i = 0; i < count; i++) {
                final AbstractExceptionHandler eh;
                final VmCompiledExceptionHandler ceh;
                ceh = cc.getExceptionHandler(i);
                eh = ceh;
                boolean match;

                match = ceh.isInScope(address);

                if (match) {
                    final VmConstClass catchType = eh.getCatchType();

                    if (catchType == null) {
                        /* Catch all exceptions */
                        return Address.fromAddress(ceh.getHandler());
                    } else {
                        if (!catchType.isResolved()) {
                            SoftByteCodes.resolveClass(catchType);
                        }
                        final VmType handlerClass = catchType
                            .getResolvedVmClass();
                        if (handlerClass != null) {
                            if (handlerClass.isAssignableFrom(exClass)) {
                                return Address.fromAddress(ceh.getHandler());
                            }
                        } else {
                            System.err
                                .println("Warning: handler class==null in "
View Full Code Here

Examples of org.jnode.vm.classmgr.VmType

        final long start = System.currentTimeMillis();
        for (int k = 0; k < clsNames.length; k++) {
            final String clsName = clsNames[k];
            System.out.println("Compiling " + clsName);
            final VmType type = cl.loadClass(clsName, true);

            final Object[] tib = ((VmClassType) type).getTIB();
            final byte[] cimt = (byte[]) tib[TIBLayout.COMPILED_IMT_INDEX];
            if (cimt != null) {
                final String fname = type.getName() + ".imt.bin";
                final FileOutputStream out = new FileOutputStream(fname);
                try {
                    out.write(cimt);
                } finally {
                    out.close();
View Full Code Here

Examples of org.jnode.vm.classmgr.VmType

        for (int ci = 0; ci < cs.length; ci++) {
            final long start = System.currentTimeMillis();
            for (int k = 0; k < clsNames.length; k++) {
                final String clsName = clsNames[k];
                System.out.println("Compiling " + clsName);
                final VmType type = cl.loadClass(clsName, true);
                final int cnt = type.getNoDeclaredMethods();
                for (int i = 0; i < cnt; i++) {
                    final VmMethod method = type.getDeclaredMethod(i);
                    if (
                        "<init>".equals(method.getName()) ||
                        "main".equals(method.getName()) ||
                            !X86Level2Compiler.canCompile(method)
                        )
View Full Code Here

Examples of org.jnode.vm.classmgr.VmType

                first = false;
            } else {
                Unsafe.debug(", ");
            }
            final VmMethod method = getMethod(f);
            final VmType vmClass = method.getDeclaringClass();
            Unsafe.debug(vmClass.getName());
            Unsafe.debug("::");
            Unsafe.debug(method.getName());
            f = getPrevious(f);
            max--;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.