Commit dfccf3ec authored by Laszlo Domoszlai's avatar Laszlo Domoszlai
Browse files

inline alloc_heap

parent 7415d5c0
...@@ -46,15 +46,15 @@ void* alloc_code(int size) { ...@@ -46,15 +46,15 @@ void* alloc_code(int size) {
return malloc(size); return malloc(size);
} }
#ifdef DEBUG
void* alloc_heap(int size) { void* alloc_heap(int size) {
char* curr = heap_curr; char* curr = heap_curr;
heap_curr += size; heap_curr += size;
#ifdef DEBUG
nr_heap_alloc++; nr_heap_alloc++;
#endif
assert(heap_curr - heap_start < heap_size); assert(heap_curr - heap_start < heap_size);
return curr; return curr;
} }
\ No newline at end of file #endif
\ No newline at end of file
...@@ -35,7 +35,10 @@ void* alloc_desc(int size); ...@@ -35,7 +35,10 @@ void* alloc_desc(int size);
// TODO: inline // TODO: inline
void* alloc_code(int size); void* alloc_code(int size);
// TODO: inline #ifdef DEBUG
void* alloc_heap(int size); void* alloc_heap(int size);
#else
#define alloc_heap(size) heap_curr; heap_curr += size
#endif
#endif // __MEM_H #endif // __MEM_H
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment