glsl/mesa: remove unused namespace support from the symbol table

Namespace support seems to have been unused for a very long time.

Previously the hash table entry was never removed and the symbol name
wasn't freed until the symbol table was destroyed.

In theory this could reduced the number of times we need to copy a string
as duplicate names are reused. However in practice there is likely only a
limited number of symbols that are the same and this is likely to cause
other less than optimal behaviour such as the hash_table continuously
growing.

Along with dropping namespace support this change removes entries from
the hash table as they become unused.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
This commit is contained in:
Timothy Arceri
2016-10-21 16:50:52 +11:00
parent 907ace5798
commit 6dbe8a1b9f
6 changed files with 126 additions and 263 deletions

View File

@@ -724,7 +724,7 @@ extSwizSel: INTEGER
srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, $1);
_mesa_symbol_table_find_symbol(state->st, $1);
free($1);
@@ -812,7 +812,7 @@ dstReg: resultBinding
| USED_IDENTIFIER /* temporaryReg | vertexResultReg */
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, $1);
_mesa_symbol_table_find_symbol(state->st, $1);
free($1);
@@ -841,7 +841,7 @@ dstReg: resultBinding
progParamArray: USED_IDENTIFIER
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, $1);
_mesa_symbol_table_find_symbol(state->st, $1);
free($1);
@@ -914,7 +914,7 @@ addrRegNegOffset: INTEGER
addrReg: USED_IDENTIFIER
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, $1);
_mesa_symbol_table_find_symbol(state->st, $1);
free($1);
@@ -2028,9 +2028,9 @@ legacyTexUnitNum: INTEGER
ALIAS_statement: ALIAS IDENTIFIER '=' USED_IDENTIFIER
{
struct asm_symbol *exist = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, $2);
_mesa_symbol_table_find_symbol(state->st, $2);
struct asm_symbol *target = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, $4);
_mesa_symbol_table_find_symbol(state->st, $4);
free($4);
@@ -2046,7 +2046,7 @@ ALIAS_statement: ALIAS IDENTIFIER '=' USED_IDENTIFIER
"undefined variable binding in ALIAS statement");
YYERROR;
} else {
_mesa_symbol_table_add_symbol(state->st, 0, $2, target);
_mesa_symbol_table_add_symbol(state->st, $2, target);
}
}
;
@@ -2235,7 +2235,7 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
{
struct asm_symbol *s = NULL;
struct asm_symbol *exist = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, name);
_mesa_symbol_table_find_symbol(state->st, name);
if (exist != NULL) {
@@ -2273,7 +2273,7 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
break;
}
_mesa_symbol_table_add_symbol(state->st, 0, s->name, s);
_mesa_symbol_table_add_symbol(state->st, s->name, s);
s->next = state->sym;
state->sym = s;
}