Package org.jnode.vm.classmgr

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


            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

            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

            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

                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

        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

                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

    protected final void verifyInvoke(VmConstMethodRef methodRef) {
        if (currentKernelSpace || currentUninterruptible) {
            // May only call methods with kernelspace pragma.
            methodRef.resolve(currentMethod.getDeclaringClass().getLoader());

            final VmMethod callee = methodRef.getResolvedVmMethod();
            if (currentKernelSpace) {
                if (!callee.hasKernelSpacePragma()) {
                    // throw new ClassFormatError("Method '" + currentMethod +
                    // "' calls method outside KernelSpace: " + callee);
                    System.out.println("Method calls method outside KernelSpace:\n\tcaller: " +
                        currentMethod.getFullName() + "\n\tcallee: " +
                        callee.getFullName());
                }
            }
            if (currentUninterruptible) {
                if (!callee.isUninterruptible()) {
                    if (currentMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.schedule")) {
                        // throw new ClassFormatError("Method '" + currentMethod +
                        // "' calls interruptible method: " + callee);
                        System.out.println("Method calls interruptible method:\n\tcaller: " +
                            currentMethod.getFullName() + "\n\tcallee: " +
                            callee.getFullName());
                    }
                }
            }
            if (callee.isSynchronized()) {
                //throw new ClassFormatError("Method '" + currentMethod + "' calls synchronized method: " + callee);
                System.out.println(
                    "Method '" + currentMethod.getFullName() + "' calls synchronized method: " + callee.getFullName());
            }
        }
    }
View Full Code Here

     */
    protected void initCallMain(X86BinaryAssembler os) throws BuildException,
        ClassNotFoundException {
        final VmType<?> vmMethodClass = loadClass(VmMethod.class);
        final VmType<?> vmMainClass = loadClass(Main.class);
        final VmMethod mainMethod = vmMainClass.getMethod(
            Main.MAIN_METHOD_NAME, Main.MAIN_METHOD_SIGNATURE);
        final VmInstanceField nativeCodeField = (VmInstanceField) vmMethodClass
            .getField("nativeCode");

        final GPR aax = os.isCode32() ? (GPR) X86Register.EAX : X86Register.RAX;
View Full Code Here

        os.setObjectRef(clInitCaller);

        // Call VmClass.loadFromBootClassArray
        final VmType<?> vmClassClass = loadClass(VmType.class);
        final VmMethod lfbcaMethod = vmClassClass.getMethod(
            "loadFromBootClassArray", "([Lorg/jnode/vm/classmgr/VmType;)V");
        final VmType<?> vmMethodClass = loadClass(VmMethod.class);
        final VmInstanceField nativeCodeField = (VmInstanceField) vmMethodClass
            .getField("nativeCode");

        final GPR aax = os.isCode32() ? (GPR) X86Register.EAX : X86Register.RAX;
        final GPR abx = os.isCode32() ? (GPR) X86Register.EBX : X86Register.RBX;

        os.writeMOV_Const(aax, bootClasses);
        os.writePUSH(aax);
        os.writeMOV_Const(aax, lfbcaMethod);
        os.writeMOV(abx.getSize(), abx, aax, nativeCodeField.getOffset());
        os.writeCALL(abx);

        // Now call all static initializers
        for (int i = 0; (i < bootClasses.length); i++) {
            VmType<?> vmClass = bootClasses[i];
            if ((vmClass instanceof VmClassType)
                && (((VmClassType<?>) vmClass).getInstanceCount() > 0)) {
                VmMethod clInit = vmClass.getMethod("<clinit>", "()V");
                if (clInit != null) {
                    // os.setObjectRef(clInitCaller + "$$" + vmClass.getName());
                    log("Missing static initializer in class "
                        + vmClass.getName(), Project.MSG_WARN);
                }
View Full Code Here

TOP

Related Classes of org.jnode.vm.classmgr.VmMethod

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.