|
@@ -68,11 +68,11 @@ int posix_memalign(void **memptr, size_t alignment, size_t size) {
|
|
|
|
|
|
* is size + alignment - 1 */
|
|
* is size + alignment - 1 */
|
|
SLIST_FOREACH(raw_block, &systemallocator.rb_head, pointers) {
|
|
SLIST_FOREACH(raw_block, &systemallocator.rb_head, pointers) {
|
|
- lock_raw_block(raw_block);
|
|
+ LOCK_RAW_BLOCK(raw_block);
|
|
encapsulated_rb = (freelist_rb_t *)
|
|
encapsulated_rb = (freelist_rb_t *)
|
|
((uintptr_t) raw_block + sizeof(raw_block_header_t));
|
|
((uintptr_t) raw_block + sizeof(raw_block_header_t));
|
|
*memptr = dmmlib_malloc(encapsulated_rb, size + alignment - 1);
|
|
*memptr = dmmlib_malloc(encapsulated_rb, size + alignment - 1);
|
|
- unlock_raw_block(raw_block);
|
|
+ UNLOCK_RAW_BLOCK(raw_block);
|
|
|
|
|
|
CheckAlignment:
|
|
CheckAlignment:
|
|
|
|
|
|
@@ -162,10 +162,10 @@ CheckAlignment:
|
|
if(*memptr != NULL) {
|
|
if(*memptr != NULL) {
|
|
|
|
|
|
#ifdef WITH_DEBUG
|
|
#ifdef WITH_DEBUG
|
|
- lock_global();
|
|
+ LOCK_GLOBAL();
|
|
SLIST_INSERT_HEAD(&systemallocator.bb_head,
|
|
SLIST_INSERT_HEAD(&systemallocator.bb_head,
|
|
(raw_block_header_t *) *memptr, pointers);
|
|
(raw_block_header_t *) *memptr, pointers);
|
|
- unlock_global();
|
|
+ UNLOCK_GLOBAL();
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_ALLOCATOR_STATS
|
|
#ifdef WITH_ALLOCATOR_STATS
|
|
@@ -197,18 +197,18 @@ CheckAlignment:
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- lock_global();
|
|
+ LOCK_GLOBAL();
|
|
raw_block = create_raw_block((size_t) SYS_ALLOC_SIZE,
|
|
raw_block = create_raw_block((size_t) SYS_ALLOC_SIZE,
|
|
DEFAULT_RB_TYPE);
|
|
DEFAULT_RB_TYPE);
|
|
if(raw_block != NULL) {
|
|
if(raw_block != NULL) {
|
|
- lock_raw_block(raw_block);
|
|
+ LOCK_RAW_BLOCK(raw_block);
|
|
SLIST_INSERT_HEAD(&systemallocator.rb_head, raw_block, pointers);
|
|
SLIST_INSERT_HEAD(&systemallocator.rb_head, raw_block, pointers);
|
|
- unlock_global();
|
|
+ UNLOCK_GLOBAL();
|
|
|
|
|
|
encapsulated_rb = (DEFAULT_RB_T *)
|
|
encapsulated_rb = (DEFAULT_RB_T *)
|
|
((uintptr_t) raw_block + sizeof(raw_block_header_t));
|
|
((uintptr_t) raw_block + sizeof(raw_block_header_t));
|
|
*memptr = dmmlib_malloc(encapsulated_rb, size + alignment - 1);
|
|
*memptr = dmmlib_malloc(encapsulated_rb, size + alignment - 1);
|
|
- unlock_raw_block(raw_block);
|
|
+ UNLOCK_RAW_BLOCK(raw_block);
|
|
|
|
|
|
if(*memptr != NULL) {
|
|
if(*memptr != NULL) {
|
|
goto CheckAlignment;
|
|
goto CheckAlignment;
|