Package org.jruby.ir.operands

Examples of org.jruby.ir.operands.Operand


    }   

    // ENEBO: This is it's own instruction, but an older note pointed out we
    // could make this an ordinary method and then depend on inlining.
    public Operand buildToAry(ToAryNode node, IRScope s) {
        Operand array = build(node.getValue(), s);
        Variable result = s.getNewTemporaryVariable();
        s.addInstr(new ToAryInstr(result, array, manager.getFalse()));
        return result;
    }
View Full Code Here


    public Operand buildTrue(Node node, IRScope s) {
        return manager.getTrue();
    }

    public Operand buildUndef(Node node, IRScope s) {
        Operand methName = build(((UndefNode) node).getName(), s);
        Variable result = s.getNewTemporaryVariable();
        s.addInstr(new UndefMethodInstr(result, methName));
        return result;       
    }
View Full Code Here

            loopStack.push(loop);

            // End of iteration jumps here
            s.addInstr(new LabelInstr(loop.loopStartLabel));
            if (isLoopHeadCondition) {
                Operand cv = build(conditionNode, s);
                s.addInstr(BEQInstr.create(cv, isWhile ? manager.getFalse() : manager.getTrue(), setupResultLabel));
            }

            // Redo jumps here
            s.addInstr(new LabelInstr(loop.iterStartLabel));

            // Thread poll at start of iteration -- ensures that redos and nexts run one thread-poll per iteration
            s.addInstr(new ThreadPollInstr(true));

            // Build body
            if (bodyNode != null) build(bodyNode, s);

            // Next jumps here
            s.addInstr(new LabelInstr(loop.iterEndLabel));
            if (isLoopHeadCondition) {
                s.addInstr(new JumpInstr(loop.loopStartLabel));
            } else {
                Operand cv = build(conditionNode, s);
                s.addInstr(BEQInstr.create(cv, isWhile ? manager.getTrue() : manager.getFalse(), loop.iterStartLabel));
            }

            // Loop result -- nil always
            s.addInstr(new LabelInstr(setupResultLabel));
View Full Code Here

**/

    public Operand buildZSuper(ZSuperNode zsuperNode, IRScope s) {
        if (s.isModuleBody()) return buildSuperInScriptBody(s);

        Operand block = setupCallClosure(zsuperNode.getIterNode(), s);
        if (block == null) block = s.getImplicitBlockArg();

        if (s instanceof IRMethod) {
            Operand[] args = ((IRMethod)s).getCallArgs();
            return buildSuperInstr(s, block, args);
View Full Code Here

                                    RubyModule implClass = dynMeth.getImplementationClass();
                                    int classToken = implClass.getGeneration();
                                    String n = tgtMethod.getName();
                                    boolean inlineCall = false;
                                    if (isHotClosure) {
                                        Operand clArg = call.getClosureArg(null);
                                        inlineCall = (clArg instanceof WrappedIRClosure) && (((WrappedIRClosure)clArg).getClosure() == hc);
                                    } else if (hotScopes.contains(tgtMethod)) {
                                        inlineCall = true;
                                    }
View Full Code Here

        }
    }

    @Override
    public Operand buildArgsPush(final ArgsPushNode node, IRScope s) {
        Operand v1 = build(node.getFirstNode(), s);
        Operand v2 = build(node.getSecondNode(), s);
        return new CompoundArray(v1, v2, true);
    }
View Full Code Here

        // args
        closureBuilder.receiveBlockArgs(node, closure);
        closureBuilder.receiveBlockClosureArg(node.getBlockVarNode(), closure);

        Operand closureRetVal = node.getBody() == null ? manager.getNil() : closureBuilder.build(node.getBody(), closure);

        // can be U_NIL if the node is an if node with returns in both branches.
        if (closureRetVal != U_NIL) closure.addInstr(new ReturnInstr(closureRetVal));

        // Added as part of 'prepareForInterpretation' code.
View Full Code Here

        return ret;
    }

    // Non-arg masgn
    public Operand buildMultipleAsgn19(MultipleAsgn19Node multipleAsgnNode, IRScope s) {
        Operand  values = build(multipleAsgnNode.getValueNode(), s);
        Variable ret = getValueInTemporaryVariable(s, values);
        s.addInstr(new ToAryInstr(ret, ret, manager.getFalse()));
        buildMultipleAsgn19Assignment(multipleAsgnNode, s, null, ret);
        return ret;
    }
View Full Code Here

            case BACKREFNODE: {
                return buildDefinitionCheck(s, new BackrefIsMatchDataInstr(s.getNewTemporaryVariable()), "global-variable");
            }
            case DREGEXPNODE:
            case DSTRNODE: {
                Operand v = super.buildVersionSpecificGetDefinitionIR(node, s);
                Label doneLabel = s.getNewLabel();
                Variable tmpVar = getValueInTemporaryVariable(s, v);
                s.addInstr(BNEInstr.create(tmpVar, manager.getNil(), doneLabel));
                s.addInstr(new CopyInstr(tmpVar, new StringLiteral("expression")));
                s.addInstr(new LabelInstr(doneLabel));
                return tmpVar;
            }
            case NOTNODE: {
                Operand v = buildGetDefinitionBase(((NotNode)node).getConditionNode(), s);
                Label doneLabel = s.getNewLabel();
                Variable tmpVar = getValueInTemporaryVariable(s, v);
                s.addInstr(BEQInstr.create(tmpVar, manager.getNil(), doneLabel));
                s.addInstr(new CopyInstr(tmpVar, new StringLiteral("method")));
                s.addInstr(new LabelInstr(doneLabel));
View Full Code Here

        return newLbl;
    }

    public void setupYieldArgsAndYieldResult(YieldInstr yi, BasicBlock yieldBB, Arity blockArity) {
        int     blockArityValue = blockArity.getValue();
        Operand yieldInstrArg = yi.getYieldArg();

        if ((yieldInstrArg == UndefinedValue.UNDEFINED) || (blockArityValue == 0)) {
            this.yieldArg = new Array(); // Zero-elt array
        } else if (yieldInstrArg instanceof Array) {
            this.yieldArg = yieldInstrArg;
View Full Code Here

TOP

Related Classes of org.jruby.ir.operands.Operand

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.