[ragel-users] Java static field initializers

Adrian Thurston thurston at complang.org
Sat Apr 9 17:17:30 UTC 2011


There is a hardcoded array limit based on one-time measurements.

I think that would be possible, but would the gain in startup speed be 
worth the coding effort?

On 11-04-07 04:08 PM, Nate wrote:
> 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
> <mailto: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 <mailto: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 <mailto:ragel-users at complang.org>
>     http://www.complang.org/mailman/listinfo/ragel-users
>
>
>
>
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users

-- 
Dr. 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



More information about the ragel-users mailing list