Examples of JumpInstr


Examples of org.jruby.compiler.ir.instructions.JumpInstr

            // No explicit return from the protected body
            // - If we dont have any ensure blocks, simply jump to the end of the rescue block
            // - If we do, get the innermost ensure block, set up the return address to the end of the ensure block, and go execute the ensure code.
            if (noEnsure) {
                m.addInstr(new JumpInstr(rEndLabel));
            }
            else {
                // NOTE: rEndLabel is identical to ebi.end, but less confusing to use rEndLabel since that makes more semantic sense
                m.addInstr(new SET_RETADDR_Instr(ebi.returnAddr, rEndLabel));
                m.addInstr(new JumpInstr(ebi.start));
            }
        }
        else {
            // If the body had an explicit return, the return instruction IR build takes care of setting
            // up execution of all necessary ensure blocks.  So, nothing to do here! 
View Full Code Here

Examples of org.jruby.compiler.ir.instructions.JumpInstr

            m.addInstr(new CopyInstr(rv, x));
            // Jump to end of rescue block since we've caught and processed the exception
            if (!_ensureBlockStack.empty()) {
                EnsureBlockInfo ebi = _ensureBlockStack.peek();
                m.addInstr(new SET_RETADDR_Instr(ebi.returnAddr, endLabel));
                m.addInstr(new JumpInstr(ebi.start));
            }
            else {
                m.addInstr(new JumpInstr(endLabel));
            }
        }

        // Uncaught exception -- build other rescue nodes or rethrow!
        if (uncaughtLabel != null) {
View Full Code Here

Examples of org.jruby.compiler.ir.instructions.JumpInstr

        if (_rescueBlockLabelStack.empty()) {
            StringLiteral exc = new StringLiteral("retry found outside of rescue clause!");
            s.addInstr(new THROW_EXCEPTION_Instr(exc));
        }
        else {
            s.addInstr(new JumpInstr(_rescueBlockLabelStack.peek()));
        }
        return Nil.NIL;
    }
View Full Code Here

Examples of org.jruby.compiler.ir.instructions.JumpInstr

            s.addInstr(new ThreadPollInstr());

            s.addInstr(new LABEL_Instr(loop.iterEndLabel));
            if (isLoopHeadCondition) {
                // Issue a jump back to the head of the while loop
                s.addInstr(new JumpInstr(loop.loopStartLabel));
            }
            else {
                Operand cv = build(conditionNode, s);
                s.addInstr(new BEQInstr(cv, isWhile ? BooleanLiteral.TRUE : BooleanLiteral.FALSE, loop.iterStartLabel));
            }
View Full Code Here

Examples of org.jruby.compiler.ir.instructions.JumpInstr

                if (val instanceof BreakResult) {
                    BreakResult br = (BreakResult)val;
                    i.markDead();
                    instrs.add(new CopyInstr(res, br._result));
                    instrs.add(new JumpInstr(br._jumpTarget));
                }
            }
            // Optimize some core class method calls for constant values
            else if (iop.isCall()) {
                val = null;
View Full Code Here

Examples of org.jruby.compiler.ir.instructions.JumpInstr

            int n = ebStack.size();
            EnsureBlockInfo[] ebArray = ebStack.toArray(new EnsureBlockInfo[n]);
            for (int i = n-1; i >= 0; i--) {
                Label retLabel = m.getNewLabel();
                m.addInstr(new SET_RETADDR_Instr(ebArray[i].returnAddr, retLabel));
                m.addInstr(new JumpInstr(ebArray[i].start));
                m.addInstr(new LABEL_Instr(retLabel));
            }
        }
View Full Code Here

Examples of org.jruby.compiler.ir.instructions.JumpInstr

                    Set<CFG_Edge> succs = _cfg.outgoingEdgesOf(curr);
                    if (succs.size() == 1) {
                        BasicBlock tgt = succs.iterator().next()._dst;
                        if ((tgt != next) && ((li == null) || !li.operation.xfersControl())) {
//                            System.out.println("BB " + curr.getID() + " doesn't fall through to " + next.getID() + ".  Adding a jump to " + tgt._label);
                            curr.addInstr(new JumpInstr(tgt._label));
                        }
                    }
                }

                if (curr == _exitBB) {
                    // Add a dummy ret
//                    System.out.println("Exit bb is not the last bb in the layout!  Adding a dummy return!");
                    curr.addInstr(new ReturnInstr(Nil.NIL));
                }
            }
            else if (curr != _exitBB) {
                Set<CFG_Edge> succs = _cfg.outgoingEdgesOf(curr);
                assert succs.size() == 1;
                BasicBlock tgt = succs.iterator().next()._dst;
                if ((li == null) || !li.operation.xfersControl()) {
//                    System.out.println("BB " + curr.getID() + " is the last bb in the layout! Adding a jump to " + tgt._label);
                    curr.addInstr(new JumpInstr(tgt._label));
                }
            }
        }

        return _linearizedBBList;
View Full Code Here

Examples of org.jruby.ir.instructions.JumpInstr

                Iterator<BasicBlock> iter = cfg.getOutgoingDestinationsNotOfType(current, EdgeType.EXCEPTION).iterator();
                BasicBlock target = iter.next();
                assert (target != null && !iter.hasNext());

                // System.out.println("BB " + curr.getID() + " is the last bb in the layout! Adding a jump to " + tgt._label);
                current.addInstr(new JumpInstr(target.getLabel()));
            }
        }
    }
View Full Code Here

Examples of org.jruby.ir.instructions.JumpInstr

        Iterator<BasicBlock> outs = cfg.getOutgoingDestinations(current).iterator();
        BasicBlock target = outs.hasNext() ? outs.next() : null;
       
        if (target != null && !outs.hasNext()) {
            if ((target != next) && ((lastInstr == null) || !lastInstr.getOperation().transfersControl())) {
                current.addInstr(new JumpInstr(target.getLabel()));
            }
        }
    }
View Full Code Here

Examples of org.jruby.ir.instructions.JumpInstr

        callBB.addInstr(new ModuleVersionGuardInstr(implClass, classToken, call.getReceiver(), failurePathLabel));

        BasicBlock failurePathBB = new BasicBlock(cfg, failurePathLabel);
        cfg.addBasicBlock(failurePathBB);
        failurePathBB.addInstr(call);
        failurePathBB.addInstr(new JumpInstr(splitBBLabel));
        call.blockInlining();

        cfg.addEdge(callBB, failurePathBB, CFG.EdgeType.REGULAR);
        cfg.addEdge(failurePathBB, splitBB, CFG.EdgeType.REGULAR);
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.