java: revert "style: avoid useless initializers"

This reverts commit ebab1ffca8.
This commit removed "useless" initializers, going from

    /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
       STATE-NUM.  */
    private static final byte yypact_[] = yypact_init ();
    private static final byte[] yypact_init ()
    {
      return new byte[]
      {
        25,    -7,    -8,    37,    -8,    40,    -8,    20,    -8,    61,
        -8,    -8,     3,     9,    51,    -8,    -8,    -2,    -2,    -2,
        -2,    -2,    -2,    -8,    -8,    -8,     1,    66,    66,     3,
         3,     3
      };
    }

to

    /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
       STATE-NUM.  */
    private static final byte[] yypact_ =
    {
        25,    -7,    -8,    37,    -8,    40,    -8,    20,    -8,    61,
        -8,    -8,     3,     9,    51,    -8,    -8,    -2,    -2,    -2,
        -2,    -2,    -2,    -8,    -8,    -8,     1,    66,    66,     3,
         3,     3
    };

But it turns out that this was on purpose, to work around the 64KB
limitation in JVM methods.  It was introduced on the 2008-11-10 by
Di-an Jan in 09ccae9b18: "Work around
Java's ``code too large'' problem for parser tables".  See
https://lists.gnu.org/r/help-bison/2008-11/msg00004.html.  A real
test, where we would hit the JVM limitation, would be nice.

To avoid further regressions, add comments.
This commit is contained in:
Akim Demaille
2020-02-10 07:24:51 +01:00
parent bc74b4b15a
commit ed1eedbbcb

View File

@@ -106,13 +106,20 @@ m4_define([b4_null], [null])
# b4_typed_parser_table_define(TYPE, NAME, DATA, COMMENT) # b4_typed_parser_table_define(TYPE, NAME, DATA, COMMENT)
# ------------------------------------------------------- # -------------------------------------------------------
# We use intermediate functions (e.g., yypact_init) to work around the
# 64KB limit for JVM methods. See
# https://lists.gnu.org/r/help-bison/2008-11/msg00004.html.
m4_define([b4_typed_parser_table_define], m4_define([b4_typed_parser_table_define],
[m4_ifval([$4], [b4_comment([$4]) [m4_ifval([$4], [b4_comment([$4])
])dnl ])dnl
[private static final ]$1[[] yy$2_ = [private static final ]$1[[] yy$2_ = yy$2_init ();
private static final ]$1[[] yy$2_init ()
{ {
return new ]$1[[]
{
]$3[ ]$3[
};]]) };
}]])
# b4_integral_parser_table_define(NAME, DATA, COMMENT) # b4_integral_parser_table_define(NAME, DATA, COMMENT)