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

Commits on Mar 5, 2015

  1. Copy the full SHA
    7789ebe View commit details
  2. Make IRScope.getLiveVariablesProblem add convenience cast to LiveVari…

    …ablesProblem.
    
    Remove DataFlowConstants since it was already mostly dead.
    Hook up more LVP getters to reduce externalized use of FIC.
    enebo committed Mar 5, 2015
    Copy the full SHA
    0b65fe8 View commit details
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/ir/IRScope.java
Original file line number Diff line number Diff line change
@@ -389,10 +389,10 @@ public boolean canReceiveNonlocalReturns() {
return flags.contains(CAN_RECEIVE_NONLOCAL_RETURNS);
}

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

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

public CFG getCFG() {
13 changes: 0 additions & 13 deletions core/src/main/java/org/jruby/ir/dataflow/DataFlowConstants.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package org.jruby.ir.dataflow.analyses;

import org.jruby.dirgra.Edge;
import org.jruby.ir.IRClosure;
import org.jruby.ir.IRScope;
import org.jruby.ir.dataflow.DataFlowConstants;
import org.jruby.ir.dataflow.FlowGraphNode;
import org.jruby.ir.instructions.ClosureAcceptingInstr;
import org.jruby.ir.instructions.Instr;
import org.jruby.ir.instructions.ResultInstr;
import org.jruby.ir.interpreter.FullInterpreterContext;
import org.jruby.ir.operands.LocalVariable;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.Variable;
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@
import org.jruby.ir.IRClosure;
import org.jruby.ir.IRScope;
import org.jruby.ir.Operation;
import org.jruby.ir.dataflow.DataFlowConstants;
import org.jruby.ir.dataflow.FlowGraphNode;
import org.jruby.ir.instructions.*;
import org.jruby.ir.operands.*;
@@ -157,7 +156,7 @@ public boolean addStores(Map<Operand, Operand> varRenameMap, Set<LocalVariable>
// i,j are dirty inside the block, but not used outside

if (basicBlock.isExitBB()) {
LiveVariablesProblem lvp = (LiveVariablesProblem)scope.getFullInterpreterContext().getDataFlowProblems().get(DataFlowConstants.LVP_NAME);
LiveVariablesProblem lvp = scope.getLiveVariablesProblem();
java.util.Collection<LocalVariable> liveVars = lvp.getVarsLiveOnScopeExit();
if (liveVars != null) {
dirtyVars.retainAll(liveVars); // Intersection with variables live on exit from the scope
@@ -242,10 +241,7 @@ public boolean addStores(Map<Operand, Operand> varRenameMap, Set<LocalVariable>
// If this also happens to be exit BB, we would have intersected already earlier -- so no need to do it again!

if (!basicBlock.isExitBB()) {
LiveVariablesProblem lvp = (LiveVariablesProblem)scope.getFullInterpreterContext().getDataFlowProblems().get(DataFlowConstants.LVP_NAME);
if (lvp == null) {
System.out.println("LVP missing for " + scope);
}
LiveVariablesProblem lvp = scope.getLiveVariablesProblem();
java.util.Collection<LocalVariable> liveVars = lvp.getVarsLiveOnScopeExit();
if (liveVars != null) {
dirtyVars.retainAll(liveVars); // Intersection with variables live on exit from the scope
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
import org.jruby.dirgra.Edge;
import org.jruby.ir.IRClosure;
import org.jruby.ir.Operation;
import org.jruby.ir.dataflow.DataFlowConstants;
import org.jruby.ir.dataflow.FlowGraphNode;
import org.jruby.ir.instructions.*;
import org.jruby.ir.instructions.boxing.*;
@@ -282,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(DataFlowConstants.UNBOXING);
UnboxableOpsAnalysisProblem subProblem = (UnboxableOpsAnalysisProblem)cl.getFullInterpreterContext().getDataFlowProblems().get(UnboxableOpsAnalysisProblem.NAME);
if (subProblem == null) {
subProblem = new UnboxableOpsAnalysisProblem();
subProblem.setup(cl);
cl.getFullInterpreterContext().getDataFlowProblems().put(DataFlowConstants.UNBOXING, subProblem);
cl.getFullInterpreterContext().getDataFlowProblems().put(UnboxableOpsAnalysisProblem.NAME, subProblem);
}

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

// Only worry about vars live on exit from the BB
LiveVariablesProblem lvp = (LiveVariablesProblem)problem.getScope().getFullInterpreterContext().getDataFlowProblems().get(DataFlowConstants.LVP_NAME);
LiveVariablesProblem lvp = problem.getScope().getLiveVariablesProblem();
BitSet liveVarsSet = lvp.getFlowGraphNode(basicBlock).getLiveInBitSet();

List<Instr> newInstrs = new ArrayList<Instr>();
@@ -655,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(DataFlowConstants.UNBOXING);
UnboxableOpsAnalysisProblem subProblem = (UnboxableOpsAnalysisProblem)cl.getFullInterpreterContext().getDataFlowProblems().get(UnboxableOpsAnalysisProblem.NAME);
UnboxableOpsAnalysisNode exitNode = subProblem.getExitNode();

// Compute solution
18 changes: 1 addition & 17 deletions core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
Original file line number Diff line number Diff line change
@@ -116,24 +116,8 @@ public void codegenScriptBody(IRScriptBody script) {
}

private void logScope(IRScope scope) {
StringBuilder b = new StringBuilder();

b.append("\n\nLinearized instructions for JIT:\n");

int i = 0;
// FIXME: This
for (BasicBlock bb : scope.getFullInterpreterContext().getLinearizedBBList()) {
for (Instr instr : bb.getInstrs()) {
if (i > 0) b.append("\n");

b.append(" ").append(i).append('\t').append(instr);

i++;
}
}

LOG.info("Starting JVM compilation on scope " + scope);
LOG.info(b.toString());
LOG.info("\n\nLinearized instructions for JIT:\n" + scope.toStringInstrs());
}

public void emitScope(IRScope scope, String name, Signature signature, boolean specificArity) {