diff options
author | Nathan Sidwell <nathan@gcc.gnu.org> | 2004-09-09 13:54:07 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2004-09-09 13:54:07 +0000 |
commit | 282899df0fb5881ddaf70814d095286221d6019e (patch) | |
tree | 186a20ffec3fade2a9f7714afe4a71cd22d79511 /gcc/ggc-zone.c | |
parent | 2a88ebca7670b70c245035a99fd17051f329820f (diff) | |
download | gcc-282899df0fb5881ddaf70814d095286221d6019e.zip gcc-282899df0fb5881ddaf70814d095286221d6019e.tar.gz gcc-282899df0fb5881ddaf70814d095286221d6019e.tar.bz2 |
gcse.c (INSN_CUID, [...]): Use gcc_assert and gcc_unreachable.
* gcse.c (INSN_CUID, insert_set_in_table, find_avail_set,
cprop_insn, do_local_cprop, local_cprop_pass, find_bypass_set,
process_insert_insn, insert_insn_end_bb, pre_insert_copy_insn,
hoist_code, extract_mentioned_regs_helper, compute_store_table,
insert_store): Use gcc_assert and gcc_unreachable.
* ggc-common.c (ggc_splay_alloc, ggc_splay_dont_free,
gt_pch_note_object, gt_pch_note_reorder, relocate_ptrs,
ggc_record_overhead): Likewise.
* ggc-page.c (alloc_page, free_page, ggc_set_mark, ggc_marked_p,
init_ggc, ggc_push_context, ggc_recalculate_in_use_p,
ggc_pop_context, clear_marks, validate_free_objects,
ggc_pch_read): Likewise.
* ggc-zone.c (ggc_allocated_p, free_chunk, ggc_set_mark,
ggc_marked_p, ggc_get_size, init_ggc, destroy_ggc_zone,
ggc_push_context, check_cookies, ggc_collect,
ggc_print_statistics): Likewise.
* gimple-low.c (lower_function_body, lower_stmt,
lower_bind_expr): Likewise.
* gimplify.c (gimple_tree_eq, push_gimplify_context,
pop_gimplify_context, gimple_pop_condition, create_tmp_var,
declare_tmp_vars, gimple_add_tmp_var, annotate_all_with_locus,
mostly_copy_tree_r, gimplify_return_expr, gimplify_switch_expr,
gimplify_case_label_expr, gimplify_exit_block_expr,
canonicalize_component_ref, gimplify_compound_lval,
gimplify_self_mod_expr, gimplify_call_expr,
gimplify_init_ctor_eval, gimplify_init_constructor,
gimplify_modify_expr, gimplify_save_expr, gimplify_target_expr,
gimplify_expr, check_pointer_types_r,
force_gimple_operand): Likewise.
* global.c (global_alloc, build_insn_chain): Likewise.
* graph.c (clean_graph_dump_file,
finish_graph_dump_file): Likewise.
gcov-io.c (gcov_open): Use GCOV_CHECK.
From-SVN: r87240
Diffstat (limited to 'gcc/ggc-zone.c')
-rw-r--r-- | gcc/ggc-zone.c | 53 |
1 files changed, 18 insertions, 35 deletions
diff --git a/gcc/ggc-zone.c b/gcc/ggc-zone.c index 86fbc28..311fff6 100644 --- a/gcc/ggc-zone.c +++ b/gcc/ggc-zone.c @@ -368,8 +368,7 @@ ggc_allocated_p (const void *p) struct alloc_chunk *chunk; chunk = (struct alloc_chunk *) ((char *)p - CHUNK_OVERHEAD); #ifdef COOKIE_CHECKING - if (chunk->magic != CHUNK_MAGIC) - abort (); + gcc_assert (chunk->magic == CHUNK_MAGIC); #endif if (chunk->type == 1) return true; @@ -578,13 +577,11 @@ free_chunk (struct alloc_chunk *chunk, size_t size, struct alloc_zone *zone) size_t bin = 0; bin = SIZE_BIN_DOWN (size); - if (bin == 0) - abort (); + gcc_assert (bin); if (bin > NUM_FREE_BINS) bin = 0; #ifdef COOKIE_CHECKING - if (chunk->magic != CHUNK_MAGIC && chunk->magic != DEADCHUNK_MAGIC) - abort (); + gcc_assert (chunk->magic == CHUNK_MAGIC || chunk->magic == DEADCHUNK_MAGIC); chunk->magic = DEADCHUNK_MAGIC; #endif chunk->u.next_free = zone->free_chunks[bin]; @@ -830,8 +827,7 @@ ggc_set_mark (const void *p) chunk = (struct alloc_chunk *) ((char *)p - CHUNK_OVERHEAD); #ifdef COOKIE_CHECKING - if (chunk->magic != CHUNK_MAGIC) - abort (); + gcc_assert (chunk->magic == CHUNK_MAGIC); #endif if (chunk->mark) return 1; @@ -854,8 +850,7 @@ ggc_marked_p (const void *p) chunk = (struct alloc_chunk *) ((char *)p - CHUNK_OVERHEAD); #ifdef COOKIE_CHECKING - if (chunk->magic != CHUNK_MAGIC) - abort (); + gcc_assert (chunk->magic == CHUNK_MAGIC); #endif return chunk->mark; } @@ -869,8 +864,7 @@ ggc_get_size (const void *p) chunk = (struct alloc_chunk *) ((char *)p - CHUNK_OVERHEAD); #ifdef COOKIE_CHECKING - if (chunk->magic != CHUNK_MAGIC) - abort (); + gcc_assert (chunk->magic == CHUNK_MAGIC); #endif if (chunk->large) return chunk->size * 1024; @@ -895,8 +889,7 @@ init_ggc (void) G.lg_pagesize = exact_log2 (G.pagesize); #ifdef HAVE_MMAP_DEV_ZERO G.dev_zero_fd = open ("/dev/zero", O_RDONLY); - if (G.dev_zero_fd == -1) - abort (); + gcc_assert (G.dev_zero_fd != -1); #endif #if 0 @@ -920,8 +913,7 @@ init_ggc (void) can't get something useful, give up. */ p = alloc_anon (NULL, G.pagesize, &main_zone); - if ((size_t)p & (G.pagesize - 1)) - abort (); + gcc_assert (!((size_t)p & (G.pagesize - 1))); } /* We have a good page, might as well hold onto it... */ @@ -953,13 +945,11 @@ destroy_ggc_zone (struct alloc_zone * dead_zone) struct alloc_zone *z; for (z = G.zones; z && z->next_zone != dead_zone; z = z->next_zone) - /* Just find that zone. */ ; + /* Just find that zone. */ + continue; -#ifdef ENABLE_CHECKING /* We should have found the zone in the list. Anything else is fatal. */ - if (!z) - abort (); -#endif + gcc_assert (z); /* z is dead, baby. z is dead. */ z->dead= true; @@ -975,8 +965,7 @@ ggc_push_context (void) for (zone = G.zones; zone; zone = zone->next_zone) ++(zone->context_depth); /* Die on wrap. */ - if (main_zone.context_depth >= HOST_BITS_PER_LONG) - abort (); + gcc_assert (main_zone.context_depth < HOST_BITS_PER_LONG); } /* Decrement the `GC context'. All objects allocated since the @@ -1204,8 +1193,8 @@ check_cookies (void) struct alloc_chunk *end = (struct alloc_chunk *)(p->page + G.pagesize); do { - if (chunk->magic != CHUNK_MAGIC && chunk->magic != DEADCHUNK_MAGIC) - abort (); + gcc_assert (chunk->magic == CHUNK_MAGIC + || chunk->magic == DEADCHUNK_MAGIC); chunk = (struct alloc_chunk *)(chunk->u.data + chunk->size); } while (chunk < end); @@ -1334,8 +1323,7 @@ ggc_collect (void) printf ("Zone `%s' is dead and will be freed.\n", dead_zone->name); /* The zone must be empty. */ - if (dead_zone->allocated != 0) - abort (); + gcc_assert (!dead_zone->allocated); /* Unchain the dead zone, release all its pages and free it. */ zone->next_zone = zone->next_zone->next_zone; @@ -1415,10 +1403,7 @@ ggc_print_statistics (void) in_use += p->bytes - CHUNK_OVERHEAD; chunk = (struct alloc_chunk *) p->page; overhead += CHUNK_OVERHEAD; - if (!chunk->type) - abort (); - if (chunk->mark) - abort (); + gcc_assert (chunk->type && !chunk->mark); continue; } @@ -1429,8 +1414,7 @@ ggc_print_statistics (void) overhead += CHUNK_OVERHEAD; if (chunk->type) in_use += chunk->size; - if (chunk->mark) - abort (); + gcc_assert (!chunk->mark); } } fprintf (stderr, "%20s %10lu%c %10lu%c %10lu%c\n", @@ -1439,8 +1423,7 @@ ggc_print_statistics (void) SCALE (in_use), LABEL (in_use), SCALE (overhead), LABEL (overhead)); - if (in_use != zone->allocated) - abort (); + gcc_assert (in_use == zone->allocated); total_overhead += overhead; total_allocated += zone->allocated; |