diff --git a/src/dfa.c b/src/dfa.c index ab103143c..4cf99a9e3 100644 --- a/src/dfa.c +++ b/src/dfa.c @@ -452,30 +452,12 @@ void ntod (void) /* Note that the test for ecgroup[0] == numecs below accomplishes * both (1) and (2) above + * + * New way: we will only use NUL table for fulltbl, because the + * scanner will use an integer instead of YY_CHAR as noted above */ - if (!fullspd && ecgroup[0] == numecs) { - /* NUL is alone in its equivalence class, which is the - * last one. - */ - int use_NUL_table = (numecs == csize); - - if (fulltbl && !use_NUL_table) { - /* We still may want to use the table if numecs - * is a power of 2. - */ - if (numecs <= csize && is_power_of_2(numecs)) { - use_NUL_table = true; - } - } - - if (use_NUL_table) - nultrans = - allocate_integer_array (current_max_dfas); - - /* From now on, nultrans != nil indicates that we're - * saving null transitions for later, separate encoding. - */ - } + if (fulltbl && ecgroup[0] == numecs && is_power_of_2(numecs)) + nultrans = allocate_integer_array (current_max_dfas); if (fullspd) { diff --git a/src/gen.c b/src/gen.c index c959f75bc..85ca91d54 100644 --- a/src/gen.c +++ b/src/gen.c @@ -715,7 +715,16 @@ void genftbl (void) void gen_next_compressed_state (char *char_map) { - indent_put2s ("YY_CHAR yy_c = %s;", char_map); + /* Formerly YY_CHAR, changed to int because table can now have up to + * 0x101 entries, since we no longer generate a separate NUL table + * + * Note: on x86-64 architecture with gcc -O2, we save an instruction + * in the main loop, since the character can now be zero-extended in + * the process of retrieving it from the input stream or the yy_ec[] + * or yy_meta[] arrays, whereas previously it was zero-extended by a + * register-to-register move just prior to the yy_chk[] table lookup + */ + indent_put2s ("int yy_c = %s;", char_map); /* Save the backing-up info \before/ computing the next state * because we always compute one more state than needed - we