diff options
author | aclement <aclement> | 2005-08-25 11:35:49 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-08-25 11:35:49 +0000 |
commit | bf767a9d6e6501df9e973e381546b1c66f41a757 (patch) | |
tree | fdbfdbc482edb6c45a6b99f3128e0949adcf51e4 | |
parent | ba19a7ecdd3fa63305746f4572972c77ebf87550 (diff) | |
download | aspectj-bf767a9d6e6501df9e973e381546b1c66f41a757.tar.gz aspectj-bf767a9d6e6501df9e973e381546b1c66f41a757.zip |
Fix for pr104720: busted tableswitch on around advice weaving.
-rw-r--r-- | bcel-builder/src/org/aspectj/apache/bcel/generic/SWITCH.java | 8 | ||||
-rw-r--r-- | bcel-builder/src/org/aspectj/apache/bcel/generic/TABLESWITCH.java | 9 | ||||
-rw-r--r-- | lib/bcel/bcel-src.zip | bin | 870592 -> 870732 bytes | |||
-rw-r--r-- | lib/bcel/bcel.jar | bin | 593660 -> 593786 bytes |
4 files changed, 14 insertions, 3 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/SWITCH.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/SWITCH.java index 35e4aa468..fb030134d 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/generic/SWITCH.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/SWITCH.java @@ -59,7 +59,7 @@ package org.aspectj.apache.bcel.generic; * TABLESWITCH instruction, depending on whether the match values (int[]) can be * sorted with no gaps between the numbers. * - * @version $Id: SWITCH.java,v 1.2 2004/11/19 16:45:19 aclement Exp $ + * @version $Id: SWITCH.java,v 1.3 2005/08/25 11:35:49 aclement Exp $ * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> */ public final class SWITCH implements CompoundInstruction { @@ -89,7 +89,11 @@ public final class SWITCH implements CompoundInstruction { this.targets = (InstructionHandle[])targets.clone(); if((match_length = match.length) < 2) // (almost) empty switch, or just default - instruction = new TABLESWITCH(match, targets, target); + if (match.length==0) { + instruction = new LOOKUPSWITCH(match,targets,target); + } else { + instruction = new TABLESWITCH(match,targets,target); + } else { sort(0, match_length - 1); diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/TABLESWITCH.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/TABLESWITCH.java index b934f369d..e40ef6890 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/generic/TABLESWITCH.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/TABLESWITCH.java @@ -59,7 +59,7 @@ import org.aspectj.apache.bcel.util.ByteSequence; /** * TABLESWITCH - Switch within given range of values, i.e., low..high * - * @version $Id: TABLESWITCH.java,v 1.2 2004/11/19 16:45:19 aclement Exp $ + * @version $Id: TABLESWITCH.java,v 1.3 2005/08/25 11:35:49 aclement Exp $ * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> * @see SWITCH */ @@ -80,6 +80,10 @@ public class TABLESWITCH extends Select { InstructionHandle target) { super(org.aspectj.apache.bcel.Constants.TABLESWITCH, match, targets, target); +// if (match_length==0) { +// throw new RuntimeException("A tableswitch with no targets should be represented as a LOOKUPSWITCH"); +// } + length = (short)(13 + match_length * 4); /* Alignment remainder assumed * 0 here, until dump time */ fixed_length = length; @@ -98,6 +102,9 @@ public class TABLESWITCH extends Select { int high = (match_length > 0)? match[match_length - 1] : 0; out.writeInt(high); +// See aj bug pr104720 +// if (match_length==0) out.writeInt(0); // following the switch you need to supply "HIGH-LOW+1" entries + for(int i=0; i < match_length; i++) // jump offsets out.writeInt(indices[i] = getTargetOffset(targets[i])); } diff --git a/lib/bcel/bcel-src.zip b/lib/bcel/bcel-src.zip Binary files differindex 27a0ff91f..846d3e557 100644 --- a/lib/bcel/bcel-src.zip +++ b/lib/bcel/bcel-src.zip diff --git a/lib/bcel/bcel.jar b/lib/bcel/bcel.jar Binary files differindex 8fc0fb582..f63428de5 100644 --- a/lib/bcel/bcel.jar +++ b/lib/bcel/bcel.jar |