From: aclement Date: Wed, 15 Sep 2010 18:18:01 +0000 (+0000) Subject: 324932 X-Git-Tag: V1_6_10~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1263e05644a62c6f12178575dd8abb81a2cb94db;p=aspectj.git 324932 --- diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionList.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionList.java index c5e2ab66f..6d8148f92 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionList.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionList.java @@ -76,8 +76,9 @@ import org.aspectj.apache.bcel.util.ByteSequence; * * A list is finally dumped to a byte code array with getByteCode. * - * @version $Id: InstructionList.java,v 1.10 2009/10/05 17:35:36 aclement Exp $ + * @version $Id: InstructionList.java,v 1.11 2010/09/15 18:18:01 aclement Exp $ * @author M. Dahm + * @author Abraham Nevado * @see Instruction * @see InstructionHandle * @see BranchHandle @@ -886,20 +887,24 @@ public class InstructionList implements Serializable { // OPTIMIZE positions will only move around if there have been expanding instructions // if (max_additional_bytes==0...) { - // + // // } /* * Pass 2: Expand the variable-length (Branch)Instructions depending on the target offset (short or int) and ensure that * branch targets are within this list. */ + boolean nonZeroOffset = false; int offset = 0; for (InstructionHandle ih = start; ih != null; ih = ih.next) { if (ih instanceof BranchHandle) { offset += ((BranchHandle) ih).updatePosition(offset, maxAdditionalBytes); + if (offset != 0) { + nonZeroOffset = true; + } } } - if (offset != 0) { + if (nonZeroOffset) { /* * Pass 3: Update position numbers (which may have changed due to the preceding expansions), like pass 1. */