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

Commits on Nov 27, 2015

  1. Rename some IRVisitor methods

    subbuss committed Nov 27, 2015
    Copy the full SHA
    44d871f View commit details
  2. Copy the full SHA
    e8c7942 View commit details
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/ir/IRVisitor.java
Original file line number Diff line number Diff line change
@@ -86,14 +86,14 @@ private void error(Object object) {
public void OneOperandArgNoBlockCallInstr(OneOperandArgNoBlockCallInstr oneOperandArgNoBlockCallInstr) { error(oneOperandArgNoBlockCallInstr); }
public void OptArgMultipleAsgnInstr(OptArgMultipleAsgnInstr optargmultipleasgninstr) { error(optargmultipleasgninstr); }
public void PopBindingInstr(PopBindingInstr popbindinginstr) { error(popbindinginstr); }
public void PopFrameInstr(PopMethodFrameInstr popframeinstr) { error(popframeinstr); }
public void PopMethodFrameInstr(PopMethodFrameInstr popframeinstr) { error(popframeinstr); }
public void ProcessModuleBodyInstr(ProcessModuleBodyInstr processmodulebodyinstr) { error(processmodulebodyinstr); }
public void PutClassVariableInstr(PutClassVariableInstr putclassvariableinstr) { error(putclassvariableinstr); }
public void PutConstInstr(PutConstInstr putconstinstr) { error(putconstinstr); }
public void PutFieldInstr(PutFieldInstr putfieldinstr) { error(putfieldinstr); }
public void PutGlobalVarInstr(PutGlobalVarInstr putglobalvarinstr) { error(putglobalvarinstr); }
public void PushBindingInstr(PushMethodBindingInstr pushbindinginstr) { error(pushbindinginstr); }
public void PushFrameInstr(PushMethodFrameInstr pushframeinstr) { error(pushframeinstr); }
public void PushMethodBindingInstr(PushMethodBindingInstr pushbindinginstr) { error(pushbindinginstr); }
public void PushMethodFrameInstr(PushMethodFrameInstr pushframeinstr) { error(pushframeinstr); }
public void RaiseArgumentErrorInstr(RaiseArgumentErrorInstr raiseargumenterrorinstr) { error(raiseargumenterrorinstr); }
public void RaiseRequiredKeywordArgumentErrorInstr(RaiseRequiredKeywordArgumentError instr) { error(instr); }
public void ReifyClosureInstr(ReifyClosureInstr reifyclosureinstr) { error(reifyclosureinstr); }
Original file line number Diff line number Diff line change
@@ -22,6 +22,6 @@ public static PopMethodFrameInstr decode(IRReaderDecoder d) {

@Override
public void visit(IRVisitor visitor) {
visitor.PopFrameInstr(this);
visitor.PopMethodFrameInstr(this);
}
}
Original file line number Diff line number Diff line change
@@ -21,6 +21,6 @@ public static PushMethodBindingInstr decode(IRReaderDecoder d) {

@Override
public void visit(IRVisitor visitor) {
visitor.PushBindingInstr(this);
visitor.PushMethodBindingInstr(this);
}
}
Original file line number Diff line number Diff line change
@@ -29,6 +29,6 @@ public static PushMethodFrameInstr decode(IRReaderDecoder d) {

@Override
public void visit(IRVisitor visitor) {
visitor.PushFrameInstr(this);
visitor.PushMethodFrameInstr(this);
}
}
Original file line number Diff line number Diff line change
@@ -38,7 +38,6 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
int n = instrs.length;
int ipc = 0;
Object exception = null;
Block.Type blockType = block == null ? null : block.type;

StaticScope currScope = interpreterContext.getStaticScope();
DynamicScope currDynScope = context.getCurrentScope();
@@ -65,7 +64,7 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
case NONLOCAL_RETURN: {
NonlocalReturnInstr ri = (NonlocalReturnInstr)instr;
IRubyObject rv = (IRubyObject)retrieveOp(ri.getReturnValue(), context, self, currDynScope, currScope, temp);
return IRRuntimeHelpers.initiateNonLocalReturn(context, currDynScope, blockType, rv);
return IRRuntimeHelpers.initiateNonLocalReturn(context, currDynScope, block.type, rv);
}
case LINE_NUM:
context.setLine(((LineNumberInstr) instr).lineNumber);
@@ -171,7 +170,7 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
case RUNTIME_HELPER: { // NO INTERP
RuntimeHelperCall rhc = (RuntimeHelperCall)instr;
setResult(temp, currDynScope, rhc.getResult(),
rhc.callHelper(context, currScope, currDynScope, self, temp, blockType));
rhc.callHelper(context, currScope, currDynScope, self, temp, block.type));
break;
}
case GET_FIELD: { // NO INTERP
29 changes: 14 additions & 15 deletions core/src/main/java/org/jruby/ir/interpreter/InterpreterEngine.java
Original file line number Diff line number Diff line change
@@ -109,7 +109,6 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
int n = instrs.length;
int ipc = 0;
Object exception = null;
Block.Type blockType = block == null ? null : block.type;

if (interpreterContext.receivesKeywordArguments()) IRRuntimeHelpers.frobnicateKwargsArgument(context, interpreterContext.getRequiredArgsCount(), args);

@@ -153,7 +152,7 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
processCall(context, instr, operation, currDynScope, currScope, temp, self);
break;
case RET_OP:
return processReturnOp(context, instr, operation, currDynScope, temp, self, blockType, currScope);
return processReturnOp(context, block, instr, operation, currDynScope, temp, self, currScope);
case BRANCH_OP:
switch (operation) {
case JUMP: ipc = ((JumpInstr)instr).getJumpTarget().getTargetPC(); break;
@@ -168,11 +167,11 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
currDynScope = interpreterContext.newDynamicScope(context);
context.pushScope(currDynScope);
} else {
processBookKeepingOp(context, instr, operation, name, args, self, blockArg, blockType, implClass);
processBookKeepingOp(context, block, instr, operation, name, args, self, blockArg, implClass);
}
break;
case OTHER_OP:
processOtherOp(context, instr, operation, currDynScope, currScope, temp, self, blockType, floats, fixnums, booleans);
processOtherOp(context, block, instr, operation, currDynScope, currScope, temp, self, floats, fixnums, booleans);
break;
}
} catch (Throwable t) {
@@ -323,9 +322,9 @@ protected static void processCall(ThreadContext context, Instr instr, Operation
}
}

