Skip to content

Commit cb80825

Browse files
committed
merge current frame only if it's changed
1 parent 1ba9169 commit cb80825

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/main/java/scala/tools/asm/tree/analysis/Analyzer.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,11 @@ public Frame<V>[] analyze(final String owner, final MethodNode method) throws An
162162
int insnOpcode = insnNode.getOpcode();
163163
int insnType = insnNode.getType();
164164

165-
if (insnType == AbstractInsnNode.LABEL
166-
|| insnType == AbstractInsnNode.LINE
167-
|| insnType == AbstractInsnNode.FRAME) {
165+
boolean isNoop = insnType == AbstractInsnNode.LABEL
166+
|| insnType == AbstractInsnNode.LINE
167+
|| insnType == AbstractInsnNode.FRAME;
168+
169+
if (isNoop) {
168170
merge(insnIndex + 1, oldFrame, subroutine);
169171
newControlFlowEdge(insnIndex, insnIndex + 1);
170172
} else {
@@ -270,12 +272,14 @@ public Frame<V>[] analyze(final String owner, final MethodNode method) throws An
270272
handler.clearStack();
271273
handler.push(exceptionValue);
272274
merge(insnList.indexOf(tryCatchBlock.handler), handler, subroutine);
273-
// Merge the frame *after* this instruction, with its stack cleared and an exception
274-
// pushed, with the handler's frame.
275-
handler = newFrame(currentFrame);
276-
handler.clearStack();
277-
handler.push(exceptionValue);
278-
merge(insnList.indexOf(tryCatchBlock.handler), handler, subroutine);
275+
if (!isNoop) {
276+
// Merge the frame *after* this instruction, with its stack cleared and an exception
277+
// pushed, with the handler's frame.
278+
handler = newFrame(currentFrame);
279+
handler.clearStack();
280+
handler.push(exceptionValue);
281+
merge(insnList.indexOf(tryCatchBlock.handler), handler, subroutine);
282+
}
279283
}
280284
}
281285
}

0 commit comments

Comments
 (0)