summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-10-21 16:50:52 +1100
committerTimothy Arceri <[email protected]>2016-10-24 21:40:39 +1100
commit6dbe8a1b9fd750b4c1bb600a0bb43129d95e6eca (patch)
treee94d879f69543871534f59c3ffbfb6adf49efdce /src/compiler
parent907ace57986733add2aebfa9dd7c83c67efed70e (diff)
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 <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/glsl_symbol_table.cpp18
-rw-r--r--src/compiler/glsl/ir_print_visitor.cpp4
2 files changed, 11 insertions, 11 deletions
diff --git a/src/compiler/glsl/glsl_symbol_table.cpp b/src/compiler/glsl/glsl_symbol_table.cpp
index 6d7baad4863..3162bb685df 100644
--- a/src/compiler/glsl/glsl_symbol_table.cpp
+++ b/src/compiler/glsl/glsl_symbol_table.cpp
@@ -126,7 +126,7 @@ void glsl_symbol_table::pop_scope()
bool glsl_symbol_table::name_declared_this_scope(const char *name)
{
- return _mesa_symbol_table_symbol_scope(table, -1, name) == 0;
+ return _mesa_symbol_table_symbol_scope(table, name) == 0;
}
bool glsl_symbol_table::add_variable(ir_variable *v)
@@ -152,7 +152,7 @@ bool glsl_symbol_table::add_variable(ir_variable *v)
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
if (existing != NULL)
entry->f = existing->f;
- int added = _mesa_symbol_table_add_symbol(table, -1, v->name, entry);
+ int added = _mesa_symbol_table_add_symbol(table, v->name, entry);
assert(added == 0);
(void)added;
return true;
@@ -162,13 +162,13 @@ bool glsl_symbol_table::add_variable(ir_variable *v)
/* 1.20+ rules: */
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
- return _mesa_symbol_table_add_symbol(table, -1, v->name, entry) == 0;
+ return _mesa_symbol_table_add_symbol(table, v->name, entry) == 0;
}
bool glsl_symbol_table::add_type(const char *name, const glsl_type *t)
{
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(t);
- return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
+ return _mesa_symbol_table_add_symbol(table, name, entry) == 0;
}
bool glsl_symbol_table::add_interface(const char *name, const glsl_type *i,
@@ -180,7 +180,7 @@ bool glsl_symbol_table::add_interface(const char *name, const glsl_type *i,
symbol_table_entry *entry =
new(mem_ctx) symbol_table_entry(i, mode);
bool add_interface_symbol_result =
- _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
+ _mesa_symbol_table_add_symbol(table, name, entry) == 0;
assert(add_interface_symbol_result);
return add_interface_symbol_result;
} else {
@@ -199,7 +199,7 @@ bool glsl_symbol_table::add_function(ir_function *f)
}
}
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);
- return _mesa_symbol_table_add_symbol(table, -1, f->name, entry) == 0;
+ return _mesa_symbol_table_add_symbol(table, f->name, entry) == 0;
}
bool glsl_symbol_table::add_default_precision_qualifier(const char *type_name,
@@ -213,13 +213,13 @@ bool glsl_symbol_table::add_default_precision_qualifier(const char *type_name,
symbol_table_entry *entry =
new(mem_ctx) symbol_table_entry(default_specifier);
- return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
+ return _mesa_symbol_table_add_symbol(table, name, entry) == 0;
}
void glsl_symbol_table::add_global_function(ir_function *f)
{
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);
- int added = _mesa_symbol_table_add_global_symbol(table, -1, f->name, entry);
+ int added = _mesa_symbol_table_add_global_symbol(table, f->name, entry);
assert(added == 0);
(void)added;
}
@@ -261,7 +261,7 @@ int glsl_symbol_table::get_default_precision_qualifier(const char *type_name)
symbol_table_entry *glsl_symbol_table::get_entry(const char *name)
{
return (symbol_table_entry *)
- _mesa_symbol_table_find_symbol(table, -1, name);
+ _mesa_symbol_table_find_symbol(table, name);
}
void
diff --git a/src/compiler/glsl/ir_print_visitor.cpp b/src/compiler/glsl/ir_print_visitor.cpp
index cdbe18476a7..703169eb976 100644
--- a/src/compiler/glsl/ir_print_visitor.cpp
+++ b/src/compiler/glsl/ir_print_visitor.cpp
@@ -130,14 +130,14 @@ ir_print_visitor::unique_name(ir_variable *var)
/* If there's no conflict, just use the original name */
const char* name = NULL;
- if (_mesa_symbol_table_find_symbol(this->symbols, -1, var->name) == NULL) {
+ if (_mesa_symbol_table_find_symbol(this->symbols, var->name) == NULL) {
name = var->name;
} else {
static unsigned i = 1;
name = ralloc_asprintf(this->mem_ctx, "%s@%u", var->name, ++i);
}
_mesa_hash_table_insert(this->printable_names, var, (void *) name);
- _mesa_symbol_table_add_symbol(this->symbols, -1, name, var);
+ _mesa_symbol_table_add_symbol(this->symbols, name, var);
return name;
}