Examples of VmByteCode


Examples of org.jnode.vm.classmgr.VmByteCode

                X86CompilerHelper helper = new X86CompilerHelper((X86Assembler) os, null, entryPoints, isBootstrap);
                helper.setMethod(method);
                X86StackFrame stackFrame = new X86StackFrame((X86Assembler) os, helper, method, entryPoints, cm);
                TypeSizeInfo typeSizeInfo = getTypeSizeInfo();

                VmByteCode bytecode = method.getBytecode();
                IRControlFlowGraph cfg = new IRControlFlowGraph(bytecode);
                IRGenerator irg = new IRGenerator(cfg);
                BytecodeParser.parse(bytecode, irg);

                initMethodArguments(method, stackFrame, typeSizeInfo, irg);

                cfg.constructSSA();
                cfg.optimize();
                cfg.removeUnusedVars();
                cfg.deconstrucSSA();
                cfg.fixupAddresses();

                X86CodeGenerator x86cg = new X86CodeGenerator(method, (X86Assembler) os, bytecode.getLength(),
                    typeSizeInfo, stackFrame);
                List<Variable<?>> liveVariables = cfg.computeLiveVariables();
                LiveRange<?>[] liveRanges = getLiveRanges(liveVariables);
                LinearScanAllocator<?> lsa = allocate(liveRanges);
                generateCode(x86cg, cfg, irg, lsa);
View Full Code Here

