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

Commits on Nov 26, 2015

  1. Push/PopFrameInstr --> Push/PopMethodFrameInstr

    * We also need Push/PopBlockFrameInstr
    subbuss committed Nov 26, 2015
    Copy the full SHA
    2368dcd View commit details
  2. PushBindingInstr -> PushMethodBindingInstr

    * We also need a PushBlockBindingInstr
    subbuss committed Nov 26, 2015
    Copy the full SHA
    c661202 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(PopFrameInstr popframeinstr) { error(popframeinstr); }
public void PopFrameInstr(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(PushBindingInstr pushbindinginstr) { error(pushbindinginstr); }
public void PushFrameInstr(PushFrameInstr pushframeinstr) { error(pushframeinstr); }
public void PushBindingInstr(PushMethodBindingInstr pushbindinginstr) { error(pushbindinginstr); }
public void PushFrameInstr(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); }
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/ir/Operation.java
Original file line number Diff line number Diff line change
@@ -204,9 +204,9 @@ public enum Operation {

/** Other JRuby internal primitives for optimizations */
MODULE_GUARD(OpFlags.f_is_jump_or_branch), /* a guard acts as a branch */
PUSH_FRAME(OpFlags.f_is_book_keeping_op | OpFlags.f_has_side_effect),
PUSH_BINDING(OpFlags.f_is_book_keeping_op | OpFlags.f_has_side_effect),
POP_FRAME(OpFlags.f_is_book_keeping_op | OpFlags.f_has_side_effect),
PUSH_METHOD_FRAME(OpFlags.f_is_book_keeping_op | OpFlags.f_has_side_effect),
PUSH_METHOD_BINDING(OpFlags.f_is_book_keeping_op | OpFlags.f_has_side_effect),
POP_METHOD_FRAME(OpFlags.f_is_book_keeping_op | OpFlags.f_has_side_effect),
POP_BINDING(OpFlags.f_is_book_keeping_op | OpFlags.f_has_side_effect),
TOGGLE_BACKTRACE(OpFlags.f_is_book_keeping_op | OpFlags.f_has_side_effect);

Original file line number Diff line number Diff line change
@@ -6,18 +6,18 @@
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.ir.transformations.inlining.SimpleCloneInfo;

public class PopFrameInstr extends NoOperandInstr implements FixedArityInstr {
public PopFrameInstr() {
super(Operation.POP_FRAME);
public class PopMethodFrameInstr extends NoOperandInstr implements FixedArityInstr {
public PopMethodFrameInstr() {
super(Operation.POP_METHOD_FRAME);
}

@Override
public Instr clone(CloneInfo ii) {
return ii instanceof SimpleCloneInfo ? this : NopInstr.NOP; // FIXME: Is this correct
}

public static PopFrameInstr decode(IRReaderDecoder d) {
return new PopFrameInstr();
public static PopMethodFrameInstr decode(IRReaderDecoder d) {
return new PopMethodFrameInstr();
}

@Override
Original file line number Diff line number Diff line change
@@ -5,18 +5,18 @@
import org.jruby.ir.persistence.IRReaderDecoder;
import org.jruby.ir.transformations.inlining.CloneInfo;

public class PushBindingInstr extends NoOperandInstr implements FixedArityInstr {
public PushBindingInstr() {
super(Operation.PUSH_BINDING);
public class PushMethodBindingInstr extends NoOperandInstr implements FixedArityInstr {
public PushMethodBindingInstr() {
super(Operation.PUSH_METHOD_BINDING);
}

@Override
public Instr clone(CloneInfo ii) {
return this; // FIXME: This has to be wrong if pop_binding is conditionally noop'ing on inline
}

public static PushBindingInstr decode(IRReaderDecoder d) {
return new PushBindingInstr();
public static PushMethodBindingInstr decode(IRReaderDecoder d) {
return new PushMethodBindingInstr();
}

@Override
Original file line number Diff line number Diff line change
@@ -6,10 +6,10 @@
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.ir.transformations.inlining.SimpleCloneInfo;

public class PushFrameInstr extends NoOperandInstr implements FixedArityInstr {
public class PushMethodFrameInstr extends NoOperandInstr implements FixedArityInstr {
private final String frameName;
public PushFrameInstr(String frameName) {
super(Operation.PUSH_FRAME);
public PushMethodFrameInstr(String frameName) {
super(Operation.PUSH_METHOD_FRAME);

this.frameName = frameName;
}
@@ -23,8 +23,8 @@ public Instr clone(CloneInfo ii) {
return ii instanceof SimpleCloneInfo ? this : NopInstr.NOP; // FIXME: Is this correct?
}

public static PushFrameInstr decode(IRReaderDecoder d) {
return new PushFrameInstr(d.decodeString());
public static PushMethodFrameInstr decode(IRReaderDecoder d) {
return new PushMethodFrameInstr(d.decodeString());
}

@Override
Original file line number Diff line number Diff line change
@@ -78,17 +78,17 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
case THROW:
instr.interpret(context, currScope, currDynScope, self, temp);
break;
case PUSH_FRAME:
case PUSH_METHOD_FRAME:
context.preMethodFrameOnly(implClass, name, self, blockArg);
// 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:
case POP_METHOD_FRAME:
context.popFrame();
break;
case PUSH_BINDING:
case PUSH_METHOD_BINDING:
// IMPORTANT: Preserve this update of currDynScope.
// This affects execution of all instructions in this scope
// which will now use the updated value of currDynScope.
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@
import org.jruby.ir.instructions.CheckArityInstr;
import org.jruby.ir.instructions.CheckForLJEInstr;
import org.jruby.ir.instructions.CopyInstr;
import org.jruby.ir.instructions.ExceptionRegionStartMarkerInstr;
import org.jruby.ir.instructions.GetFieldInstr;
import org.jruby.ir.instructions.Instr;
import org.jruby.ir.instructions.JumpInstr;
@@ -63,8 +62,6 @@
import org.jruby.runtime.ivars.VariableAccessor;
import org.jruby.runtime.opto.ConstantCache;

import java.util.Stack;

/**
* Base full interpreter. Subclasses can use utility methods here and override what they want. This method requires
* that it has fully built and has had a CFG made, etc...
@@ -164,7 +161,7 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
}
break;
case BOOK_KEEPING_OP:
if (operation == Operation.PUSH_BINDING) {
if (operation == Operation.PUSH_METHOD_BINDING) {
// IMPORTANT: Preserve this update of currDynScope.
// This affects execution of all instructions in this scope
// which will now use the updated value of currDynScope.
@@ -332,14 +329,14 @@ protected static void processBookKeepingOp(ThreadContext context, Instr instr, O
switch(operation) {
case LABEL:
break;
case PUSH_FRAME:
case PUSH_METHOD_FRAME:
context.preMethodFrameOnly(implClass, name, self, blockArg);
// 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:
case POP_METHOD_FRAME:
context.popFrame();
break;
case POP_BINDING:
Original file line number Diff line number Diff line change
@@ -44,9 +44,9 @@ public class SimpleMethodInterpreterEngine extends InterpreterEngine {
put(Operation.RECV_SELF, true);
put(Operation.RECV_JRUBY_EXC, true);
put(Operation.THROW, true);
put(Operation.PUSH_FRAME, true);
put(Operation.POP_FRAME, true);
put(Operation.PUSH_BINDING, true);
put(Operation.PUSH_METHOD_FRAME, true);
put(Operation.POP_METHOD_FRAME, true);
put(Operation.PUSH_METHOD_BINDING, true);
put(Operation.POP_BINDING, true);
put(Operation.NORESULT_CALL_1O, true);
put(Operation.SEARCH_CONST, true);
@@ -120,17 +120,17 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
case THROW:
instr.interpret(context, currScope, currDynScope, self, temp);
break;
case PUSH_FRAME:
case PUSH_METHOD_FRAME:
context.preMethodFrameOnly(implClass, name, self, blockArg);
// 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:
case POP_METHOD_FRAME:
context.popFrame();
break;
case PUSH_BINDING:
case PUSH_METHOD_BINDING:
// IMPORTANT: Preserve this update of currDynScope.
// This affects execution of all instructions in this scope
// which will now use the updated value of currDynScope.
@@ -322,17 +322,17 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
case THROW:
instr.interpret(context, currScope, currDynScope, self, temp);
break;
case PUSH_FRAME:
case PUSH_METHOD_FRAME:
context.preMethodFrameOnly(implClass, name, self, blockArg);
// 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:
case POP_METHOD_FRAME:
context.popFrame();
break;
case PUSH_BINDING:
case PUSH_METHOD_BINDING:
// IMPORTANT: Preserve this update of currDynScope.
// This affects execution of all instructions in this scope
// which will now use the updated value of currDynScope.
@@ -525,17 +525,17 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
case THROW:
instr.interpret(context, currScope, currDynScope, self, temp);
break;
case PUSH_FRAME:
case PUSH_METHOD_FRAME:
context.preMethodFrameOnly(implClass, name, self, blockArg);
// 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:
case POP_METHOD_FRAME:
context.popFrame();
break;
case PUSH_BINDING:
case PUSH_METHOD_BINDING:
// IMPORTANT: Preserve this update of currDynScope.
// This affects execution of all instructions in this scope
// which will now use the updated value of currDynScope.
@@ -729,17 +729,17 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
case THROW:
instr.interpret(context, currScope, currDynScope, self, temp);
break;
case PUSH_FRAME:
case PUSH_METHOD_FRAME:
context.preMethodFrameOnly(implClass, name, self, blockArg);
// 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:
case POP_METHOD_FRAME:
context.popFrame();
break;
case PUSH_BINDING:
case PUSH_METHOD_BINDING:
// IMPORTANT: Preserve this update of currDynScope.
// This affects execution of all instructions in this scope
// which will now use the updated value of currDynScope.
@@ -925,17 +925,17 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
case THROW:
instr.interpret(context, currScope, currDynScope, self, temp);
break;
case PUSH_FRAME:
case PUSH_METHOD_FRAME:
context.preMethodFrameOnly(implClass, name, self, blockArg);
// 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:
case POP_METHOD_FRAME:
context.popFrame();
break;
case PUSH_BINDING:
case PUSH_METHOD_BINDING:
// IMPORTANT: Preserve this update of currDynScope.
// This affects execution of all instructions in this scope
// which will now use the updated value of currDynScope.
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@ public IRubyObject interpret(ThreadContext context, Block block, IRubyObject sel
break;
case BOOK_KEEPING_OP:
switch (operation) {
case PUSH_BINDING:
case PUSH_METHOD_BINDING:
// IMPORTANT: Preserve this update of currDynScope.
// This affects execution of all instructions in this scope
// which will now use the updated value of currDynScope.
Original file line number Diff line number Diff line change
@@ -71,8 +71,8 @@ public Object execute(IRScope scope, Object... data) {
if (requireBinding || requireFrame) {
BasicBlock entryBB = cfg.getEntryBB();
// Push
if (requireFrame) entryBB.addInstr(new PushFrameInstr(scope.getName()));
if (requireBinding) entryBB.addInstr(new PushBindingInstr());
if (requireFrame) entryBB.addInstr(new PushMethodFrameInstr(scope.getName()));
if (requireBinding) entryBB.addInstr(new PushMethodBindingInstr());

// SSS FIXME: We are doing this conservatively.
// Only scopes that have unrescued exceptions need a GEB.
@@ -105,7 +105,7 @@ public Object execute(IRScope scope, Object... data) {
// Add before the break/return
instrs.previous();
if (requireBinding) instrs.add(new PopBindingInstr());
if (requireFrame) instrs.add(new PopFrameInstr());
if (requireFrame) instrs.add(new PopMethodFrameInstr());
break;
}
}
@@ -119,7 +119,7 @@ public Object execute(IRScope scope, Object... data) {
instrs.previous();
}
if (requireBinding) instrs.add(new PopBindingInstr());
if (requireFrame) instrs.add(new PopFrameInstr());
if (requireFrame) instrs.add(new PopMethodFrameInstr());
}

if (bb == geb) {
@@ -130,7 +130,7 @@ public Object execute(IRScope scope, Object... data) {
instrs.previous();
}
if (requireBinding) instrs.add(new PopBindingInstr());
if (requireFrame) instrs.add(new PopFrameInstr());
if (requireFrame) instrs.add(new PopMethodFrameInstr());
}
}
}
Original file line number Diff line number Diff line change
@@ -250,10 +250,10 @@ public Instr decodeInstr() {
case NORESULT_CALL:
case NORESULT_CALL_1O: return NoResultCallInstr.decode(this);
case POP_BINDING: return PopBindingInstr.decode(this);
case POP_FRAME: return PopFrameInstr.decode(this);
case POP_METHOD_FRAME: return PopMethodFrameInstr.decode(this);
case PROCESS_MODULE_BODY: return ProcessModuleBodyInstr.decode(this);
case PUSH_BINDING: return PushBindingInstr.decode(this);
case PUSH_FRAME: return PushFrameInstr.decode(this);
case PUSH_METHOD_BINDING: return PushMethodBindingInstr.decode(this);
case PUSH_METHOD_FRAME: return PushMethodFrameInstr.decode(this);
case PUT_CONST: return PutConstInstr.decode(this);
case PUT_CVAR: return PutClassVariableInstr.decode(this);
case PUT_FIELD: return PutFieldInstr.decode(this);
Loading