Commit c5ff6a47 authored by Matthias Braun's avatar Matthias Braun
Browse files

plug memory leaks

parent b482d88d
......@@ -73,9 +73,8 @@ struct pdeq {
/**
* cache of unused, pdeq blocks to speed up new_pdeq and del_pdeq.
* +1 for compilers that can't grok empty arrays
*/
static pdeq *pdeq_block_cache[TUNE_NSAVED_PDEQS+1];
static pdeq *pdeq_block_cache[TUNE_NSAVED_PDEQS];
/**
* Number of pdeqs in pdeq_store.
......@@ -107,7 +106,7 @@ static inline void free_pdeq_block (pdeq *p)
static inline pdeq *alloc_pdeq_block (void)
{
pdeq *p;
if (TUNE_NSAVED_PDEQS && pdeqs_cached) {
if (pdeqs_cached > 0) {
p = pdeq_block_cache[--pdeqs_cached];
} else {
p = (pdeq*) xmalloc(PREF_MALLOC_SIZE);
......@@ -157,7 +156,6 @@ void del_pdeq(pdeq *dq)
qq = q->r;
free_pdeq_block(q);
} while ((q = qq));
}
/* Checks if a list is empty. */
......
......@@ -1243,7 +1243,7 @@ static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c)
*/
for (i = 0; i < env->k; ++i) {
int col = order[i].col;
waitq *good_starts = new_waitq();
waitq *good_starts;
aff_chunk_t *local_best;
int n_succeeded;
......@@ -1254,6 +1254,7 @@ static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c)
DB((dbg, LEVEL_2, "\ttrying color %d\n", col));
n_succeeded = 0;
good_starts = new_waitq();
/* try to bring all nodes of given chunk to the current color. */
for (idx = 0, len = ARR_LEN(c->n); idx < len; ++idx) {
......@@ -1292,8 +1293,10 @@ static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c)
}
/* try next color when failed */
if (n_succeeded == 0)
if (n_succeeded == 0) {
del_waitq(good_starts);
continue;
}
/* fragment the chunk according to the coloring */
local_best = fragment_chunk(env, col, c, tmp_chunks);
......
......@@ -186,7 +186,7 @@ ir_node *be_ifg_neighbours_begin(const be_ifg_t *ifg, neighbours_iter_t *iter,
const ir_node *irn)
{
find_neighbours(ifg, iter, irn);
return ir_nodeset_iterator_next(&iter->iter);
return get_next_neighbour(iter);
}
ir_node *be_ifg_neighbours_next(neighbours_iter_t *iter)
......
......@@ -1831,8 +1831,6 @@ static void move_loads_out_of_loops(scc *pscc, loop_env *env)
phi_entry *phi_list = NULL;
set *avail;
avail = new_set(cmp_avail_entry, 8);
/* collect all outer memories */
for (phi = pscc->head; phi != NULL; phi = next) {
node_entry *ne = get_irn_ne(phi, env);
......@@ -1866,6 +1864,8 @@ static void move_loads_out_of_loops(scc *pscc, loop_env *env)
if (phi_list->next != NULL)
return;
avail = new_set(cmp_avail_entry, 8);
for (load = pscc->head; load; load = next) {
ir_mode *load_mode;
node_entry *ne = get_irn_ne(load, env);
......
......@@ -590,6 +590,8 @@ static void extend_irn(ir_node *n, ir_node *newnode, bool new_is_backedge)
set_backedge(n, i);
}
}
free(ins);
free(bes);
}
/* Extends a block by a copy of its pred at pos,
......
......@@ -1518,6 +1518,8 @@ static ir_graph **create_irg_list(void)
callgraph_walk(NULL, callgraph_walker, &env);
assert(n_irgs == env.last_irg);
free_callgraph();
return env.irgs;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment