diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index 6d9c10ffb..9bba40323 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -49,6 +49,17 @@ struct ankr; using hb_aat_class_cache_t = hb_ot_layout_mapping_cache_t; +/* The state-machine subtables' transition functions are called once per + * transition from the drive loop, but are big enough that the compiler + * declines to inline them, leaving a call in the hottest loop of AAT + * shaping. Forcing them inline is worth 3-10% instructions on + * morx/kerx-heavy fonts, for about 16KB of code. */ +#ifndef HB_OPTIMIZE_SIZE +#define HB_AAT_TRANSITION_INLINE HB_ALWAYS_INLINE +#else +#define HB_AAT_TRANSITION_INLINE +#endif + struct hb_aat_scratch_t { hb_aat_scratch_t () = default; diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index db7cd6f54..5d5b2e173 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -258,6 +258,7 @@ struct KerxSubTableFormat1 depth (0), crossStream (table->header.coverage & table->header.CrossStream) {} + HB_AAT_TRANSITION_INLINE void transition (hb_buffer_t *buffer, StateTableDriver *driver, const Entry &entry) @@ -551,6 +552,7 @@ struct KerxSubTableFormat4 mark_set (false), mark (0) {} + HB_AAT_TRANSITION_INLINE void transition (hb_buffer_t *buffer, StateTableDriver *driver, const Entry &entry) diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index 4811f12be..aa6081131 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -84,6 +84,7 @@ struct RearrangementSubtable table (table_), start (0), end (0) {} + HB_AAT_TRANSITION_INLINE void transition (hb_buffer_t *buffer, StateTableDriver *driver, const Entry &entry) @@ -243,6 +244,7 @@ struct ContextualSubtable mark (0), subs (table+table->substitutionTables) {} + HB_AAT_TRANSITION_INLINE void transition (hb_buffer_t *buffer, StateTableDriver *driver, const Entry &entry) @@ -490,6 +492,7 @@ struct LigatureSubtable ligature (table+table->ligature), match_length (0) {} + HB_AAT_TRANSITION_INLINE void transition (hb_buffer_t *buffer, StateTableDriver *driver, const Entry &entry) @@ -787,6 +790,7 @@ struct InsertionSubtable mark (0), insertionAction (table+table->insertionAction) {} + HB_AAT_TRANSITION_INLINE void transition (hb_buffer_t *buffer, StateTableDriver *driver, const Entry &entry)