Package org.jruby.compiler.ir

Examples of org.jruby.compiler.ir.IRModule


    public boolean isPreOrder()  { return true; }

    public void run(IRScope s) {
        if (s instanceof IRMethod) {
           CFG       c  = ((IRMethod)s).getCFG();
           IRModule m  = s.getNearestModule();
           IRMethod  mi = m.getInstanceMethod(methodToInline);
           for (BasicBlock b: c.getNodes()) {
               for (Instr i: b.getInstrs()) {
                   if (i instanceof CallInstr) {
                       CallInstr call = (CallInstr)i;
                       MethAddr addr = call.getMethodAddr();
View Full Code Here


                    // Check if we can optimize this call based on the receiving method and receiver type
                    // Use the simplified receiver!
                    IRMethod rm = call.getTargetMethodWithReceiver(r);
                    if (rm != null) {
                        IRModule rc = rm.getDefiningIRModule();
                        if (rc != null) { // TODO: I am fairly sure I am wallpapering
                            if (rc.isCoreClass("Fixnum")) {
                                Operand[] args = call.getOperands();
                                if (args[2].isConstant()) {
                                    addMethodGuard(rm, deoptLabel, versionMap, instrs);
                                    val = ((Fixnum) r).computeValue(rm.getName(), (Constant) args[2]);
                                }
                            } else if (rc.isCoreClass("Float")) {
                                Operand[] args = call.getOperands();
                                if (args[2].isConstant()) {
                                    addMethodGuard(rm, deoptLabel, versionMap, instrs);
                                    val = ((Float) r).computeValue(rm.getName(), (Constant) args[2]);
                                }
                            } else if (rc.isCoreClass("Array")) {
                                Operand[] args = call.getOperands();
                                if (args[2] instanceof Fixnum && (rm.getName() == "[]")) {
                                    addMethodGuard(rm, deoptLabel, versionMap, instrs);
                                    val = ((Array) r).fetchCompileTimeArrayElement(((Fixnum) args[2]).value.intValue(), false);
                                }
View Full Code Here

    // If so, the receiver type and hence the target method will be known.
    public IRMethod getTargetMethodWithReceiver(Operand receiver) {
        String mname = methAddr.getName();

        if (receiver instanceof MetaObject) {
            IRModule m = (IRModule) (((MetaObject) receiver).scope);
            return m.getClassMethod(mname);
        } // self.foo(..);
        // If this call instruction is in a class method, we'll fetch a class method
        // If this call instruction is in an instance method, we'll fetch an instance method
        else if ((receiver instanceof LocalVariable) && (((LocalVariable)receiver).isSelf())) {
            return null;
View Full Code Here

TOP

Related Classes of org.jruby.compiler.ir.IRModule

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.