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

Commits on Oct 13, 2014

  1. Copy the full SHA
    ca67379 View commit details
  2. Turn off requireFrame opt for now since it is buggy in some scenarios

    * Fixes some rubyspec failures when this is enabled.
    subbuss committed Oct 13, 2014
    Copy the full SHA
    2499589 View commit details
3 changes: 0 additions & 3 deletions core/src/main/java/org/jruby/ir/IRScope.java
Original file line number Diff line number Diff line change
@@ -7,13 +7,10 @@
import org.jruby.ir.instructions.*;
import org.jruby.ir.operands.*;
import org.jruby.ir.operands.Float;
import org.jruby.ir.passes.AddLocalVarLoadStoreInstructions;
import org.jruby.ir.passes.CompilerPass;
import org.jruby.ir.passes.CompilerPassScheduler;
import org.jruby.ir.passes.DeadCodeElimination;
import org.jruby.ir.passes.OptimizeDynScopesPass;
import org.jruby.ir.dataflow.analyses.StoreLocalVarPlacementProblem;
import org.jruby.ir.dataflow.analyses.LiveVariablesProblem;
import org.jruby.ir.passes.UnboxingPass;
import org.jruby.ir.persistence.IRReaderDecoder;
import org.jruby.ir.representations.BasicBlock;
29 changes: 16 additions & 13 deletions core/src/main/java/org/jruby/ir/interpreter/Interpreter.java
Original file line number Diff line number Diff line change
@@ -23,7 +23,6 @@
import org.jruby.util.log.LoggerFactory;

import java.util.List;
import java.util.Map;

public class Interpreter extends IRTranslator<IRubyObject, IRubyObject> {

@@ -509,6 +508,21 @@ private static void processOtherOp(ThreadContext context, Instr instr, Operation
}
}

private static DynamicScope getNewDynScope(ThreadContext context, IRScope scope, StaticScope currScope) {
// SSS NOTE: Method/module scopes only!
//
// Blocks are a headache -- so, these instrs. are only added to IRMethods.
// Blocks have more complicated logic for pushing a dynamic scope (see InterpretedIRBlockBody)
if (scope instanceof IRMetaClassBody) {
// Add a parent-link to current dynscope to support non-local returns cheaply
// This doesn't affect variable scoping since local variables will all have
// the right scope depth.
return DynamicScope.newDynamicScope(currScope, context.getCurrentScope());
} else {
return DynamicScope.newDynamicScope(currScope);
}
}

private static IRubyObject interpret(ThreadContext context, IRubyObject self,
IRScope scope, Visibility visibility, RubyModule implClass, String name, IRubyObject[] args, Block block, Block.Type blockType) {
Instr[] instrs = scope.getInstrsForInterpretation(blockType == Block.Type.LAMBDA);
@@ -570,18 +584,7 @@ private static IRubyObject interpret(ThreadContext context, IRubyObject self,
break;
case BOOK_KEEPING_OP:
if (operation == Operation.PUSH_BINDING) {
// SSS NOTE: Method/module scopes only!
//
// Blocks are a headache -- so, these instrs. are only added to IRMethods.
// Blocks have more complicated logic for pushing a dynamic scope (see InterpretedIRBlockBody)
if (scope instanceof IRMetaClassBody) {
// Add a parent-link to current dynscope to support non-local returns cheaply
// This doesn't affect variable scoping since local variables will all have
// the right scope depth.
currDynScope = DynamicScope.newDynamicScope(currScope, context.getCurrentScope());
} else {
currDynScope = DynamicScope.newDynamicScope(currScope);
}
currDynScope = getNewDynScope(context, scope, currScope);
context.pushScope(currDynScope);
} else {
processBookKeepingOp(context, instr, operation, currScope, name, args, self, block, implClass, visibility, temp, currDynScope);
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.jruby.ir.passes;

import org.jruby.ir.*;
import org.jruby.ir.dataflow.analyses.LiveVariablesProblem;
import org.jruby.ir.dataflow.analyses.StoreLocalVarPlacementProblem;
import org.jruby.ir.instructions.*;
import org.jruby.ir.operands.Label;
@@ -71,6 +70,24 @@ public Object execute(IRScope scope, Object... data) {
}
}

/* ----------------------------------------------------------------------
* Turning this off for now since this code is buggy and fails a few tests
* See example below which fails:
*
def y; yield; end
y {
def revivify
Proc::new
end
y {
x = Proc.new {}
y = revivify(&x)
p x.object_id, y.object_id
}
}
*
boolean requireFrame = bindingHasEscaped || scope.usesEval();
for (IRFlags flag : scope.getFlags()) {
@@ -88,7 +105,9 @@ public Object execute(IRScope scope, Object... data) {
requireFrame = true;
}
}
* ---------------------------------------------------------------------- */

boolean requireFrame = true;
boolean requireBinding = bindingHasEscaped || scopeHasLocalVarStores || !scope.getFlags().contains(IRFlags.DYNSCOPE_ELIMINATED);

// FIXME: Why do we need a push/pop for frame & binding for scopes with unrescued exceptions??
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
import org.jruby.ir.IRClosure;
import org.jruby.ir.IRFlags;
import org.jruby.ir.IRScope;
import org.jruby.ir.dataflow.analyses.LiveVariablesProblem;
import org.jruby.ir.dataflow.analyses.LoadLocalVarPlacementProblem;
import org.jruby.ir.dataflow.analyses.StoreLocalVarPlacementProblem;
import org.jruby.ir.instructions.Instr;
Original file line number Diff line number Diff line change
@@ -2,15 +2,11 @@

import org.jruby.RubyInstanceConfig;
import org.jruby.ir.IRManager;
import org.jruby.ir.IRScope;
import org.jruby.ir.instructions.CallBase;
import org.jruby.ir.instructions.Instr;
import org.jruby.ir.instructions.YieldInstr;
import org.jruby.ir.listeners.InstructionsListener;
import org.jruby.ir.listeners.InstructionsListenerDecorator;
import org.jruby.ir.operands.Label;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.WrappedIRClosure;
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.ir.transformations.inlining.InlineCloneInfo;
import org.jruby.ir.transformations.inlining.SimpleCloneInfo;