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

Commits on Feb 12, 2015

  1. Copy the full SHA
    813996a View commit details
  2. Copy the full SHA
    8a0f5a3 View commit details
  3. Noticed this is now passing

    enebo committed Feb 12, 2015
    Copy the full SHA
    6e0efce View commit details
Showing with 17 additions and 21 deletions.
  1. +6 −0 core/src/main/java/org/jruby/RubyBinding.java
  2. +11 −20 core/src/main/java/org/jruby/ir/dataflow/analyses/LiveVariableNode.java
  3. +0 −1 test/mri/excludes/TestProc.rb
6 changes: 6 additions & 0 deletions core/src/main/java/org/jruby/RubyBinding.java
Original file line number Diff line number Diff line change
@@ -135,4 +135,10 @@ public IRubyObject eval(ThreadContext context, IRubyObject[] args) {

return RubyKernel.eval(context, this, newArgs, Block.NULL_BLOCK);
}


@JRubyMethod(name = "receiver")
public IRubyObject receiver(ThreadContext context) {
return binding.getSelf();
}
}
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@

import org.jruby.dirgra.Edge;
import org.jruby.ir.IRClosure;
import org.jruby.ir.IRFlags;
import org.jruby.ir.IRScope;
import org.jruby.ir.dataflow.DataFlowConstants;
import org.jruby.ir.dataflow.FlowGraphNode;
@@ -71,13 +70,13 @@ public void compute_MEET(Edge e, LiveVariableNode pred) {
in.or(pred.out);
}

private void markAllVariablesLive(LiveVariablesProblem lvp, BitSet living, Collection<? extends Variable> variableList) {
private void markAllVariablesLive(LiveVariablesProblem lvp, Collection<? extends Variable> variableList) {
for (Variable variable: variableList) {
markVariableLive(lvp, living, variable);
markVariableLive(lvp, variable);
}
}

private void markVariableLive(LiveVariablesProblem lvp, BitSet living, Variable x) {
private void markVariableLive(LiveVariablesProblem lvp, Variable x) {
Integer dv = lvp.getDFVar(x);

// A buggy Ruby program that uses but does not assign a value to a var
@@ -179,7 +178,7 @@ public void applyTransferFunction(Instr i) {
} while (changed);

// Merge live on closure entry info into the current problem.
markAllVariablesLive(problem, living, liveOnEntryAfter);
markAllVariablesLive(problem, liveOnEntryAfter);
}

// If this is a dataflow barrier -- mark all local vars but %self and %block live
@@ -196,12 +195,10 @@ public void applyTransferFunction(Instr i) {
// the binding has escaped since the if (scopeBindingHasEscapd) check above
// would have handled it. But, extra readability of the DRY-ed version is
// worth the the little bit of extra work.
if (i.canRaiseException()) {
makeOutExceptionVariablesLiving(living);
}
if (i.canRaiseException()) makeOutExceptionVariablesLiving();

// Now, for all variables used by 'i', mark them live before 'i'
markAllVariablesLive(problem, living, i.getUsedVariables());
markAllVariablesLive(problem, i.getUsedVariables());
}

@Override
@@ -221,12 +218,8 @@ public void finalizeSolution() {
* control-flow edge from pretty much every instr. to the rescuer/exit BB, we are handling it
* implicitly here.
*/
private void makeOutExceptionVariablesLiving(BitSet living) {
BitSet etOut = getExceptionTargetNode().out;

for (int i = 0; i < etOut.size(); i++) {
if (etOut.get(i)) living.set(i);
}
private void makeOutExceptionVariablesLiving() {
living.or(getExceptionTargetNode().out);
}

@Override
@@ -314,7 +307,7 @@ void markDeadInstructions() {
IRClosure cl = ((WrappedIRClosure)o).getClosure();
LiveVariablesProblem cl_lvp = (LiveVariablesProblem)cl.getDataFlowSolution(problem.getName());
// Collect variables live on entry and merge that info into the current problem.
markAllVariablesLive(problem, living, cl_lvp.getVarsLiveOnScopeEntry());
markAllVariablesLive(problem, cl_lvp.getVarsLiveOnScopeEntry());
} else if (scopeBindingHasEscaped) {
// Mark all non-self, non-block local variables live if 'c' is a dataflow barrier!
for (Variable x: problem.getNonSelfLocalVars()) {
@@ -327,12 +320,10 @@ void markDeadInstructions() {
// the binding has escaped since the if (scopeBindingHasEscapd) check above
// would have handled it. But, extra readability of the DRY-ed version is
// worth the the little bit of extra work.
if (i.canRaiseException()) {
makeOutExceptionVariablesLiving(living);
}
if (i.canRaiseException()) makeOutExceptionVariablesLiving();

// Do not mark this instruction's operands live if the instruction itself is dead!
if (!i.isDead()) markAllVariablesLive(problem, living, i.getUsedVariables());
if (!i.isDead()) markAllVariablesLive(problem, i.getUsedVariables());
}
}

1 change: 0 additions & 1 deletion test/mri/excludes/TestProc.rb
Original file line number Diff line number Diff line change
@@ -14,6 +14,5 @@
exclude :test_proc_args_pos_opt_post, "needs investigation"
exclude :test_proc_args_pos_opt_post_block, "needs investigation"
exclude :test_proc_lambda, "needs investigation"
exclude :test_proc_location, "needs investigation"
exclude :test_safe, "needs investigation"
exclude :test_to_s, "needs investigation"