Skip to content

Commit

Permalink
More defined? IR fixes: generate properly nested rescue regions
Browse files Browse the repository at this point in the history
In two scenarios, IR code was generated where we were jumping
into the middle of a rescuable region rather than enter it
at the start. This caused the interpreter to not have information
about a rescuable region in some cases.

Fixes build failures for -S rake test:jruby
  • Loading branch information
subbuss committed Mar 30, 2015
1 parent dbffda3 commit 1695da3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/src/main/java/org/jruby/ir/IRBuilder.java
Expand Up @@ -1525,7 +1525,7 @@ public Operand run() {
}
};

// Try verifying definition, and if we get an JumpException exception, process it with the rescue block above
// Try verifying definition, and if we get an JumpException exception, process it with the rescue block above
return protectCodeWithRescue(protectedCode, rescueBlock);
}
case FCALLNODE: {
Expand All @@ -1543,14 +1543,14 @@ public Operand run() {
return buildDefnCheckIfThenPaths(undefLabel, argsCheckDefn);
}
case CALLNODE: {
final Label undefLabel = getNewLabel();
final CallNode callNode = (CallNode) node;
Operand receiverDefn = buildGetDefinition(callNode.getReceiverNode());
addInstr(BEQInstr.create(receiverDefn, manager.getNil(), undefLabel));

// protected main block
CodeBlock protectedCode = new CodeBlock() {
public Operand run() {
final Label undefLabel = getNewLabel();
Operand receiverDefn = buildGetDefinition(callNode.getReceiverNode());
addInstr(BEQInstr.create(receiverDefn, manager.getNil(), undefLabel));
Variable tmpVar = createTemporaryVariable();
addInstr(new RuntimeHelperCall(tmpVar, IS_DEFINED_CALL,
new Operand[]{build(callNode.getReceiverNode()), new StringLiteral(callNode.getName())}));
Expand All @@ -1567,14 +1567,14 @@ public Operand run() {
return protectCodeWithRescue(protectedCode, rescueBlock);
}
case ATTRASSIGNNODE: {
final Label undefLabel = getNewLabel();
final AttrAssignNode attrAssign = (AttrAssignNode) node;
Operand receiverDefn = buildGetDefinition(attrAssign.getReceiverNode());
addInstr(BEQInstr.create(receiverDefn, manager.getNil(), undefLabel));

// protected main block
CodeBlock protectedCode = new CodeBlock() {
public Operand run() {
final Label undefLabel = getNewLabel();
Operand receiverDefn = buildGetDefinition(attrAssign.getReceiverNode());
addInstr(BEQInstr.create(receiverDefn, manager.getNil(), undefLabel));
/* --------------------------------------------------------------------------
* This basically combines checks from CALLNODE and FCALLNODE
*
Expand Down

0 comments on commit 1695da3

Please sign in to comment.