From: aclement Date: Fri, 12 May 2006 08:17:43 +0000 (+0000) Subject: test and fix for 138384: woven methods being >64k in code size X-Git-Tag: V1_5_2rc1~139 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5d2b5b8892cc6e714565326b70d7c6a4b7007129;p=aspectj.git test and fix for 138384: woven methods being >64k in code size --- 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 getByteCode. * - * @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 M. Dahm * @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 index 8295e9380..af1509b80 100644 Binary files a/lib/bcel/bcel-src.zip and b/lib/bcel/bcel-src.zip differ diff --git a/lib/bcel/bcel.jar b/lib/bcel/bcel.jar index 82e554d95..223a7cd40 100644 Binary files a/lib/bcel/bcel.jar and b/lib/bcel/bcel.jar differ 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 @@ + + + + + + +