Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c34c031763be
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bc28e1c513fd
Choose a head ref
  • 3 commits
  • 5 files changed
  • 1 contributor

Commits on Oct 21, 2014

  1. Appease subbu in making the intent between call protocol path seem mo…

    …re equal to non-call protocol path
    enebo committed Oct 21, 2014
    Copy the full SHA
    3b7d4a1 View commit details
  2. Copy the full SHA
    322767e View commit details
  3. IC pushed further through stack

    enebo committed Oct 21, 2014

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    bc28e1c View commit details
Original file line number Diff line number Diff line change
@@ -94,14 +94,16 @@ public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule claz

if (IRRuntimeHelpers.isDebug()) doDebug();

if (ic.hasExplicitCallProtocol()) return Interpreter.INTERPRET_METHOD(context, this, self, name, args, block);

pre(ic, context, self, name, block);

try {
if (ic.hasExplicitCallProtocol()) {
return Interpreter.INTERPRET_METHOD(context, this, self, name, args, block);
} finally {
post(ic, context);
} else {
try {
pre(ic, context, self, name, block);

return Interpreter.INTERPRET_METHOD(context, this, self, name, args, block);
} finally {
post(ic, context);
}
}
}

@@ -135,11 +137,7 @@ protected void pre(InterpreterContext ic, ThreadContext context, IRubyObject sel
}

public InterpreterContext ensureInstrsReady() {
InterpreterContext context = method.getInterpreterContext();
if (context == null) {
context = method.prepareForInterpretation();
}
return context;
return method.prepareForInterpretation();
}

public DynamicMethod getMethodForCaching() {
5 changes: 4 additions & 1 deletion core/src/main/java/org/jruby/ir/IREvalScript.java
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
import org.jruby.EvalType;
import org.jruby.RubyModule;
import org.jruby.ir.interpreter.Interpreter;
import org.jruby.ir.interpreter.InterpreterContext;
import org.jruby.ir.operands.ClosureLocalVariable;
import org.jruby.ir.operands.Label;
import org.jruby.ir.operands.LocalVariable;
@@ -104,8 +105,10 @@ public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule claz
LOG.info("CFG:\n" + cfg().toStringInstrs());
}

InterpreterContext ic = prepareForInterpretation();

// FIXME: Do not push new empty arg array in every time
return Interpreter.INTERPRET_EVAL(context, self, this, clazz, new IRubyObject[] {}, backtraceName, block, null);
return Interpreter.INTERPRET_EVAL(context, self, ic, clazz, new IRubyObject[] {}, backtraceName, block, null);
}

@Override
5 changes: 3 additions & 2 deletions core/src/main/java/org/jruby/ir/IRScriptBody.java
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

import org.jruby.RubyModule;
import org.jruby.ir.interpreter.Interpreter;
import org.jruby.ir.interpreter.InterpreterContext;
import org.jruby.ir.operands.IRException;
import org.jruby.ir.representations.CFG;
import org.jruby.ir.runtime.IRBreakJump;
@@ -80,7 +81,7 @@ public boolean isScriptScope() {
}

