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

Commits on Jan 6, 2015

  1. Copy the full SHA
    ecf6693 View commit details
  2. Copy the full SHA
    7c489e2 View commit details
  3. Copy the full SHA
    d87860a View commit details
6 changes: 0 additions & 6 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -467,12 +467,6 @@ public IRubyObject evalScriptlet(String script, DynamicScope scope) {

try {
return Interpreter.getInstance().execute(this, rootNode, context.getFrameSelf());
} catch (JumpException.ReturnJump rj) {
throw newLocalJumpError(RubyLocalJumpError.Reason.RETURN, (IRubyObject)rj.getValue(), "unexpected return");
} catch (JumpException.BreakJump bj) {
throw newLocalJumpError(RubyLocalJumpError.Reason.BREAK, (IRubyObject)bj.getValue(), "unexpected break");
} catch (JumpException.RedoJump rj) {
throw newLocalJumpError(RubyLocalJumpError.Reason.REDO, (IRubyObject)rj.getValue(), "unexpected redo");
} finally {
context.postEvalScriptlet();
}
4 changes: 0 additions & 4 deletions core/src/main/java/org/jruby/exceptions/JumpException.java
Original file line number Diff line number Diff line change
@@ -84,11 +84,7 @@ public RaiseException buildException(Ruby runtime) {

public static class BreakJump extends FlowControlException { public BreakJump(int t, Object v) { super(Reason.BREAK, t, v); } }
public static class NextJump extends FlowControlException { public NextJump(Object v) { super(Reason.NEXT, 0, v); } }
public static final NextJump NEXT_JUMP = new NextJump(null);
public static class RetryJump extends FlowControlException { public RetryJump() {super(Reason.RETRY); } }
public static final RetryJump RETRY_JUMP = new RetryJump();
public static class RedoJump extends FlowControlException { public RedoJump() {super(Reason.REDO); } }
public static final RedoJump REDO_JUMP = new RedoJump();
public static class SpecialJump extends FlowControlException { public SpecialJump() {super(Reason.NOREASON); } }
public static final SpecialJump SPECIAL_JUMP = new SpecialJump();
public static class ReturnJump extends FlowControlException { public ReturnJump(int t, Object v) { super(Reason.RETURN, t, v); }}
33 changes: 17 additions & 16 deletions core/src/main/java/org/jruby/ir/passes/DominatorTreeBuilder.java
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@

/* SSS: Currently unused code. Will be useful for some SSA building algos. */
public class DominatorTreeBuilder extends CompilerPass {
private static int NULL = -1;
private static final Logger LOG = LoggerFactory.getLogger("DominatorTreeBuilder");
public static List<Class<? extends CompilerPass>> DEPENDENCIES = Arrays.<Class<? extends CompilerPass>>asList(CFGBuilder.class);

@@ -42,7 +43,7 @@ public boolean invalidate(IRScope scope) {
}

public void buildDominatorTree(CFG cfg, LinkedList<BasicBlock> postOrderList, int maxNodeId) {
Integer[] bbToPoNumbers = new Integer[maxNodeId + 1]; // Set up a map of bbid -> post order numbering
int[] bbToPoNumbers = new int[maxNodeId + 1]; // Set up a map of bbid -> post order numbering
BasicBlock[] poNumbersToBB = new BasicBlock[maxNodeId + 1];
int n = 0;
ListIterator<BasicBlock> it = postOrderList.listIterator();
@@ -61,10 +62,10 @@ public void buildDominatorTree(CFG cfg, LinkedList<BasicBlock> postOrderList, in
//
// This maps a bb's post-order number to the bb's idom post-order number.
// We convert this po-number -> po-number map to a bb -> bb map later on!
Integer[] idoms = new Integer[maxNodeId + 1];
int[] idoms = new int[maxNodeId + 1];

BasicBlock root = cfg.getEntryBB();
Integer rootPoNumber = bbToPoNumbers[root.getID()];
int rootPoNumber = bbToPoNumbers[root.getID()];
idoms[rootPoNumber] = rootPoNumber;

boolean changed = true;
@@ -76,32 +77,32 @@ public void buildDominatorTree(CFG cfg, LinkedList<BasicBlock> postOrderList, in
if (b == root) continue;

// Non-root -- process it
Integer bPoNumber = bbToPoNumbers[b.getID()];
Integer oldBIdom = idoms[bPoNumber];
Integer newBIdom = null;
int bPoNumber = bbToPoNumbers[b.getID()];
int oldBIdom = idoms[bPoNumber];
int newBIdom = NULL;

// newBIdom is initialized to be some (first-encountered, for ex.) processed predecessor of 'b'.
for (BasicBlock src : cfg.getIncomingSources(b)) {
Integer srcPoNumber = bbToPoNumbers[src.getID()];
int srcPoNumber = bbToPoNumbers[src.getID()];

if (idoms[srcPoNumber] != null) {
if (idoms[srcPoNumber] != NULL) {
// System.out.println("Initialized idom(" + bPoNumber + ")=" + srcPoNumber);
newBIdom = srcPoNumber;
break;
}
}

// newBIdom should not be null
assert newBIdom != null;
assert newBIdom != NULL;

// Now, intersect dom sets of all of b's predecessors
Integer processedPred = newBIdom;
int processedPred = newBIdom;
for (BasicBlock src: cfg.getIncomingSources(b)) {
// Process b's predecessors except the initialized bidom value
Integer srcPoNumber = bbToPoNumbers[src.getID()];
Integer srcIdom = idoms[srcPoNumber];
if ((srcIdom != null) && (srcPoNumber != processedPred)) {
// Integer old = newBIdom;
int srcPoNumber = bbToPoNumbers[src.getID()];
int srcIdom = idoms[srcPoNumber];
if ((srcIdom != NULL) && (srcPoNumber != processedPred)) {
// int old = newBIdom;
newBIdom = intersectDomSets(idoms, srcPoNumber, newBIdom);
// System.out.println("Intersect " + srcIdom + " & " + old + " = " + newBIdom);
}
@@ -118,13 +119,13 @@ public void buildDominatorTree(CFG cfg, LinkedList<BasicBlock> postOrderList, in

// Convert the idom map based on post order numbers to one based on basic blocks
Map<BasicBlock, BasicBlock> idomMap = new HashMap<BasicBlock, BasicBlock>();
for (Integer i = 0; i < maxNodeId; i++) {
for (int i = 0; i < maxNodeId; i++) {
idomMap.put(poNumbersToBB[i], poNumbersToBB[idoms[i]]);
// System.out.println("IDOM(" + poNumbersToBB[i].getID() + ") = " + poNumbersToBB[idoms[i]].getID());
}
}

private Integer intersectDomSets(Integer[] idomMap, Integer nb1, Integer nb2) {
private int intersectDomSets(int[] idomMap, int nb1, int nb2) {
while (nb1 != nb2) {
while (nb1 < nb2) {
nb1 = idomMap[nb1];
22 changes: 0 additions & 22 deletions core/src/main/java/org/jruby/runtime/Helpers.java
Original file line number Diff line number Diff line change
@@ -1301,28 +1301,6 @@ public static IRubyObject setConstantInModule(ThreadContext context, String name
public static IRubyObject setConstantInCurrent(IRubyObject value, ThreadContext context, String name) {
return context.getCurrentStaticScope().setConstant(name, value);
}

public static IRubyObject retryJump() {
throw JumpException.RETRY_JUMP;
}

public static IRubyObject redoJump() {
throw JumpException.REDO_JUMP;
}

public static IRubyObject redoLocalJumpError(Ruby runtime) {
throw runtime.newLocalJumpError(RubyLocalJumpError.Reason.REDO, runtime.getNil(), "unexpected redo");
}

public static IRubyObject nextJump(IRubyObject value) {
if (value.isNil()) throw JumpException.NEXT_JUMP;

throw new JumpException.NextJump(value);
}

public static IRubyObject nextLocalJumpError(Ruby runtime, IRubyObject value) {
throw runtime.newLocalJumpError(RubyLocalJumpError.Reason.NEXT, value, "unexpected next");
}

public static final int MAX_SPECIFIC_ARITY_OBJECT_ARRAY = 10;

Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package org.jruby.runtime.callsite;

import org.jruby.RubyBasicObject;
import org.jruby.RubyClass;
import org.jruby.RubyFixnum;
import org.jruby.RubyFloat;
import org.jruby.RubyLocalJumpError;
import org.jruby.exceptions.JumpException;
import org.jruby.exceptions.JumpException.BreakJump;
import org.jruby.exceptions.RaiseException;
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.runtime.Helpers;
import org.jruby.runtime.Block;
@@ -420,10 +415,6 @@ protected IRubyObject callMethodMissing(ThreadContext context, IRubyObject self,

private static RubyClass getClass(IRubyObject self) {
// the cast in the following line is necessary due to lacking optimizations in Hotspot
return ((RubyBasicObject)self).getMetaClass();
}

private static RaiseException retryJumpError(ThreadContext context) {
return context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.RETRY, context.runtime.getNil(), "retry outside of rescue not supported");
return self.getMetaClass();
}
}
11 changes: 2 additions & 9 deletions core/src/main/java/org/jruby/runtime/callsite/SuperCallSite.java
Original file line number Diff line number Diff line change
@@ -3,10 +3,7 @@
import org.jruby.RubyClass;
import org.jruby.RubyFixnum;
import org.jruby.RubyFloat;
import org.jruby.RubyLocalJumpError;
import org.jruby.RubyModule;
import org.jruby.exceptions.JumpException;
import org.jruby.exceptions.RaiseException;
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.runtime.Helpers;
import org.jruby.runtime.Block;
@@ -402,8 +399,8 @@ protected boolean methodMissing(DynamicMethod method, IRubyObject caller) {

protected static RubyClass pollAndGetClass(ThreadContext context, IRubyObject self, RubyModule frameClass, String frameName) {
checkSuperDisabledOrOutOfMethod(context, frameClass, frameName);
RubyClass superClass = Helpers.findImplementerIfNecessary(self.getMetaClass(), frameClass).getSuperClass();
return superClass;

return Helpers.findImplementerIfNecessary(self.getMetaClass(), frameClass).getSuperClass();
}

protected static void checkSuperDisabledOrOutOfMethod(ThreadContext context, RubyModule frameClass, String frameName) {
@@ -415,8 +412,4 @@ protected static void checkSuperDisabledOrOutOfMethod(ThreadContext context, Rub
}
}
}

protected static RaiseException retryJumpError(ThreadContext context) {
return context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.RETRY, context.runtime.getNil(), "retry outside of rescue not supported");
}
}
Original file line number Diff line number Diff line change
@@ -989,10 +989,6 @@ public static RubyClass pollAndGetClass(ThreadContext context, IRubyObject self)
RubyClass selfType = ((RubyBasicObject)self).getMetaClass();
return selfType;
}

public static IRubyObject retryJumpError(ThreadContext context) {
throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.RETRY, context.runtime.getNil(), "retry outside of rescue not supported");
}

////////////////////////////////////////////////////////////////////////////
// Utility methods for lookup