Skip to content

Commit 8ef032d

Browse files
Fix offset for collapsed GOTO_W instructions
1 parent fc0b1f5 commit 8ef032d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

OPAL/br/src/main/scala/org/opalj/br/reader/BytecodeOptimizer.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,10 @@ trait BytecodeOptimizer extends MethodsBinding {
292292
if (newBranchoffset >= Short.MinValue &&
293293
newBranchoffset <= Short.MaxValue
294294
) {
295-
// Replace it by a short goto
296-
instructions(pc + 0) = NOP
295+
// Replace it by a short goto, which has length 3 instead of length 5
296+
instructions(pc + 0) = GOTO(newBranchoffset)
297297
instructions(pc + 1) = NOP
298-
instructions(pc + 2) = GOTO(newBranchoffset)
298+
instructions(pc + 2) = NOP
299299
simplified = true
300300
} else {
301301
// let's replace the original jump

0 commit comments

Comments
 (0)