[ragel-users] Java static field initializers

Adrian Thurston thurston at complang.org
Thu Apr 7 20:34:04 UTC 2011


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



More information about the ragel-users mailing list