In theory, this patch should apply and run cleanly. It doesn't. Thus, something somewhere pokes into memory it shouldn't.
Any ideas? Alternately, any comments on this analysis? -- c
=== include/parrot/pobj.h ================================================================== --- include/parrot/pobj.h (revision 4520) +++ include/parrot/pobj.h (local) @@ -139,6 +139,7 @@ #define PMC_DATA_IN_EXT 1 struct PMC { + size_t sentinel; pobj_t obj; VTABLE *vtable; PMC *real_self; @@ -183,7 +184,7 @@ #ifdef NDEBUG # define PMC_ext_checked(pmc) (pmc)->pmc_ext #else -# define PMC_ext_checked(pmc) (assert((pmc)->pmc_ext), (pmc)->pmc_ext) +# define PMC_ext_checked(pmc) (assert((pmc)->pmc_ext && (pmc)->sentinel == 0xbeefbeef), (pmc)->pmc_ext) #endif /* NDEBUG */ #if PMC_DATA_IN_EXT # define PMC_data(pmc) PMC_ext_checked(pmc)->data === src/headers.c ================================================================== --- src/headers.c (revision 4520) +++ src/headers.c (local) @@ -249,6 +249,7 @@ ? interp->arena_base->constant_pmc_pool : interp->arena_base->pmc_pool; PMC * const pmc = (PMC *)pool->get_free_object(interp, pool); + pmc->sentinel = 0xbeefbeef; /* clear flags, set is_PMC_FLAG */ if (flags & PObj_is_PMC_EXT_FLAG) { === src/pmc/hash.pmc ================================================================== --- src/pmc/hash.pmc (revision 4520) +++ src/pmc/hash.pmc (local) @@ -526,6 +531,9 @@ */ PMC* get_pmc_keyed_str(STRING *key) { + if (!PMC_struct_val(SELF)) + return PMCNULL; + HashBucket * const b = parrot_hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF), key); === src/pmc.c ================================================================== --- src/pmc.c (revision 4520) +++ src/pmc.c (local) @@ -199,6 +199,7 @@ pmc->real_self = pmc; VTABLE_set_pointer(interp, pmc, pmc); } + pmc->sentinel = 0xdeadbeef; return pmc; } if (vtable->flags & VTABLE_IS_CONST_PMC_FLAG) { @@ -245,6 +246,7 @@ fprintf(stderr, "\t=> new %p type %d\n", pmc, (int)base_type); } #endif + pmc->sentinel = 0xbeefbeef; return pmc; }