Hi.

Another section of questions:

>From rts/sm/Evac.c:
(...)
>    Changing evacuate() to take an (StgClosure **) rather than
>    returning the new pointer seems attractive, because we can avoid
>    writing back the pointer when it hasn't changed (eg. for a static
>    object, or an object in a generation > N).  However, I tried it and
>    it doesn't help.  One reason is that the (StgClosure **) pointer
>    gets spilled to the stack inside evacuate(), resulting in far more
>    extra reads/writes than we save.

This comment seems to be outdated, since evacuate doesn't take a StgClosure
**.  Should it be removed, and maybe something added in it's place?

(...)

The mark_stack is used only for compaction, right?  So why can't the code in:

>From rts/sm/GC.c:
(...)
>   if (major_gc && oldest_gen->mark) {

include the test oldest_gen->compact?  I tried including it, and I got a
segfault in:

(...)
>From rts/sm/Evac.c:
(...)
>       if (!is_marked((P_)q,bd)) {
>           mark((P_)q,bd);
>           push_mark_stack((P_)q);
>       }

So I included the test if mark_stack_bd != NULL, and I got a segfault outside
the GarbageCollect() function.  Any idea about why this happened?

(...)

I first started wanting to enable mark_stack only in compact because it was
giving me a segfault in my changes to sweep.  The algorithm in sweep is similar
to immix, so I thought it'd be easier to start changing the sweep to free
lines.  I tried to make a list of free lines, using the following:

>From rts/sm/Sweep.c:
(...)
>         for (i = 0; i < BLOCK_SIZE_W / BITS_IN(W_); i++)
>         {
>             if (bd->u.bitmap[i] != 0) resid++;
>             else line_found(bd->start + 8 * i);
>         }
(...)
> static void
> line_found(StgPtr start)
> {
>     if(!line_first)
>         line_first = start;
>     // Includes a pointer to the next line
>     if(line_last)
>         *line_last = (StgWord) start;
>     line_last = start;
>     // Finalizes the list
>     *line_last = 0;
> }

With this I got:

circsim: internal error: scavenge_mark_stack: unimplemented/strange closure 
type -308026752 @ 0x7fa4ee0641c0
    (GHC version 6.13.20100524 for x86_64_unknown_linux)
    Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
Aborted

So I thought I should just remove the whole mark_stack code in sweep, and that
was the motivation.

Then I tried to comment only the call to scavenge_mark_stack:

(...)
>From rts/sm/Scav.c:
(...)
>     if (mark_stack_bd != NULL && !mark_stack_empty()) {
>         // scavenge_mark_stack();
>         // work_to_do = rtsTrue;
>     }

But it gave different problems in different places, so I think I'm messing up
with things by writing in what I suppose were free lines.  Notice I'm
considering the 8 words pointed by a byte in the bitmap.  I thought that if the
bit was set to 0, that space in the block was free and I could write in them,
but it seems that this assumption is not valid.  What am I doing wrong?

(...)

One minor thing I noticed is that, in evacuate, gct->evac_gen and bd->gen are
not always set.  What is the scenario behind the situation in that they're not
set?

I'm thinking about start writing in the wiki some of the conclusions I'm
getting to, but I'd be glad to have them reviewed by someone with a better
knowleged of the GC.  What's the procedure?  Should I write them there and ask
for a review latter, send the proposed changes to someone to review and update
there only after the review or just write there and people will be mailed about
the change and will review without need of my report?

Greetings.
-- 
marcot
http://wiki.debian.org/MarcoSilva

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to