Skip to content

Commit 1695da3

Browse files
committed
More defined? IR fixes: generate properly nested rescue regions
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
1 parent dbffda3 commit 1695da3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

core/src/main/java/org/jruby/ir/IRBuilder.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,7 @@ public Operand run() {
15251525
}
15261526
};
15271527

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

15511548
// protected main block
15521549
CodeBlock protectedCode = new CodeBlock() {
15531550
public Operand run() {
1551+
final Label undefLabel = getNewLabel();
1552+
Operand receiverDefn = buildGetDefinition(callNode.getReceiverNode());
1553+
addInstr(BEQInstr.create(receiverDefn, manager.getNil(), undefLabel));
15541554
Variable tmpVar = createTemporaryVariable();
15551555
addInstr(new RuntimeHelperCall(tmpVar, IS_DEFINED_CALL,
15561556
new Operand[]{build(callNode.getReceiverNode()), new StringLiteral(callNode.getName())}));
@@ -1567,14 +1567,14 @@ public Operand run() {
15671567
return protectCodeWithRescue(protectedCode, rescueBlock);
15681568
}
15691569
case ATTRASSIGNNODE: {
1570-
final Label undefLabel = getNewLabel();
15711570
final AttrAssignNode attrAssign = (AttrAssignNode) node;
1572-
Operand receiverDefn = buildGetDefinition(attrAssign.getReceiverNode());
1573-
addInstr(BEQInstr.create(receiverDefn, manager.getNil(), undefLabel));
15741571

15751572
// protected main block
15761573
CodeBlock protectedCode = new CodeBlock() {
15771574
public Operand run() {
1575+
final Label undefLabel = getNewLabel();
1576+
Operand receiverDefn = buildGetDefinition(attrAssign.getReceiverNode());
1577+
addInstr(BEQInstr.create(receiverDefn, manager.getNil(), undefLabel));
15781578
/* --------------------------------------------------------------------------
15791579
* This basically combines checks from CALLNODE and FCALLNODE
15801580
*

0 commit comments

Comments
 (0)