equal
deleted
inserted
replaced
54 } |
54 } |
55 |
55 |
56 template <class Chunk_t, template <class> class FreeList_t> |
56 template <class Chunk_t, template <class> class FreeList_t> |
57 void TreeChunk<Chunk_t, FreeList_t>::verify_tree_chunk_list() const { |
57 void TreeChunk<Chunk_t, FreeList_t>::verify_tree_chunk_list() const { |
58 TreeChunk<Chunk_t, FreeList_t>* nextTC = (TreeChunk<Chunk_t, FreeList_t>*)next(); |
58 TreeChunk<Chunk_t, FreeList_t>* nextTC = (TreeChunk<Chunk_t, FreeList_t>*)next(); |
59 if (prev() != NULL) { // interior list node shouldn'r have tree fields |
59 if (prev() != NULL) { // interior list node shouldn't have tree fields |
60 guarantee(embedded_list()->parent() == NULL && embedded_list()->left() == NULL && |
60 guarantee(embedded_list()->parent() == NULL && embedded_list()->left() == NULL && |
61 embedded_list()->right() == NULL, "should be clear"); |
61 embedded_list()->right() == NULL, "should be clear"); |
62 } |
62 } |
63 if (nextTC != NULL) { |
63 if (nextTC != NULL) { |
64 guarantee(as_TreeChunk(nextTC->prev()) == this, "broken chain"); |
64 guarantee(as_TreeChunk(nextTC->prev()) == this, "broken chain"); |
245 } |
245 } |
246 // Chunk is interior to the list |
246 // Chunk is interior to the list |
247 prevFC->link_after(nextTC); |
247 prevFC->link_after(nextTC); |
248 } |
248 } |
249 |
249 |
250 // Below this point the embeded TreeList<Chunk_t, FreeList_t> being used for the |
250 // Below this point the embedded TreeList<Chunk_t, FreeList_t> being used for the |
251 // tree node may have changed. Don't use "this" |
251 // tree node may have changed. Don't use "this" |
252 // TreeList<Chunk_t, FreeList_t>*. |
252 // TreeList<Chunk_t, FreeList_t>*. |
253 // chunk should still be a free chunk (bit set in _prev) |
253 // chunk should still be a free chunk (bit set in _prev) |
254 assert(!retTL->head() || retTL->size() == retTL->head()->size(), |
254 assert(!retTL->head() || retTL->size() == retTL->head()->size(), |
255 "Wrong sized chunk in list"); |
255 "Wrong sized chunk in list"); |
701 } |
701 } |
702 } else { |
702 } else { |
703 // The only use of this method would not pass the root of the |
703 // The only use of this method would not pass the root of the |
704 // tree (as indicated by the assertion above that the tree list |
704 // tree (as indicated by the assertion above that the tree list |
705 // has a parent) but the specification does not explicitly exclude the |
705 // has a parent) but the specification does not explicitly exclude the |
706 // passing of the root so accomodate it. |
706 // passing of the root so accommodate it. |
707 set_root(NULL); |
707 set_root(NULL); |
708 } |
708 } |
709 debug_only( |
709 debug_only( |
710 curTL->clear_parent(); // Test if this needs to be cleared |
710 curTL->clear_parent(); // Test if this needs to be cleared |
711 curTL->clear_right(); // recall, above, left child is already null |
711 curTL->clear_right(); // recall, above, left child is already null |