• Post Reply Bookmark Topic Watch Topic
  • New Topic

bytecode limits  RSS feed

 
George Brown
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure that this is necessarily the correct forum for this post but since it's loosely related to performance in the sense of the compiler performing at all, I'll post it here...
While compiling some new versions of classes today the java compiler refused to compile one, complaining of a 64Kb bytecode limit.
While this class should ideally be split up to be smaller and more manageable, it is part of a regression test suite that we wrote and has, as the project increased in scope, increased in size accordingly.
In the short term, and to get around immediately rewriting this test system, can anyone tell me whether this is a configurable, or fixed, limitation on compiled classes?
all replies are appreciated,
- George.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its a fixed limitation, and it's getting more common to hit it with automatically generated classes such as JSPs too.
Sorry, but I think the only answer in your case is a bit of refactoring to reduce the class size.
 
George Brown
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was afraid that might be the case. Thanks Frank.
 
Mark Herschberg
Sheriff
Posts: 6037
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whoa! I never knew that. Any other interesting limits along these lines?
I guess Sun figured 64Kb of bytecodes ought to be enough for any class. (Sorry, I couldn't resist :-)

--Mark
hershey@vaultus.com
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
George,
What platform are you using? I have a 114 KB class file and the javac compiler has never complained. I develop on Windows 2K.
-Peter
 
George Brown
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter, the complaining compiler was the one included with Visual Age v3.02 (early adopter's Java 2 edition), running under Windows NT 4.0.
Our .java files can be any size, but the bytecode class files apparently aren't allwed to exceed 64K. So it's definitely your classfiles? The plot thickens...
It's possible that it's an outdated compiler that's been superceded. The version of Visual Age that we're using is certainly an old one which we keep trying to upgrade. We'll try it with more compilers. I'll keep the thread informed.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I spoke a bit too soon. The limit is actually that any single method in a class file is limited to 64K, so maybe splitting your method(s) would help. I'm boggled at the thought of anyone manually writing a 64K method, but automatic code generators can easily hit such a limit.
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
George,
Why don't you download JDK 1.3.1 and see if the javac compiler can compile your source file. If it can, then you'll need to upgrade your compiler or do what Frank suggests.
-Peter
 
George Brown
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can understand the boggle. The thing is that there is no single method that is particularly big in that class. However, there are loads and loads of static final 2-dimensional java.lang.Object arrays on the class, and that is where the real weight of code is. So I imagine that although the 64K limit applies to methods, it may well count the class itself (outside methods) as limited to 64K as well.
I would be shocked too if I saw 64K worth of bytecode in one method
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!