protected static void processBookKeepingOp(ThreadContext context, Instr instr, Operation operation,
protected static void processBookKeepingOp(ThreadContext context, Block block, Instr instr, Operation operation,
String name, IRubyObject[] args, IRubyObject self, Block blockArg,
Block.Type blockType, RubyModule implClass) {
RubyModule implClass) {
switch(operation) {
case LABEL:
break;
@@ -347,7 +346,7 @@ protected static void processBookKeepingOp(ThreadContext context, Instr instr, O
context.callThreadPoll();
break;
case CHECK_ARITY:
((CheckArityInstr)instr).checkArity(context, args, blockType);
((CheckArityInstr)instr).checkArity(context, args, block.type);
break;
case LINE_NUM:
context.setLine(((LineNumberInstr)instr).lineNumber);
@@ -369,9 +368,9 @@ protected static void processBookKeepingOp(ThreadContext context, Instr instr, O
}
}

protected static IRubyObject processReturnOp(ThreadContext context, Instr instr, Operation operation,
protected static IRubyObject processReturnOp(ThreadContext context, Block block, Instr instr, Operation operation,
DynamicScope currDynScope, Object[] temp, IRubyObject self,
Block.Type blockType, StaticScope currScope) {
StaticScope currScope) {
switch(operation) {
// --------- Return flavored instructions --------
case RETURN: {
@@ -385,19 +384,19 @@ protected static IRubyObject processReturnOp(ThreadContext context, Instr instr,
// This assumes that scopes with break instr. have a frame / dynamic scope
// pushed so that we can get to its static scope. For-loops now always have
// a dyn-scope pushed onto stack which makes this work in all scenarios.
return IRRuntimeHelpers.initiateBreak(context, currDynScope, rv, blockType);
return IRRuntimeHelpers.initiateBreak(context, currDynScope, rv, block.type);
}
case NONLOCAL_RETURN: {
NonlocalReturnInstr ri = (NonlocalReturnInstr)instr;
IRubyObject rv = (IRubyObject)retrieveOp(ri.getReturnValue(), context, self, currDynScope, currScope, temp);
return IRRuntimeHelpers.initiateNonLocalReturn(context, currDynScope, blockType, rv);
return IRRuntimeHelpers.initiateNonLocalReturn(context, currDynScope, block.type, rv);
}
}
return null;
}

protected static void processOtherOp(ThreadContext context, Instr instr, Operation operation, DynamicScope currDynScope,
StaticScope currScope, Object[] temp, IRubyObject self, Block.Type blockType,
protected static void processOtherOp(ThreadContext context, Block block, Instr instr, Operation operation, DynamicScope currDynScope,
StaticScope currScope, Object[] temp, IRubyObject self,
double[] floats, long[] fixnums, boolean[] booleans) {
Object result;
switch(operation) {
@@ -447,12 +446,12 @@ protected static void processOtherOp(ThreadContext context, Instr instr, Operati
case RUNTIME_HELPER: {
RuntimeHelperCall rhc = (RuntimeHelperCall)instr;
setResult(temp, currDynScope, rhc.getResult(),
rhc.callHelper(context, currScope, currDynScope, self, temp, blockType));
rhc.callHelper(context, currScope, currDynScope, self, temp, block.type));
break;
}

case CHECK_FOR_LJE:
((CheckForLJEInstr) instr).check(context, currDynScope, blockType);
((CheckForLJEInstr) instr).check(context, currDynScope, block.type);
break;

case BOX_FLOAT: {
Original file line number Diff line number Diff line change
@@ -38,7 +38,6 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
int n = instrs.length;
int ipc = 0;
Object exception = null;
Block.Type blockType = block == null ? null : block.type;

if (interpreterContext.receivesKeywordArguments()) IRRuntimeHelpers.frobnicateKwargsArgument(context, interpreterContext.getRequiredArgsCount(), args);

@@ -78,7 +77,7 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
processCall(context, instr, operation, currDynScope, currScope, temp, self);
break;
case RET_OP:
return processReturnOp(context, instr, operation, currDynScope, temp, self, blockType, currScope);
return processReturnOp(context, block, instr, operation, currDynScope, temp, self, currScope);
case BRANCH_OP:
switch (operation) {
case JUMP:
@@ -109,11 +108,11 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
rescuePCs.pop();
break;
default:
processBookKeepingOp(context, instr, operation, name, args, self, blockArg, blockType, implClass);
processBookKeepingOp(context, block, instr, operation, name, args, self, blockArg, implClass);
}
break;
case OTHER_OP:
processOtherOp(context, instr, operation, currDynScope, currScope, temp, self, blockType);
processOtherOp(context, block, instr, operation, currDynScope, currScope, temp, self);
break;
}
} catch (Throwable t) {
@@ -143,8 +142,8 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
throw context.runtime.newRuntimeError("BUG: interpreter fell through to end unexpectedly");
}

protected static void processOtherOp(ThreadContext context, Instr instr, Operation operation, DynamicScope currDynScope,
StaticScope currScope, Object[] temp, IRubyObject self, Block.Type blockType) {
protected static void processOtherOp(ThreadContext context, Block block, Instr instr, Operation operation, DynamicScope currDynScope,
StaticScope currScope, Object[] temp, IRubyObject self) {
switch(operation) {
case RECV_SELF:
break;
@@ -178,11 +177,11 @@ protected static void processOtherOp(ThreadContext context, Instr instr, Operati
case RUNTIME_HELPER: {
RuntimeHelperCall rhc = (RuntimeHelperCall)instr;
setResult(temp, currDynScope, rhc.getResult(),
rhc.callHelper(context, currScope, currDynScope, self, temp, blockType));
rhc.callHelper(context, currScope, currDynScope, self, temp, block.type));
break;
}
case CHECK_FOR_LJE:
((CheckForLJEInstr) instr).check(context, currDynScope, blockType);
((CheckForLJEInstr) instr).check(context, currDynScope, block.type);
break;
case LOAD_FRAME_CLOSURE:
setResult(temp, currDynScope, instr, context.getFrameBlock());
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
Original file line number Diff line number Diff line change
@@ -1389,7 +1389,7 @@ public void PopBindingInstr(PopBindingInstr popbindinginstr) {
}

@Override
public void PopFrameInstr(PopMethodFrameInstr popframeinstr) {
public void PopMethodFrameInstr(PopMethodFrameInstr popframeinstr) {
jvmMethod().loadContext();
jvmMethod().invokeVirtual(Type.getType(ThreadContext.class), Method.getMethod("void postMethodFrameOnly()"));
}
@@ -1404,7 +1404,7 @@ public void ProcessModuleBodyInstr(ProcessModuleBodyInstr processmodulebodyinstr
}

@Override
public void PushBindingInstr(PushMethodBindingInstr pushbindinginstr) {
public void PushMethodBindingInstr(PushMethodBindingInstr pushbindinginstr) {
jvmMethod().loadContext();
jvmMethod().loadStaticScope();
jvmAdapter().invokestatic(p(DynamicScope.class), "newDynamicScope", sig(DynamicScope.class, StaticScope.class));
@@ -1422,7 +1422,7 @@ public void RaiseRequiredKeywordArgumentErrorInstr(RaiseRequiredKeywordArgumentE
}

@Override
public void PushFrameInstr(PushMethodFrameInstr pushframeinstr) {
public void PushMethodFrameInstr(PushMethodFrameInstr pushframeinstr) {
jvmMethod().loadContext();
jvmMethod().loadFrameClass();
jvmMethod().loadFrameName();