mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 09:48:07 +02:00
glsl/ir_variable_refcount: don't ralloc the hash table
Reviewed-by: Gert Wollny <gert.wollny@collabora.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
This commit is contained in:
parent
44d9d4d06b
commit
deac7cf1a2
3 changed files with 7 additions and 6 deletions
|
|
@ -38,14 +38,14 @@
|
|||
ir_variable_refcount_visitor::ir_variable_refcount_visitor()
|
||||
{
|
||||
this->linalloc = linear_context(ralloc_context(NULL));
|
||||
this->ht = _mesa_pointer_hash_table_create(NULL);
|
||||
_mesa_pointer_hash_table_init(&this->ht, NULL);
|
||||
this->global = true;
|
||||
}
|
||||
|
||||
ir_variable_refcount_visitor::~ir_variable_refcount_visitor()
|
||||
{
|
||||
ralloc_free(ralloc_parent_of_linear_context(this->linalloc));
|
||||
_mesa_hash_table_destroy(this->ht, NULL);
|
||||
_mesa_hash_table_fini(&this->ht, NULL);
|
||||
}
|
||||
|
||||
// constructor
|
||||
|
|
@ -63,13 +63,13 @@ ir_variable_refcount_visitor::get_variable_entry(ir_variable *var)
|
|||
{
|
||||
assert(var);
|
||||
|
||||
struct hash_entry *e = _mesa_hash_table_search(this->ht, var);
|
||||
struct hash_entry *e = _mesa_hash_table_search(&this->ht, var);
|
||||
if (e)
|
||||
return (ir_variable_refcount_entry *)e->data;
|
||||
|
||||
ir_variable_refcount_entry *entry = new(linalloc) ir_variable_refcount_entry(var);
|
||||
assert(entry->referenced_count == 0);
|
||||
_mesa_hash_table_insert(this->ht, var, entry);
|
||||
_mesa_hash_table_insert(&this->ht, var, entry);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "ir.h"
|
||||
#include "ir_visitor.h"
|
||||
#include "compiler/glsl_types.h"
|
||||
#include "util/hash_table.h"
|
||||
|
||||
struct assignment_entry {
|
||||
ir_exec_node link;
|
||||
|
|
@ -90,7 +91,7 @@ public:
|
|||
/**
|
||||
* Hash table mapping ir_variable to ir_variable_refcount_entry.
|
||||
*/
|
||||
struct hash_table *ht;
|
||||
struct hash_table ht;
|
||||
|
||||
linear_ctx *linalloc;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ do_dead_code(ir_exec_list *instructions)
|
|||
|
||||
v.run(instructions);
|
||||
|
||||
hash_table_foreach(v.ht, e) {
|
||||
hash_table_foreach(&v.ht, e) {
|
||||
ir_variable_refcount_entry *entry = (ir_variable_refcount_entry *)e->data;
|
||||
|
||||
/* Since each assignment is a reference, the refereneced count must be
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue