Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Virtual Machine / May 2007

Tip: Looking for answers? Try searching our database.

65535 bytes method code limit?

Thread view: 
aloha.kakuikanu - 01 Mar 2007 21:24 GMT
I'm getting:

"The code of method mTokens() is exceeding the 65535 bytes limit"

The method is antlr generated, so I struggle to find any workaround.
Perhaps I'm missing some magic JVM parameter setting? Aren't 16 bit
integers relics of the past century?
Chris Uppal - 01 Mar 2007 22:04 GMT
> "The code of method mTokens() is exceeding the 65535 bytes limit"
>
> The method is antlr generated, so I struggle to find any workaround.
> Perhaps I'm missing some magic JVM parameter setting? Aren't 16 bit
> integers relics of the past century?

It's a hard limit in Java, I'm afraid.  No way around it (with current versions
of Java) because it's a limit of the classfile format itself, rather than a
limit of the Java compiler, or of the JVM.

(Actually, the limit in the classfile is rather more complicated than that, and
you can, structurally, have more than 64K bytes of bytecode per method, but
there are various auxiliary structures in the classfile which do have a 64K
limits.)

   -- chris
Florian Weimer - 02 Mar 2007 12:45 GMT
* aloha kakuikanu:

> I'm getting:
>
> "The code of method mTokens() is exceeding the 65535 bytes limit"
>
> The method is antlr generated, so I struggle to find any workaround.
> Perhaps I'm missing some magic JVM parameter setting?

Anything that compiles to class files in a straightforward way will
hit this limit, as Chris explained.

There are basically two workarounds: Use a compiler that synthesizes
additional classes to work around the limit (I don't know if one
exists), or a compiler that does not compile to class files, such as
an earlier GCJ version.  The latter approach might work if your
intention is to get the code running.  (Nowadays, GCJ uses class files
as well.)
Roedy Green - 25 May 2007 09:35 GMT
On 1 Mar 2007 13:24:13 -0800, "aloha.kakuikanu"
<aloha.kakuikanu@yahoo.com> wrote, quoted or indirectly quoted someone
who said :

>Perhaps I'm missing some magic JVM parameter setting? Aren't 16 bit
>integers relics of the past century?

Nope. Using 32 bit addressing would double the size of a class file.
It is rare to blow the limit unless you are mechanically generating
code.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
glen herrmannsfeldt - 31 May 2007 21:48 GMT
> On 1 Mar 2007 13:24:13 -0800, "aloha.kakuikanu"
> <aloha.kakuikanu@yahoo.com> wrote, quoted or indirectly quoted someone

>>Perhaps I'm missing some magic JVM parameter setting? Aren't 16 bit
>>integers relics of the past century?

> Nope. Using 32 bit addressing would double the size of a class file.
> It is rare to blow the limit unless you are mechanically generating
> code.

If you used an escape or prefix code for larger addresses it wouldn't
double the size.  I believe that might have been part of the
design, but was never (as far as I know) implemented.  Yes, it is
exactly mechanically generated code that needs this.

(The IBM z/OS system only allows code below the 2GB bar.  There
has been discussion on the need for this restriction, but again
it is only machine generated code that is likely to cause problems.)

-- glen


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.