Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
updated inlinetest ir compiler pass
  • Loading branch information
subbuss committed May 12, 2011
1 parent 334fb14 commit f2f49a6
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/org/jruby/compiler/ir/compiler_pass/InlineTest.java
@@ -1,13 +1,16 @@
package org.jruby.compiler.ir.compiler_pass;

import org.jruby.compiler.ir.IRScope;
import org.jruby.compiler.ir.IRClass;
import org.jruby.compiler.ir.IRMethod;
import org.jruby.compiler.ir.IRModule;
import org.jruby.compiler.ir.IRScope;
import org.jruby.compiler.ir.representations.CFG;
import org.jruby.compiler.ir.representations.BasicBlock;
import org.jruby.compiler.ir.instructions.CallInstr;
import org.jruby.compiler.ir.instructions.Instr;
import org.jruby.compiler.ir.operands.MethAddr;
import org.jruby.compiler.ir.operands.ClassMetaObject;
import org.jruby.compiler.ir.operands.Operand;

public class InlineTest implements CompilerPass {
public final String methodToInline;
Expand All @@ -19,8 +22,22 @@ public class InlineTest implements CompilerPass {
public void run(IRScope s) {
if (s instanceof IRMethod) {
CFG c = ((IRMethod)s).getCFG();
IRModule m = s.getNearestModule();
IRModule m = s.getNearestModule();
IRMethod mi = m.getInstanceMethod(methodToInline);

/*
// aggressive testing .. super class walking
while ((mi == null) && (m instanceof IRClass)) {
Operand sc = ((IRClass)m).superClass;
if (!(sc instanceof ClassMetaObject)) break;
m = (IRModule)((ClassMetaObject)sc).scope;
mi = m.getInstanceMethod(methodToInline);
}
*/

// just a test .. dont bother if we dont have a match!
if (mi == null) return;

for (BasicBlock b: c.getNodes()) {
for (Instr i: b.getInstrs()) {
if (i instanceof CallInstr) {
Expand Down

0 comments on commit f2f49a6

Please sign in to comment.