mark huge allocations as unlikely

This cleans up the fast path a bit more by moving away more code.
This commit is contained in:
Daniel Micay
2014-10-23 10:30:52 -04:00
committed by Jason Evans
parent c93ed81cd0
commit 809b0ac391
4 changed files with 16 additions and 16 deletions

View File

@@ -264,7 +264,7 @@ a0alloc(size_t size, bool zero)
if (size == 0)
size = 1;
if (size <= arena_maxclass)
if (likely(size <= arena_maxclass))
ret = arena_malloc(NULL, a0get(), size, zero, false);
else
ret = huge_malloc(NULL, a0get(), size, zero, false);
@@ -295,7 +295,7 @@ a0free(void *ptr)
return;
chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
if (chunk != ptr)
if (likely(chunk != ptr))
arena_dalloc(NULL, chunk, ptr, false);
else
huge_dalloc(NULL, ptr, false);