Changeset c44e622 for src/examples/gc_no_raii/src/internal
- Timestamp:
- Feb 24, 2016, 10:36:17 AM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- ae7f1e0
- Parents:
- d41280e
- Location:
- src/examples/gc_no_raii/src/internal
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/gc_no_raii/src/internal/collector.c
rd41280e rc44e622 6 6 #include <string.h> 7 7 8 #include "fstream.h"8 #include <fstream> 9 9 10 10 #include "memory_pool.h" -
src/examples/gc_no_raii/src/internal/collector.h
rd41280e rc44e622 6 6 #include "tools.h" 7 7 8 #include "gcpointers.h" 9 #include "internal/collector.h" 10 #include "internal/gc_tools.h" 11 #include "internal/globals.h" 8 //#include "gcpointers.h" 9 //#include "internal/gc_tools.h" 10 //#include "internal/globals.h" 12 11 #include "internal/object_header.h" 13 #include "internal/state.h"12 //#include "internal/state.h" 14 13 #include "tools/worklist.h" 15 14 /* 16 15 inline bool gc_is_managed(void* address) 17 16 { … … 27 26 inline gc_memory_pool* gc_pool_of(void* address) 28 27 { 29 return (struct gc_memory_pool*)(((intptr_t)address) & POOL_PTR_MASK);28 //return (struct gc_memory_pool*)(((intptr_t)address) & POOL_PTR_MASK); 30 29 } 31 30 … … 47 46 48 47 void gc_scan_object(struct gc_object_header* object, worklist_t* worklist); 48 */ -
src/examples/gc_no_raii/src/internal/state.c
rd41280e rc44e622 1 1 #include "state.h" 2 2 3 #include <stdlib.h>4 5 // general purpouse includes6 #include "tools.h"7 8 // platform abstraction includes9 #include "allocate-pool.h"10 11 // gc internal includes12 // #include "globals.h"13 #include "memory_pool.h"3 // #include <stdlib.h> 4 // 5 // //general purpouse includes 6 // #include "tools.h" 7 // 8 // //platform abstraction includes 9 // #include "allocate-pool.h" 10 // 11 // //gc internal includes 12 // // #include "globals.h" 13 // #include "memory_pool.h" 14 14 // #include "memory_pool_iterator.h" 15 15 // #include "object_header.h" … … 25 25 // #endif 26 26 27 void gc_state_ctor(gc_state* state)28 {29 state->from_code = 0;30 state->to_space = NULL;31 state->from_space = NULL;32 state->total_space = 0;33 state->used_space = 0;34 // state->pools_table();35 36 gc_allocate_pool(state);37 38 state->is_initialized = true;39 }27 // void gc_state_ctor(gc_state* state) 28 // { 29 // state->from_code = 0; 30 // state->to_space = NULL; 31 // state->from_space = NULL; 32 // state->total_space = 0; 33 // state->used_space = 0; 34 // // state->pools_table(); 35 // 36 // gc_allocate_pool(state); 37 // 38 // state->is_initialized = true; 39 // } 40 40 41 41 // bool state::is_in_heap(void* address) const … … 59 59 // } 60 60 // 61 gc_object_header* gc_get_object_for_ref(gc_state* state, void* member)62 {63 intptr_t target = ((intptr_t)member);64 if(!gc_is_in_heap(state, member)) return NULL;65 66 gc_memory_pool* pool = gc_pool_of(member);67 gc_pool_object_iterator it = gc_pool_iterator_for(pool, member);68 gc_pool_object_iterator end = gc_pool_end(pool);69 70 while(it != end)71 {72 gc_object_header* object = *it;73 {74 intptr_t start = ((intptr_t)object);75 intptr_t end = ((intptr_t)start + object->size);76 if(start < target && end > target)77 {78 return object;79 }80 }81 ++it;82 }83 84 checkf(false, "is_in_heap() and iterator_for() return inconsistent data");85 abort();86 return NULL;87 }61 // gc_object_header* gc_get_object_for_ref(gc_state* state, void* member) 62 // { 63 // intptr_t target = ((intptr_t)member); 64 // if(!gc_is_in_heap(state, member)) return NULL; 65 // 66 // gc_memory_pool* pool = gc_pool_of(member); 67 // gc_pool_object_iterator it = gc_pool_iterator_for(pool, member); 68 // gc_pool_object_iterator end = gc_pool_end(pool); 69 // 70 // while(it != end) 71 // { 72 // gc_object_header* object = *it; 73 // { 74 // intptr_t start = ((intptr_t)object); 75 // intptr_t end = ((intptr_t)start + object->size); 76 // if(start < target && end > target) 77 // { 78 // return object; 79 // } 80 // } 81 // ++it; 82 // } 83 // 84 // checkf(false, "is_in_heap() and iterator_for() return inconsistent data"); 85 // abort(); 86 // return NULL; 87 // } 88 88 // 89 89 // void* state::try_allocate(size_t size)
Note: See TracChangeset
for help on using the changeset viewer.