Skip to content

Instantly share code, notes, and snippets.

@enebo
Created June 2, 2010 17:22
Show Gist options
  • Save enebo/422693 to your computer and use it in GitHub Desktop.
Save enebo/422693 to your computer and use it in GitHub Desktop.
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args, Block block) {
InterpreterContext interp = new IRInterpreterContext(context, self, args);
BasicBlock basicBlock = cfg.getEntryBB();
BasicBlock jumpBlock = basicBlock;
while (basicBlock != null) {
// System.out.println("BB:" + basicBlock);
for (Instr instruction : basicBlock.getInstrs()) {
try {
System.out.println("EXEC'ing: " + instruction);
instruction.interpret(interp, self);
} catch (Jump jump) {
jumpBlock = cfg.getTargetBB(jump.getTarget());
break;
}
}
if (jumpBlock != basicBlock) {
basicBlock = jumpBlock;
} else {
basicBlock = cfg.getFallThroughBB(basicBlock);
jumpBlock = basicBlock;
}
}
return (IRubyObject) interp.getReturnValue();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment