@@ -113,7 +113,7 @@ STATIC machine_uint_t gc_lock_depth;
113113void gc_init (void * start , void * end ) {
114114 // align end pointer on block boundary
115115 end = (void * )((machine_uint_t )end & (~(BYTES_PER_BLOCK - 1 )));
116- DEBUG_printf ("Initializing GC heap: %p..%p = " UINT_FMT " bytes\n" , start , end , end - start );
116+ DEBUG_printf ("Initializing GC heap: %p..%p = " UINT_FMT " bytes\n" , start , end , ( byte * ) end - ( byte * ) start );
117117
118118 // calculate parameters for GC (T=total, A=alloc table, F=finaliser table, P=pool; all in bytes):
119119 // T = A + F + P
@@ -268,6 +268,7 @@ STATIC void gc_sweep(void) {
268268
269269 case AT_TAIL :
270270 if (free_tail ) {
271+ DEBUG_printf ("gc_sweep(%p)\n" ,PTR_FROM_BLOCK (block ));
271272 ATB_ANY_TO_FREE (block );
272273 }
273274 break ;
@@ -401,6 +402,7 @@ void *gc_alloc(machine_uint_t n_bytes, bool has_finaliser) {
401402
402403 // get pointer to first block
403404 void * ret_ptr = (void * )(gc_pool_start + start_block * WORDS_PER_BLOCK );
405+ DEBUG_printf ("gc_alloc(%p)\n" , ret_ptr );
404406
405407 // zero out the additional bytes of the newly allocated blocks
406408 // This is needed because the blocks may have previously held pointers
@@ -439,6 +441,7 @@ void gc_free(void *ptr_in) {
439441 }
440442
441443 machine_uint_t ptr = (machine_uint_t )ptr_in ;
444+ DEBUG_printf ("gc_free(%p)\n" , ptr );
442445
443446 if (VERIFY_PTR (ptr )) {
444447 machine_uint_t block = BLOCK_FROM_PTR (ptr );
@@ -590,7 +593,7 @@ void *gc_realloc(void *ptr_in, machine_uint_t n_bytes) {
590593 return NULL ;
591594 }
592595
593- DEBUG_printf ("gc_realloc: allocating new block \n" );
596+ DEBUG_printf ("gc_realloc(%p -> %p) \n" , ptr_in , ptr_out );
594597 memcpy (ptr_out , ptr_in , n_blocks * BYTES_PER_BLOCK );
595598 gc_free (ptr_in );
596599 return ptr_out ;
0 commit comments