# HG changeset patch # User Aidan Kehoe # Date 1431085633 -3600 # Node ID 2dc8711af537f1664d31f0d07eb04844b705614d # Parent a485caa1131d9e850b4faf369f8d1e8243379ec5 Make get_char_table in loop bodies more tolerable without optimization. 2015-05-08 Aidan Kehoe * chartab.h (get_char_table): * chartab.h (get_char_table_mirrors_ok): New. Provide get_char_table_mirrors_ok, which differs from get_char_table only if ERROR_CHECK_TYPES is defined. Implement it, and get_char_table, using a macro wrapper of get_char_table_1, so that on builds without optimization each get_char_table no longer requires two C function calls. * chartab.c (updating_mirror_get_range_char_table): Use get_char_table_mirrors_ok. * syntax.h: Ditto. diff -r a485caa1131d -r 2dc8711af537 src/ChangeLog --- a/src/ChangeLog Tue May 05 13:12:14 2015 +0900 +++ b/src/ChangeLog Fri May 08 12:47:13 2015 +0100 @@ -1,3 +1,17 @@ +2015-05-08 Aidan Kehoe + + * chartab.h (get_char_table): + * chartab.h (get_char_table_mirrors_ok): New. + Provide get_char_table_mirrors_ok, which differs from + get_char_table only if ERROR_CHECK_TYPES is defined. + Implement it, and get_char_table, using a macro wrapper of + get_char_table_1, so that on builds without optimization each + get_char_table no longer requires two C function calls. + * chartab.c (updating_mirror_get_range_char_table): + Use get_char_table_mirrors_ok. + * syntax.h: + Ditto. + 2015-04-20 Jerry James * lisp.h (max_align_t): Do not define if C11 or C++11, or a later diff -r a485caa1131d -r 2dc8711af537 src/chartab.c --- a/src/chartab.c Tue May 05 13:12:14 2015 +0900 +++ b/src/chartab.c Fri May 08 12:47:13 2015 +0100 @@ -1042,7 +1042,7 @@ Lisp_Object multi) { if (range->type == CHARTAB_RANGE_CHAR) - return get_char_table_1 (range->ch, table); + return get_char_table_mirrors_ok (range->ch, table); else return get_range_char_table_1 (range, table, multi); } diff -r a485caa1131d -r 2dc8711af537 src/chartab.h --- a/src/chartab.h Tue May 05 13:12:14 2015 +0900 +++ b/src/chartab.h Fri May 08 12:47:13 2015 +0100 @@ -140,13 +140,28 @@ int leading_byte, Ichar c); +#ifdef ERROR_CHECK_TYPES +DECLARE_INLINE_HEADER ( +Lisp_Object +get_char_table_1 (Ichar ch, Lisp_Object table, Boolint mirrors_allowed) +) +#else DECLARE_INLINE_HEADER ( Lisp_Object get_char_table_1 (Ichar ch, Lisp_Object table) ) +#endif { Lisp_Object retval; Lisp_Char_Table *ct = XCHAR_TABLE (table); + +#ifdef ERROR_CHECK_TYPES + if (!mirrors_allowed) + { + assert (!ct->mirror_table_p); + } +#endif + #ifdef MULE if (ch < NUM_ASCII_CHARS) retval = ct->ascii[ch]; @@ -168,16 +183,11 @@ } #ifdef ERROR_CHECK_TYPES -DECLARE_INLINE_HEADER ( -Lisp_Object -get_char_table (Ichar ch, Lisp_Object table) -) -{ - assert (!XCHAR_TABLE (table)->mirror_table_p); - return get_char_table_1 (ch, table); -} +#define get_char_table(ch, table) get_char_table_1 (ch, table, 0) +#define get_char_table_mirrors_ok(ch, table) get_char_table_1 (ch, table, 1) #else -#define get_char_table(ch, table) get_char_table_1 (ch, table) +#define get_char_table get_char_table_1 +#define get_char_mirrors_ok get_char_table_1 #endif enum chartab_range_type diff -r a485caa1131d -r 2dc8711af537 src/syntax.h --- a/src/syntax.h Tue May 05 13:12:14 2015 +0900 +++ b/src/syntax.h Fri May 08 12:47:13 2015 +0100 @@ -92,7 +92,7 @@ { type_checking_assert (XCHAR_TABLE (table)->mirror_table_p); update_mirror_syntax_if_dirty (table); - return XFIXNUM (get_char_table_1 (c, table)); + return XFIXNUM (get_char_table_mirrors_ok (c, table)); } #ifdef NOT_WORTH_THE_EFFORT @@ -105,7 +105,7 @@ ) { type_checking_assert (XCHAR_TABLE (table)->mirror_table_p); - return (enum syntaxcode) XFIXNUM (get_char_table_1 (c, table)); + return (enum syntaxcode) XFIXNUM (get_char_table_mirrors_ok (c, table)); } #endif /* NOT_WORTH_THE_EFFORT */