No change in behavior. ralloc_size is equivalent to rzalloc_size.
That will change though.
Calls not switched to rzalloc_size:
- ralloc_vasprintf
- glsl_type::name allocation (it's filled with snprintf)
- C++ classes where valgrind didn't show uninitialized values
I switched most of non-glsl stuff to rzalloc without checking whether
it's really needed.
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
*/
class ast_node {
public:
- DECLARE_RALLOC_CXX_OPERATORS(ast_node);
+ DECLARE_RZALLOC_CXX_OPERATORS(ast_node);
/**
* Print an AST node in something approximating the original GLSL code
* the types to HIR. This ensures that structure definitions embedded in
* other structure definitions or in interface blocks are processed.
*/
- glsl_struct_field *const fields = ralloc_array(state, glsl_struct_field,
- decl_count);
+ glsl_struct_field *const fields = rzalloc_array(state, glsl_struct_field,
+ decl_count);
bool first_member = true;
bool first_member_has_explicit_location = false;
_mesa_glsl_parse_state(struct gl_context *_ctx, gl_shader_stage stage,
void *mem_ctx);
- DECLARE_RALLOC_CXX_OPERATORS(_mesa_glsl_parse_state);
+ DECLARE_RZALLOC_CXX_OPERATORS(_mesa_glsl_parse_state);
/**
* Generate a string representing the GLSL version currently being compiled
/* Allocate storage to hold all of the information related to uniform
* blocks that can be queried through the API.
*/
- struct gl_uniform_block *blocks = ralloc_array(mem_ctx, gl_uniform_block, num_blocks);
+ struct gl_uniform_block *blocks = rzalloc_array(mem_ctx, gl_uniform_block, num_blocks);
gl_uniform_buffer_variable *variables =
ralloc_array(blocks, gl_uniform_buffer_variable, num_variables);
struct exec_node *prev;
#ifdef __cplusplus
- DECLARE_RALLOC_CXX_OPERATORS(exec_node)
+ DECLARE_RZALLOC_CXX_OPERATORS(exec_node)
exec_node() : next(NULL), prev(NULL)
{
nir_alu_instr_create(nir_shader *shader, nir_op op)
{
unsigned num_srcs = nir_op_infos[op].num_inputs;
+ /* TODO: don't use rzalloc */
nir_alu_instr *instr =
- ralloc_size(shader,
- sizeof(nir_alu_instr) + num_srcs * sizeof(nir_alu_src));
+ rzalloc_size(shader,
+ sizeof(nir_alu_instr) + num_srcs * sizeof(nir_alu_src));
instr_init(&instr->instr, nir_instr_type_alu);
instr->op = op;
nir_intrinsic_instr_create(nir_shader *shader, nir_intrinsic_op op)
{
unsigned num_srcs = nir_intrinsic_infos[op].num_srcs;
+ /* TODO: don't use rzalloc */
nir_intrinsic_instr *instr =
- ralloc_size(shader,
+ rzalloc_size(shader,
sizeof(nir_intrinsic_instr) + num_srcs * sizeof(nir_src));
instr_init(&instr->instr, nir_instr_type_intrinsic);
struct vtn_access_chain *chain;
unsigned new_len = old->length + new_ids;
- chain = ralloc_size(b, sizeof(*chain) + new_len * sizeof(chain->link[0]));
+ /* TODO: don't use rzalloc */
+ chain = rzalloc_size(b, sizeof(*chain) + new_len * sizeof(chain->link[0]));
chain->var = old->var;
chain->length = new_len;
*/
void * ir3_alloc(struct ir3 *shader, int sz)
{
- return ralloc_size(shader, sz);
+ return rzalloc_size(shader, sz); /* TODO: don't use rzalloc */
}
struct ir3 * ir3_create(struct ir3_compiler *compiler,
void
vc4_init_cl(void *mem_ctx, struct vc4_cl *cl)
{
- cl->base = ralloc_size(mem_ctx, 1);
+ cl->base = rzalloc_size(mem_ctx, 1); /* TODO: don't use rzalloc */
cl->next = cl->base;
cl->size = 0;
}
qir_compile_destroy(c);
struct vc4_key *dup_key;
- dup_key = ralloc_size(shader, key_size);
+ dup_key = rzalloc_size(shader, key_size); /* TODO: don't use rzalloc */
memcpy(dup_key, key, key_size);
_mesa_hash_table_insert(ht, dup_key, shader);
if (!brw->state_batch_list) {
/* Our structs are always aligned to at least 32 bytes, so
* our array doesn't need to be any larger
+ * TODO: don't use rzalloc
*/
- brw->state_batch_list = ralloc_size(brw, sizeof(*brw->state_batch_list) *
- batch->bo->size / 32);
+ brw->state_batch_list = rzalloc_size(brw, sizeof(*brw->state_batch_list) *
+ batch->bo->size / 32);
}
brw->state_batch_list[brw->state_batch_count].offset = offset;