env.build_dir('modules', 'build/obj/modules')
# Setup include paths
env['CPPPATH'] += Dir['source/**/', 'modules/atf/source/']
+ # Turn on all warnings and treat them as errors, Also C99 strict mode
+ env['CFLAGS'] += ['-Wall', '-Wextra', '-Werror']
+ # Enable debug symbols for test
+ if Opts[:profile].include? "test"
+ env['CFLAGS'] += ['-g', '-O0']
+ else
+ env['CFLAGS'] += ['-O3']
+ end
+ # Enable profiling info
+ if Opts[:profile].include? "profile"
+ env['CFLAGS'] += ['-pg']
+ env['LDFLAGS'] += ['-pg']
+ end
+
+ # Enable coverage info
+ if Opts[:profile].include? "coverage"
+ env['CFLAGS'] += ['--coverage']
+ env['LDFLAGS'] += ['--coverage']
+ end
end
#------------------------------------------------------------------------------
-Subproject commit 0110dca83199322915e157fc1278ee6b58dfb4f8
+Subproject commit 04d4571218dbef83a4321209c21b383defb9dc16
void gc_init(void* stack_bottom)
{
+ (void)stack_bottom;
heap = heap_create();
}
-void* gc_alloc(uint64_t objmap, size_t num_slots)
+void* gc_object(uint64_t objmap, size_t num_slots)
{
+ (void)objmap;
return heap_allocate(heap, num_slots+1);
}
+void* gc_allocate(size_t size)
+{
+ size_t slot_sz = sizeof(uintptr_t);
+ size_t remainder = size % slot_sz;
+ size_t num_slots = (size / slot_sz) + ((remainder == 0) ? 0 : (slot_sz - remainder));
+ return heap_allocate(heap, num_slots + 1);
+}
+
void gc_collect(void)
{
}
heap_destroy(heap);
}
-/*****************************************************************************/
-
void gc_init(void* stack_bottom);
-void* gc_alloc(uint64_t objmap, size_t size);
+void* gc_object(uint64_t objmap, size_t num_slots);
+
+void* gc_allocate(size_t size);
void gc_collect(void);
void heap_destroy(heap_t* heap)
{
- int i;
+ unsigned int i;
block_t* current = heap->blocks;
/* Free all the large blocks */
while (NULL != current) {
/* Verify: segment_create
*************************************************************************/
TEST(Verify_Create_allocates_and_initializes_a_segment) {
- int i;
+ unsigned int i;
segment_t* seg = segment_create(2u, NULL);
CHECK(seg->blocksize == 2u);
CHECK(seg->start != NULL);