Author: Whiteknight
Date: Tue Aug 12 16:03:02 2008
New Revision: 30193
Modified:
branches/gsoc_pdd09/src/gc/gc_it.c
Log:
[gsoc_pdd09] A couple assertions to make damn certain things are doing what I
think they are doing.
Modified: branches/gsoc_pdd09/src/gc/gc_it.c
==============================================================================
--- branches/gsoc_pdd09/src/gc/gc_it.c (original)
+++ branches/gsoc_pdd09/src/gc/gc_it.c Tue Aug 12 16:03:02 2008
@@ -151,6 +151,22 @@
arena_base->do_gc_mark = Parrot_gc_it_run;
arena_base->finalize_gc_system = Parrot_gc_it_deinit;
arena_base->init_pool = Parrot_gc_it_pool_init;
+ {
+ /* Let's just test the hell out of this to make sure that things are
+ doing what I think they are doing. */
+ Gc_it_hdr * hdr = 0;
+ UINTVAL h = (UINTVAL)hdr;
+ UINTVAL p;
+ PObj * pobj = (PObj*)(hdr + 1);
+ p = h + sizeof(Gc_it_hdr);
+ PARROT_ASSERT(&(hdr[1]) == (hdr + 1));
+ PARROT_ASSERT((hdr + 1) == (Gc_it_hdr*)((char*)hdr +
sizeof(Gc_it_hdr)));
+ PARROT_ASSERT((void*)pobj > (void*)hdr);
+ PARROT_ASSERT(p > h);
+ PARROT_ASSERT(p == (UINTVAL)pobj);
+ PARROT_ASSERT(hdr == PObj_to_IT_HDR(pobj));
+ PARROT_ASSERT(pobj == IT_HDR_to_PObj(hdr));
+ }
# if GC_IT_DEBUG
fprintf(stderr, "GC IT Initialized: %p\n", gc_priv_data);
fprintf(stderr, "SIZES. Hdr: %d, Data: %d\n", sizeof (Gc_it_hdr),