[ragel-users] Java static field initializers

Nate nathan.sweet at gmail.com
Thu Apr 7 23:08:59 UTC 2011


Ah, interesting. Does Ragel actually approximate the bytecode size of the
separate functions and break them into multiple init functions if near the
64kb limit? If it does, maybe an approximation could be done to avoid init
functions entirely. Or alternatively, how about a "write init" option to not
use functions at all?

-Nate


On Thu, Apr 7, 2011 at 1:34 PM, Adrian Thurston <thurston at complang.org>wrote:

> If I recall correctly, the functions are there because the initializers
> become code in the calling function. Since java has a limit on the amount of
> (compiled) code per function, we always use separate functions so we can
> test for a reasonable approximation of the limit on a per-array basis. I
> think that was it.
>
>
> On 04/06/2011 01:20 AM, Nate wrote:
>
>> Ragel currently outputs a method and static field for Java, eg:
>>
>> private static byte[] init__tableLayout_trans_targs_0 () { return new
>> byte[] {...}; }
>> private static final byte _tableLayout_trans_targs[] =
>> init__tableLayout_trans_targs_0();
>>
>> We could save a few bytes on class file size by just assigning the
>> array, without an method:
>>
>> private static final byte _tableLayout_trans_targs[] = new byte[] {...};
>>
>> The end result is the exactly the same, but less code needs to be output
>> and the class files will be a little bit smaller.
>>
>> -Nate
>>
>>
>>
>> _______________________________________________
>> ragel-users mailing list
>> ragel-users at complang.org
>> http://www.complang.org/mailman/listinfo/ragel-users
>> --===============1102049
>>
>
> --
> Adrian D. Thurston
> http://www.complang.org/thurston/
>
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20110407/2f9fe44d/attachment-0001.html>
-------------- next part --------------
_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users


More information about the ragel-users mailing list