Changeset fd782b2 for src/examples/gc_no_raii/src/internal/state.c
- Timestamp:
- Sep 15, 2016, 10:55:52 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- aa8f9df
- Parents:
- f006f01 (diff), 1eba452 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/gc_no_raii/src/internal/state.c
rf006f01 rfd782b2 21 21 void gc_state_calc_usage(gc_state *const this); 22 22 23 #if 23 #ifndef NDEBUG 24 24 bool gc_state_roots_match(gc_state *const this); 25 25 bool gc_state_no_from_space_ref(gc_state *const this); … … 76 76 gc_object_header* gc_get_object_for_ref(gc_state* state, void* member) 77 77 { 78 volatile int stage = 0; 78 79 intptr_t target = ((intptr_t)member); 79 80 if(!gc_is_in_heap(state, member)) return NULL; 81 stage++; 80 82 81 83 gc_memory_pool* pool = gc_pool_of(member); 84 stage++; 82 85 gc_pool_object_iterator it = gc_pool_iterator_for(pool, member); 86 stage++; 83 87 gc_pool_object_iterator end = end(pool); 88 stage++; 84 89 85 90 while(it != end) 86 91 { 87 92 gc_object_header* object = *it; 93 check(object); 94 check( is_valid(object) ); 88 95 { 89 96 intptr_t start = ((intptr_t)object); … … 94 101 } 95 102 } 103 stage++; 96 104 ++it; 97 105 } 98 106 99 checkf( false, "is_in_heap() and iterator_for() return inconsistent data");107 checkf( (int) 0, "is_in_heap() and iterator_for() return inconsistent data"); 100 108 abort(); 101 109 return NULL; … … 176 184 this->from_code = (~this->from_code) & 0x01; 177 185 178 #if _DEBUG186 #ifndef NDEBUG 179 187 { 180 188 gc_memory_pool* pool = this->from_space; … … 251 259 } 252 260 253 #if _DEBUG261 #ifndef NDEBUG 254 262 bool gc_state_roots_match(gc_state* const this) 255 263 { … … 265 273 size += object->size; 266 274 267 gcpointer_ base* ptr = object->root_chain;275 gcpointer_t* ptr = object->root_chain; 268 276 while(ptr) 269 277 { 270 check(g et_object_ptr(ptr->m_ptr) == object);271 ptr = ptr-> m_next;278 check(gc_get_object_ptr( (void*)ptr->ptr ) == object); 279 ptr = ptr->next; 272 280 } 273 281 } 274 282 275 check(size + gc_pool_size_used(pool) == gc_pool_size_total(pool)); 283 checkf(size + gc_pool_size_left(pool) == gc_pool_size_total(pool), 284 (const char*)"expected %lu + %lu == %lu\n", 285 (size_t)size, 286 (size_t)gc_pool_size_left(pool), 287 (size_t)gc_pool_size_total(pool)); 276 288 277 289 pool = pool->next; … … 286 298 while(pool) 287 299 { 288 void** potential_ref = (void**)pool-> m_start;289 while(potential_ref < (void**)pool-> m_free)300 void** potential_ref = (void**)pool->start_p; 301 while(potential_ref < (void**)pool->free_p) 290 302 { 291 303 check(!gc_is_in_heap(this, *potential_ref));
Note: See TracChangeset
for help on using the changeset viewer.