@@ -56,11 +56,16 @@ impl BlockList {
5656 // }
5757 #[ cfg( feature = "ms_block_list_sanity" ) ]
5858 fn verify_block_list ( & self , sanity_list : & mut Vec < Block > ) {
59- if !sanity_list. iter ( ) . map ( |b| * b) . eq ( BlockListIterator { cursor : self . first } ) {
59+ if !sanity_list
60+ . iter ( )
61+ . map ( |b| * b)
62+ . eq ( BlockListIterator { cursor : self . first } )
63+ {
6064 eprintln ! ( "Sanity block list: {:?}" , sanity_list) ;
6165 eprintln ! ( "First {:?}" , sanity_list. get( 0 ) ) ;
6266 eprintln ! ( "Actual block list: {:?}" , self ) ;
6367 eprintln ! ( "First {:?}" , self . first) ;
68+ eprintln ! ( "Block list {:?}" , self as * const _) ;
6469 panic ! ( "Incorrect block list" ) ;
6570 }
6671 }
@@ -81,6 +86,7 @@ impl BlockList {
8186
8287 /// Remove a block from the list
8388 pub fn remove ( & mut self , block : Block ) {
89+ trace ! ( "Blocklist {:?}: Remove {:?}" , self as * const _, block) ;
8490 match ( block. load_prev_block ( ) , block. load_next_block ( ) ) {
8591 ( None , None ) => {
8692 self . first = None ;
@@ -89,12 +95,14 @@ impl BlockList {
8995 ( None , Some ( next) ) => {
9096 next. clear_prev_block ( ) ;
9197 self . first = Some ( next) ;
92- next. store_block_list ( self ) ;
98+ // next.store_block_list(self);
99+ debug_assert_eq ! ( next. load_block_list( ) , self as * mut _) ;
93100 }
94101 ( Some ( prev) , None ) => {
95102 prev. clear_next_block ( ) ;
96103 self . last = Some ( prev) ;
97- prev. store_block_list ( self ) ;
104+ // prev.store_block_list(self);
105+ debug_assert_eq ! ( prev. load_block_list( ) , self as * mut _) ;
98106 }
99107 ( Some ( prev) , Some ( next) ) => {
100108 prev. store_next_block ( next) ;
@@ -105,7 +113,11 @@ impl BlockList {
105113 #[ cfg( feature = "ms_block_list_sanity" ) ]
106114 {
107115 let mut sanity_list = self . sanity_list . lock ( ) . unwrap ( ) ;
108- if let Some ( ( index, _) ) = sanity_list. iter ( ) . enumerate ( ) . find ( |& ( _, & val) | val == block) {
116+ if let Some ( ( index, _) ) = sanity_list
117+ . iter ( )
118+ . enumerate ( )
119+ . find ( |& ( _, & val) | val == block)
120+ {
109121 sanity_list. remove ( index) ;
110122 } else {
111123 panic ! ( "Cannot find {:?} in the block list" , block) ;
@@ -144,11 +156,13 @@ impl BlockList {
144156 assert_eq ! ( sanity_ret, ret) ;
145157 }
146158
159+ trace ! ( "Blocklist {:?}: Pop = {:?}" , self as * const _, ret) ;
147160 ret
148161 }
149162
150163 /// Push block to the front of the list
151164 pub fn push ( & mut self , block : Block ) {
165+ trace ! ( "Blocklist {:?}: Push {:?}" , self as * const _, block) ;
152166 if self . is_empty ( ) {
153167 block. clear_next_block ( ) ;
154168 block. clear_prev_block ( ) ;
@@ -173,6 +187,11 @@ impl BlockList {
173187
174188 /// Moves all the blocks of `other` into `self`, leaving `other` empty.
175189 pub fn append ( & mut self , other : & mut BlockList ) {
190+ trace ! (
191+ "Blocklist {:?}: Append Blocklist {:?}" ,
192+ self as * const _,
193+ other as * const _
194+ ) ;
176195 #[ cfg( feature = "ms_block_list_sanity" ) ]
177196 {
178197 // Check before merging
@@ -226,6 +245,7 @@ impl BlockList {
226245
227246 /// Remove all blocks
228247 fn reset ( & mut self ) {
248+ trace ! ( "Blocklist {:?}: Reset" , self as * const _) ;
229249 self . first = None ;
230250 self . last = None ;
231251
@@ -252,10 +272,12 @@ impl BlockList {
252272 . compare_exchange ( false , true , Ordering :: SeqCst , Ordering :: SeqCst )
253273 . is_ok ( ) ;
254274 }
275+ trace ! ( "Blocklist {:?}: locked" , self as * const _) ;
255276 }
256277
257278 /// Unlock list. See the comments on the lock method.
258279 pub fn unlock ( & mut self ) {
280+ trace ! ( "Blocklist {:?}: unlock" , self as * const _) ;
259281 self . lock . store ( false , Ordering :: SeqCst ) ;
260282 }
261283
0 commit comments