Name: laC46010 Date: 01/22/99
The following 516Byte example is compiled by javac (versions 1.2.2b, 1.2fcs)
into 2.6Mb classfile. See also bug #4184242 (Synopsis: poor performance of
constant expression calculation)
Test example and javac diagnostics follow:
-------------------------------------------------------
novo35% cat test.java
class test {
public static void main(String[] argv) {
final int i0 = 1 / 0;
final int i1 = i0 / i0;
final int i2 = i1 / i1;
final int i3 = i2 / i2;
final int i4 = i3 / i3;
final int i5 = i4 / i4;
final int i6 = i5 / i5;
final int i7 = i6 / i6;
final int i8 = i7 / i7;
final int i9 = i8 / i8;
final int j0 = i9 / i9;
final int j1 = j0 / j0;
final int j2 = j1 / j1;
final int j3 = j2 / j2;
final int j4 = j3 / j3;
final int j5 = j4 / j4;
final int j6 = j5 / j5;
final int j7 = j6 / j6;
}
}
novo35% java -version
java version "1.2.2"
Classic VM (build JDK-1.2.2-C, green threads, sunwjit)
novo35% javac -J-mx96M test.java
test1.java:11: This code requires generating a method with more than 64K bytes. Virtual
machines may refuse the resulting class file.
final int i8 = i7 / i7;
^
1 warning
novo35% java -verify test
Exception in thread "main" java.lang.ClassFormatError: test (Code of a method longer than
65535 bytes)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Compiled Code)
at java.security.SecureClassLoader.defineClass(Compiled Code)
at java.net.URLClassLoader.defineClass(Compiled Code)
at java.net.URLClassLoader.access$1(Compiled Code)
at java.net.URLClassLoader$1.run(Compiled Code)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at sun.misc.Launcher$AppClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
-------------------------------------------------------
======================================================================