On 6/7/07, chromatic <[EMAIL PROTECTED]> wrote:
When I run the t/01-sanity/06-use.t test in languages/perl6, I get an
assertion failure:
parrot: src/string.c:2028: string_hash: Assertion `s->encoding &&
s->charset
&& !(((s)->obj.flags) & b_PObj_on_free_list_FLAG)' failed.
Assertions like this really ought to be broken up in the source. By
using multiple assertions, it's immediately obvious which assertion as
actually failing. I've been meaning to split this up for quite some
time but never got around to it.
This happens when trying to hash a string (specifically the
string 'Perl6::Grammar::quote_term'). I dug into this a little bit. It's
the last test that fails; the string IS on the free list. Something isn't
marking it as live appropriately.
<snip>
The test then passed. The assertion was okay. The String is obviously live,
after it gets marked as live. I then wondered if strings get marked as live
when they're created. The answer was in new_string_header() in
src/headers.c:
PObj_get_FLAGS(string) |= flags
|PObj_is_string_FLAG|PObj_is_COWable_FLAG;
I changed it:
PObj_get_FLAGS(string) |= flags |
PObj_is_string_FLAG | PObj_is_COWable_FLAG | PObj_live_FLAG;
Adding the live flag fixed the problem (r18855).
Good work! This has been the cause of a number of Perl 6 GC errors. I
spent some time trying to track it down before but never made it as
far as you did.
Here's hoping that this is the last GC bug. ;-)
--
Matt Diephouse
http://matt.diephouse.com