Immix on GHC Summer of Code weekly report #6

My project.

This post assumes that the reader has read my last post.

I started the change in the line representation. Instead of a single linked list of free lines, it’s better to work with line groups, to avoid fragmentation inside lines in allocation. I’ve create a struct to represent this line group, with a pointer to the next group, and the size, in lines, of the group. It is stored in includes/rts/storage/GC.h currently, but I’m not sure if this is the best place to put it, and I’m thinking about changing it latter.

#include "rts/OSThreads.h"

typedef struct line_ {
    struct line_ *next;
    StgWord size;
} line;

/* -----------------------------------------------------------------------------

Then we need to change the code of liberation of lines in rts/sm/Sweep.c.

            else if(!(bd->flags & BF_MEDIUM)) {
                StgBool sequence;
                sequence = 0;

                for(i = 1; i < BLOCK_SIZE_W / BITS_IN(W_); i++) {
                    StgPtr start;
                    start = bd->start + BITS_IN(W_) * i;
                    if(bd->u.bitmap[i] == 0 && bd->u.bitmap[i - 1] == 0 &&
                       start + BITS_IN(W_) <= bd->free) {
                        printf("DEBUG: line_found(%p)\n", start); fflush(stdout);
                        if(gen->first_line == NULL) {
                            gen->first_line = (line *) start;
                        }
                        if(sequence) {
                            last_line->size++;
                        }
                        else {
                            if(last_line != NULL) {
                                last_line->next = (line *) start;
                            }
                            last_line = (line *) start;
                            last_line->next = NULL;
                            last_line->size = 1;
                        }
                        sequence = 1;
                    }
                    else {
                        sequence = 0;
                    }

I’ve tested this code using the same technique as before, checking the produced list trasversing it after it’s done. The list obtained showed the correct lines.

Now I’m back to the allocation code, which never worked. The changes in rts/sm/Evac.c are straightfoward.

        if (gen->first_line != NULL &&
            size <= BITS_IN(W_) * gen->first_line->size) {
            ws->todo_free = (StgPtr) gen->first_line;
            ws->todo_lim = ws->todo_free + BITS_IN(W_) * gen->first_line->size;
            gen->first_line = gen->first_line->next;
            to = ws->todo_free;
        }

This cause the same kind of errors I was getting before. I should go back to debugging. My co-supervisor in my Oriented Project in Computer Science suggested me using valgrind. I’ll try it.


Last week I forgot to mention I’ve presented my final presentation about my Oriented Project in Computer Science. This week I finished writing my monograph.

About these ads

3 Respostas to “Immix on GHC Summer of Code weekly report #6”

  1. Immix on GHC Summer of Code weekly report #7 « Blog do Marcot Says:

    […] This post assumes that the reader has read my last post. […]

  2. James Says:

    clicking “my last post” gives a 404.

  3. marcotmarcot Says:

    Thanks, the correct link is: http://marcotmarcot.wordpress.com/2010/06/15/summer-of-code-weekly-report-5/

Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s


Seguir

Obtenha todo post novo entregue na sua caixa de entrada.

%d blogueiros gostam disto: