Groups | Blog | Home
all groups > dotnet clr > november 2005 >

dotnet clr : MSIL size limit


Etienne Fortin
11/22/2005 7:28:03 AM
Looking at the output of ildasm, I was wondering if there's a size limit on
msil for any given method. The IL_xxxx index is an hexa number on 16-bits.
Does it mean that for any given method, there's a 64 kb size limit?

I know I shoudn't create methods so big, but let's say I want a 256 kb
method. Would it compile?

Gabriele G. Ponti
11/22/2005 1:23:57 PM
Those labels are added by ILDASM, it's not a restriction of the MSIL. If you
consider the branch instruction the offset is 32 bit, so you can assume that
there's no 16 bit restriction.

Gabriele

Richard Grimes
11/26/2005 9:46:37 PM
[quoted text, click to view]

The IL for every method has a header, it is either 'tiny' or 'fat'
format. The tiny format header uses 6 bits to indicate the size of the
method (64 bytes). The fat format uses 4 bytes to indicate the size of
the method (4Gb).

[quoted text, click to view]

Yes, but it would be a bit silly because you can guarantee that much of
the code won't be called, and if you factorize the code into methods it
would reduce considerably the amount of code that would be JIT compiled.
Of course, I know that you are not thinking of writing a 256 Kb method
<g>

Richard
--
http://www.grimes.demon.co.uk/workshops/fusionWS.htm
http://www.grimes.demon.co.uk/workshops/securityWS.htm

AddThis Social Bookmark Button