Examples of org.jnode.vm.classmgr.VmByteCode

        int end = os.getLength();

        final VmAddress nativeCode = (VmAddress) cm.getCodeStart().getObject();
        final VmCompiledExceptionHandler[] eTable;
        final VmAddress defExHandler;
        final VmByteCode bc;
        final VmAddressMap aTable = cm.getAddressTable();

        if (!(method.isNative() || abstractM)) {
            final NativeStream.ObjectRef defExHRef = cm
                .getDefExceptionHandler();
            if (defExHRef != null) {
                defExHandler = (VmAddress) defExHRef.getObject();
            } else {
                defExHandler = null;
            }
            bc = method.getBytecode();
            final CompiledExceptionHandler[] ceh = cm.getExceptionHandlers();
            if (ceh != null) {
                eTable = new VmCompiledExceptionHandler[ceh.length];
                for (int i = 0; i < ceh.length; i++) {

                    final VmConstClass catchType = bc.getExceptionHandler(i)
                        .getCatchType();
                    final VmAddress startPtr = (VmAddress) ceh[i].getStartPc()
                        .getObject();
                    final VmAddress endPtr = (VmAddress) ceh[i].getEndPc()
                        .getObject();
View Full Code Here

Examples of org.jnode.vm.classmgr.VmByteCode

                defExHandler = Address.zero();
            }
            final VmCompiledExceptionHandler[] eTable;
            final VmAddressMap aTable = cm.getAddressTable();

            final VmByteCode bc = method.getBytecode();
            final CompiledExceptionHandler[] ceh = cm.getExceptionHandlers();
            if (ceh != null) {
                eTable = new VmCompiledExceptionHandler[ceh.length];
                for (int i = 0; i < ceh.length; i++) {

                    final VmConstClass catchType = bc.getExceptionHandler(i)
                        .getCatchType();
                    final Address startPtr = codePtr.add(ceh[i].getStartPc()
                        .getOffset()
                        - startOffset);
                    final Address endPtr = codePtr.add(ceh[i].getEndPc()
View Full Code Here

Examples of org.jnode.vm.classmgr.VmByteCode

                    // Wrap in verifier if needed
                    if (!(bcv instanceof VerifyingCompilerBytecodeVisitor)) {
                        bcv = new VerifyingCompilerBytecodeVisitor<CompilerBytecodeVisitor>(bcv);
                    }
                    // Get the bytecode
                    final VmByteCode bc = method.getBytecode();
                    // Create the control flow graph
                    ControlFlowGraph cfg = (ControlFlowGraph) bc.getCompilerData();
                    if (cfg == null) {
                        cfg = new ControlFlowGraph(bc);
                        bc.setCompilerData(cfg);
                    }
                    // Compile the code 1 basic block at a time
                    final CompilerBytecodeParser parser = new CompilerBytecodeParser(bc, cfg, bcv);
                    bcv.startMethod(method);
                    for (BasicBlock bb : cfg) {
                        bcv.startBasicBlock(bb);
                        parser.parse(bb.getStartPC(), bb.getEndPC(), false);
                        bcv.endBasicBlock();
                    }
                    bcv.endMethod();

                    //remove the compiler data to save memory, will be regenerated if needed
                    bc.setCompilerData(null);
                } finally {
                    releaseBytecodeVisitor(bcv);
                }
            }
        } catch (RuntimeException x) {
View Full Code Here

Examples of org.jnode.vm.classmgr.VmByteCode

            TestCFG(vmClass.getDeclaredMethod(i));
        }
    }

    private static void TestCFG(VmMethod method) {
        final VmByteCode bc = method.getBytecode();
        System.out.println("Method     " + method);
        System.out.println("MaxStack   " + bc.getMaxStack());
        System.out.println("#Locals    " + bc.getNoLocals());
        System.out.println("#Arg slots " + method.getArgSlotCount());
        final ControlFlowGraph cfg = new ControlFlowGraph(method.getBytecode());
        BytecodeParser.parse(method.getBytecode(), new BytecodeViewer(cfg));

        System.out.println();
View Full Code Here

Examples of org.jnode.vm.classmgr.VmByteCode

     * @return The line number, or -1 if not found.
     */
    public final String getLocationInfo() {
        int lineNo = -1;
        if (sfMethod != null) {
            final VmByteCode bc = sfMethod.getBytecode();
            if (bc != null) {
                lineNo = bc.getLineNr(programCounter);
            }
        }
        if (lineNo >= 0) {
            return String.valueOf(lineNo);
        } else {
View Full Code Here

Examples of org.jnode.vm.classmgr.VmByteCode

        // Save some variables
        final char oldLocalDelta = this.localDelta;
        final boolean oldVisitedReturn = this.visitedReturn;
        final VmMethod oldMethod = this.method;
        final InlineBytecodeVisitor ibv = getDelegate();
        final VmByteCode bc = im.getBytecode();

        // Calculate the new maxLocals
        final int imLocals = bc.getNoLocals(); // #Locals of the inlined method
        final int curLocals = oldMethod.getBytecode().getNoLocals(); // #Locals
        // of
        // the
        // current
        // method
        maxLocals = (char) Math.max(maxLocals, oldLocalDelta + curLocals
            + imLocals);

        // Set new variables
        this.localDelta += curLocals;
        this.visitedReturn = false;
        this.inlineDepth++;
        this.method = im;

        // Reset optimization flags
        this.optimizeFlags = 0;
        this.previousOptimizeFlags = 0;

        // Start the inlining
        ibv.startInlinedMethodHeader(im, maxLocals);

        // Store the arguments in the locals of the inlined method
        storeArgumentsToLocals(im, ibv, localDelta);

        // Start the inlining
        ibv.startInlinedMethodCode(im, maxLocals);

        // Emit a NOP so we can differentiate when a method is virtually empty
        if (inlineDepth > 1) {
            ibv.visit_nop();
        }

        // Create the control flow graph
        ControlFlowGraph cfg = (ControlFlowGraph) bc.getCompilerData();
        if (cfg == null) {
            cfg = new ControlFlowGraph(bc);
            bc.setCompilerData(cfg);
        }
        // Compile the code 1 basic block at a time
        final CompilerBytecodeParser parser = new CompilerBytecodeParser(bc,
            cfg, this);
        for (BasicBlock bb : cfg) {
View Full Code Here

Examples of org.jnode.vm.classmgr.VmByteCode

            return false;
        }
        if (!declClass.isAlwaysInitialized()) {
            return false;
        }
        final VmByteCode bc = method.getBytecode();
        if (bc == null) {
            return false;
        }
        if (method.hasNoInlinePragma()) {
            return false;
        }
        if (bc.getNoExceptionHandlers() > 0) {
            return false;
        }

        // Now determine if we SHOULD inline
        if (!method.hasInlinePragma()) {
            if (inlineDepth >= MAX_INLINE_DEPTH) {
                return false;
            }
            if (bc.getLength() > SIZE_LIMIT) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

Examples of org.jnode.vm.classmgr.VmByteCode

             * 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++) {
View Full Code Here

Examples of org.jnode.vm.classmgr.VmByteCode

                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);
        TypeSizeInfo typeSizeInfo = loader.getArchitecture().getTypeSizeInfo();
        helper.setMethod(method);
        X86StackFrame stackFrame = new X86StackFrame(os, helper, method, context, cm);
        X86CodeGenerator x86cg = new X86CodeGenerator(method, os, code.getLength(), typeSizeInfo, stackFrame);

        generateCode(os, code, x86cg, stackFrame, arithMethod, typeSizeInfo);


//        X86CodeGenerator x86cg = null;//new X86CodeGenerator(os, code.getLength());
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.