[Mesa-dev] [PATCH 10/15] glsl: use the linear allocator in glsl_symbol_table
Marek Olšák
maraeo at gmail.com
Sat Oct 8 10:58:34 UTC 2016
From: Marek Olšák <marek.olsak at amd.com>
no ralloc_free occurences
---
src/compiler/glsl/glsl_symbol_table.cpp | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/compiler/glsl/glsl_symbol_table.cpp b/src/compiler/glsl/glsl_symbol_table.cpp
index 0b21faa..e9d57e8 100644
--- a/src/compiler/glsl/glsl_symbol_table.cpp
+++ b/src/compiler/glsl/glsl_symbol_table.cpp
@@ -20,21 +20,21 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "glsl_symbol_table.h"
#include "ast.h"
class symbol_table_entry {
public:
- DECLARE_RALLOC_CXX_OPERATORS(symbol_table_entry);
+ DECLARE_LINEAR_ALLOC_CXX_OPERATORS(symbol_table_entry);
bool add_interface(const glsl_type *i, enum ir_variable_mode mode)
{
const glsl_type **dest;
switch (mode) {
case ir_var_uniform:
dest = &ibu;
break;
case ir_var_shader_storage:
@@ -143,90 +143,90 @@ bool glsl_symbol_table::add_variable(ir_variable *v)
*/
if (existing->v == NULL && existing->t == NULL) {
existing->v = v;
return true;
}
} else {
/* If not declared at this scope, add a new entry. But if an existing
* entry includes a function, propagate that to this block - otherwise
* the new variable declaration would shadow the function.
*/
- symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
+ symbol_table_entry *entry = new(linalloc) symbol_table_entry(v);
if (existing != NULL)
entry->f = existing->f;
int added = _mesa_symbol_table_add_symbol(table, -1, v->name, entry);
assert(added == 0);
(void)added;
return true;
}
return false;
}
/* 1.20+ rules: */
- symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
+ symbol_table_entry *entry = new(linalloc) symbol_table_entry(v);
return _mesa_symbol_table_add_symbol(table, -1, 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);
+ symbol_table_entry *entry = new(linalloc) symbol_table_entry(t);
return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
}
bool glsl_symbol_table::add_interface(const char *name, const glsl_type *i,
enum ir_variable_mode mode)
{
assert(i->is_interface());
symbol_table_entry *entry = get_entry(name);
if (entry == NULL) {
symbol_table_entry *entry =
- new(mem_ctx) symbol_table_entry(i, mode);
+ new(linalloc) symbol_table_entry(i, mode);
bool add_interface_symbol_result =
_mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
assert(add_interface_symbol_result);
return add_interface_symbol_result;
} else {
return entry->add_interface(i, mode);
}
}
bool glsl_symbol_table::add_function(ir_function *f)
{
if (this->separate_function_namespace && name_declared_this_scope(f->name)) {
/* In 1.10, functions and variables have separate namespaces. */
symbol_table_entry *existing = get_entry(f->name);
if ((existing->f == NULL) && (existing->t == NULL)) {
existing->f = f;
return true;
}
}
- symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);
+ symbol_table_entry *entry = new(linalloc) symbol_table_entry(f);
return _mesa_symbol_table_add_symbol(table, -1, f->name, entry) == 0;
}
bool glsl_symbol_table::add_default_precision_qualifier(const char *type_name,
int precision)
{
char *name = ralloc_asprintf(mem_ctx, "#default_precision_%s", type_name);
ast_type_specifier *default_specifier = new(linalloc) ast_type_specifier(name);
default_specifier->default_precision = precision;
symbol_table_entry *entry =
- new(mem_ctx) symbol_table_entry(default_specifier);
+ new(linalloc) symbol_table_entry(default_specifier);
return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
}
void glsl_symbol_table::add_global_function(ir_function *f)
{
- symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);
+ symbol_table_entry *entry = new(linalloc) symbol_table_entry(f);
int added = _mesa_symbol_table_add_global_symbol(table, -1, f->name, entry);
assert(added == 0);
(void)added;
}
ir_variable *glsl_symbol_table::get_variable(const char *name)
{
symbol_table_entry *entry = get_entry(name);
return entry != NULL ? entry->v : NULL;
}
--
2.7.4
More information about the mesa-dev
mailing list