You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mark Galbreath <ma...@qat.com> on 2003/05/03 19:18:02 UTC

Method byte limit - Craig?

Hey Craig (or anyone else who knows):

What's the history behind the 64k byte limit on compiled Java methods?  I'm
just curious as to the rationale.

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Method byte limit - Craig?

Posted by Andrew Hill <an...@gridnode.com>.
Perhaps they thought 64k should be enough for anybody? ;-)

(In actual fact it should be. Its almost always generated code (like that
produced from JSPs) that has the problems...)

-----Original Message-----
From: Mark Galbreath [mailto:mark_galbreath@qat.com]
Sent: Sunday, 4 May 2003 02:02
To: 'Struts Users Mailing List'
Subject: RE: Method byte limit - Craig?


This stuff is fascinating...thanks for the explanation.  Can you elaborate
on why, as in, was this a register or I/O limitation, or simply an arbitrary
decision by Gosling's group (if it was).  Perhaps a compiler limitation that
was arbitrarily set?

Mark

-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org]
Sent: Saturday, May 03, 2003 1:24 PM
To: Struts Users Mailing List
Subject: Re: Method byte limit - Craig?




On Sat, 3 May 2003, Mark Galbreath wrote:

> Date: Sat, 3 May 2003 13:18:02 -0400
> From: Mark Galbreath <ma...@qat.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: 'Struts Users Mailing List' <st...@jakarta.apache.org>
> Subject: Method byte limit - Craig?
>
> Hey Craig (or anyone else who knows):
>
> What's the history behind the 64k byte limit on compiled Java methods?
> I'm just curious as to the rationale.
>

In the bytecodes of the JVM, there needed to be a way to represent a
relative branch (used to implement things like for, while, break, and
try/catch/finally loops).  The designers chose a 16 bit unsigned int field
for the number of bytes that you could jump; hence a 64k limit on this.
Because a JSP page encapsulates its logic inside a try/catch block, you
effectively have a 64k limit on the size of the code for the generated
service() method (although technically methods can actually be bigger --
it's actually the maximum jump offset that is the limit).

Jasper2 avoids this issue by dividing your JSP page's code up into multiple
methods.  However, this cannot be done if you use scriptlets, because of the
semantics of local variable declarations.  It is quite instructive to
examine the source code generated by Jasper2 compared to an old JSP page
compiler, for a complex page with lots of tags.

> Mark
>

Craig


>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Method byte limit - Craig?

Posted by Mark Galbreath <ma...@qat.com>.
This stuff is fascinating...thanks for the explanation.  Can you elaborate
on why, as in, was this a register or I/O limitation, or simply an arbitrary
decision by Gosling's group (if it was).  Perhaps a compiler limitation that
was arbitrarily set?

Mark

-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org] 
Sent: Saturday, May 03, 2003 1:24 PM
To: Struts Users Mailing List
Subject: Re: Method byte limit - Craig?




On Sat, 3 May 2003, Mark Galbreath wrote:

> Date: Sat, 3 May 2003 13:18:02 -0400
> From: Mark Galbreath <ma...@qat.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: 'Struts Users Mailing List' <st...@jakarta.apache.org>
> Subject: Method byte limit - Craig?
>
> Hey Craig (or anyone else who knows):
>
> What's the history behind the 64k byte limit on compiled Java methods?  
> I'm just curious as to the rationale.
>

In the bytecodes of the JVM, there needed to be a way to represent a
relative branch (used to implement things like for, while, break, and
try/catch/finally loops).  The designers chose a 16 bit unsigned int field
for the number of bytes that you could jump; hence a 64k limit on this.
Because a JSP page encapsulates its logic inside a try/catch block, you
effectively have a 64k limit on the size of the code for the generated
service() method (although technically methods can actually be bigger --
it's actually the maximum jump offset that is the limit).

Jasper2 avoids this issue by dividing your JSP page's code up into multiple
methods.  However, this cannot be done if you use scriptlets, because of the
semantics of local variable declarations.  It is quite instructive to
examine the source code generated by Jasper2 compared to an old JSP page
compiler, for a complex page with lots of tags.

> Mark
>

Craig


>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Method byte limit - Craig?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Sat, 3 May 2003, Mark Galbreath wrote:

> Date: Sat, 3 May 2003 13:18:02 -0400
> From: Mark Galbreath <ma...@qat.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: 'Struts Users Mailing List' <st...@jakarta.apache.org>
> Subject: Method byte limit - Craig?
>
> Hey Craig (or anyone else who knows):
>
> What's the history behind the 64k byte limit on compiled Java methods?  I'm
> just curious as to the rationale.
>

In the bytecodes of the JVM, there needed to be a way to represent a
relative branch (used to implement things like for, while, break, and
try/catch/finally loops).  The designers chose a 16 bit unsigned int field
for the number of bytes that you could jump; hence a 64k limit on this.
Because a JSP page encapsulates its logic inside a try/catch block, you
effectively have a 64k limit on the size of the code for the generated
service() method (although technically methods can actually be bigger --
it's actually the maximum jump offset that is the limit).

Jasper2 avoids this issue by dividing your JSP page's code up into
multiple methods.  However, this cannot be done if you use scriptlets,
because of the semantics of local variable declarations.  It is quite
instructive to examine the source code generated by Jasper2 compared to an
old JSP page compiler, for a complex page with lots of tags.

> Mark
>

Craig


>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org