Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Whiteknight (8626)

Whiteknight
  (email not shown publicly)
http://en.wikibo ... User:Whiteknight
AOL IM: wknight8111 (Add Buddy, Send Message)

My name's Andrew. I'm an open-content advocate at http://en.wikibooks.org. I'm also involved with Parrot as a semi-competent C hacker. This blog is going to be a forum where I can ramble about minutia and post information about perl-world stuff that I care about.

Journal of Whiteknight (8626)

Sunday July 13, 2008
02:52 PM

Success! ...ish, Again!

[ #36905 ]

I ended last week with a major overhaul, reordering and refactoring of my sweep code. I was marking cards in the opposite order from how I was sweeping them, which caused me to prematurely free a number of PMCs. So I fixed that, ran it again, and...segfault. I don't get down about seeing that error anymore, it's just another hurdle to cross and I'm definitely up for the challenge.

I trace it out, and one of my PMCs is still being freed prematurely, somewhere buried deep in the hash code (i think). I know the PMC is being freed prematurely, because the PMC destruction code, Parrot_dod_free_pmc, assigns the vtable, pmc_ext, and data pointers to the oft-amusing value 0xdeadbeef. I love finding words that you can spell in hexadecimal, it brings back memories of writing out 55378008 in our calculators and turning them upside-down in math class (never done it? try it for a quick low-brow laugh).

I know the PMC in question is being freed prematurely, and there are only two places where a PMC is freed: In gc_it_add_free_object and gc_it_sweep_pmc_pools. On a hunch, I comment out the call to the later and...it compiles without error. That function in turn sweeps the pmc and const_pmc pools, so now I test commenting out each of those and figuring out which one causes the error. From there, I can try to figure out how the offending PMC gets freed in the first place: is it not being marked properly? If marked, is the sweep code not reading the mark properly? And, if both of those aren't an issue, is the PMC being improperly freed in some other way? This might be my last big core error. It might not be, of course, but I have my fingers crossed. I fix this, and hopefully I can start re-integrating some of the components I've commented out (specifically the compacting code on the Memory_Pool allocator, and the system stack tracing code). Then, when everything gets back up to a point where everything is working as well as it was before I started, I can divert and start adding all sorts of shiney new features to the mix, several of which have been sitting on the back burner while the basics have been in the works.

I'd like (for what little my preference is worth) to have this particular problem resolved this week so I can get moving on the rest of the work I need to do. I probably won't make it to #ps this week, but I don't have much worth reporting there anyway.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Look at a Java .class file in a hex editor sometime. The first 4 bytes (8 hex chars) are the magic number that identifies the file type.

    • Yeah, I'm familiar with Java's 0xcafebabe. It's one of the better magic numbers for binary file formats (beats 'MZ' anyday).

      --
      Andrew Whitworth