Examples of VmMethod


Examples of org.jnode.vm.classmgr.VmMethod

        final VmStackReader reader = VmProcessor.current().getArchitecture()
            .getStackReader();
        final VmSystemClassLoader systemLoader = VmSystem.systemLoader;
        Address f = VmMagic.getCurrentFrame();
        while (reader.isValid(f)) {
            final VmMethod method = reader.getMethod(f);
            final VmClassLoader loader = method.getDeclaringClass().getLoader();
            if ((loader != null) && (loader != systemLoader)) {
                return loader;
            } else {
                f = reader.getPrevious(f);
            }
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

            .getCurrentFrame(), null, VmThread.STACKTRACE_LIMIT);
        final int count = stack.length;
        final Class[] result = new Class[count];
        int real_count = 0;
        for (int i = 0; i < count; i++) {
            VmMethod method = stack[i].getMethod();
            VmType<?> clazz = method.getDeclaringClass();
            if ((method.getName().equals("invoke") && (
                clazz.getName().equals("java.lang.reflect.Method") ||
                    clazz.getName().equals("org.jnode.vm.VmReflection"))))
                continue;

            result[real_count++] = clazz.asClass();
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

            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 "
                                    + method.getName());
                        }
                    }
                }
            }

View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

            new File("local/classlib").toURL()
        }, arch);
        new VmImpl("?", arch, loader.getSharedStatics(), true, loader, null);
        VmType.initializeForBootImage(loader);
        VmType<?> type = loader.loadClass(className, true);
        VmMethod arithMethod = null;
        int nMethods = type.getNoDeclaredMethods();
        for (int i = 0; i < nMethods; i += 1) {
            VmMethod method1 = type.getDeclaredMethod(i);
            if ("terniary22".equals(method1.getName())) {
//            if ("darken".equals(method1.getName())) {
                arithMethod = method1;
                break;
            }
        }
        VmMethod method = arithMethod;
        VmByteCode code = method.getBytecode();
        //VmByteCode code = loadByteCode(className, "appel");

        EntryPoints context = new EntryPoints(loader, VmUtils.getVm().getHeapManager(), 1);
        X86CompilerHelper helper = new X86CompilerHelper(os, null, context, true);
        CompiledMethod cm = new CompiledMethod(1);
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

            new File("core/build/classes").toURL(),
            new File("local/classlib").toURL()
        }, arch);
        new VmImpl("?", arch, vmc.getSharedStatics(), true, vmc, null);
        VmType<?> type = vmc.loadClass(className, true);
        VmMethod arithMethod = null;
        int nMethods = type.getNoDeclaredMethods();
        for (int i = 0; i < nMethods; i += 1) {
            VmMethod method = type.getDeclaredMethod(i);
            if (methodName.equals(method.getName())) {
                arithMethod = method;
                break;
            }
        }
        VmByteCode code = arithMethod.getBytecode();
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

            if (first) {
                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());
            Unsafe.debug('\n');
            f = getPrevious(f);
            max--;
        }
        if (isValid(f)) {
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

            if (first) {
                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--;
        }
        if (isValid(f)) {
            Unsafe.debug("...");
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

                System.out.println("--------------------------------------------------------------------------");
                System.out.println("Stack frame:    " + NumberUtils.hex(stackFrame.toInt()));

                VmCompiledCode cc = VmUtils.getVm().getCompiledMethods().get(ccid);
                VmMethod vmMethod = cc.getMethod();
                int noArguments = vmMethod.getNoArguments();
                VmType[] args = new VmType[noArguments];
                for (int i = 0; i < noArguments; i++) {
                    args[i] = vmMethod.getArgumentType(i);
                }
                System.out.print(NumberUtils.hex(ptr.toInt()) + " ");
                System.out.println(vmMethod.getDeclaringClass().getName() + "." + vmMethod.getName() +
                    Signature.toSignature(vmMethod.getReturnType(), args));

                ptr = ptr.sub(Offset.fromIntSignExtend(VmX86StackReader.METHOD_ID_OFFSET * slotSize));

                //old EBP
                System.out.println("Previous frame");
                ptr = ptr.add(Offset.fromIntSignExtend(VmX86StackReader.PREVIOUS_OFFSET * slotSize));
                System.out.print(NumberUtils.hex(ptr.toInt()) + " ");
                System.out.println(NumberUtils.hex(ptr.loadInt()));

                ptr = ptr.sub(Offset.fromIntSignExtend(VmX86StackReader.PREVIOUS_OFFSET * slotSize));

                //return Address
                System.out.println("Return address");
                ptr = ptr.add(Offset.fromIntSignExtend(VmX86StackReader.RETURNADDRESS_OFFSET * slotSize));
                System.out.print(NumberUtils.hex(ptr.toInt()) + " ");
                System.out.println(NumberUtils.hex(ptr.loadInt()));

                //method argumants
                int sc = vmMethod.getArgSlotCount();
                System.out.println("Method arguments: " + sc);
                for (int i = 0; i < sc; i++) {
                    ptr = ptr.add(slotSize);
                    System.out.print(NumberUtils.hex(ptr.toInt()) + " Arg" + (i + 1) + " = ");
                    Address child = ptr.loadAddress();
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

        while (i < cnt) {
            final VmStackFrame f = mt[i];
            if (f == null) {
                break;
            }
            final VmMethod method = f.getMethod();
            if (method == null) {
                break;
            }
            final VmType<?> vmClass = method.getDeclaringClass();
            if (vmClass == null) {
                break;
            }
            final VmType<?> sClass = vmClass.getSuperClass();
            if (lastClass != null && sClass != lastClass && vmClass != lastClass) {
                break;
            }
            final String mname = method.getName();
            if (mname == null) {
                break;
            }
            if (!("<init>".equals(mname) || "fillInStackTrace".equals(mname) || "getStackTrace"
                .equals(mname))) {
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

                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)
                        )
                        continue;

                    System.out.println("Compiling method " + clsName + "#" + method.getName());
                    counts[ci]++;
                    try {
                        compile(method, arch, cs[ci], cpuId, ci + 1);
                    } catch (Exception x) {
                        x.printStackTrace();
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.