source: proiecte/swift/trunk/include/swift_allocator.h @ 176

Last change on this file since 176 was 176, checked in by (none), 14 years ago
  • imported repo from "guagal"
File size: 903 bytes
Line 
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
25struct swift_allocator_list {
26        void *aligned_addr;
27        void *next;
28};
29
30void* swift_malloc_system(size_t size);
31
32void swift_free_system(void *addr);
33
34void* swift_malloc(swift_thread_t *thread, size_t size);
35
36void swift_free(swift_thread_t *thread, void *addr);
37
38void 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.