From: Mike D. Lowis Date: Tue, 31 Mar 2015 20:45:53 +0000 (-0400) Subject: Added skeleton for the heap module X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=de7638dc1082b012ae613e8f1f87c1695abc1e33;p=archive%2Fatc.git Added skeleton for the heap module --- diff --git a/Gemfile.lock b/Gemfile.lock index 22e438c..88f9e23 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,22 +2,23 @@ GEM remote: https://rubygems.org/ specs: diff-lcs (1.2.5) - json (1.8.1) - rake (10.3.2) - rscons (1.8.1) + json (1.8.2) + rake (10.4.2) + rscons (1.9.0) json (~> 1.0) - rspec (3.1.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-core (3.1.7) - rspec-support (~> 3.1.0) - rspec-expectations (3.1.2) + rspec (3.2.0) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-core (3.2.2) + rspec-support (~> 3.2.0) + rspec-expectations (3.2.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) - rspec-mocks (3.1.3) - rspec-support (~> 3.1.0) - rspec-support (3.1.2) + rspec-support (~> 3.2.0) + rspec-mocks (3.2.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-support (3.2.2) PLATFORMS ruby diff --git a/source/runtime/heap.c b/source/runtime/heap.c new file mode 100644 index 0000000..3635053 --- /dev/null +++ b/source/runtime/heap.c @@ -0,0 +1,24 @@ +/** + @file heap.c + @brief See header for details + $Revision$ + $HeadURL$ + */ +#include "heap.h" + +heap_t* heap_create(void) +{ + return NULL; +} + +void heap_destroy(heap_t* heap) +{ + (void)heap; +} + +void* heap_allocate(size_t block_size) +{ + (void)block_size; + return NULL; +} + diff --git a/source/runtime/heap.h b/source/runtime/heap.h new file mode 100644 index 0000000..54b78e6 --- /dev/null +++ b/source/runtime/heap.h @@ -0,0 +1,31 @@ +/** + @file heap.h + @brief TODO: Describe this file +*/ +#ifndef HEAP_H +#define HEAP_H + +#include "segment.h" + +#define NUM_HEAP_STACKS ((sizeof(uintptr_t) * 8u) - 3u) + +typedef struct segnode_t { + segment_t* segment; + struct segnode_t* next; +} segnode_t; + +typedef struct { + uintptr_t bytes_allocated; + struct { + segnode_t* first; + segnode_t* last; + } heaps[NUM_HEAP_STACKS]; +} heap_t; + +heap_t* heap_create(void); + +void heap_destroy(heap_t* heap); + +void* heap_allocate(size_t block_size); + +#endif /* HEAP_H */