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

Commits on Mar 5, 2015

  1. Copy the full SHA
    cd796d0 View commit details
  2. Copy the full SHA
    a5e6a7b View commit details
28 changes: 28 additions & 0 deletions core/src/main/java/org/jruby/ir/IRScope.java
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@
import org.jruby.RubyModule;
import org.jruby.ir.dataflow.DataFlowProblem;
import org.jruby.ir.dataflow.analyses.LiveVariablesProblem;
import org.jruby.ir.dataflow.analyses.UnboxableOpsAnalysisNode;
import org.jruby.ir.dataflow.analyses.UnboxableOpsAnalysisProblem;
import org.jruby.ir.instructions.*;
import org.jruby.ir.interpreter.FullInterpreterContext;
import org.jruby.ir.interpreter.InterpreterContext;
@@ -389,12 +391,38 @@ public boolean canReceiveNonlocalReturns() {
return flags.contains(CAN_RECEIVE_NONLOCAL_RETURNS);
}

public void putLiveVariablesProblem(LiveVariablesProblem problem) {
// Technically this is if a pass is invalidated which has never run on a scope with no CFG/FIC yet.
if (fullInterpreterContext == null) {
// This should never trigger unless we got sloppy
if (problem != null) throw new IllegalStateException("LVP being stored when no FIC");
return;
}
fullInterpreterContext.getDataFlowProblems().put(LiveVariablesProblem.NAME, problem);
}

public LiveVariablesProblem getLiveVariablesProblem() {
if (fullInterpreterContext == null) return null; // no fic so no pass-related info

return (LiveVariablesProblem) fullInterpreterContext.getDataFlowProblems().get(LiveVariablesProblem.NAME);
}

public void putUnboxableOpsAnalysisProblem(UnboxableOpsAnalysisProblem problem) {
// Technically this is if a pass is invalidated which has never run on a scope with no CFG/FIC yet.
if (fullInterpreterContext == null) {
// This should never trigger unless we got sloppy
if (problem != null) throw new IllegalStateException("UboxableOpsAnalysisProblem being stored when no FIC");
return;
}
fullInterpreterContext.getDataFlowProblems().put(UnboxableOpsAnalysisProblem.NAME, problem);
}

public UnboxableOpsAnalysisProblem getUnboxableOpsAnalysisProblem() {
if (fullInterpreterContext == null) return null; // no fic so no pass-related info

return (UnboxableOpsAnalysisProblem) fullInterpreterContext.getDataFlowProblems().get(UnboxableOpsAnalysisProblem.NAME);
}

public CFG getCFG() {
// A child scope may not have been prepared yet so we advance it to point of have a fresh CFG.
if (getFullInterpreterContext() == null) prepareFullBuildCommon();
Original file line number Diff line number Diff line change
@@ -281,11 +281,11 @@ public void applyTransferFunction(Instr i) {
} else if (o instanceof WrappedIRClosure) {
// Fetch the nested unboxing-analysis problem, creating one if necessary
IRClosure cl = ((WrappedIRClosure)o).getClosure();
UnboxableOpsAnalysisProblem subProblem = (UnboxableOpsAnalysisProblem)cl.getFullInterpreterContext().getDataFlowProblems().get(UnboxableOpsAnalysisProblem.NAME);
UnboxableOpsAnalysisProblem subProblem = cl.getUnboxableOpsAnalysisProblem();
if (subProblem == null) {
subProblem = new UnboxableOpsAnalysisProblem();
subProblem.setup(cl);
cl.getFullInterpreterContext().getDataFlowProblems().put(UnboxableOpsAnalysisProblem.NAME, subProblem);
cl.putUnboxableOpsAnalysisProblem(subProblem);
}

UnboxableOpsAnalysisNode exitNode = subProblem.getExitNode();
@@ -654,7 +654,7 @@ public void unbox(Map<Variable, TemporaryLocalVariable> unboxMap) {

// Fetch the nested unboxing-analysis problem, creating one if necessary
IRClosure cl = ((WrappedIRClosure)o).getClosure();
UnboxableOpsAnalysisProblem subProblem = (UnboxableOpsAnalysisProblem)cl.getFullInterpreterContext().getDataFlowProblems().get(UnboxableOpsAnalysisProblem.NAME);
UnboxableOpsAnalysisProblem subProblem = cl.getUnboxableOpsAnalysisProblem();
UnboxableOpsAnalysisNode exitNode = subProblem.getExitNode();

// Compute solution
Original file line number Diff line number Diff line change
@@ -83,17 +83,15 @@ public Object execute(IRScope scope, Object... data) {
}

lvp.compute_MOP_Solution();
scope.getFullInterpreterContext().getDataFlowProblems().put(LiveVariablesProblem.NAME, lvp);
scope.putLiveVariablesProblem(lvp);

return lvp;
}

@Override
public boolean invalidate(IRScope scope) {
super.invalidate(scope);
if (scope.getFullInterpreterContext() != null) {
scope.getFullInterpreterContext().getDataFlowProblems().put(LiveVariablesProblem.NAME, null);
}
scope.putLiveVariablesProblem(null);
return true;
}
}
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ir/passes/UnboxingPass.java
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ public Object execute(IRScope scope, Object... data) {

@Override
public Object previouslyRun(IRScope scope) {
return scope.getFullInterpreterContext().getDataFlowProblems().get(UnboxableOpsAnalysisProblem.NAME);
return scope.getUnboxableOpsAnalysisProblem();
}

public boolean invalidate(IRScope scope) {