From c2f2121527dababdede6c17180e045eea3ec86bb Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 16 Sep 2025 16:29:23 -0600 Subject: [PATCH 1/8] [vector] Simplify allocate_from_pool / set_storage --- src/hb-vector.hh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/hb-vector.hh b/src/hb-vector.hh index 41d666ee6..adcc8d9eb 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -107,9 +107,6 @@ struct hb_vector_t void set_storage (Type *array, unsigned n) { - if (unlikely (in_error ())) - return; - assert (allocated == 0); assert (length == 0); @@ -557,12 +554,10 @@ struct hb_vector_t set_error (); return false; } - set_storage (arrayZ, size); if (initialize) - { - length = 0; grow_vector (size, hb_prioritize); - } + else + length = size; return true; } return resize_full ((int) size, initialize, true); From bdac0aec2e3d0126675710b769d3a139e6ed93a3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 16 Sep 2025 16:42:32 -0600 Subject: [PATCH 2/8] [vector] Make shrink() useful in un-owned vectors --- src/hb-vector.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-vector.hh b/src/hb-vector.hh index adcc8d9eb..e6cc08a1c 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -649,7 +649,7 @@ struct hb_vector_t shrink_vector (size); - if (shrink_memory) + if (is_owned () && shrink_memory) alloc_exact (size); /* To force shrinking memory if needed. */ } From ea9b7de4edbd75c854d11337b2ca1bdfe3c22324 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 16 Sep 2025 16:45:02 -0600 Subject: [PATCH 3/8] [instancer/tuplevars] Allocate compiled_tuple_headers from alloc pool --- src/hb-ot-var-common.hh | 14 +++++++++----- src/hb-ot-var-gvar-table.hh | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/hb-ot-var-common.hh b/src/hb-ot-var-common.hh index 2830c3fec..d22181565 100644 --- a/src/hb-ot-var-common.hh +++ b/src/hb-ot-var-common.hh @@ -475,7 +475,8 @@ struct tuple_delta_t bool compile_tuple_var_header (const hb_map_t& axes_index_map, unsigned points_data_length, const hb_map_t& axes_old_index_tag_map, - const hb_hashmap_t*, unsigned>* shared_tuples_idx_map) + const hb_hashmap_t*, unsigned>* shared_tuples_idx_map, + hb_alloc_pool_t *pool = nullptr) { /* compiled_deltas could be empty after iup delta optimization, we can skip * compiling this tuple and return true */ @@ -484,7 +485,7 @@ struct tuple_delta_t unsigned cur_axis_count = axes_index_map.get_population (); /* allocate enough memory: 1 peak + 2 intermediate coords + fixed header size */ unsigned alloc_len = 3 * cur_axis_count * (F2DOT14::static_size) + 4; - if (unlikely (!compiled_tuple_header.resize_dirty (alloc_len))) return false; + if (unlikely (!compiled_tuple_header.allocate_from_pool (pool, alloc_len, false))) return false; unsigned flag = 0; /* skip the first 4 header bytes: variationDataSize+tupleIndex */ @@ -522,7 +523,8 @@ struct tuple_delta_t o->tupleIndex = flag; unsigned total_header_len = 4 + (peak_count + interim_count) * (F2DOT14::static_size); - return compiled_tuple_header.resize (total_header_len); + compiled_tuple_header.shrink (total_header_len); + return true; } unsigned encode_peak_coords (hb_array_t peak_coords, @@ -1276,7 +1278,8 @@ struct TupleVariationData const hb_map_t& axes_old_index_tag_map, bool use_shared_points, bool is_gvar = false, - const hb_hashmap_t*, unsigned>* shared_tuples_idx_map = nullptr) + const hb_hashmap_t*, unsigned>* shared_tuples_idx_map = nullptr, + hb_alloc_pool_t *pool = nullptr) { // return true for empty glyph if (!tuple_vars) @@ -1315,7 +1318,8 @@ struct TupleVariationData unsigned points_data_length = (points_data != shared_points_bytes) ? points_data->length : 0; if (!tuple.compile_tuple_var_header (axes_index_map, points_data_length, axes_old_index_tag_map, - shared_tuples_idx_map)) + shared_tuples_idx_map, + pool)) return false; compiled_byte_size += tuple.compiled_tuple_header.length + points_data_length + tuple.compiled_deltas.length; } diff --git a/src/hb-ot-var-gvar-table.hh b/src/hb-ot-var-gvar-table.hh index 5f8ab44b5..a30eb0a01 100644 --- a/src/hb-ot-var-gvar-table.hh +++ b/src/hb-ot-var-gvar-table.hh @@ -165,7 +165,8 @@ struct glyph_variations_t if (!vars.compile_bytes (axes_index_map, axes_old_index_tag_map, true, /* use shared points*/ true, - &shared_tuples_idx_map)) + &shared_tuples_idx_map, + &pool)) return false; return true; From 5b04b40dd55bfd9308875cf82b6ded3e1b42a22f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 16 Sep 2025 16:52:53 -0600 Subject: [PATCH 4/8] [instancer/tuplevars] Allocate compiled_deltas from alloc pool --- src/hb-ot-var-common.hh | 15 +++++++++------ src/hb-vector.hh | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/hb-ot-var-common.hh b/src/hb-ot-var-common.hh index d22181565..5dedff1f1 100644 --- a/src/hb-ot-var-common.hh +++ b/src/hb-ot-var-common.hh @@ -547,14 +547,16 @@ struct tuple_delta_t return compiled_interm_coords.length; } - bool compile_deltas (hb_vector_t &rounded_deltas_scratch) - { return compile_deltas (indices, deltas_x, deltas_y, compiled_deltas, rounded_deltas_scratch); } + bool compile_deltas (hb_vector_t &rounded_deltas_scratch, + hb_alloc_pool_t *pool = nullptr) + { return compile_deltas (indices, deltas_x, deltas_y, compiled_deltas, rounded_deltas_scratch, pool); } static bool compile_deltas (hb_array_t point_indices, hb_array_t x_deltas, hb_array_t y_deltas, hb_vector_t &compiled_deltas, /* OUT */ - hb_vector_t &rounded_deltas /* scratch */) + hb_vector_t &rounded_deltas, /* scratch */ + hb_alloc_pool_t *pool = nullptr) { if (unlikely (!rounded_deltas.resize_dirty (point_indices.length))) return false; @@ -573,7 +575,7 @@ struct tuple_delta_t if (y_deltas) alloc_len *= 2; - if (unlikely (!compiled_deltas.resize_dirty (alloc_len))) return false; + if (unlikely (!compiled_deltas.allocate_from_pool (pool, alloc_len, false))) return false; unsigned encoded_len = compile_deltas (compiled_deltas, rounded_deltas); @@ -594,7 +596,8 @@ struct tuple_delta_t if (j != rounded_deltas.length) return false; encoded_len += compile_deltas (compiled_deltas.as_array ().sub_array (encoded_len), rounded_deltas); } - return compiled_deltas.resize (encoded_len); + compiled_deltas.shrink (encoded_len); + return true; } static unsigned compile_deltas (hb_array_t encoded_bytes, @@ -1313,7 +1316,7 @@ struct TupleVariationData * this tuple */ if (!points_data->length) continue; - if (!tuple.compile_deltas (rounded_deltas_scratch)) + if (!tuple.compile_deltas (rounded_deltas_scratch, pool)) return false; unsigned points_data_length = (points_data != shared_points_bytes) ? points_data->length : 0; diff --git a/src/hb-vector.hh b/src/hb-vector.hh index e6cc08a1c..d24ae0b6b 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -545,9 +545,9 @@ struct hb_vector_t HB_ALWAYS_INLINE_VECTOR_ALLOCS bool allocate_from_pool (allocator_t *allocator, unsigned size, unsigned int initialize = true) { - assert (!length && !allocated); if (allocator) { + assert (!length && !allocated); arrayZ = (Type *) allocator->alloc (size * sizeof (Type)); if (unlikely (!arrayZ)) { From d4cc4823fadf48c2839bfe3048c4a58f33ede36b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 16 Sep 2025 17:00:38 -0600 Subject: [PATCH 5/8] [instancer/tuplevar] Tune allocation size --- src/hb-ot-var-common.hh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-var-common.hh b/src/hb-ot-var-common.hh index 5dedff1f1..9ab0134b7 100644 --- a/src/hb-ot-var-common.hh +++ b/src/hb-ot-var-common.hh @@ -570,8 +570,12 @@ struct tuple_delta_t rounded_deltas.resize (j); if (!rounded_deltas) return true; - /* allocate enough memories 5 * num_deltas */ - unsigned alloc_len = 5 * rounded_deltas.length; + /* Allocate enough memory: this is the correct bound: + * Worst case scenario is that each delta has to be encoded in 4 bytes, and there + * are runs of 64 items each. Any delta encoded in less than 4 bytes (2, 1, or 0) + * is still smaller than the 4-byte encoding even with their control byte. + * The initial 2 is to handle length==0, for both x and y deltas. */ + unsigned alloc_len = 2 + 4 * rounded_deltas.length + (rounded_deltas.length + 63) / 64; if (y_deltas) alloc_len *= 2; @@ -603,7 +607,6 @@ struct tuple_delta_t static unsigned compile_deltas (hb_array_t encoded_bytes, hb_array_t deltas) { - assert (encoded_bytes.length >= 5 * deltas.length); return TupleValues::compile_unsafe (deltas, encoded_bytes); } From c03e1e0a7b396cb0ef01a6222985e026f1a331f5 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 16 Sep 2025 18:15:51 -0600 Subject: [PATCH 6/8] [iup] Use a bit-page instead of bit-set Reject large contours instead. --- src/hb-bit-page.hh | 33 +++++++++++++++++++++++++++++++++ src/hb-subset-instancer-iup.cc | 34 ++++++++++++++++++++-------------- src/hb-subset-instancer-iup.hh | 4 ---- 3 files changed, 53 insertions(+), 18 deletions(-) diff --git a/src/hb-bit-page.hh b/src/hb-bit-page.hh index e84557984..07baf65fc 100644 --- a/src/hb-bit-page.hh +++ b/src/hb-bit-page.hh @@ -142,6 +142,7 @@ struct hb_bit_page_t bool operator [] (hb_codepoint_t g) const { return get (g); } bool operator () (hb_codepoint_t g) const { return get (g); } + bool has (hb_codepoint_t g) const { return get (g); } void add_range (hb_codepoint_t a, hb_codepoint_t b) { @@ -346,6 +347,38 @@ struct hb_bit_page_t return 0; } + /* + * Iterator implementation. + */ + struct iter_t : hb_iter_with_fallback_t + { + static constexpr bool is_sorted_iterator = true; + iter_t (const hb_bit_page_t &s_ = Null (hb_bit_page_t), bool init = true) : s (&s_), v (INVALID) + { + if (init) + v = s->get_min (); + } + + typedef hb_codepoint_t __item_t__; + hb_codepoint_t __item__ () const { return v; } + bool __more__ () const { return v != INVALID; } + void __next__ () { + s->next (&v); if (l) l--; + } + void __prev__ () { s->previous (&v); } + unsigned __len__ () const { return l; } + iter_t end () const { return iter_t (*s, false); } + bool operator != (const iter_t& o) const + { return s != o.s || v != o.v; } + + protected: + const hb_bit_page_t *s; + hb_codepoint_t v; + unsigned l; + }; + iter_t iter () const { return iter_t (*this); } + operator iter_t () const { return iter (); } + static constexpr hb_codepoint_t INVALID = HB_SET_VALUE_INVALID; typedef unsigned long long elt_t; diff --git a/src/hb-subset-instancer-iup.cc b/src/hb-subset-instancer-iup.cc index a036fd355..a7cbde589 100644 --- a/src/hb-subset-instancer-iup.cc +++ b/src/hb-subset-instancer-iup.cc @@ -24,6 +24,10 @@ #include "hb-subset-instancer-iup.hh" +#include "hb-bit-page.hh" + +using hb_iup_set_t = hb_bit_page_t; + /* This file is a straight port of the following: * * https://github.com/fonttools/fonttools/blob/main/Lib/fontTools/varLib/iup.py @@ -37,7 +41,7 @@ constexpr static unsigned MAX_LOOKBACK = 8; static void _iup_contour_bound_forced_set (const hb_array_t contour_points, const hb_array_t x_deltas, const hb_array_t y_deltas, - hb_bit_set_t& forced_set, /* OUT */ + hb_iup_set_t& forced_set, /* OUT */ double tolerance = 0.0) { unsigned len = contour_points.length; @@ -150,10 +154,10 @@ static bool rotate_array (const hb_array_t& org_array, return true; } -static bool rotate_set (const hb_bit_set_t& org_set, +static bool rotate_set (const hb_iup_set_t& org_set, int k, unsigned n, - hb_bit_set_t& out) + hb_iup_set_t& out) { if (!n) return false; k %= n; @@ -162,14 +166,14 @@ static bool rotate_set (const hb_bit_set_t& org_set, if (k == 0) { - out.set (org_set); + out = org_set; } else { - for (auto v : org_set) + for (unsigned v : org_set) out.add ((v + k) % n); } - return !out.in_error (); + return true; } /* Given two reference coordinates (start and end of contour_points array), @@ -280,7 +284,7 @@ static bool _can_iup_in_between (const hb_array_t contour static bool _iup_contour_optimize_dp (const contour_point_vector_t& contour_points, const hb_vector_t& x_deltas, const hb_vector_t& y_deltas, - const hb_bit_set_t& forced_set, + const hb_iup_set_t& forced_set, double tolerance, unsigned lookback, hb_vector_t& costs, /* OUT */ @@ -347,6 +351,9 @@ static bool _iup_contour_optimize (const hb_array_t conto y_deltas.length != n) return false; + if (unlikely (n > hb_iup_set_t::PAGE_BITS)) + return true; // Refuse to work + bool all_within_tolerance = true; double tolerance_sq = tolerance * tolerance; for (unsigned i = 0; i < n; i++) @@ -389,7 +396,7 @@ static bool _iup_contour_optimize (const hb_array_t conto } /* else, solve the general problem using Dynamic Programming */ - hb_bit_set_t &forced_set = scratch.forced_set.reset (); + hb_iup_set_t forced_set; _iup_contour_bound_forced_set (contour_points, x_deltas, y_deltas, forced_set, tolerance); hb_vector_t &costs = scratch.costs.reset (); @@ -405,7 +412,7 @@ static bool _iup_contour_optimize (const hb_array_t conto hb_vector_t &rot_y_deltas = scratch.rot_y_deltas.reset (); contour_point_vector_t &rot_points = scratch.rot_points; rot_points.reset (); - hb_bit_set_t &rot_forced_set = scratch.rot_forced_set.reset (); + hb_iup_set_t rot_forced_set; if (!rotate_array (contour_points, k, rot_points) || !rotate_array (x_deltas, k, rot_x_deltas) || !rotate_array (y_deltas, k, rot_y_deltas) || @@ -418,7 +425,7 @@ static bool _iup_contour_optimize (const hb_array_t conto scratch.interp_x_deltas, scratch.interp_y_deltas)) return false; - hb_bit_set_t &solution = scratch.solution.reset (); + hb_iup_set_t solution; int index = n - 1; while (index != -1) { @@ -471,11 +478,10 @@ static bool _iup_contour_optimize (const hb_array_t conto unsigned best_cost = n + 1; int len = costs.length; - hb_bit_set_t &solution = scratch.solution.reset (); - hb_bit_set_t &best_sol = scratch.best_sol.reset (); + hb_iup_set_t best_sol; for (int start = n - 1; start < len; start++) { - solution.reset (); + hb_iup_set_t solution; int i = start; int lookback = start - (int) n; while (i > lookback) @@ -489,7 +495,7 @@ static bool _iup_contour_optimize (const hb_array_t conto unsigned cost = costs.arrayZ[start] - cost_i; if (cost <= best_cost) { - best_sol.set (solution); + best_sol = solution; best_cost = cost; } } diff --git a/src/hb-subset-instancer-iup.hh b/src/hb-subset-instancer-iup.hh index 981c88d24..32d38c04f 100644 --- a/src/hb-subset-instancer-iup.hh +++ b/src/hb-subset-instancer-iup.hh @@ -38,10 +38,6 @@ struct iup_scratch_t hb_vector_t rot_x_deltas; hb_vector_t rot_y_deltas; contour_point_vector_t rot_points; - hb_bit_set_t forced_set; - hb_bit_set_t rot_forced_set; - hb_bit_set_t solution; - hb_bit_set_t best_sol; }; /* given contour points and deltas, optimize a set of referenced points within error From 3f71afe7605cdc7260990f8925e6ed49521fe728 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 17 Sep 2025 00:22:39 -0400 Subject: [PATCH 7/8] [instancer] Preallocate coordinate maps from alloc pool as well --- src/hb-map.hh | 42 +++++++++++++++++++++++++++++++++++------ src/hb-ot-var-common.hh | 2 ++ 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/hb-map.hh b/src/hb-map.hh index e4fc74077..cdc4a261e 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -143,6 +143,7 @@ struct hb_hashmap_t hb_object_header_t header; bool successful; /* Allocations successful */ + bool foreign; /* Is items array allocated outside */ unsigned short max_chain_length; unsigned int population; /* Not including tombstones. */ unsigned int occupancy; /* Including tombstones. */ @@ -160,12 +161,14 @@ struct hb_hashmap_t hb_swap (a.mask, b.mask); hb_swap (a.prime, b.prime); hb_swap (a.items, b.items); + hb_swap (a.foreign, b.foreign); } void init () { hb_object_init (this); successful = true; + foreign = false; max_chain_length = 0; population = occupancy = 0; mask = 0; @@ -181,7 +184,9 @@ struct hb_hashmap_t unsigned size = mask + 1; for (unsigned i = 0; i < size; i++) items[i].~item_t (); - hb_free (items); + if (!foreign) + hb_free (items); + foreign = false; items = nullptr; } population = occupancy = 0; @@ -196,15 +201,25 @@ struct hb_hashmap_t bool in_error () const { return !successful; } - bool alloc (unsigned new_population = 0) + unsigned power_for (unsigned int desired_population) const + { + unsigned int power = hb_bit_storage (hb_max (desired_population * 2, 4u)); + return power; + } + unsigned size_for (unsigned int desired_population) const + { + return 1u << power_for (desired_population); + } + + bool alloc (unsigned new_population = 0, item_t *foreign_items = nullptr) { if (unlikely (!successful)) return false; if (new_population != 0 && (new_population + new_population / 2) < mask) return true; - unsigned int power = hb_bit_storage (hb_max (hb_max ((unsigned) population, new_population) * 2, 4u)); - unsigned int new_size = 1u << power; - item_t *new_items = (item_t *) hb_malloc ((size_t) new_size * sizeof (item_t)); + unsigned power = power_for (hb_max ((unsigned) population, new_population)); + unsigned new_size = 1u << power; + item_t *new_items = foreign_items ? foreign_items : (item_t *) hb_malloc ((size_t) new_size * sizeof (item_t)); if (unlikely (!new_items)) { successful = false; @@ -239,11 +254,26 @@ struct hb_hashmap_t for (unsigned int i = 0; i < old_size; i++) old_items[i].~item_t (); - hb_free (old_items); + if (!foreign) + hb_free (old_items); + + foreign = foreign_items != nullptr; return true; } + template + HB_ALWAYS_INLINE_VECTOR_ALLOCS + bool allocate_from_pool (allocator_t *allocator, unsigned size) + { + item_t *arrayZ = nullptr; + + if (allocator) + arrayZ = (item_t *) allocator->alloc (size_for (size) * sizeof (item_t)); + + return alloc (size, arrayZ); + } + template bool set_with_hash (KK&& key, uint32_t hash, VV&& value, bool overwrite = true) { diff --git a/src/hb-ot-var-common.hh b/src/hb-ot-var-common.hh index 9ab0134b7..ff194c9e3 100644 --- a/src/hb-ot-var-common.hh +++ b/src/hb-ot-var-common.hh @@ -982,6 +982,8 @@ struct TupleVariationData return false; hb_hashmap_t axis_tuples; + axis_tuples.allocate_from_pool (pool, iterator.get_axis_count ()); + if (!iterator.current_tuple->unpack_axis_tuples (iterator.get_axis_count (), shared_tuples, axes_old_index_tag_map, axis_tuples) || axis_tuples.is_empty ()) return false; From 2be836c1513ad3783e680a3e8382e8c9fda1d201 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 17 Sep 2025 00:31:50 -0400 Subject: [PATCH 8/8] Revert "[instancer] Preallocate coordinate maps from alloc pool as well" This reverts commit 3f71afe7605cdc7260990f8925e6ed49521fe728. Slowed things down. --- src/hb-map.hh | 42 ++++++----------------------------------- src/hb-ot-var-common.hh | 2 -- 2 files changed, 6 insertions(+), 38 deletions(-) diff --git a/src/hb-map.hh b/src/hb-map.hh index cdc4a261e..e4fc74077 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -143,7 +143,6 @@ struct hb_hashmap_t hb_object_header_t header; bool successful; /* Allocations successful */ - bool foreign; /* Is items array allocated outside */ unsigned short max_chain_length; unsigned int population; /* Not including tombstones. */ unsigned int occupancy; /* Including tombstones. */ @@ -161,14 +160,12 @@ struct hb_hashmap_t hb_swap (a.mask, b.mask); hb_swap (a.prime, b.prime); hb_swap (a.items, b.items); - hb_swap (a.foreign, b.foreign); } void init () { hb_object_init (this); successful = true; - foreign = false; max_chain_length = 0; population = occupancy = 0; mask = 0; @@ -184,9 +181,7 @@ struct hb_hashmap_t unsigned size = mask + 1; for (unsigned i = 0; i < size; i++) items[i].~item_t (); - if (!foreign) - hb_free (items); - foreign = false; + hb_free (items); items = nullptr; } population = occupancy = 0; @@ -201,25 +196,15 @@ struct hb_hashmap_t bool in_error () const { return !successful; } - unsigned power_for (unsigned int desired_population) const - { - unsigned int power = hb_bit_storage (hb_max (desired_population * 2, 4u)); - return power; - } - unsigned size_for (unsigned int desired_population) const - { - return 1u << power_for (desired_population); - } - - bool alloc (unsigned new_population = 0, item_t *foreign_items = nullptr) + bool alloc (unsigned new_population = 0) { if (unlikely (!successful)) return false; if (new_population != 0 && (new_population + new_population / 2) < mask) return true; - unsigned power = power_for (hb_max ((unsigned) population, new_population)); - unsigned new_size = 1u << power; - item_t *new_items = foreign_items ? foreign_items : (item_t *) hb_malloc ((size_t) new_size * sizeof (item_t)); + unsigned int power = hb_bit_storage (hb_max (hb_max ((unsigned) population, new_population) * 2, 4u)); + unsigned int new_size = 1u << power; + item_t *new_items = (item_t *) hb_malloc ((size_t) new_size * sizeof (item_t)); if (unlikely (!new_items)) { successful = false; @@ -254,26 +239,11 @@ struct hb_hashmap_t for (unsigned int i = 0; i < old_size; i++) old_items[i].~item_t (); - if (!foreign) - hb_free (old_items); - - foreign = foreign_items != nullptr; + hb_free (old_items); return true; } - template - HB_ALWAYS_INLINE_VECTOR_ALLOCS - bool allocate_from_pool (allocator_t *allocator, unsigned size) - { - item_t *arrayZ = nullptr; - - if (allocator) - arrayZ = (item_t *) allocator->alloc (size_for (size) * sizeof (item_t)); - - return alloc (size, arrayZ); - } - template bool set_with_hash (KK&& key, uint32_t hash, VV&& value, bool overwrite = true) { diff --git a/src/hb-ot-var-common.hh b/src/hb-ot-var-common.hh index ff194c9e3..9ab0134b7 100644 --- a/src/hb-ot-var-common.hh +++ b/src/hb-ot-var-common.hh @@ -982,8 +982,6 @@ struct TupleVariationData return false; hb_hashmap_t axis_tuples; - axis_tuples.allocate_from_pool (pool, iterator.get_axis_count ()); - if (!iterator.current_tuple->unpack_axis_tuples (iterator.get_axis_count (), shared_tuples, axes_old_index_tag_map, axis_tuples) || axis_tuples.is_empty ()) return false;