harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yuri Kashnikoff" <yuri.kashnik...@gmail.com>
Subject Re: [drlvm][gc] How to iterate MOS?
Date Tue, 25 Mar 2008 08:44:40 GMT
Hi!

Xiao-Feng,
During my investigations I tried to copy some particular object from
MOS to some space allocated by myself. And I've got a problem during
this process.

I've got 2 methods called right before move_compact compaction starts
(line #220, mspace_move_compact.cpp) .
 a) The first one is void gc_layout_alloc_mem() [1] is calculating the
size_in_bytes of the space which should be allocated for the sequence
of objects which are stored in list<seqSimpleList>[2] (variable
seq_head) - seqSimpleList just holds the the head and the tail of the
sequence. After calcualting the size_in_bytes variable
layout_mem_space points to the allocated space.
 b) The second one is void gc_layout_copy_seq_to_mem()[3] just copies
object of the sequences stored in list<seqSimpleList> variable
seq_head to the previously allocated space (layout_mem_space). During
this phase obj_unmark_in_vt() and obj_set_fw_in_oi () called for each
iterated object.

But I've got an assertion during move_compact phase :
assert(vt && vt->gcvt) in vtable_get_gcvt_raw

Call Stack:
        vtable_get_gcvt_raw(Partial_Reveal_VTable * vt=0x00000000)
 obj_get_gcvt_raw(Partial_Reveal_Object * obj=0x109f6898)
 object_is_array(Partial_Reveal_Object * obj=0x109f6898)
 vm_object_size(Partial_Reveal_Object * obj=0x109f6898)
 obj_end(Partial_Reveal_Object * obj=0x109f6898)
 block_get_next_marked_object(Block_Header * block=0x109f0000, void *
* start_pos=0x0211fd54)
 mspace_move_objects(Collector * collector=0x004ada70, Mspace *
mspace=0x00493100)

I've got no idea why this happens. I'll appreciate any help. I am
looking forward for your suggestions.

[1]
void gc_layout_alloc_mem()
{
    unsigned long size_in_bytes = 0;
    unsigned obj_size = 0, hash_extend_size = 0;
    Partial_Reveal_Object* p_obj = NULL;
    fhSimpleList* field_it = NULL;

    for (list<seqSimpleList>::iterator it = seq_head.begin(); it !=
seq_head.end(); it++)
    {
        for (p_obj = (*it).s_head;
             p_obj != (*it).s_tail;
             field_it = gc_layout_obj_get_hot_field_it(p_obj),
             p_obj = gc_layout_get_obj_by_hot_field(p_obj, field_it))
        {
#ifdef USE_32BITS_HASHCODE
            hash_extend_size  =
(hashcode_is_attached((Partial_Reveal_Object*)p_obj))?GC_OBJECT_ALIGNMENT:0;
#endif
            obj_size = vm_object_size(p_obj) + hash_extend_size;
            size_in_bytes += obj_size;
        }
    }
    layout_mem_space = (char*) malloc(sizeof(char)*size_in_bytes);
}

[2]
#define seqSimpleList seq_simple_list
struct seq_simple_list
{
    Partial_Reveal_Object* s_head;
    Partial_Reveal_Object* s_tail;
};

[3]
void gc_layout_copy_seq_to_mem()
{
    Partial_Reveal_Object *p_obj = NULL;
    char* _currMem = layout_mem_space;
    unsigned obj_size = 0, hash_extend_size = 0;
    fhSimpleList* field_it = NULL;

    for (list<seqSimpleList>::iterator it = seq_head.begin(); it !=
seq_head.end(); it++)
    {
        // copy sequence
        for (p_obj = (*it).s_head;
             p_obj != (*it).s_tail;
             field_it = gc_layout_obj_get_hot_field_it(p_obj),
             p_obj = gc_layout_get_obj_by_hot_field(p_obj, field_it))
        {
#ifdef USE_32BITS_HASHCODE
            hash_extend_size  =
(hashcode_is_attached((Partial_Reveal_Object*)p_obj))?GC_OBJECT_ALIGNMENT:0;
#endif
            obj_size = vm_object_size(p_obj) + hash_extend_size;
            obj_set_fw_in_oi(p_obj, _currMem); // fix pointers
            memcpy(_currMem, p_obj, obj_size);
            obj_unmark_in_vt(p_obj);
            _currMem += obj_size;
        }
    }
}


-- 
Yuri S. Kashnikov
Novosibirsk State University, Russia
2 Pirogova street
630090, Novosibirsk-90
yuri.kashnikoff@gmail.com

Mime
View raw message