Rev | Line | |
---|
[176] | 1 | /* |
---|
| 2 | * swift_allocator.h |
---|
| 3 | * |
---|
| 4 | * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com> |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #ifndef SWIFT_ALLOCATOR_H_ |
---|
| 9 | #define SWIFT_ALLOCATOR_H_ |
---|
| 10 | |
---|
| 11 | #include <stdlib.h> |
---|
| 12 | #include "swift_common.h" |
---|
| 13 | #include "swift_thread.h" |
---|
| 14 | #include "swift_dfg.h" |
---|
| 15 | |
---|
| 16 | /* The address of malloc/realloc is 8 byte alligned */ |
---|
| 17 | #define SWIFT_MALLOC_ALIGN 8 |
---|
| 18 | |
---|
| 19 | /* The bucket count (i.e. the number of bites for the platform) */ |
---|
| 20 | #define SWIFT_BUCKET_COUNT 32 |
---|
| 21 | |
---|
| 22 | #define SWIFT_MEM_ALIGN(size) \ |
---|
| 23 | ( ((swift_size_t)(size) + (SWIFT_MALLOC_ALIGN) - 1) & (~((SWIFT_MALLOC_ALIGN) - 1)) ) |
---|
| 24 | |
---|
| 25 | struct swift_allocator_list { |
---|
| 26 | void *aligned_addr; |
---|
| 27 | void *next; |
---|
| 28 | }; |
---|
| 29 | |
---|
| 30 | void* swift_malloc_system(size_t size); |
---|
| 31 | |
---|
| 32 | void swift_free_system(void *addr); |
---|
| 33 | |
---|
| 34 | void* swift_malloc(swift_thread_t *thread, size_t size); |
---|
| 35 | |
---|
| 36 | void swift_free(swift_thread_t *thread, void *addr); |
---|
| 37 | |
---|
| 38 | void swift_retire_frame(swift_thread_t *thread, swift_frame_t *frame); |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | #endif /* SWIFT_ALLOCATOR_H_ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.