Package org.jnode.vm.x86.compiler.l1b

Examples of org.jnode.vm.x86.compiler.l1b.MagicHelper


     */
    protected final BaseVmArchitecture getArchitecture() throws BuildException {
        if (arch == null) {
            switch (bits) {
                case 32:
                    arch = new VmX86Architecture32(getJnodeCompiler());
                    break;
                case 64:
                    arch = new VmX86Architecture64(getJnodeCompiler());
                    break;
                default:
View Full Code Here


    protected BaseVmArchitecture getArchitecture() {
        if (arch == null) {
            switch (bits) {
                case 32:
                    arch = new VmX86Architecture32();
                    break;
                case 64:
                    arch = new VmX86Architecture64();
                    break;
                default:
View Full Code Here

//            }
    }

    private static VmByteCode loadByteCode(String className)
        throws MalformedURLException, ClassNotFoundException {
        VmSystemClassLoader vmc = new VmSystemClassLoader(new File(".").toURL(), new VmX86Architecture32());
        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);
View Full Code Here

        final String dir = System.getProperty("classes.dir", ".");
        final String archName = System.getProperty("arch", "x86");

        final VmX86Architecture arch;
        if (archName.equals("x86_64")) {
            arch = new VmX86Architecture64();
        } else {
            arch = new VmX86Architecture32();
        }
        final VmSystemClassLoader cl = new VmSystemClassLoader(new java.net.URL[]{
            new File("./core/build/classes/").getCanonicalFile().toURI().toURL(),
View Full Code Here

            switch (bits) {
                case 32:
                    arch = new VmX86Architecture32(getJnodeCompiler());
                    break;
                case 64:
                    arch = new VmX86Architecture64(getJnodeCompiler());
                    break;
                default:
                    throw new BuildException("Unknown bits " + bits);
            }
        }
View Full Code Here

            switch (bits) {
                case 32:
                    arch = new VmX86Architecture32();
                    break;
                case 64:
                    arch = new VmX86Architecture64();
                    break;
                default:
                    throw new IllegalArgumentException("Invalid bits " + bits);
            }
        }
View Full Code Here

        VmScheduler scheduler = new VmScheduler(getArchitecture());
        vm.setScheduler(scheduler);
        if (processor == null) {
            switch (bits) {
                case 32:
                    processor = new VmX86Processor32(0,
                        (VmX86Architecture32) getArchitecture(), statics, isolatedStatics, scheduler,
                        getCPUID());
                    break;
                case 64:
                    processor = new VmX86Processor64(0,
View Full Code Here

                    processor = new VmX86Processor32(0,
                        (VmX86Architecture32) getArchitecture(), statics, isolatedStatics, scheduler,
                        getCPUID());
                    break;
                case 64:
                    processor = new VmX86Processor64(0,
                        (VmX86Architecture64) getArchitecture(), statics, isolatedStatics, scheduler,
                        getCPUID());
                    break;
                default:
                    throw new BuildException("Unknown bits " + bits);
View Full Code Here

                }
                ptr = ptr.sub(slotSize);
            }

            System.out.println("Stack frames:");
            VmX86StackReader sr = new VmX86StackReader(slotSize);
            Address currFrame = stackFrame;

            //Address prevFrame = null;
            do {
                ptr = currFrame;
                //ccid
                ptr = ptr.add(Offset.fromIntSignExtend(VmX86StackReader.METHOD_ID_OFFSET * slotSize));
                int ccid = ptr.loadInt();
                if (ccid == 0) {
                    //invalid farme, exit
                    break;
                }

                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();
                    if (VmUtils.getVm().getHeapManager().isObject(child)) {
                        System.out.println("Class: " + child.getClass() + " Value: " + child);
                    } else {
                        System.out.println(NumberUtils.hex(child.toInt()));
                    }
                    //System.out.println(NumberUtils.hex(ptr.loadInt()));
                }
            } while ((currFrame = sr.getPrevious(currFrame)) != null);

        } else {
            System.out.println("Stack is null");
        }
    }
View Full Code Here

        // Override me
    }

    public final void stopCounters() {
        // TODO Implement me
        final VmX86Thread thread = (VmX86Thread) cpu.getCurrentThread();
        stopCounters(thread);
        UnsafeX86.saveMSRs();

        thread.setMSRs(null, null);
    }
View Full Code Here

TOP

Related Classes of org.jnode.vm.x86.compiler.l1b.MagicHelper

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.