harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiao-Feng Li" <xiaofeng...@gmail.com>
Subject Re: [drlvm][gc] How to iterate MOS?
Date Wed, 26 Mar 2008 09:01:28 GMT
Yuri, I probably can guess what you want to achieve with the code
snippets. But I need your clarification about two things:
1. your allocated separate mem is not collected by GC, right?
2. the original copy of a copied object is unmarked (as dead), right?

If they are yes, then it might have problems when GC compacts. The
problems could be:
1. how are the pointers to copied objects updated to point to the new copies?
2. you set a fw pointer from original copy to new copy, but that
doesn't help, because the compaction doesn't follow fw pointer at all.

For problem 1, you need extra operations to update all the references
to the new copies.
For problem 2, you need install the fw pointer inside the object body,
not in object header, so that it does not impact the obj_end
computation. But you need a bit somewhere to indicate the object has
been copied away. In this way, in the ref updating phase, you can
check the flag, and follow the fw pointer.

I think the key error is, you overwrite the obj_info, which holds some
info (hash bits) for obj size computation.

Thanks,
xiaofeng

On Tue, Mar 25, 2008 at 4:44 PM, Yuri Kashnikoff
<yuri.kashnikoff@gmail.com> wrote:
> 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
>



-- 
http://xiao-feng.blogspot.com

Mime
View raw message