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: 67caf6254383
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 34f3e0bb6459
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Jan 10, 2016

  1. Do frame and scope optimizations for blocks.

    This appears to pass all tests after recent fixes, and reduces the
    costs of block state by a fair amount. More to come.
    headius committed Jan 10, 2016
    Copy the full SHA
    34f3e0b View commit details
Showing with 14 additions and 9 deletions.
  1. +14 −9 core/src/main/java/org/jruby/ir/passes/AddCallProtocolInstructions.java
Original file line number Diff line number Diff line change
@@ -52,8 +52,10 @@ private void popSavedState(IRScope scope, boolean isGEB, boolean requireBinding,
}
if (requireBinding) instrs.add(new PopBindingInstr());
if (scope instanceof IRClosure) {
instrs.add(new RestoreBindingVisibilityInstr(savedViz));
instrs.add(new PopBlockFrameInstr(savedFrame));
if (scope.needsFrame()) {
instrs.add(new RestoreBindingVisibilityInstr(savedViz));
instrs.add(new PopBlockFrameInstr(savedFrame));
}
} else {
if (requireFrame) instrs.add(new PopMethodFrameInstr());
}
@@ -83,18 +85,21 @@ public Object execute(IRScope scope, Object... data) {
savedViz = scope.createTemporaryVariable();
savedFrame = scope.createTemporaryVariable();

{ // FIXME: Hacky...need these to come before other stuff in entryBB so we insert instead of add
int insertIndex = 0;
// FIXME: Hacky...need these to come before other stuff in entryBB so we insert instead of add
int insertIndex = 0;

if (scope.needsFrame()) {
entryBB.insertInstr(insertIndex++, new SaveBindingVisibilityInstr(savedViz));
entryBB.insertInstr(insertIndex++, new PushBlockFrameInstr(savedFrame, scope.getName()));
}

// NOTE: Order of these next two is important, since UBESI resets state PBBI needs.
if (requireBinding) {
entryBB.insertInstr(insertIndex++, new PushBlockBindingInstr());
}
entryBB.insertInstr(insertIndex++, new UpdateBlockExecutionStateInstr(Self.SELF));
// NOTE: Order of these next two is important, since UBESI resets state PBBI needs.
if (requireBinding) {
entryBB.insertInstr(insertIndex++, new PushBlockBindingInstr());
}

entryBB.insertInstr(insertIndex++, new UpdateBlockExecutionStateInstr(Self.SELF));

Signature sig = ((IRClosure)scope).getSignature();

// Add the right kind of arg preparation instruction