]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for 138384: woven methods being >64k in code size
authoraclement <aclement>
Fri, 12 May 2006 08:17:43 +0000 (08:17 +0000)
committeraclement <aclement>
Fri, 12 May 2006 08:17:43 +0000 (08:17 +0000)
bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionList.java
lib/bcel/bcel-src.zip
lib/bcel/bcel.jar
tests/bugs152/pr138384/BigMethod.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
tests/src/org/aspectj/systemtest/ajc152/ajc152.xml

index 55cfc95dbbe38a92b3a79bf22410256d1d6963c0..cf0fb321a4d92a781ef79942001191e48d0cc79e 100644 (file)
@@ -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;
   }
 
   /**
index 8295e9380399603b3491e02afebe25e06ab6d560..af1509b80bbb6827465c515b79bf37cff4db3931 100644 (file)
Binary files a/lib/bcel/bcel-src.zip and b/lib/bcel/bcel-src.zip differ
index 82e554d957a81f0860060ccbe794f5bd09da9ef0..223a7cd408f4c1553b16f70ddc4f039128dce3ca 100644 (file)
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 (file)
index 0000000..ac68c32
--- /dev/null
@@ -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
index 52f98d3b38de9aec1585ee44503349038f5e279d..bb6e4994c419b18befc1832e4cfcb349372d0087 100644 (file)
@@ -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");}
index abcf47c5093204e28ac3a4cac0598a9548826976..eb90cdda94a930ea76ff8635cc2c782d43f28ce2 100644 (file)
       <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">