From 0a400f933fa0962f4a709bec3f4d10cbcffb3614 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Wed, 12 Apr 2023 11:55:13 -0700 Subject: [PATCH] symbol_table: Don't maintain the HT as we're destroying the table. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Release Mesa build runtime of KHR-Single-GL46.arrays_of_arrays_gl.SizedDeclarationsPrimitive -5.05801% +/- 3.41206% (n=12) Reviewed-by: Alyssa Rosenzweig Reviewed-by: Marek Olšák Part-of: --- src/mesa/program/symbol_table.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/mesa/program/symbol_table.c b/src/mesa/program/symbol_table.c index ccf611a..7df2713 100644 --- a/src/mesa/program/symbol_table.c +++ b/src/mesa/program/symbol_table.c @@ -296,8 +296,20 @@ _mesa_symbol_table_ctor(void) void _mesa_symbol_table_dtor(struct _mesa_symbol_table *table) { - while (table->current_scope != NULL) { - _mesa_symbol_table_pop_scope(table); + /* Free all the scopes and symbols left in the table. This is like repeated + * _mesa_symbol_table_pop_scope(), but not maintining the hash table as we + * blow it all away. + */ + while (table->current_scope) { + struct scope_level *scope = table->current_scope; + table->current_scope = scope->next; + + while (scope->symbols) { + struct symbol *sym = scope->symbols; + scope->symbols = sym->next_with_same_scope; + free(sym); + } + free(scope); } _mesa_hash_table_destroy(table->ht, NULL); -- 2.7.4