diff options
author | aclement <aclement> | 2006-05-12 08:17:43 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-05-12 08:17:43 +0000 |
commit | 5d2b5b8892cc6e714565326b70d7c6a4b7007129 (patch) | |
tree | 5b021aa2f81c7991cac1a043dbe262863a2d818c | |
parent | 9d1f31f65bbf7e7d4b5e205d983201d724f97676 (diff) | |
download | aspectj-5d2b5b8892cc6e714565326b70d7c6a4b7007129.tar.gz aspectj-5d2b5b8892cc6e714565326b70d7c6a4b7007129.zip |
test and fix for 138384: woven methods being >64k in code size
-rw-r--r-- | bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionList.java | 7 | ||||
-rw-r--r-- | lib/bcel/bcel-src.zip | bin | 877356 -> 877450 bytes | |||
-rw-r--r-- | lib/bcel/bcel.jar | bin | 602691 -> 605367 bytes | |||
-rw-r--r-- | tests/bugs152/pr138384/BigMethod.java | 488 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java | 1 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc152/ajc152.xml | 7 |
6 files changed, 501 insertions, 2 deletions
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 55cfc95db..cf0fb321a 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionList.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionList.java @@ -75,7 +75,7 @@ import java.util.ArrayList; * A list is finally dumped to a byte code array with <a * href="#getByteCode()">getByteCode</a>. * - * @version $Id: InstructionList.java,v 1.3 2006/02/14 13:32:07 aclement Exp $ + * @version $Id: InstructionList.java,v 1.4 2006/05/12 08:17:43 aclement Exp $ * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> * @see Instruction * @see InstructionHandle @@ -986,8 +986,11 @@ public class InstructionList implements Serializable { System.err.println(e); return null; } + byte[] byteCode = b.toByteArray(); + if (byteCode.length > Constants.MAX_CODE_SIZE) + throw new ClassGenException("Code size too big: " + byteCode.length); - return b.toByteArray(); + return byteCode; } /** diff --git a/lib/bcel/bcel-src.zip b/lib/bcel/bcel-src.zip Binary files differindex 8295e9380..af1509b80 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 82e554d95..223a7cd40 100644 --- a/lib/bcel/bcel.jar +++ b/lib/bcel/bcel.jar diff --git a/tests/bugs152/pr138384/BigMethod.java b/tests/bugs152/pr138384/BigMethod.java new file mode 100644 index 000000000..ac68c32f0 --- /dev/null +++ b/tests/bugs152/pr138384/BigMethod.java @@ -0,0 +1,488 @@ +public class BigMethod { + + public void i_am_a_big_method() { + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + for (int i = 0; i < 1; i++) { + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + System.out.print("."); + } + } + + public static void main(String[] args) { + new BigMethod().i_am_a_big_method(); + } +} + +aspect GoBang { + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } + before(): call(* *(..)) && withincode(void i_am_a_big_method()) { + System.err.println("Kaboom"); + } +}
\ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java index 52f98d3b3..bb6e4994c 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java @@ -17,6 +17,7 @@ import org.aspectj.testing.XMLBasedAjcTestCase; public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testMethodTooBigAfterWeaving_pr138384() { runTest("method too big"); } public void testNotAtWithincode_pr138158_1() { runTest("not at withincode - 1");} public void testNotAtWithincode_pr138158_2() { runTest("not at withincode - 2");} public void testNotAtWithincode_pr138158_3() { runTest("not at within - 3");} diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml index abcf47c50..eb90cdda9 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml +++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml @@ -20,6 +20,13 @@ <run class="StatisticsTypeImpl"/> </ajc-test> + <ajc-test dir="bugs152/pr138384" title="method too big"> + <compile files="BigMethod.java" options="-1.5"> <!-- will be 67628 bytes in the big method --> + <message kind="error" line="1" text="problem generating method BigMethod.i_am_a_big_method : Code size too big: 67629"/> + </compile> + <!--run class="BigMethod"/--> + </ajc-test> + <ajc-test dir="bugs152/pr138798" title="atWithinCodeBug"> <compile files="ErrorHandling.aj" options="-1.5"/> <run class="ErrorHandling"> |