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 Thu, 27 Mar 2008 07:41:39 GMT
Yuri, I need understand your approach better so as to answer your
question better. It would be great if you can describe what you are
trying to achieve and the steps so that I have a good overall picture.
>From what you described, I need your further clarification:
You copy some objects away to a separate region, and throw away the
original copy; then you copy back those objects to some free area in
MOS after compaction?

Thanks,
xiaofeng

On Thu, Mar 27, 2008 at 3:15 PM, Yuri Kashnikoff
<yuri.kashnikoff@gmail.com> wrote:
> Additional info for previous letter. This is how I am copying object
>  back to MOS[1]. And After that running fix_pointers (as in
>  move_compact but with minimal changes) it fails because of vt
>  corrupted. If fix_pointers routine is needed I could present it here.
>
>  [1]
>  void gc_layout_copy_to_mos(GC_Gen* gc)
>  {
>     char* obj_src = layout_mem_space; // from space
>     char* obj_dst = NULL;
>
>     Mspace* mos = (Mspace*)gc->mos; // to space
>     Partial_Reveal_Object *p_target_object = NULL, *p_obj = NULL;
>
>     unsigned obj_size = 0, hash_extend_size = 0;
>     unsigned long available_free_size_in_block = 0, free_block_index =
>  mos->free_block_idx;
>
>     // check for available free memory
>     unsigned mos_free_memory_size =
>  blocked_space_free_mem_size((Blocked_Space*)mos);
>     assert(mos_free_memory_size > layout_mem_space_size);
>
>     // iterate until free blocks starts
>     blocked_space_block_iterator_init((Blocked_Space*)mos); // ???
>
>     Block_Header* curr_block =
>  blocked_space_block_iterator_next((Blocked_Space*) mos);
>
>     while (curr_block->block_idx < free_block_index)
>     {
>         curr_block = blocked_space_block_iterator_next((Blocked_Space*) mos);
>     }
>
>     curr_block->free = curr_block->new_free;
>
>     // begin copying
>     while (obj_src < layout_mem_space + layout_mem_space_size) {
>         obj_dst = (char*)curr_block->free;
>         Partial_Reveal_Object* p_obj = LAYOUT_CONVERTION(obj_src);
>
> #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; THIS
>  POINT SHOULD BE REVIEWED CAREFULLY
>         obj_size = gc_layout_get_obj_size(p_obj);
>         available_free_size_in_block =
>  (POINTER_SIZE_INT)GC_BLOCK_END(curr_block) -
>
> (POINTER_SIZE_INT)curr_block->free;
>
>         if (available_free_size_in_block >= obj_size)
>         {
>             memcpy(obj_dst, obj_src, obj_size);
>             gc_layout_add_old_new_pair(get_old_by_middle(p_obj),
>  LAYOUT_CONVERTION(obj_dst)); // for fix pointers method needed
>             curr_block->free = (void*)((char*)curr_block->free +
>  obj_size);  // now less free mem in block is available
>             obj_src += obj_size; // next object to copy
>
>             obj_mark_in_vt(LAYOUT_CONVERTION(obj_dst));
>
>         }
>         else
>         {
>             curr_block =
>  blocked_space_block_iterator_next((Blocked_Space*) mos); // no free
>  mem is available for this object, get next block
>             curr_block->free = curr_block->new_free;
>
>
>         }
>     }
>  }
>
>  --
>  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