public IRubyObject interpret(ThreadContext context, IRubyObject self) {
prepareForInterpretation();
InterpreterContext ic = prepareForInterpretation();

String name = "(root)";
if (IRRuntimeHelpers.isDebug()) {
@@ -111,7 +112,7 @@ public IRubyObject interpret(ThreadContext context, IRubyObject self) {

try {
Interpreter.runBeginEndBlocks(getBeginBlocks(), context, self, scope, null);
retVal = Interpreter.INTERPRET_ROOT(context, self, this, currModule, name);
retVal = Interpreter.INTERPRET_ROOT(context, self, ic, currModule, name);
Interpreter.runBeginEndBlocks(getEndBlocks(), context, self, scope, null);

Interpreter.dumpStats();
27 changes: 13 additions & 14 deletions core/src/main/java/org/jruby/ir/interpreter/Interpreter.java
Original file line number Diff line number Diff line change
@@ -509,8 +509,7 @@ private static void processOtherOp(ThreadContext context, Instr instr, Operation
}

private static IRubyObject interpret(ThreadContext context, IRubyObject self,
IRScope scope, Visibility visibility, RubyModule implClass, String name, IRubyObject[] args, Block block, Block.Type blockType) {
InterpreterContext interpreterContext = scope.getInterpreterContext();
InterpreterContext interpreterContext, Visibility visibility, RubyModule implClass, String name, IRubyObject[] args, Block block, Block.Type blockType) {
Instr[] instrs = interpreterContext.getInstructions();
int numTempVars = interpreterContext.getTemporaryVariablecount();
Object[] temp = numTempVars > 0 ? new Object[numTempVars] : null;
@@ -622,44 +621,44 @@ private static void extractToMethodToAvoidC2Crash(ThreadContext context, Instr i
}

public static IRubyObject INTERPRET_ROOT(ThreadContext context, IRubyObject self,
IRScope scope, RubyModule clazz, String name) {
InterpreterContext ic, RubyModule clazz, String name) {
try {
ThreadContext.pushBacktrace(context, name, scope.getFileName(), context.getLine());
return interpret(context, self, scope, null, clazz, name, IRubyObject.NULL_ARRAY, Block.NULL_BLOCK, null);
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());
return interpret(context, self, ic, null, clazz, name, IRubyObject.NULL_ARRAY, Block.NULL_BLOCK, null);
} finally {
ThreadContext.popBacktrace(context);
}
}

public static IRubyObject INTERPRET_EVAL(ThreadContext context, IRubyObject self,
IRScope scope, RubyModule clazz, IRubyObject[] args, String name, Block block, Block.Type blockType) {
InterpreterContext ic, RubyModule clazz, IRubyObject[] args, String name, Block block, Block.Type blockType) {
try {
ThreadContext.pushBacktrace(context, name, scope.getFileName(), context.getLine());
return interpret(context, self, scope, null, clazz, name, args, block, blockType);
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());
return interpret(context, self, ic, null, clazz, name, args, block, blockType);
} finally {
ThreadContext.popBacktrace(context);
}
}

public static IRubyObject INTERPRET_BLOCK(ThreadContext context, IRubyObject self,
IRScope scope, IRubyObject[] args, String name, Block block, Block.Type blockType) {
InterpreterContext ic, IRubyObject[] args, String name, Block block, Block.Type blockType) {
try {
ThreadContext.pushBacktrace(context, name, scope.getFileName(), context.getLine());
return interpret(context, self, scope, null, null, name, args, block, blockType);
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());
return interpret(context, self, ic, null, null, name, args, block, blockType);
} finally {
ThreadContext.popBacktrace(context);
}
}

public static IRubyObject INTERPRET_METHOD(ThreadContext context, InterpretedIRMethod method,
IRubyObject self, String name, IRubyObject[] args, Block block) {
IRScope scope = method.getIRMethod();
InterpreterContext ic = method.ensureInstrsReady();
boolean syntheticMethod = name == null || name.equals("");

try {
if (!syntheticMethod) ThreadContext.pushBacktrace(context, name, scope.getFileName(), context.getLine());
if (!syntheticMethod) ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());

return interpret(context, self, scope, method.getVisibility(), method.getImplementationClass(), name, args, block, null);
return interpret(context, self, ic, method.getVisibility(), method.getImplementationClass(), name, args, block, null);
} finally {
if (!syntheticMethod) ThreadContext.popBacktrace(context);
}
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ protected IRubyObject commonYieldPath(ThreadContext context, IRubyObject[] args,
this.evalType.set(EvalType.NONE);

try {
return Interpreter.INTERPRET_BLOCK(context, self, closure, args, binding.getMethod(), block, type);
return Interpreter.INTERPRET_BLOCK(context, self, ic, args, binding.getMethod(), block, type);
}
finally {
// IMPORTANT: Do not clear eval-type in case this is reused in bindings!