* alloc.c (GC_clear_a_few_frames): Use BZERO().
* mark_rts.c (GC_clear_roots, GC_rebuild_root_index): Ditto.
* reclaim.c (GC_start_reclaim): Ditto.
* blacklst.c (total_stack_black_listed): Remove "len" local
variable.
* dbg_mlc.c (GC_generate_random_valid_address): Replace "for"
statement with "do-while" one.
* dyn_load.c (GC_register_dynamic_libraries,
GC_register_dynlib_callback): Remove redundant parentheses.
+2011-05-07 Ivan Maidanski <ivmai@mail.ru>
+
+ * alloc.c (GC_clear_a_few_frames): Use BZERO().
+ * mark_rts.c (GC_clear_roots, GC_rebuild_root_index): Ditto.
+ * reclaim.c (GC_start_reclaim): Ditto.
+ * blacklst.c (total_stack_black_listed): Remove "len" local
+ variable.
+ * dbg_mlc.c (GC_generate_random_valid_address): Replace "for"
+ statement with "do-while" one.
+ * dyn_load.c (GC_register_dynamic_libraries,
+ GC_register_dynlib_callback): Remove redundant parentheses.
+
2011-05-06 Ivan Maidanski <ivmai@mail.ru>
* cord/cordxtra.c (CORD_from_file_lazy_inner): Suppress
# define CLEAR_NWORDS 64
# endif
volatile word frames[CLEAR_NWORDS];
- int i;
-
- for (i = 0; i < CLEAR_NWORDS; i++) frames[i] = 0;
+ BZERO((word *)frames, CLEAR_NWORDS * sizeof(word));
}
/* Heap size at which we need a collection to avoid expanding past */
for (i = 0; i < GC_n_heap_sects; i++) {
struct hblk * start = (struct hblk *) GC_heap_sects[i].hs_start;
- size_t len = (word) GC_heap_sects[i].hs_bytes;
- struct hblk * endp1 = start + len/HBLKSIZE;
+ struct hblk * endp1 = start + GC_heap_sects[i].hs_bytes/HBLKSIZE;
total += GC_number_stack_black_listed(start, endp1);
}
{
ptr_t result;
ptr_t base;
- for (;;) {
- result = GC_generate_random_heap_address();
- base = GC_base(result);
- if (0 == base) continue;
- if (!GC_is_marked(base)) continue;
- return result;
- }
+ do {
+ result = GC_generate_random_heap_address();
+ base = GC_base(result);
+ } while (base == 0 || !GC_is_marked(base));
+ return result;
}
/* Print back trace for p */
struct link_map *lm = GC_FirstDLOpenedLinkMap();
- for (lm = GC_FirstDLOpenedLinkMap();
- lm != (struct link_map *) 0; lm = lm->l_next)
- {
+ for (lm = GC_FirstDLOpenedLinkMap(); lm != 0; lm = lm->l_next) {
ElfW(Ehdr) * e;
ElfW(Phdr) * p;
unsigned long offset;
# endif
p = ((ElfW(Phdr) *)(((char *)(e)) + e->e_phoff));
offset = ((unsigned long)(lm->l_addr));
- for( i = 0; i < (int)(e->e_phnum); ((i++),(p++)) ) {
+ for( i = 0; i < (int)e->e_phnum; i++, p++ ) {
switch( p->p_type ) {
case PT_LOAD:
{
return -1;
p = info->dlpi_phdr;
- for( i = 0; i < (int)(info->dlpi_phnum); ((i++),(p++)) ) {
+ for( i = 0; i < (int)info->dlpi_phnum; i++, p++ ) {
switch( p->p_type ) {
# ifdef PT_GNU_RELRO
case PT_GNU_RELRO:
}
# endif
lm = GC_FirstDLOpenedLinkMap();
- for (lm = GC_FirstDLOpenedLinkMap();
- lm != (struct link_map *) 0; lm = lm->l_next)
+ for (lm = GC_FirstDLOpenedLinkMap(); lm != 0; lm = lm->l_next)
{
ElfW(Ehdr) * e;
ElfW(Phdr) * p;
# endif
p = ((ElfW(Phdr) *)(((char *)(e)) + e->e_phoff));
offset = ((unsigned long)(lm->l_addr));
- for( i = 0; i < (int)(e->e_phnum); ((i++),(p++)) ) {
+ for( i = 0; i < (int)e->e_phnum; i++, p++ ) {
switch( p->p_type ) {
case PT_LOAD:
{
/* For each region in this module */
for (region = 0; region < moduleinfo.lmi_nregion; region++) {
-
/* Get the region information */
status = ldr_inq_region(mypid, moduleid, region, ®ioninfo,
regioninfosize, ®ionreturnsize);
for (q = p -> lf_ls; q != NIL; q = q -> ls_next) {
if ((q -> ls_flags & PCR_IL_SegFlags_Traced_MASK)
== PCR_IL_SegFlags_Traced_on) {
- GC_add_roots_inner
- ((char *)(q -> ls_addr),
- (char *)(q -> ls_addr) + q -> ls_bytes,
- TRUE);
+ GC_add_roots_inner((char *)(q -> ls_addr),
+ (char *)(q -> ls_addr) + q -> ls_bytes, TRUE);
}
}
}
n_root_sets = 0;
GC_root_size = 0;
# if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
- {
- int i;
- for (i = 0; i < RT_SIZE; i++) GC_root_index[i] = 0;
- }
+ BZERO(GC_root_index, RT_SIZE * sizeof(void *));
# endif
UNLOCK();
}
STATIC void GC_rebuild_root_index(void)
{
int i;
-
- for (i = 0; i < RT_SIZE; i++) GC_root_index[i] = 0;
+ BZERO(GC_root_index, RT_SIZE * sizeof(void *));
for (i = 0; i < n_root_sets; i++)
add_roots_to_index(GC_static_roots + i);
}
for (kind = 0; kind < GC_n_kinds; kind++) {
void **fop;
void **lim;
- struct hblk ** rlp;
- struct hblk ** rlim;
struct hblk ** rlist = GC_obj_kinds[kind].ok_reclaim_list;
GC_bool should_clobber = (GC_obj_kinds[kind].ok_descriptor != 0);
}
} /* otherwise free list objects are marked, */
/* and its safe to leave them */
- rlim = rlist + MAXOBJGRANULES+1;
- for( rlp = rlist; rlp < rlim; rlp++ ) {
- *rlp = 0;
- }
+ BZERO(rlist, (MAXOBJGRANULES + 1) * sizeof(void *));
}