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: 9345e9a69dbf
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a64705f6105f
Choose a head ref
  • 16 commits
  • 5 files changed
  • 1 contributor

Commits on Jan 23, 2015

  1. trivial. fix comment

    enebo committed Jan 23, 2015
    Copy the full SHA
    f253f8d View commit details
  2. Start of making all IRBuilder methods only have knowledge of a single…

    … IRScope object.
    
    This will make it so IRBuilder can retain implicit scope and that eventually state objects
    on IRScope only used for building IR will end up as temporary state on IRBuilder.
    enebo committed Jan 23, 2015
    Copy the full SHA
    d85d18d View commit details
  3. Start of making all IRBuilder methods only have knowledge of a single…

    … IRScope object.
    
    Convert iter
    enebo committed Jan 23, 2015
    Copy the full SHA
    5ef6bd9 View commit details
  4. Copy the full SHA
    c50356f View commit details
  5. Copy the full SHA
    d44f16b View commit details
  6. Copy the full SHA
    172cbd4 View commit details
  7. Copy the full SHA
    177de60 View commit details
  8. Copy the full SHA
    6e0bd6f View commit details
  9. Copy the full SHA
    0542de6 View commit details
  10. createTemporaryVariable method to remove more references to scope. Re…

    …move some methods from
    
    having a scope parameter and rely on scope field.
    enebo committed Jan 23, 2015
    Copy the full SHA
    0f378ac View commit details
  11. Copy the full SHA
    f6fac89 View commit details
  12. Moar scope field usage

    enebo committed Jan 23, 2015
    Copy the full SHA
    1ff3ffb View commit details
  13. Moar scope field usage

    enebo committed Jan 23, 2015
    Copy the full SHA
    c3950d1 View commit details
  14. Moar scope field usage

    enebo committed Jan 23, 2015
    Copy the full SHA
    3b5ff32 View commit details
  15. Moar scope field usage

    enebo committed Jan 23, 2015
    Copy the full SHA
    75217c1 View commit details
  16. Copy the full SHA
    a64705f View commit details
2,372 changes: 1,169 additions & 1,203 deletions core/src/main/java/org/jruby/ir/IRBuilder.java

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions core/src/main/java/org/jruby/ir/IRMethod.java
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@

import org.jcodings.specific.USASCIIEncoding;
import org.jruby.ast.MethodDefNode;
import org.jruby.ast.Node;
import org.jruby.internal.runtime.methods.IRMethodArgs;
import org.jruby.ir.instructions.Instr;
import org.jruby.ir.instructions.ReceiveArgBase;
@@ -67,7 +66,7 @@ public IRMethod(IRManager manager, IRScope lexicalParent, MethodDefNode defn, St
/** Run any necessary passes to get the IR ready for interpretation */
public synchronized InterpreterContext prepareForInterpretation() {
if (defn != null) {
IRBuilder.newIRBuilder(getManager()).defineMethodInner(defn, this, getLexicalParent());
IRBuilder.newIRBuilder(getManager(), this).defineMethodInner(defn, getLexicalParent());

defn = null;
}
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/ir/IRTranslator.java
Original file line number Diff line number Diff line change
@@ -23,8 +23,8 @@ public R execute(Ruby runtime, ParseResult result, S specificObject) {
if (result instanceof IRScriptBody) { // Already have it (likely from read from persistent store).
scope = (IRScriptBody) result;
} else if (result instanceof RootNode) { // Need to perform create IR from AST
scope = IRBuilder.createIRBuilder(runtime, runtime.getIRManager()).buildRoot((RootNode) result);
scope.setTopLevelBindingScope(((RootNode)result).getScope());
scope = IRBuilder.buildRoot(runtime.getIRManager(), (RootNode) result);
scope.setTopLevelBindingScope(((RootNode) result).getScope());

if (RubyInstanceConfig.IR_WRITING) {
try {
21 changes: 17 additions & 4 deletions core/src/main/java/org/jruby/ir/interpreter/Interpreter.java
Original file line number Diff line number Diff line change
@@ -733,13 +733,26 @@ private static BeginEndInterpreterContext prepareIC(ThreadContext context, Dynam
Ruby runtime = context.runtime;
IRScope containingIRScope = evalScope.getStaticScope().getEnclosingScope().getIRScope();
RootNode rootNode = (RootNode) runtime.parseEval(src.convertToString().getByteList(), file, evalScope, lineNumber);
IREvalScript evalScript = IRBuilder.createIRBuilder(runtime, runtime.getIRManager()).buildEvalRoot(evalScope.getStaticScope(), containingIRScope, file, lineNumber, rootNode, evalType);
StaticScope staticScope = evalScope.getStaticScope();
// Top-level script!
IREvalScript script;

BeginEndInterpreterContext ic = (BeginEndInterpreterContext) evalScript.prepareForInterpretation();
if (evalType == EvalType.BINDING_EVAL) {
script = new IRBindingEvalScript(runtime.getIRManager(), containingIRScope, file, lineNumber, staticScope, evalType);
} else {
script = new IREvalScript(runtime.getIRManager(), containingIRScope, file, lineNumber, staticScope, evalType);
}

// We link IRScope to StaticScope because we may add additional variables (like %block). During execution
// we end up growing dynamicscope potentially based on any changes made.
staticScope.setIRScope(script);

IRBuilder.newIRBuilder(runtime.getIRManager(), script).buildEvalRoot(rootNode);
BeginEndInterpreterContext ic = (BeginEndInterpreterContext) script.prepareForInterpretation();

if (IRRuntimeHelpers.isDebug()) {
LOG.info("Graph:\n" + evalScript.cfg().toStringGraph());
LOG.info("CFG:\n" + evalScript.cfg().toStringInstrs());
LOG.info("Graph:\n" + script.cfg().toStringGraph());
LOG.info("CFG:\n" + script.cfg().toStringInstrs());
}

return ic;
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ public List<Class<? extends CompilerPass>> getDependencies() {
public Object execute(IRScope s, Object... data) {
StoreLocalVarPlacementProblem slvp = new StoreLocalVarPlacementProblem();

// No need to run this pass if we eliminated the dynamic scope!
// Only run if we are pushing a scope or we are reusing the parents scope.
if (!s.getFlags().contains(IRFlags.DYNSCOPE_ELIMINATED) || s.getFlags().contains(IRFlags.REUSE_PARENT_DYNSCOPE)) {
// Make sure flags are computed
s.computeScopeFlags();