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, 29 Jan 2008 09:17:30 GMT
I uncommented but the problem is still exist.
As I know USE_32BITS_HASHCODE defined in gc_common.h. This is my patch

Index: C:/users/kashnikov/drlvm/trunk/working_vm/vm/gc_gen/src/gen/gen.cpp
===================================================================
--- C:/users/kashnikov/drlvm/trunk/working_vm/vm/gc_gen/src/gen/gen.cpp	(revision
613057)
+++ C:/users/kashnikov/drlvm/trunk/working_vm/vm/gc_gen/src/gen/gen.cpp	(working
copy)
@@ -19,6 +19,7 @@
  * @author Xiao-Feng Li, 2006/10/05
  */

+
 #include "gen.h"
 #include "../finalizer_weakref/finalizer_weakref.h"
 #include "../verify/verify_live_heap.h"
@@ -690,15 +691,340 @@
 Boolean IS_FALLBACK_COMPACTION = FALSE; /* only for debugging, don't use it. */
 void gc_gen_stats_verbose(GC_Gen* gc);

+
+
+
+
+void iter_mos(GC_Gen *gc)
+{
+    Mutator *mutator = gc->mutator_list;
+    while (mutator) {
+        Block_Header* block = (Block_Header*)mutator->alloc_block;
+        if(block != NULL) block->free = mutator->free;
+        mutator = mutator->next;
+    }
+
+
+        Blocked_Space *mspace = (Blocked_Space*)gc->mos;
+        Block_Header *curr_block = (Block_Header*)mspace->blocks;
+        Block_Header *space_end =
(Block_Header*)&mspace->blocks[mspace->free_block_idx -
mspace->first_block_idx];
+        while(curr_block < space_end) {
+            POINTER_SIZE_INT p_obj = (POINTER_SIZE_INT)curr_block->base;
+            POINTER_SIZE_INT p_next_obj = p_obj;
+            POINTER_SIZE_INT block_end = (POINTER_SIZE_INT)curr_block->free;
+
+            unsigned int hash_extend_size = 0;
+            while(p_obj < block_end){
+#ifdef USE_32BITS_HASHCODE
+                hash_extend_size  =
(hashcode_is_attached((Partial_Reveal_Object*)p_obj))?GC_OBJECT_ALIGNMENT:0;
+#endif
+                p_next_obj = p_obj +
vm_object_size((Partial_Reveal_Object *)p_obj) + hash_extend_size;
+                p_obj = p_next_obj;
+            }
+            curr_block = curr_block->next;
+            if(curr_block == NULL) break;
+        }
+}
+
+
+
 void gc_gen_reclaim_heap(GC_Gen *gc, int64 gc_start_time)
 {
   INFO2("gc.process", "GC: start GC_Gen ...\n");

   Space *nos = gc->nos;
   Space *mos = gc->mos;
   Space *los = gc->los;
-
-
   if(verify_live_heap && (MAJOR_ALGO != MAJOR_MARK_SWEEP))
     gc_verify_heap((GC*)gc, TRUE);

@@ -727,7 +1053,9 @@
     if(MAJOR_ALGO != MAJOR_MARK_SWEEP)
       mos_used_blocks_before_minor =
((Blocked_Space*)mos)->free_block_idx -
((Blocked_Space*)mos)->first_block_idx;

     nos_collection(nos);

 #ifdef GC_GEN_STATS
     gc_gen_collector_stats_verbose_minor_collection(gc);
@@ -758,7 +1086,11 @@
     if(MAJOR_ALGO != MAJOR_MARK_SWEEP)
       los->move_object = TRUE;

+
+    iter_mos(gc); // before
     mos_collection(mos); /* collect mos and nos  together */
+
     los_collection(los);

     if(MAJOR_ALGO != MAJOR_MARK_SWEEP)
@@ -800,14 +1132,18 @@

     if(MAJOR_ALGO != MAJOR_MARK_SWEEP)
       los->move_object = TRUE;
-
+    iter_mos(gc);
     mos_collection(mos); /* collect both mos and nos */
     los_collection(los);
     if(MAJOR_ALGO != MAJOR_MARK_SWEEP)
       los->move_object = FALSE;

     IS_FALLBACK_COMPACTION = FALSE;

 #ifdef GC_GEN_STATS
     gc->stats->num_fallback_collections++;
     gc_gen_collector_stats_verbose_major_collection(gc);
@@ -844,19 +1180,26 @@

     gc_space_tuner_reset((GC*)gc); /* related to los_boundary adjustment */
   }
-
   gc_gen_update_space_info_after_gc(gc);

 #ifdef GC_GEN_STATS
   gc_gen_stats_update_after_collection(gc);
   gc_gen_stats_verbose(gc);
 #endif

   INFO2("gc.process", "GC: end of GC_Gen\n");
-
+
+
   return;
 }


On Jan 29, 2008 1:45 PM, Xiao-Feng Li <xiaofeng.li@gmail.com> wrote:
> Can you paste your complete patch with the context? Have you defined
> USE_32BITS_HASHCODE? I'd suggest you define it and uncomment the " +
> hash_extend_size;"
>
> Thanks,
> xiaofeng
>
> On Jan 29, 2008 3:20 PM, Yuri Kashnikoff <yuri.kashnikoff@gmail.com> wrote:
>
> > I am trying to iterate MOS (see below). And on DaCapo::jython I've got
> > problems with this code,(vm_object_size crashes). Any
> > ideas/suggestions ?
> >
> >         Blocked_Space *mspace = (Blocked_Space*)gc->mos;
> >         Block_Header *curr_block = (Block_Header*)mspace->blocks;
> >         Block_Header *space_end =
> > (Block_Header*)&mspace->blocks[mspace->free_block_idx -
> > mspace->first_block_idx];
> >         while(curr_block < space_end) {
> >             POINTER_SIZE_INT p_obj = (POINTER_SIZE_INT)curr_block->base;
> >             POINTER_SIZE_INT p_next_obj = p_obj;
> >             POINTER_SIZE_INT block_end = (POINTER_SIZE_INT)curr_block->free;
> >
> >             unsigned int hash_extend_size = 0;
> >             while(p_obj < block_end){
> > #ifdef USE_32BITS_HASHCODE
> >                 hash_extend_size  =
> > (hashcode_is_attached((Partial_Reveal_Object*)p_obj))?GC_OBJECT_ALIGNMENT:0;
> > #endif
> >                  p_next_obj = p_obj +
> > vm_object_size((Partial_Reveal_Object *)p_obj);// + hash_extend_size;
> >                  //do something with p_obj
> >                  p_obj = p_next_obj;
> >             }
> >             curr_block = curr_block->next;
> >             if(curr_block == NULL) break;
> >         }
> >     }
> >
> >
> > --
> > Yuri S. Kashnikov
> > Novosibirsk State University, Russia
> > 2 Pirogova street
> > 630090, Novosibirsk-90
> > yuri.kashnikoff@gmail.com
> >
>
>
>
> --
> http://xiao-feng.blogspot.com
>



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

Mime
View raw message