Merge branch 'dev'

This commit is contained in:
Jason Evans 2010-08-12 12:11:58 -07:00
commit e139ab8b4f
3 changed files with 6 additions and 6 deletions

View File

@ -254,7 +254,6 @@ arena_run_reg_alloc(arena_run_t *run, arena_bin_t *bin)
run->nfree--; run->nfree--;
ret = run->avail; ret = run->avail;
if (ret != NULL) { if (ret != NULL) {
run->avail = *(void **)ret;
/* Double free can cause assertion failure.*/ /* Double free can cause assertion failure.*/
assert(ret != NULL); assert(ret != NULL);
/* Write-after free can cause assertion failure. */ /* Write-after free can cause assertion failure. */
@ -264,6 +263,7 @@ arena_run_reg_alloc(arena_run_t *run, arena_bin_t *bin)
assert(((uintptr_t)ret - ((uintptr_t)run + assert(((uintptr_t)ret - ((uintptr_t)run +
(uintptr_t)bin->reg0_offset)) % (uintptr_t)bin->reg_size == (uintptr_t)bin->reg0_offset)) % (uintptr_t)bin->reg_size ==
0); 0);
run->avail = *(void **)ret;
return (ret); return (ret);
} }
ret = run->next; ret = run->next;

View File

@ -324,6 +324,7 @@ malloc_init_hard(void)
CPU_SPINWAIT; CPU_SPINWAIT;
malloc_mutex_lock(&init_lock); malloc_mutex_lock(&init_lock);
} while (malloc_initialized == false); } while (malloc_initialized == false);
malloc_mutex_unlock(&init_lock);
return (false); return (false);
} }

View File

@ -239,16 +239,15 @@ prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max)
} }
/* /*
* Iterate over stack frames until there are no more. Heap-allocate * Iterate over stack frames until there are no more, or until no space
* and iteratively grow a larger bt if necessary. * remains in bt.
*/ */
for (i = 0; i < max; i++) { for (i = 0; i < max; i++) {
unw_get_reg(&cursor, UNW_REG_IP, (unw_word_t *)&bt->vec[i]); unw_get_reg(&cursor, UNW_REG_IP, (unw_word_t *)&bt->vec[i]);
bt->len++;
err = unw_step(&cursor); err = unw_step(&cursor);
if (err <= 0) { if (err <= 0)
bt->len = i;
break; break;
}
} }
} }
#else #else