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: d8dd33d783fc
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: dd7f8b74be72
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Nov 17, 2014

  1. Copy the full SHA
    5a134c3 View commit details
  2. Fix #2205: All (except top-level) scopes have PUBLIC visibility by de…

    …fault
    
    * JIT was already behaving this way.
    * Updated interpreter to have the same behavior and eliminated the
      visibility parameter to interpret methods.
    * Eliminates the difference between MRI behavior and jruby -X-C on the
      snippet in #2205.
    subbuss committed Nov 17, 2014
    Copy the full SHA
    dd7f8b7 View commit details
Showing with 15 additions and 8 deletions.
  1. +11 −8 core/src/main/java/org/jruby/ir/interpreter/Interpreter.java
  2. +4 −0 core/src/main/java/org/jruby/ir/targets/IRBytecodeAdapter7.java
19 changes: 11 additions & 8 deletions core/src/main/java/org/jruby/ir/interpreter/Interpreter.java
Original file line number Diff line number Diff line change
@@ -380,11 +380,14 @@ private static void processCall(ThreadContext context, Instr instr, Operation op

private static void processBookKeepingOp(ThreadContext context, Instr instr, Operation operation,
String name, IRubyObject[] args, IRubyObject self, Block block,
RubyModule implClass, Visibility visibility) {
RubyModule implClass) {
switch(operation) {
case PUSH_FRAME:
context.preMethodFrameOnly(implClass, name, self, block);
context.setCurrentVisibility(visibility);
// Only the top-level script scope has PRIVATE visibility.
// This is already handled as part of Interpreter.execute above.
// Everything else is PUBLIC by default.
context.setCurrentVisibility(Visibility.PUBLIC);
break;
case POP_FRAME:
context.popFrame();
@@ -548,7 +551,7 @@ private static void processOtherOp(ThreadContext context, Instr instr, Operation
}

private static IRubyObject interpret(ThreadContext context, IRubyObject self,
InterpreterContext interpreterContext, Visibility visibility, RubyModule implClass,
InterpreterContext interpreterContext, RubyModule implClass,
String name, IRubyObject[] args, Block block, Block.Type blockType) {
Instr[] instrs = interpreterContext.getInstructions();
Object[] temp = interpreterContext.allocateTemporaryVariables();
@@ -612,7 +615,7 @@ private static IRubyObject interpret(ThreadContext context, IRubyObject self,
currDynScope = interpreterContext.newDynamicScope(context);
context.pushScope(currDynScope);
} else {
processBookKeepingOp(context, instr, operation, name, args, self, block, implClass, visibility);
processBookKeepingOp(context, instr, operation, name, args, self, block, implClass);
}
break;
case OTHER_OP:
@@ -661,7 +664,7 @@ public static IRubyObject INTERPRET_ROOT(ThreadContext context, IRubyObject self
InterpreterContext ic, RubyModule clazz, String name) {
try {
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());
return interpret(context, self, ic, null, clazz, name, IRubyObject.NULL_ARRAY, Block.NULL_BLOCK, null);
return interpret(context, self, ic, clazz, name, IRubyObject.NULL_ARRAY, Block.NULL_BLOCK, null);
} finally {
ThreadContext.popBacktrace(context);
}
@@ -671,7 +674,7 @@ public static IRubyObject INTERPRET_EVAL(ThreadContext context, IRubyObject self
InterpreterContext ic, RubyModule clazz, IRubyObject[] args, String name, Block block, Block.Type blockType) {
try {
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());
return interpret(context, self, ic, null, clazz, name, args, block, blockType);
return interpret(context, self, ic, clazz, name, args, block, blockType);
} finally {
ThreadContext.popBacktrace(context);
}
@@ -681,7 +684,7 @@ public static IRubyObject INTERPRET_BLOCK(ThreadContext context, IRubyObject sel
InterpreterContext ic, IRubyObject[] args, String name, Block block, Block.Type blockType) {
try {
ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());
return interpret(context, self, ic, null, null, name, args, block, blockType);
return interpret(context, self, ic, null, name, args, block, blockType);
} finally {
ThreadContext.popBacktrace(context);
}
@@ -696,7 +699,7 @@ public static IRubyObject INTERPRET_METHOD(ThreadContext context, InterpretedIRM
try {
if (!isSynthetic) ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());

return interpret(context, self, ic, method.getVisibility(), method.getImplementationClass().getMethodLocation(), name, args, block, null);
return interpret(context, self, ic, method.getImplementationClass().getMethodLocation(), name, args, block, null);
} finally {
if (!isSynthetic) ThreadContext.popBacktrace(context);
}
Original file line number Diff line number Diff line change
@@ -247,6 +247,10 @@ public void hash(int length) {
adapter.invokedynamic("hash", sig(JVM.OBJECT, params(ThreadContext.class, JVM.OBJECT, length * 2)), Bootstrap.hash());
}

public void kwargsHash(int length) {
throw new RuntimeException("kwargsHash not implemented in IRBytecodeAdapter7");
}

public void checkpoint() {
loadContext();
adapter.invokedynamic(