Refactor checks to improve codegen.
This commit is contained in:
committed by
Matthew Parkinson
parent
0983f1837b
commit
ed615eade9
@@ -139,10 +139,9 @@ namespace snmalloc
|
||||
# ifndef NDEBUG
|
||||
if (next != nullptr)
|
||||
{
|
||||
if (unlikely(different_slab(prev, next)))
|
||||
{
|
||||
error("Heap corruption - free list corrupted!");
|
||||
}
|
||||
check_client(
|
||||
!different_slab(prev, next),
|
||||
"Heap corruption - free list corrupted!");
|
||||
}
|
||||
# endif
|
||||
prev = address_cast(curr);
|
||||
@@ -162,10 +161,8 @@ namespace snmalloc
|
||||
void move_next()
|
||||
{
|
||||
#ifdef CHECK_CLIENT
|
||||
if (unlikely(different_slab(prev, curr)))
|
||||
{
|
||||
error("Heap corruption - free list corrupted!");
|
||||
}
|
||||
check_client(
|
||||
!different_slab(prev, curr), "Heap corruption - free list corrupted!");
|
||||
#endif
|
||||
update_cursor(curr->read_next(get_prev()));
|
||||
}
|
||||
@@ -221,6 +218,14 @@ namespace snmalloc
|
||||
return front.get_curr() == nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current head without affecting the iterator.
|
||||
*/
|
||||
void* peek()
|
||||
{
|
||||
return front.get_curr();
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the iterator on, and returns the current value.
|
||||
*/
|
||||
@@ -258,7 +263,7 @@ namespace snmalloc
|
||||
*/
|
||||
void* peek_head()
|
||||
{
|
||||
return front.get_curr();
|
||||
return peek();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user