harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x..@apache.org
Subject svn commit: r637062 [3/3] - in /harmony/enhanced/drlvm/trunk: make/vm/ vm/gc_gen/src/common/ vm/gc_gen/src/finalizer_weakref/ vm/gc_gen/src/gen/ vm/gc_gen/src/jni/ vm/gc_gen/src/los/ vm/gc_gen/src/mark_compact/ vm/gc_gen/src/mark_sweep/ vm/gc_gen/src/m...
Date Fri, 14 Mar 2008 11:21:32 GMT
Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace.cpp Fri Mar 14 04:21:27 2008
@@ -61,8 +61,9 @@
   wspace->space_statistic = (Space_Statistics*)STD_MALLOC(sizeof(Space_Statistics));
   assert(wspace->space_statistic);
   memset(wspace->space_statistic, 0, sizeof(Space_Statistics));
+  wspace->space_statistic->size_free_space = commit_size;
 
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
   gc_ms_set_wspace((GC_MS*)gc, wspace);
 #else
   gc_set_mos((GC_Gen*)gc, (Space*)wspace);
@@ -124,6 +125,15 @@
   allocator->local_chunks = local_chunks;
 }
 
+void allocator_register_new_obj_size(Allocator *allocator)
+{
+  Mutator* mutator = (Mutator*)allocator;
+  Wspace *wspace = gc_get_wspace(allocator->gc);
+  Space_Statistics* space_stat = wspace->space_statistic;
+  space_stat->size_new_obj += mutator->new_obj_size;
+}
+
+
 void allocactor_destruct_local_chunks(Allocator *allocator)
 {
   Wspace *wspace = gc_get_wspace(allocator->gc);
@@ -140,28 +150,26 @@
       if(!chunk_ptrs){
         chunk_ptrs = local_chunks[i];
 
-  
         /* Put local pfc to the according pools */
-        for(unsigned int i = 0; i < chunk_ptr_num; ++i){
-          if(chunk_ptrs[i]){
+        for(unsigned int j = 0; j < chunk_ptr_num; ++j){
+          if(chunk_ptrs[j]){
             if(!USE_CONCURRENT_GC){
-              wspace_put_pfc(wspace, chunk_ptrs[i]);
+              wspace_put_pfc(wspace, chunk_ptrs[j]);
             }else{
-              Chunk_Header* chunk_to_rem = chunk_ptrs[i];
+              Chunk_Header* chunk_to_rem = chunk_ptrs[j];
               chunk_to_rem->status = CHUNK_USED | CHUNK_NORMAL;
               wspace_register_used_chunk(wspace, chunk_to_rem);
             }
           }
         }
-        
-        /* Free mem for local chunk pointers */
-        STD_FREE(chunk_ptrs);
+
         chunk_ptrs = NULL;
       }
     }
   }
   
-  
+  /* Free mem for local chunk pointers */  
+  STD_FREE(*local_chunks);
   /* Free mem for size segments (Chunk_Header**) */
   STD_FREE(local_chunks);
 }
@@ -189,7 +197,7 @@
 
 static void gc_clear_mutator_local_chunks(GC *gc)
 {
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
   /* release local chunks of each mutator in unique mark-sweep GC */
   Mutator *mutator = gc->mutator_list;
   while(mutator){
@@ -201,14 +209,14 @@
 
 void gc_clear_collector_local_chunks(GC *gc)
 {
-  if(!gc_match_kind(gc, MAJOR_COLLECTION)) return;
+  if(!collect_is_major()) return;
   /* release local chunks of each collector in gen GC */
   for(unsigned int i = gc->num_collectors; i--;){
     allocator_clear_local_chunks((Allocator*)gc->collectors[i]);
   }
 }
 
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
 void wspace_set_space_statistic(Wspace *wspace)
 {
   GC_MS *gc = (GC_MS*)wspace->gc;
@@ -241,11 +249,11 @@
 
 
   wspace_decide_compaction_need(wspace);
-  if(wspace->need_compact && gc_match_kind(gc, MARK_SWEEP_GC)){
-    assert(gc_match_kind(gc, MS_COLLECTION));
-    gc->collect_kind = MS_COMPACT_COLLECTION;
+  if(wspace->need_compact && major_is_marksweep()){
+    assert(!collect_move_object());
+    GC_PROP |= ALGO_MS_COMPACT;
   }
-  if(wspace->need_compact || gc_match_kind(gc, MAJOR_COLLECTION))
+  if(wspace->need_compact || collect_is_major())
     wspace->need_fix = TRUE;
 
   //printf("\n\n>>>>>>>>%s>>>>>>>>>>>>\n\n", wspace->need_compact ? "COMPACT" : "NO COMPACT");
@@ -263,6 +271,9 @@
   
   collector_execute_task(gc, (TaskType)mark_sweep_wspace, (Space*)wspace);
 
+  /* set the collection type back to ms_normal in case it's ms_compact */
+  collect_set_ms_normal();
+  
 #ifdef SSPACE_TIME
   wspace_gc_time(gc, FALSE);
 #endif

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace.h Fri Mar 14 04:21:27 2008
@@ -75,7 +75,7 @@
   POINTER_SIZE_INT surviving_obj_size;
 } Wspace;
 
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
 void wspace_set_space_statistic(Wspace *wspace);
 #endif
 
@@ -91,11 +91,12 @@
 void allocator_init_local_chunks(Allocator *allocator);
 void allocactor_destruct_local_chunks(Allocator *allocator);
 void gc_init_collector_free_chunk_list(Collector *collector);
+void allocator_register_new_obj_size(Allocator *allocator);
 
 POINTER_SIZE_INT wspace_free_memory_size(Wspace *wspace);
 
 
-#ifndef USE_MARK_SWEEP_GC
+#ifndef USE_UNIQUE_MARK_SWEEP_GC
 #define gc_get_wspace(gc) ((Wspace*)gc_get_mos((GC_Gen*)(gc)))
 #else
 #define gc_get_wspace(gc) (gc_ms_get_wspace((GC_MS*)(gc)))

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_alloc.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_alloc.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_alloc.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_alloc.cpp Fri Mar 14 04:21:27 2008
@@ -222,7 +222,7 @@
     chunk->table[0] |= cur_mark_black_color  ;
   } 
   mutator_post_signal((Mutator*) allocator,MUTATOR_EXIT_ALLOCATION_MARK);
-  mem_fence();
+  //mem_fence();
   
   chunk->table[0] |= cur_alloc_color;
   set_super_obj_mask(chunk->base);
@@ -254,6 +254,8 @@
   if(p_obj && gc_is_concurrent_mark_phase()) ((Partial_Reveal_Object*)p_obj)->obj_info |= NEW_OBJ_MASK;
 #endif
 
+  if(p_obj) ((Mutator*)allocator)->new_obj_size += size;
+  
   return p_obj;
 }
 
@@ -264,7 +266,10 @@
   
   /* First, try to allocate object from TLB (thread local chunk) */
   p_obj = wspace_try_alloc(size, allocator);
-  if(p_obj)  return p_obj;
+  if(p_obj){
+    ((Mutator*)allocator)->new_obj_size += size;
+    return p_obj;
+  }
   
   if(allocator->gc->in_collection) return NULL;
   
@@ -273,9 +278,10 @@
   p_obj = wspace_try_alloc(size, allocator);
   if(p_obj){
     vm_gc_unlock_enum();
+    ((Mutator*)allocator)->new_obj_size += size;
     return p_obj;
   }
-  gc_reclaim_heap(allocator->gc, GC_CAUSE_WSPACE_IS_FULL);
+  gc_reclaim_heap(allocator->gc, GC_CAUSE_MOS_IS_FULL);
   vm_gc_unlock_enum();
 
 #ifdef SSPACE_CHUNK_INFO
@@ -283,6 +289,8 @@
 #endif
 
   p_obj = wspace_try_alloc(size, allocator);
+  
+  if(p_obj) ((Mutator*)allocator)->new_obj_size += size;
   
   return p_obj;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_alloc.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_alloc.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_alloc.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_alloc.h Fri Mar 14 04:21:27 2008
@@ -187,7 +187,7 @@
   if(p_obj && is_obj_alloced_live())
     obj_mark_black_in_table((Partial_Reveal_Object*)p_obj, chunk->slot_size);
   
-  mem_fence();
+  //mem_fence();
   
   alloc_slot_in_table(table, slot_index);
   if(chunk->status & CHUNK_NEED_ZEROING)

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_compact.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_compact.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_compact.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_compact.cpp Fri Mar 14 04:21:27 2008
@@ -28,10 +28,10 @@
   POINTER_SIZE_INT free_mem_size = free_mem_in_wspace(wspace, FALSE);
   float free_mem_ratio = (float)free_mem_size / wspace->committed_heap_size;
 
-#ifdef USE_MARK_SWEEP_GC
-  if(!gc_mark_is_concurrent() && (free_mem_ratio > SSPACE_COMPACT_RATIO) && (wspace->gc->cause != GC_CAUSE_RUNTIME_FORCE_GC)){
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
+  if(!gc_mark_is_concurrent() && (free_mem_ratio > WSPACE_COMPACT_RATIO) && (wspace->gc->cause != GC_CAUSE_RUNTIME_FORCE_GC)){
 #else
-  if(gc_match_kind(wspace->gc, MAJOR_COLLECTION)){
+  if(collect_is_major()){
 #endif
     wspace->need_compact = wspace->move_object = TRUE;
   } else {
@@ -156,7 +156,7 @@
   return result;
 }
 
-static inline void move_obj_between_chunks(Chunk_Header **dest_ptr, Chunk_Header *src)
+static inline void move_obj_between_chunks(Wspace *wspace, Chunk_Header **dest_ptr, Chunk_Header *src)
 {
   Chunk_Header *dest = *dest_ptr;
   assert(dest->slot_size == src->slot_size);
@@ -170,7 +170,8 @@
     void *target = alloc_in_chunk(dest);
 
     if(dest->slot_index == MAX_SLOT_INDEX){
-      dest->status = CHUNK_USED | CHUNK_NORMAL;
+      dest->status = CHUNK_USED | CHUNK_NORMAL;      
+      wspace_register_used_chunk(wspace,dest);
       dest = NULL;
     }
     
@@ -209,8 +210,8 @@
     while(dest && src){
       if(src_is_new)
         src->slot_index = 0;
-      chunk_depad_last_index_word(src);
-      move_obj_between_chunks(&dest, src);
+      //chunk_depad_last_index_word(src);
+      move_obj_between_chunks(wspace, &dest, src);
       if(!dest)
         dest = get_least_free_chunk(&least_free_chunk, &most_free_chunk);
       if(!src->alloc_num){
@@ -232,6 +233,8 @@
     }
   }
 }
+
+
 
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_concurrent_gc_stats.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_concurrent_gc_stats.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_concurrent_gc_stats.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_concurrent_gc_stats.cpp Fri Mar 14 04:21:27 2008
@@ -30,7 +30,7 @@
 static void normal_chunk_scanning(Chunk_Header *chunk)
 {
   chunk->slot_index = 0;
-  chunk_depad_last_index_word(chunk);
+  //chunk_depad_last_index_word(chunk);
   
   unsigned int alloc_num = chunk->alloc_num;
   assert(alloc_num);
@@ -139,7 +139,7 @@
 static void normal_chunk_clear(Chunk_Header *chunk)
 {
   chunk->slot_index = 0;
-  chunk_depad_last_index_word(chunk);
+  //chunk_depad_last_index_word(chunk);
   
   unsigned int alloc_num = chunk->alloc_num;
   assert(alloc_num);
@@ -198,4 +198,6 @@
 
 }
 #endif
+
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_fallback_mark.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_fallback_mark.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_fallback_mark.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_fallback_mark.cpp Fri Mar 14 04:21:27 2008
@@ -26,7 +26,7 @@
   if(obj_belongs_to_space(obj, (Space*)wspace_in_fallback_marking)){
     Boolean marked_by_self = obj_mark_black_in_table(obj);
 
-#ifndef USE_MARK_SWEEP_GC
+#ifndef USE_UNIQUE_MARK_SWEEP_GC
     /* When fallback happens, some objects in MOS have their fw bit set, which is actually their mark bit in the last minor gc.
      * If we don't clear it, some objects that didn't be moved will be mistaken for being moved in the coming fixing phase.
      */
@@ -150,7 +150,7 @@
       REF *p_ref = (REF*)*iter;
       iter = vector_block_iterator_advance(root_set,iter);
       
-      /* root ref can't be NULL, (remset may have NULL ref entry, but this function is only for MAJOR_COLLECTION */
+      /* root ref can't be NULL, (remset may have NULL ref entry, but this function is only for ALGO_MAJOR */
       assert(read_slot(p_ref) != NULL);
       /* we have to mark the object before putting it into marktask, because
          it is possible to have two slots containing a same object. They will

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark.cpp Fri Mar 14 04:21:27 2008
@@ -32,7 +32,7 @@
   if(obj_belongs_to_space(obj, (Space*)wspace_in_marking)){
     Boolean marked_by_self = obj_mark_black_in_table(obj);
 
-#ifndef USE_MARK_SWEEP_GC
+#ifndef USE_UNIQUE_MARK_SWEEP_GC
     /* When fallback happens, some objects in MOS have their fw bit set, which is actually their mark bit in the last minor gc.
      * If we don't clear it, some objects that didn't be moved will be mistaken for being moved in the coming fixing phase.
      */
@@ -115,8 +115,12 @@
     scan_slot(collector, p_ref);
   }
 
+    if(!IGNORE_FINREF )
+      scan_weak_reference(collector, p_obj, scan_slot);
 #ifndef BUILD_IN_REFERENT
-  scan_weak_reference(collector, p_obj, scan_slot);
+    else {
+      scan_weak_reference_direct(collector, p_obj, scan_slot);
+    }
 #endif
 
 }
@@ -176,7 +180,7 @@
       iter = vector_block_iterator_advance(root_set,iter);
       
       Partial_Reveal_Object *p_obj = read_slot(p_ref);
-      /* root ref can't be NULL, (remset may have NULL ref entry, but this function is only for MAJOR_COLLECTION */
+      /* root ref can't be NULL, (remset may have NULL ref entry, but this function is only for ALGO_MAJOR */
       assert(p_obj != NULL);
       /* we have to mark the object before putting it into marktask, because
          it is possible to have two slots containing a same object. They will

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_mostly_concurrent.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_mostly_concurrent.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_mostly_concurrent.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_mostly_concurrent.cpp Fri Mar 14 04:21:27 2008
@@ -126,7 +126,7 @@
       iter = vector_block_iterator_advance(root_set,iter);
       
       Partial_Reveal_Object *p_obj = read_slot(p_ref);
-      /* root ref can't be NULL, (remset may have NULL ref entry, but this function is only for MAJOR_COLLECTION */
+      /* root ref can't be NULL, (remset may have NULL ref entry, but this function is only for ALGO_MAJOR */
       assert(p_obj!=NULL);
       assert(address_belongs_to_gc_heap(p_obj, gc));
       if(obj_mark_gray_in_table(p_obj))
@@ -223,4 +223,6 @@
   obj_mark_gray_in_table((Partial_Reveal_Object*)p_obj);
   trace_object((Marker*)collector, (Partial_Reveal_Object *)p_obj);
 }
+
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_otf_concurrent.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_otf_concurrent.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_otf_concurrent.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_otf_concurrent.cpp Fri Mar 14 04:21:27 2008
@@ -115,7 +115,7 @@
       iter = vector_block_iterator_advance(root_set,iter);
       
       Partial_Reveal_Object *p_obj = read_slot(p_ref);
-      /* root ref can't be NULL, (remset may have NULL ref entry, but this function is only for MAJOR_COLLECTION */
+      /* root ref can't be NULL, (remset may have NULL ref entry, but this function is only for ALGO_MAJOR */
       assert(p_obj!=NULL);
       assert(address_belongs_to_gc_heap(p_obj, gc));
       if(obj_mark_gray_in_table(p_obj))
@@ -195,11 +195,18 @@
            */
       if(local_dirty_set != NULL){
         atomic_inc32(&num_active_markers);
-        while(!vector_block_is_empty(local_dirty_set) || !vector_block_not_full_set_unshared(local_dirty_set)){
-          Partial_Reveal_Object* p_obj = (Partial_Reveal_Object*) vector_block_get_entry(local_dirty_set);        
-          if(obj_mark_gray_in_table(p_obj)) 
-            collector_tracestack_push((Collector*)marker, p_obj);
-        }
+        do{        
+          while(!vector_block_is_empty(local_dirty_set)){ //|| !vector_block_not_full_set_unshared(local_dirty_set)){
+            Partial_Reveal_Object* p_obj = (Partial_Reveal_Object*) vector_block_get_entry(local_dirty_set);
+            if(!obj_belongs_to_gc_heap(p_obj)) {
+              assert(0);
+            }
+            
+            if(obj_mark_gray_in_table(p_obj)){ 
+              collector_tracestack_push((Collector*)marker, p_obj);
+            }
+          }
+        }while(!vector_block_not_full_set_unshared(local_dirty_set) && !vector_block_is_empty(local_dirty_set));
         goto retry;
       }
     }
@@ -223,4 +230,6 @@
   obj_mark_gray_in_table((Partial_Reveal_Object*)p_obj);
   trace_object((Marker*)collector, (Partial_Reveal_Object *)p_obj);
 }
+
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_sweep.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_sweep.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_sweep.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_sweep.cpp Fri Mar 14 04:21:27 2008
@@ -149,13 +149,20 @@
     REF * p_ref = object_ref_iterator_get(ref_iterator+i, p_obj);  
     slot_double_fix(p_ref);
   }    
+  
+#ifndef BUILD_IN_REFERENT
+    if(IGNORE_FINREF && is_reference_obj(p_obj)) {
+      REF* p_ref = obj_get_referent_field(p_obj);
+      slot_double_fix(p_ref);
+    }
+#endif
 }
 
 static void normal_chunk_fix_repointed_refs(Chunk_Header *chunk, Boolean double_fix)
 {
   /* Init field slot_index and depad the last index word in table for fixing */
   chunk->slot_index = 0;
-  chunk_depad_last_index_word(chunk);
+  //chunk_depad_last_index_word(chunk);
   
   unsigned int alloc_num = chunk->alloc_num;
   assert(alloc_num);
@@ -238,7 +245,7 @@
   GC *gc = collector->gc;
   Wspace *wspace = gc_get_wspace(gc);
   Space *nos = NULL;
-  if(gc_match_kind(gc, MAJOR_COLLECTION))
+  if(collect_is_major())
     nos = gc_get_nos((GC_Gen*)gc);
   
   unsigned int num_active_collectors = gc->num_active_collectors;
@@ -248,7 +255,7 @@
   atomic_cas32(&num_marking_collectors, 0, num_active_collectors+1);
 
   if(!gc_mark_is_concurrent()){  
-    if(gc_match_kind(gc, FALLBACK_COLLECTION))
+    if(collect_is_fallback())
       wspace_fallback_mark_scan(collector, wspace);
     else
       wspace_mark_scan(collector, wspace);
@@ -291,7 +298,7 @@
     wspace_verify_after_sweep(gc);
 #endif
 
-    if(gc_match_kind(gc, MAJOR_COLLECTION)){
+    if(collect_is_major()){
       wspace_merge_free_chunks(gc, wspace);
       nos_init_block_for_forwarding((GC_Gen*)gc);
     }
@@ -306,7 +313,7 @@
   
   /* Optional Pass: *******************************************
      Forward live obj in nos to mos (wspace) ******************/
-  if(gc_match_kind(gc, MAJOR_COLLECTION)){
+  if(collect_is_major()){
     atomic_cas32( &num_forwarding_collectors, 0, num_active_collectors+1);
     
     collector_forward_nos_to_wspace(collector, wspace);
@@ -330,7 +337,7 @@
     /* If we need forward nos to mos, i.e. in major collection, an extra fixing phase after compaction is needed. */
     old_num = atomic_inc32(&num_compacting_collectors);
     if( ++old_num == num_active_collectors ){
-      if(gc_match_kind(gc, MAJOR_COLLECTION))
+      if(collect_is_major())
         wspace_remerge_free_chunks(gc, wspace);
       /* let other collectors go */
       num_compacting_collectors++;
@@ -347,7 +354,7 @@
      * we need double fix object slots,
      * because some objects are forwarded from nos to mos and compacted into another chunk afterwards.
      */
-    Boolean double_fix = gc_match_kind(gc, MAJOR_COLLECTION) && wspace->need_compact;
+    Boolean double_fix = collect_is_major() && wspace->need_compact;
     wspace_fix_repointed_refs(collector, wspace, double_fix);
     
     atomic_inc32(&num_fixing_collectors);
@@ -360,17 +367,17 @@
   /* Leftover: *************************************************/
   
   if(wspace->need_fix){
-    Boolean double_fix = gc_match_kind(gc, MAJOR_COLLECTION) && wspace->need_compact;
+    Boolean double_fix = collect_is_major() && wspace->need_compact;
     gc_fix_rootset(collector, double_fix);
 #ifdef SSPACE_TIME
     wspace_fix_time(FALSE);
 #endif
   }
   
-  if(!gc_match_kind(gc, MAJOR_COLLECTION))
+  if(!collect_is_major())
     wspace_merge_free_chunks(gc, wspace);
 
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
   wspace_set_space_statistic(wspace);
 #endif 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_sweep.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_sweep.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_sweep.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_sweep.h Fri Mar 14 04:21:27 2008
@@ -22,7 +22,7 @@
 #include "wspace_verify.h"
 
 #define PFC_REUSABLE_RATIO 0.1
-#define SSPACE_COMPACT_RATIO 0.06
+#define WSPACE_COMPACT_RATIO 0.06
 
 inline Boolean chunk_is_reusable(Chunk_Header *chunk)
 { return (float)(chunk->slot_num-chunk->alloc_num)/chunk->slot_num > PFC_REUSABLE_RATIO; }
@@ -431,7 +431,7 @@
 {
   POINTER_SIZE_INT temp = cur_alloc_color;
   cur_alloc_color = cur_mark_black_color;
-  mem_fence();
+  //mem_fence();
   cur_mark_black_color = temp;
   cur_alloc_mask = (~cur_alloc_mask) & FLIP_COLOR_MASK_IN_TABLE;
   cur_mark_mask = (~cur_mark_mask) & FLIP_COLOR_MASK_IN_TABLE;

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_sweep_concurrent.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_sweep_concurrent.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_sweep_concurrent.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_sweep_concurrent.cpp Fri Mar 14 04:21:27 2008
@@ -242,7 +242,7 @@
 
 static void gc_sweep_mutator_local_chunks(GC *gc)
 {
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
   lock(gc->mutator_list_lock);     // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
 
   /* release local chunks of each mutator in unique mark-sweep GC */
@@ -280,6 +280,7 @@
   */
 void wspace_sweep_concurrent(Collector* collector)
 {
+  collector->time_measurement_start = time_now();
   GC *gc = collector->gc;
   Wspace *wspace = gc_get_wspace(gc);
 
@@ -378,6 +379,9 @@
     /* let other collectors go */
     num_sweeping_collectors++;
   }
-  while(num_sweeping_collectors != num_active_collectors + 1);
+  while(num_sweeping_collectors != num_active_collectors + 1);  
+  collector->time_measurement_end = time_now();
 }
+
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_verify.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_verify.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_verify.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_verify.cpp Fri Mar 14 04:21:27 2008
@@ -366,7 +366,7 @@
 
 static void gc_verify_allocator_local_chunks(GC *gc)
 {
-  if(gc_match_kind(gc, MARK_SWEEP_GC)){
+  if(major_is_marksweep()){
     Mutator *mutator = gc->mutator_list;
     while(mutator){
       allocator_verify_local_chunks((Allocator*)mutator);
@@ -374,7 +374,7 @@
     }
   }
   
-  if(gc_match_kind(gc, MAJOR_COLLECTION))
+  if(collect_is_major())
     for(unsigned int i = gc->num_collectors; i--;){
       allocator_verify_local_chunks((Allocator*)gc->collectors[i]);
     }

Added: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/move_compact/gc_mc.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/move_compact/gc_mc.cpp?rev=637062&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/move_compact/gc_mc.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/move_compact/gc_mc.cpp Fri Mar 14 04:21:27 2008
@@ -0,0 +1,25 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+ 
+#include "gc_common.h"
+#include "gc_mc.h"
+
+GC* gc_mc_create()
+{
+  assert(0);
+  return NULL;
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/move_compact/gc_mc.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/move_compact/gc_mc.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/move_compact/gc_mc.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/move_compact/gc_mc.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/move_compact/gc_mc.h Fri Mar 14 04:21:27 2008
@@ -14,51 +14,3 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace.cpp Fri Mar 14 04:21:27 2008
@@ -19,6 +19,8 @@
 #include "sspace.h"
 
 POINTER_SIZE_INT TOSPACE_SIZE = 0;
+void* tospace_start;
+void* tospace_end;
 
 static unsigned int sspace_compute_num_tospace_blocks(Sspace* sspace)
 {
@@ -221,7 +223,7 @@
 
   unsigned int sspace_first_idx = sspace->first_block_idx;
 
-  Boolean is_major_collection = gc_match_kind(sspace->gc, MAJOR_COLLECTION);
+  Boolean is_major_collection = collect_is_major();
 
   if( is_major_collection ){ 
     /* prepare for from-space, first half */
@@ -337,7 +339,7 @@
      It's troublesome to do config again after minor collection. */
 
   /* major collection leaves no survivor area in nos */
-  if( gc_match_kind(gc, MAJOR_COLLECTION)){
+  if( collect_is_major()){
     /* retore the fromspace last block next pointer. It was set a moment ago in sspace_reset_after_collection. */
     Block_Header* block_before_survivor_area = (Block_Header*)((Block*)(sspace->survivor_area_start) - 1);
     block_before_survivor_area->next = (Block_Header*)(sspace->survivor_area_start);
@@ -385,40 +387,25 @@
 {
   sspace->num_collections++;  
 
-  if(gc_is_gen_mode()){
-    sspace->collect_algorithm = MINOR_GEN_SEMISPACE_POOL;
-  }else{
-    sspace->collect_algorithm = MINOR_NONGEN_SEMISPACE_POOL;
-  }
-
   GC* gc = sspace->gc;
   
   /* we should not destruct rootset structure in case we need fall back */
   pool_iterator_init(gc->metadata->gc_rootset_pool);
 
-  switch(sspace->collect_algorithm){
-
+  if(!gc_is_gen_mode()){
 #ifdef MARK_BIT_FLIPPING
+    TRACE2("gc.process", "GC: nongenerational semispace algo start ... \n");
+    collector_execute_task(gc, (TaskType)nongen_ss_pool, (Space*)sspace);
+    TRACE2("gc.process", "\nGC: end of nongen semispace pool algo ... \n");
+#else
+    assert(0);
+#endif /*#ifdef MARK_BIT_FLIPPING #else */
 
-    case MINOR_NONGEN_SEMISPACE_POOL:
-      TRACE2("gc.process", "GC: nongen_semispace_pool algo start ... \n");
-      collector_execute_task(gc, (TaskType)nongen_ss_pool, (Space*)sspace);
-      TRACE2("gc.process", "\nGC: end of nongen semispace pool algo ... \n");
-      break;
-
-#endif /*#ifdef MARK_BIT_FLIPPING */
-
-    case MINOR_GEN_SEMISPACE_POOL:
-      TRACE2("gc.process", "gen_semispace_pool algo start ... \n");
-      collector_execute_task(gc, (TaskType)gen_ss_pool, (Space*)sspace);
-      TRACE2("gc.process", "\nGC: end of gen semispace pool algo ... \n");
-      break;
-    
-    default:
-      DIE2("gc.collection","Specified minor collection algorithm doesn't exist!");
-      exit(0);
-      break;
-  }
+  }else{
+    TRACE2("gc.process", "generational semispace algo start ... \n");
+    collector_execute_task(gc, (TaskType)gen_ss_pool, (Space*)sspace);
+    TRACE2("gc.process", "\nGC: end of gen semispace pool algo ... \n");
+  }    
   
   return; 
 }

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace.h Fri Mar 14 04:21:27 2008
@@ -19,6 +19,8 @@
 #define _SEMI_SPACE_H_
 
 #include "../thread/gc_thread.h"
+extern void* tospace_start;
+extern void* tospace_end;
 
 typedef struct Sspace{
   /* <-- first couple of fields are overloadded as Space */
@@ -93,6 +95,11 @@
   return (sspace->cur_free_block != NULL);
 }
 
+FORCE_INLINE Boolean obj_belongs_to_tospace(Partial_Reveal_Object* p_obj)
+{
+  return ( p_obj >= tospace_start && p_obj < tospace_end );
+}
+
 FORCE_INLINE Boolean obj_belongs_to_survivor_area(Sspace* sspace, Partial_Reveal_Object* p_obj)
 {
   return (p_obj >= sspace->survivor_area_start && 
@@ -111,7 +118,7 @@
 }
 
 /* treat semispace alloc as thread local alloc. If it fails or p_obj is old, forward it to MOS */
-FORCE_INLINE void* semispace_forward_obj(Partial_Reveal_Object* p_obj, unsigned int size, Allocator* allocator)
+FORCE_INLINE void* semispace_copy_object(Partial_Reveal_Object* p_obj, unsigned int size, Allocator* allocator)
 {
   void* p_targ_obj = NULL;
   Sspace* sspace = (Sspace*)allocator->alloc_space;

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace_forward.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace_forward.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace_forward.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace_forward.cpp Fri Mar 14 04:21:27 2008
@@ -50,7 +50,7 @@
    
   /* All chunks of data requested need to be multiples of GC_OBJECT_ALIGNMENT */
   assert((size % GC_OBJECT_ALIGNMENT) == 0);
-  assert( size <= GC_OBJ_SIZE_THRESHOLD );
+  assert( size <= GC_LOS_OBJ_SIZE_THRESHOLD );
 
   /* check if collector local alloc block is ok. If not, grab a new block */
   p_return = thread_local_alloc(size, allocator);

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace_gen_ss_pool.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace_gen_ss_pool.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace_gen_ss_pool.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace_gen_ss_pool.cpp Fri Mar 14 04:21:27 2008
@@ -30,14 +30,6 @@
 #include "../gen/gen_stats.h"
 #endif
 
-static void* tospace_start;
-static void* tospace_end;
-
-static Boolean obj_belongs_to_tospace(Partial_Reveal_Object* p_obj)
-{
-  return ( p_obj >= tospace_start && p_obj < tospace_end );
-}
-
 static FORCE_INLINE void scan_slot(Collector *collector, REF *p_ref) 
 {
   Partial_Reveal_Object *p_obj = read_slot(p_ref);
@@ -121,7 +113,7 @@
     write_slot(p_ref, p_target_obj);
 
     /* check if the target obj stays in NOS, and p_ref from MOS. If yes, rem p_ref. */
-    if(obj_is_survivor(p_target_obj))
+    if(obj_belongs_to_tospace(p_target_obj))
       if( !addr_belongs_to_nos(p_ref) && address_belongs_to_gc_heap(p_ref, gc))
         collector_remset_add_entry(collector, ( Partial_Reveal_Object**) p_ref); 
 
@@ -163,7 +155,7 @@
   write_slot(p_ref, p_target_obj);
   
   /* check if the target obj stays in NOS, and p_ref from MOS. If yes, rem p_ref. */
-  if(obj_is_survivor(p_target_obj)){
+  if(obj_belongs_to_tospace(p_target_obj)){
     if( !addr_belongs_to_nos(p_ref) && address_belongs_to_gc_heap(p_ref, gc))
       collector_remset_add_entry(collector, ( Partial_Reveal_Object**) p_ref); 
   }
@@ -178,10 +170,18 @@
   Vector_Block* trace_stack = (Vector_Block*)collector->trace_stack;
   while( !vector_stack_is_empty(trace_stack)){
     p_ref = (REF *)vector_stack_pop(trace_stack); 
+#ifdef PREFETCH_SUPPORTED
+    /* DO PREFETCH */
+   if(mark_prefetch) {
+     if(!vector_stack_is_empty(trace_stack)) {
+        REF *pref = (REF*)vector_stack_read(trace_stack, 0);
+        PREFETCH( read_slot(pref) );
+     }
+   }
+#endif
     forward_object(collector, p_ref);
     trace_stack = (Vector_Block*)collector->trace_stack;
   }
-    
   return; 
 }
  
@@ -246,6 +246,15 @@
       REF *p_ref = (REF *)*iter;
       iter = vector_block_iterator_advance(trace_task,iter);
       assert(*p_ref); /* a task can't be NULL, it was checked before put into the task stack */
+#ifdef PREFETCH_SUPPORTED      
+      /* DO PREFETCH */  
+      if( mark_prefetch ) {    
+        if(!vector_block_iterator_end(trace_task, iter)) {
+      	  REF *pref= (REF*) *iter;
+      	  PREFETCH( read_slot(pref));
+        }	
+      }
+#endif            
       /* in sequential version, we only trace same object once, but we were using a local hashset for that,
          which couldn't catch the repetition between multiple collectors. This is subject to more study. */
    

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace_nongen_ss_pool.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace_nongen_ss_pool.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace_nongen_ss_pool.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace_nongen_ss_pool.cpp Fri Mar 14 04:21:27 2008
@@ -87,6 +87,8 @@
   GC* gc = collector->gc;
   Partial_Reveal_Object *p_obj = read_slot(p_ref);
 
+  if(obj_belongs_to_tospace(p_obj)) return;
+    
   if(!obj_belongs_to_nos(p_obj)){
     if(obj_mark_in_oi(p_obj)){
 #ifdef GC_GEN_STATS
@@ -150,6 +152,15 @@
   Vector_Block* trace_stack = (Vector_Block*)collector->trace_stack;
   while( !vector_stack_is_empty(trace_stack)){
     p_ref = (REF *)vector_stack_pop(trace_stack); 
+#ifdef PREFETCH_SUPPORTED
+    /* DO PREFETCH */
+   if(mark_prefetch) {
+     if(!vector_stack_is_empty(trace_stack)) {
+        REF *pref = (REF*)vector_stack_read(trace_stack, 0);
+        PREFETCH( read_slot(pref) );
+     }
+   }
+#endif    
     forward_object(collector, p_ref);
     trace_stack = (Vector_Block*)collector->trace_stack;
   }
@@ -213,6 +224,15 @@
     while(!vector_block_iterator_end(trace_task,iter)){
       REF *p_ref = (REF *)*iter;
       iter = vector_block_iterator_advance(trace_task, iter);
+#ifdef PREFETCH_SUPPORTED
+      /* DO PREFETCH */
+      if( mark_prefetch ) {    
+        if(!vector_block_iterator_end(trace_task, iter)) {
+      	  REF *pref= (REF*) *iter;
+      	  PREFETCH( read_slot(pref));
+        }	
+      }
+#endif      
       trace_object(collector, p_ref);
       
       if(collector->result == FALSE)  break; /* force return */
@@ -255,6 +275,11 @@
 void nongen_ss_pool(Collector* collector) 
 {  
   GC* gc = collector->gc;
+
+  Sspace* sspace = (Sspace*)collector->collect_space;
+  unsigned int sspace_first_idx = sspace->first_block_idx;
+  tospace_start = (void*)&(sspace->blocks[sspace->tospace_first_idx - sspace_first_idx]);
+  tospace_end = (void*)&(sspace->blocks[sspace->ceiling_block_idx - sspace_first_idx + 1]);
   
   collector_trace_rootsets(collector);  
   /* the rest work is not enough for parallelization, so let only one thread go */

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.cpp Fri Mar 14 04:21:27 2008
@@ -30,7 +30,6 @@
 unsigned int MINOR_COLLECTORS = 0;
 unsigned int MAJOR_COLLECTORS = 0;
 static volatile unsigned int live_collector_num = 0;
-Boolean is_collector_local_alloc = TRUE;
 
 void collector_restore_obj_info(Collector* collector)
 {
@@ -85,8 +84,8 @@
     
   GC_Metadata* metadata = collector->gc->metadata;
   
-  if(gc_is_gen_mode() && gc_match_kind(collector->gc, MINOR_COLLECTION)){
-    if( NOS_PARTIAL_FORWARD || MINOR_ALGO == MINOR_GEN_SEMISPACE_POOL ){
+  if(gc_is_gen_mode() && collect_is_minor()){
+    if( NOS_PARTIAL_FORWARD || minor_is_semispace() ){
       assert(collector->rem_set==NULL);
       collector->rem_set = free_set_pool_get_entry(metadata);
     }
@@ -96,7 +95,7 @@
   collector_reset_weakref_sets(collector);
 #endif
 
-#if !defined(USE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
+#if !defined(USE_UNIQUE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
   /*For LOS_Shrink and LOS_Extend*/
   if(gc_has_space_tuner(collector->gc) && collector->gc->tuner->kind != TRANS_NOTHING){
     collector->non_los_live_obj_size = 0;
@@ -131,9 +130,9 @@
 static void assign_collector_with_task(GC* gc, TaskType task_func, Space* space)
 {
   /* FIXME:: to adaptively identify the num_collectors_to_activate */
-  if( MINOR_COLLECTORS && gc_match_kind(gc, MINOR_COLLECTION)){
+  if( MINOR_COLLECTORS && collect_is_minor()){
     gc->num_active_collectors = MINOR_COLLECTORS;
-  }else if ( MAJOR_COLLECTORS && gc_match_kind(gc, MAJOR_COLLECTION)){
+  }else if ( MAJOR_COLLECTORS && collect_is_major()){
     gc->num_active_collectors = MAJOR_COLLECTORS;
   }else{
     gc->num_active_collectors = gc->num_collectors;
@@ -182,7 +181,7 @@
     task_func(collector);
 
    //conducted after collection to return last TLB in hand 
-   #if !defined(USE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
+   #if !defined(USE_UNIQUE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
     gc_reset_collector_alloc(collector->gc, collector);
    #endif
     collector_notify_work_done(collector);
@@ -230,14 +229,14 @@
 
 void collector_init_stats(Collector* collector)
 {
-#if !defined(USE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
+#if !defined(USE_UNIQUE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
   gc_gen_collector_stats_initialize(collector);
 #endif
 }
 
 void collector_destruct_stats(Collector* collector)
 {
-#if !defined(USE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
+#if !defined(USE_UNIQUE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
   gc_gen_collector_stats_destruct(collector);
 #endif
 }
@@ -349,4 +348,20 @@
   return TRUE;
 
 }
+
+int64 gc_get_collector_time(GC* gc)
+{
+  int64 time_collector = 0;
+  unsigned int num_active_collectors = gc->num_active_collectors;
+  unsigned int i = 0;
+  for(; i<num_active_collectors; i++){
+    Collector* collector = gc->collectors[i];
+    int64 time_measured = collector->time_measurement_end - collector->time_measurement_start;
+    if(time_measured > time_collector)
+      time_collector = time_measured;
+  }
+  return time_collector;
+}
+
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.h Fri Mar 14 04:21:27 2008
@@ -29,11 +29,9 @@
 struct Chunk_Header;
 struct Free_Chunk_List;
 
-extern Boolean is_collector_local_alloc;
-
 #define NORMAL_SIZE_SEGMENT_GRANULARITY_BITS  8
 #define NORMAL_SIZE_SEGMENT_GRANULARITY (1 << NORMAL_SIZE_SEGMENT_GRANULARITY_BITS)
-#define NORMAL_SIZE_SEGMENT_NUM (GC_OBJ_SIZE_THRESHOLD / NORMAL_SIZE_SEGMENT_GRANULARITY)
+#define NORMAL_SIZE_SEGMENT_NUM (GC_LOS_OBJ_SIZE_THRESHOLD / NORMAL_SIZE_SEGMENT_GRANULARITY)
 #define SIZE_TO_SEGMENT_INDEX(size) ((((size) + NORMAL_SIZE_SEGMENT_GRANULARITY-1) >> NORMAL_SIZE_SEGMENT_GRANULARITY_BITS) - 1)
 #define SEGMENT_INDEX_TO_SIZE(index)  (((index)+1) << NORMAL_SIZE_SEGMENT_GRANULARITY_BITS)
 
@@ -49,6 +47,8 @@
   VmThreadHandle thread_handle;   /* This thread; */
   unsigned int handshake_signal; /*Handshake is used in concurrent GC.*/
   unsigned int num_alloc_blocks; /* the number of allocated blocks in this collection. */
+  int64 time_measurement_start;
+  int64 time_measurement_end;
   /* End of Allocator --> */
 
   /* FIXME:: for testing */
@@ -111,12 +111,13 @@
 void collector_attach_hashcode(Collector *collector);
 #endif
 
-#ifndef USE_MARK_SWEEP_GC
+#ifndef USE_UNIQUE_MARK_SWEEP_GC
 void gc_gen_hook_for_collector_init(Collector *collector);
 #endif
 
 Boolean is_collector_finished(GC* gc);
 void wait_collection_finish(GC* gc);
+int64 gc_get_collector_time(GC* gc);
 
 inline Boolean gc_collection_result(GC* gc)
 {

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.h Fri Mar 14 04:21:27 2008
@@ -34,10 +34,7 @@
 
 extern Space_Alloc_Func mos_alloc;
 
-//FIXME: MINOR_ALGO is static
-extern unsigned int MINOR_ALGO;
-
-/* NOS forward obj to other space in MINOR_COLLECTION */
+/* NOS forward obj to other space in ALGO_MINOR */
 FORCE_INLINE Partial_Reveal_Object* collector_forward_object(Collector* collector, Partial_Reveal_Object* p_obj)
 {
   Obj_Info_Type oi = get_obj_info_raw(p_obj);
@@ -65,18 +62,16 @@
   Allocator* allocator = (Allocator*)collector;
   
   /* can also use collector->collect_space->collect_algorithm */
-  if( MINOR_ALGO == MINOR_NONGEN_SEMISPACE_POOL || MINOR_ALGO == MINOR_GEN_SEMISPACE_POOL){
+  if( minor_is_semispace()){
 
-    p_targ_obj = (Partial_Reveal_Object*)semispace_forward_obj(p_obj, size, allocator);
+    p_targ_obj = (Partial_Reveal_Object*)semispace_copy_object(p_obj, size, allocator);
     if( !p_targ_obj )
       allocator = ((Collector*)collector)->backup_allocator;
 
-  }else{ /* other non-ss algorithms. FIXME:: I am going to remove this branch if it has no perf impact. */
-    
-    if(is_collector_local_alloc){  /* try local alloc first if collector supports it. Marksweep doesn't. */
-      p_targ_obj = thread_local_alloc(size, allocator);
-    }
-  }
+  } /*
+  else{ // other non-ss algorithms. can do thread_local_alloc here to speedup. I removed it for simplicity.  
+     if(support thread local alloc in MOS) p_targ_obj = thread_local_alloc(size, allocator);
+  }*/
     
   if(!p_targ_obj){
     p_targ_obj = (Partial_Reveal_Object*)mos_alloc(size, allocator);
@@ -85,7 +80,7 @@
   if(p_targ_obj == NULL){
     /* failed to forward an obj */
     collector->result = FALSE;
-    TRACE2("gc.collect", "failed to forward an obj, minor collection failed.");
+    TRACE2("gc.collect", "failed to forward an object, minor collection failed.");
     return NULL;
   }
     

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/gc_thread.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/gc_thread.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/gc_thread.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/gc_thread.h Fri Mar 14 04:21:27 2008
@@ -27,7 +27,7 @@
 
 #define ALLOC_ZEROING
 
-#ifndef _IPF_
+#ifdef PREFETCH_SUPPORTED
 #define ALLOC_PREFETCH
 #endif
 
@@ -68,7 +68,10 @@
   VmThreadHandle thread_handle;   /* This thread; */
   unsigned int handshake_signal; /*Handshake is used in concurrent GC.*/
   /* the number of allocated blocks. For collector, it reflects the load balance; for mutator, it reflects mutator activities. */
-  unsigned int num_alloc_blocks; 
+  unsigned int num_alloc_blocks;
+  /* Time measurment. For collector, it's used to collect collection time; for mutator, it's used to collect mutator time.  */
+  int64 time_measurement_start;
+  int64 time_measurement_end;
 }Allocator;
 
 inline void thread_local_unalloc(unsigned int size, Allocator* allocator)

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.cpp Fri Mar 14 04:21:27 2008
@@ -277,3 +277,19 @@
   return;
 }
 
+int64 gc_get_marker_time(GC* gc)
+{
+  int64 time_marker = 0;
+  unsigned int num_active_markers = gc->num_active_markers;
+  unsigned int i = 0;
+  for(; i<num_active_markers; i++){
+    Marker* marker = gc->markers[i];
+    int64 time_measured = marker->time_measurement_end - marker->time_measurement_start;
+    if(time_measured > time_marker)
+      time_marker = time_measured;
+  }
+  return time_marker;
+}
+
+
+

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.h Fri Mar 14 04:21:27 2008
@@ -33,6 +33,8 @@
   VmThreadHandle thread_handle;   /* This thread; */
   unsigned int handshake_signal; /*Handshake is used in concurrent GC.*/  
   unsigned int num_alloc_blocks; /* the number of allocated blocks in this collection. */
+  int64 time_measurement_start;
+  int64 time_measurement_end;
   /* End of Allocator --> */
 
   /* FIXME:: for testing */
@@ -95,8 +97,9 @@
 void marker_notify_mark_root_done(Marker* marker);
 void wait_mark_finish(GC* gc);
 Boolean is_mark_finished(GC* gc);
+int64 gc_get_marker_time(GC* gc);
 
+#endif //_MARKER_H_
 
 
-#endif //_MARKER_H_
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.cpp Fri Mar 14 04:21:27 2008
@@ -21,6 +21,7 @@
 
 #include "mutator.h"
 #include "../trace_forward/fspace.h"
+#include "../mark_sweep/gc_ms.h"
 #include "../mark_sweep/wspace.h"
 #include "../finalizer_weakref/finalizer_weakref.h"
 
@@ -45,7 +46,7 @@
   else
     mutator->obj_with_fin = NULL;
 
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
   allocator_init_local_chunks((Allocator*)mutator);
 #endif
   
@@ -54,7 +55,8 @@
   mutator->next = (Mutator *)gc->mutator_list;
   gc->mutator_list = mutator;
   gc->num_mutators++;
-
+  /*Begin to measure the mutator thread execution time. */
+  mutator->time_measurement_start = time_now();
   unlock(gc->mutator_list_lock); // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   
   gc_set_tls(mutator);
@@ -72,8 +74,9 @@
 
   lock(gc->mutator_list_lock);     // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
 
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
     allocactor_destruct_local_chunks((Allocator*)mutator);
+    allocator_register_new_obj_size((Allocator*)mutator);
 #endif
 
   volatile Mutator *temp = gc->mutator_list;
@@ -172,5 +175,36 @@
   unlock(gc->mutator_list_lock); 
   return NULL;
 }
+
+void gc_start_mutator_time_measurement(GC* gc)
+{
+  lock(gc->mutator_list_lock);
+  Mutator* mutator = gc->mutator_list;
+  while (mutator) {
+    mutator->time_measurement_start = time_now();
+    mutator = mutator->next;
+  }  
+  unlock(gc->mutator_list_lock);
+}
+
+int64 gc_get_mutator_time(GC* gc)
+{
+  int64 time_mutator = 0;
+  lock(gc->mutator_list_lock);
+  Mutator* mutator = gc->mutator_list;
+  while (mutator) {
+#ifdef _DEBUG
+    mutator->time_measurement_end = time_now();
+#endif
+    int64 time_measured = time_now() - mutator->time_measurement_start;
+    if(time_measured > time_mutator){
+      time_mutator = time_measured;
+    }
+    mutator = mutator->next;
+  }  
+  unlock(gc->mutator_list_lock);
+  return time_mutator;
+}
+
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.h Fri Mar 14 04:21:27 2008
@@ -39,6 +39,8 @@
   VmThreadHandle thread_handle;   /* This thread; */
   volatile unsigned int handshake_signal; /*Handshake is used in concurrent GC.*/
   unsigned int num_alloc_blocks; /* the number of allocated blocks since last collection. */
+  int64 time_measurement_start;
+  int64 time_measurement_end;
   /* END of Allocator --> */
   
   Vector_Block* rem_set;
@@ -48,6 +50,7 @@
   SpinLock dirty_set_lock;
   unsigned int dirty_obj_slot_num; //only ON_THE_FLY
   unsigned int dirty_obj_num; //concurrent mark  
+  POINTER_SIZE_INT new_obj_size;
 } Mutator;
 
 void mutator_initialize(GC* gc, void* tls_gc_info);
@@ -59,6 +62,8 @@
 
 Boolean gc_local_dirtyset_is_empty(GC* gc);
 Vector_Block* gc_get_local_dirty_set(GC* gc, unsigned int shared_id);
+void gc_start_mutator_time_measurement(GC* gc);
+int64 gc_get_mutator_time(GC* gc);
 
 inline void mutator_post_signal(Mutator* mutator, unsigned int handshake_signal)
 { 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp Fri Mar 14 04:21:27 2008
@@ -80,24 +80,32 @@
   gc_alloc_statistic_obj_distrubution(size);
 #endif
 
-#if defined(USE_MARK_SWEEP_GC)
+#if defined(USE_UNIQUE_MARK_SWEEP_GC)
+
   p_obj = (Managed_Object_Handle)gc_ms_alloc(size, allocator);
+
 #elif defined(USE_UNIQUE_MOVE_COMPACT_GC)
+
   p_obj = (Managed_Object_Handle)gc_mc_alloc(size, allocator);
+
 #else
-  if ( size > GC_OBJ_SIZE_THRESHOLD ){
+
+  if ( size > GC_LOS_OBJ_SIZE_THRESHOLD ){
     p_obj = (Managed_Object_Handle)los_alloc(size, allocator);
+
 #ifdef GC_GEN_STATS
     if (p_obj != NULL){
       GC_Gen* gc = (GC_Gen*)allocator->gc;
       gc->stats->obj_num_los_alloc++;
       gc->stats->total_size_los_alloc += size;
     }
-#endif
+#endif /* #ifdef GC_GEN_STATS */
+
   }else{
       p_obj = (Managed_Object_Handle)nos_alloc(size, allocator);
   }
-#endif
+
+#endif /* defined(USE_UNIQUE_MARK_SWEEP_GC) else */
 
   if( p_obj == NULL )
     return NULL;
@@ -125,21 +133,28 @@
 #ifdef GC_OBJ_SIZE_STATISTIC
   gc_alloc_statistic_obj_distrubution(size);
 #endif
-  
-  /* object shoud be handled specially */
-  if ( size > GC_OBJ_SIZE_THRESHOLD ) return NULL;
- 
+   
   Allocator* allocator = (Allocator*)gc_get_tls();
  
   /* Try to allocate an object from the current Thread Local Block */
   Managed_Object_Handle p_obj;
-#if defined(USE_MARK_SWEEP_GC)
+
+#if defined(USE_UNIQUE_MARK_SWEEP_GC)
+
   p_obj = (Managed_Object_Handle)gc_ms_fast_alloc(size, allocator);
+
 #elif defined(USE_UNIQUE_MOVE_COMPACT_GC)
-  p_obj = (Managed_Object_Handle)gc_mc_fast_alloc(size, allocator);
+
+  if ( size > GC_LARGE_OBJ_SIZE_THRESHOLD ) return NULL;
+  p_obj = (Managed_Object_Handle)thread_local_alloc(size, allocator);
+
 #else
+  /* object shoud be handled specially */
+  if ( size > GC_LOS_OBJ_SIZE_THRESHOLD ) return NULL;
   p_obj = (Managed_Object_Handle)thread_local_alloc(size, allocator);
+
 #endif
+
   if(p_obj == NULL) return NULL;
 
   assert((((POINTER_SIZE_INT)p_obj) % GC_OBJECT_ALIGNMENT) == 0);

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.cpp Fri Mar 14 04:21:27 2008
@@ -106,11 +106,10 @@
   unsigned int first_idx = fspace->first_block_idx;
   unsigned int marked_start_idx = 0; //was for oi markbit reset, now useless
   unsigned int marked_last_idx = 0;
-  Boolean is_major_collection = gc_match_kind(fspace->gc, MAJOR_COLLECTION);
-  Boolean gen_mode = gc_is_gen_mode();
+  Boolean is_major_collection = collect_is_major();
   
   if(  is_major_collection || 
-         NOS_PARTIAL_FORWARD == FALSE || !gen_mode)            
+         NOS_PARTIAL_FORWARD == FALSE || !gc_is_gen_mode())            
   {
     fspace->free_block_idx = first_idx;
     fspace->ceiling_block_idx = first_idx + fspace->num_managed_blocks - 1;  
@@ -189,45 +188,24 @@
   fspace->num_collections++;  
 
   GC* gc = fspace->gc;
-
-  if(gc_is_gen_mode()){
-    fspace->collect_algorithm = MINOR_GEN_FORWARD_POOL;
-  }else{
-    fspace->collect_algorithm = MINOR_NONGEN_FORWARD_POOL;
-  }
   
   /* we should not destruct rootset structure in case we need fall back */
   pool_iterator_init(gc->metadata->gc_rootset_pool);
 
-  switch(fspace->collect_algorithm){
-
+  if( !gc_is_gen_mode() ){
 #ifdef MARK_BIT_FLIPPING
 
-    case MINOR_NONGEN_FORWARD_POOL:
-      TRACE2("gc.process", "GC: nongen_forward_pool algo start ... \n");
-      collector_execute_task(gc, (TaskType)nongen_forward_pool, (Space*)fspace);
-      TRACE2("gc.process", "\nGC: end of nongen forward algo ... \n");
-#ifdef GC_GEN_STATS
-      gc_gen_stats_set_nos_algo((GC_Gen*)gc, MINOR_NONGEN_FORWARD_POOL);
-#endif
-      break;
-
-#endif /*#ifdef MARK_BIT_FLIPPING */
-
-    case MINOR_GEN_FORWARD_POOL:
-      TRACE2("gc.process", "gen_forward_pool algo start ... \n");
-      collector_execute_task(gc, (TaskType)gen_forward_pool, (Space*)fspace);
-      TRACE2("gc.process", "\nGC: end of gen forward algo ... \n");
-#ifdef GC_GEN_STATS
-      gc_gen_stats_set_nos_algo((GC_Gen*)gc, MINOR_NONGEN_FORWARD_POOL);
-#endif
-      break;
-    
-    default:
-      DIE2("gc.collection","Specified minor collection algorithm doesn't exist!");
-      exit(0);
-      break;
-  }
+    TRACE2("gc.process", "GC: nongenerational forward algo start ... \n");
+    collector_execute_task(gc, (TaskType)nongen_forward_pool, (Space*)fspace);
+    TRACE2("gc.process", "\nGC: end of nongen forward algo ... \n");
+#else
+    assert(0);  
+#endif /*#ifdef MARK_BIT_FLIPPING #else */
+  }else{
+    TRACE2("gc.process", "generational forward algo start ... \n");
+    collector_execute_task(gc, (TaskType)gen_forward_pool, (Space*)fspace);
+    TRACE2("gc.process", "\nGC: end of gen forward algo ... \n");
+  }    
   
   return; 
 }

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.h Fri Mar 14 04:21:27 2008
@@ -29,9 +29,6 @@
  * In our Gen GC, not all live objects are copied to tspace space, the newer baby will
  * still be preserved in  fspace, that means to give them time to die. 
  */
-#ifdef PREFETCH_SUPPORTED
-extern Boolean mark_prefetch;
-#endif
 
 extern Boolean forward_first_half;
 /* boundary splitting fspace into forwarding part and remaining part */

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_nongen_forward_pool.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_nongen_forward_pool.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_nongen_forward_pool.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_nongen_forward_pool.cpp Fri Mar 14 04:21:27 2008
@@ -40,21 +40,10 @@
   return;
 }
 
-/* forward declaration */
-static void forward_jlc_instance(Collector* collector, Partial_Reveal_Object *p_obj);
-
 static FORCE_INLINE void scan_object(Collector* collector, Partial_Reveal_Object *p_obj) 
 {
   assert((((POINTER_SIZE_INT)p_obj) % GC_OBJECT_ALIGNMENT) == 0);
-  
-  Partial_Reveal_VTable *vtable = decode_vt(obj_get_vt(p_obj));
-  if(TRACE_JLC_VIA_VTABLE){
-    if(vtable->vtmark == VT_UNMARKED) {
-      vtable->vtmark = VT_MARKED;
-      forward_jlc_instance(collector, vtable->jlC);
-    }
-  }
-    
+      
   if (!object_has_ref_field_before_scan(p_obj)) return;
     
   REF *p_ref;
@@ -143,34 +132,6 @@
 #endif
   write_slot(p_ref, p_target_obj);
 
-  scan_object(collector, p_target_obj); 
-  return;
-}
-
-/*
- Forward the vtable->jlc and trace the forwarded object. 
- But do not update the vtable->jlc but leave them for weakroots updating
- We probably do not need this function if we do not perform class unloading in minor collections. 
- That means all the weakroots to jlc instances are treated as strong roots.
-*/
-static void forward_jlc_instance(Collector* collector, Partial_Reveal_Object *p_obj) 
-{
-  if(!obj_belongs_to_nos(p_obj)){
-    if(obj_mark_in_oi(p_obj))
-      scan_object(collector, p_obj);
-    return;
-  }
-
-  /* following is the logic for forwarding */  
-  Partial_Reveal_Object* p_target_obj = collector_forward_object(collector, p_obj);
-  if( p_target_obj == NULL ){
-    if(collector->result == FALSE ){
-      vector_stack_clear(collector->trace_stack);
-      return; /* FIXME: the failure result is not propagated back to GC */
-    }
-    assert(obj_get_fw_in_oi(p_obj));
-    return;
-  }
   scan_object(collector, p_target_obj); 
   return;
 }

Added: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/uneven_map.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/uneven_map.h?rev=637062&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/uneven_map.h (added)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/uneven_map.h Fri Mar 14 04:21:27 2008
@@ -0,0 +1,72 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+#ifndef _UNEVEN_MAP_H_
+#define _UNEVEN_MAP_H_
+
+#include "../common/gc_metadata.h"
+
+#define MAP_ARRAY_SIZE 512
+#define MAP_VECTOR_ENTRY_SHIFT 8
+#define MAP_VECTOR_ENTRY_NUM (1<<MAP_VECTOR_ENTRY_SHIFT)
+
+typedef Vector_Block* Uneven_Map[MAP_ARRAY_SIZE];
+
+extern GC_Metadata gc_metadata;
+
+FORCE_INLINE void to_from_hash_insert(Uneven_Map* map, unsigned int to_block_index, unsigned int from_block_index)
+{
+  unsigned int vector_block_index = to_block_index >> MAP_VECTOR_ENTRY_SHIFT;
+  unsigned int vector_block_entry = to_block_index & (MAP_VECTOR_ENTRY_NUM - 1);
+  Vector_Block *vector_block = (*map)[vector_block_index];
+  if(vector_block == NULL){    
+    Vector_Block *new_vector_block = free_set_pool_get_entry(&gc_metadata);
+    assert(new_vector_block);
+    vector_block_set_zero(new_vector_block);
+    (*map)[vector_block_index] = new_vector_block;
+    vector_block = new_vector_block;
+  }
+  assert(vector_block_entry < MAP_VECTOR_ENTRY_NUM);
+  vector_block_set_at_index(vector_block, vector_block_entry, (POINTER_SIZE_INT)from_block_index);
+}
+
+FORCE_INLINE unsigned int uneven_map_get(Uneven_Map* map, unsigned int to_block_index)
+{
+  unsigned int vector_block_index = to_block_index >> MAP_VECTOR_ENTRY_SHIFT;
+  unsigned int vector_block_entry = to_block_index & (MAP_VECTOR_ENTRY_NUM - 1);
+  Vector_Block *vector_block = (*map)[vector_block_index];
+  assert(vector_block_entry < MAP_VECTOR_ENTRY_NUM);
+
+  if(vector_block)
+    return (unsigned int)vector_block_get_at_index(vector_block, vector_block_entry);
+
+  return 0;
+}
+
+FORCE_INLINE void uneven_map_free(Uneven_Map* map)
+{
+  Vector_Block *block;
+  for(unsigned int i = 0; i<MAP_ARRAY_SIZE; i++){
+    block = (*map)[i];
+    if(block){      
+      free_set_pool_put_entry(block, &gc_metadata);
+      (*map)[i] = NULL;  
+    }
+  }
+}
+
+#endif

Propchange: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/uneven_map.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/vector_block.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/vector_block.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/vector_block.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/vector_block.h Fri Mar 14 04:21:27 2008
@@ -88,14 +88,14 @@
 #endif
   return value;
 }
-inline void vector_block_add_entry_to_index(Vector_Block* block, unsigned int index, POINTER_SIZE_INT value)
+inline void vector_block_set_at_index(Vector_Block* block, unsigned int index, POINTER_SIZE_INT value)
 {
 #ifdef _DEBUG 
   assert(index < VECTOR_BLOCK_ENTRY_NUM);
 #endif
   block->entries[index] = value;
 }
-inline POINTER_SIZE_INT vector_block_get_entry_from_index(Vector_Block* block, unsigned int index)
+inline POINTER_SIZE_INT vector_block_get_at_index(Vector_Block* block, unsigned int index)
 {
 #ifdef _DEBUG 
   assert(index < VECTOR_BLOCK_ENTRY_NUM);
@@ -185,6 +185,13 @@
 #ifdef _DEBUG
   memset(block->entries, 0, (POINTER_SIZE_INT)block->heap_end - (POINTER_SIZE_INT)block->entries);
 #endif
+}
+
+inline void vector_block_set_zero(Vector_Block* block)
+{
+  block->head = (POINTER_SIZE_INT*)block->entries;
+  block->tail = (POINTER_SIZE_INT*)block->entries;
+  memset(block->entries, 0, (POINTER_SIZE_INT)block->heap_end - (POINTER_SIZE_INT)block->entries);
 }
 
 /* Below is for sequential local access */

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.cpp Fri Mar 14 04:21:27 2008
@@ -85,14 +85,14 @@
 {
   Partial_Reveal_Object* p_obj = read_slot(p_ref);
   assert(address_belongs_to_gc_heap(p_obj,heap_verifier->gc));
-#if !defined(USE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
+#if !defined(USE_UNIQUE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
   GC_Gen* gc    = (GC_Gen*)heap_verifier->gc;
   Space* mspace = gc_get_mos(gc);
   Space* lspace  = gc_get_los(gc);
   Space* nos = gc_get_nos(gc);
 
   if(p_obj == NULL){
-    if(gc_match_kind((GC*)gc, MAJOR_COLLECTION) ||(!heap_verifier->gc_is_gen_mode && !NOS_PARTIAL_FORWARD)){
+    if(collect_is_major() ||(!heap_verifier->gc_is_gen_mode && !NOS_PARTIAL_FORWARD)){
       assert(0);
       return FALSE;
     }else{
@@ -116,7 +116,7 @@
       assert(0);
       return FALSE;
     }
-#if !defined(USE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
+#if !defined(USE_UNIQUE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
   }else{
     if(heap_verifier->gc_verifier->is_before_fallback_collection){
       if(!address_belongs_to_gc_heap(p_obj, heap_verifier->gc)){
@@ -128,8 +128,8 @@
     }
 
     if(!address_belongs_to_space(p_obj, mspace) && !address_belongs_to_space(p_obj, lspace) && !NOS_PARTIAL_FORWARD){
-      if( gc_match_kind((GC*)gc, MINOR_COLLECTION)){
-        if( nos->collect_algorithm == MINOR_NONGEN_SEMISPACE_POOL || nos->collect_algorithm == MINOR_GEN_SEMISPACE_POOL){
+      if( collect_is_minor()){
+        if( minor_is_semispace()){
           if( obj_belongs_to_survivor_area((Sspace*)nos, p_obj)) 
             return TRUE;            
         }
@@ -218,17 +218,15 @@
 {
   GC* gc = heap_verifier->gc;
   char* gc_kind;
-  if(gc_match_kind(gc, MINOR_COLLECTION)){ 
+  if(collect_is_minor()){ 
     gc_kind = " minor collection.";
-  }else if(gc_match_kind(gc, FALLBACK_COLLECTION)){ 
+  }else if(collect_is_fallback()){ 
     gc_kind = " fallback collection.";
-  }else if(gc_match_kind(gc, EXTEND_COLLECTION)){ 
-    gc_kind = " extend collection.";
-  }else if(gc_match_kind(gc, NORMAL_MAJOR_COLLECTION)){ 
+  }else if(collect_is_major_normal()){ 
     if(gc->tuner->kind == TRANS_NOTHING)  gc_kind = "major collection (normal)";
     else if(gc->tuner->kind == TRANS_FROM_LOS_TO_MOS) gc_kind = "major collection (LOS shrink)";
     else if(gc->tuner->kind == TRANS_FROM_MOS_TO_LOS) gc_kind = "major collection (LOS extend)";
-  }else if(gc_match_kind(gc, MARK_SWEEP_GC)){
+  }else if(major_is_marksweep()){
     gc_kind = " mark sweep collection.";
   }
   printf(" GC_kind: %s\n", gc_kind);
@@ -268,5 +266,7 @@
 {
     printf(" %-14s:    %-7s |   Before %10d   |   After %10d   |\n", "hashcode", "NUM", gc_verifier->num_hash_before_gc, gc_verifier->num_hash_after_gc);
 }
+
+
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.h Fri Mar 14 04:21:27 2008
@@ -28,7 +28,7 @@
 #ifdef USE_32BITS_HASHCODE
 #include "../common/hashcode.h"
 #endif
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
 #include "../mark_sweep/wspace_mark_sweep.h"
 #endif
 #include "../common/gc_concurrent.h"
@@ -120,7 +120,7 @@
   assert(decode_vt(obj_get_vt(p_obj)));
   assert(!address_belongs_to_gc_heap(decode_vt(obj_get_vt(p_obj)), (GC*)heap_verifier->gc));
 
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
   GC_MS* gc = (GC_MS*)heap_verifier->gc;
   if(!heap_verifier->is_before_gc){
     /*in GC_MS mark sweep algorithm, all live objects should be set their mark bit*/

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_scanner.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_scanner.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_scanner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_scanner.cpp Fri Mar 14 04:21:27 2008
@@ -37,7 +37,7 @@
 {
   GC_Verifier* gc_verifier = heap_verifier->gc_verifier;
 
-#if !defined(USE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
+#if !defined(USE_UNIQUE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
   if(gc_verifier->is_before_fallback_collection) {
     if(obj_belongs_to_nos(p_obj) && obj_is_fw_in_oi(p_obj)){
       assert(obj_get_vt(p_obj) == obj_get_vt(obj_get_fw_in_oi(p_obj)));
@@ -49,8 +49,7 @@
   
   if(!obj_mark_in_vt(p_obj)) return;
 
-   extern unsigned int MAJOR_ALGO;
-  if( MAJOR_ALGO != MAJOR_MARK_SWEEP && p_obj >= los_boundary ){
+  if( !major_is_marksweep() && p_obj >= los_boundary ){
     Block_Header* block = GC_BLOCK_HEADER(p_obj);
     if( heap_verifier->is_before_gc)  block->num_live_objs++;
     /* we can't set block->num_live_objs = 0 if !is_before_gc, because the some blocks may be freed hence not
@@ -87,7 +86,7 @@
 
 #ifndef BUILD_IN_REFERENT
      WeakReferenceType type = special_reference_type(p_obj);
-    if(type == SOFT_REFERENCE && verifier_get_gc_collect_kind(heap_verifier->gc_verifier) == MINOR_COLLECTION){
+    if(type == SOFT_REFERENCE && verifier_collect_is_minor(gc_verifier)){
       p_ref = obj_get_referent_field(p_obj);
       scan_slot(heap_verifier, p_ref);
     } 
@@ -300,7 +299,7 @@
     WeakReferenceType type = special_reference_type(p_obj);
     if(type == NOT_REFERENCE) return;
     
-    //if(type != SOFT_REFERENCE && verifier_get_gc_collect_kind(heap_verifier) == MINOR_COLLECTION){
+    //if(type != SOFT_REFERENCE && verifier_collect_is_minor(heap_verifier->gc_verifier)){
     {
       p_ref = obj_get_referent_field(p_obj);
       verify_write_barrier(p_ref, heap_verifier);
@@ -374,7 +373,7 @@
 
 void verifier_scan_all_objects(Heap_Verifier* heap_verifier)
 {
-#if !defined(USE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
+#if !defined(USE_UNIQUE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
   GC_Gen* gc       = (GC_Gen*)heap_verifier->gc;
   Space* fspace     = gc_get_nos(gc);
   Space* mspace   = gc_get_mos(gc);
@@ -422,7 +421,7 @@
 
 void verifier_scan_unreachable_objects(Heap_Verifier* heap_verifier)
 {
-#if !defined(USE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
+#if !defined(USE_UNIQUE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
   if(heap_verifier->is_before_gc) return;
   GC_Gen* gc       = (GC_Gen*)heap_verifier->gc;  
   Space* mspace   = gc_get_mos(gc);
@@ -441,5 +440,7 @@
   heap_verifier->live_obj_scanner = verifier_scan_live_objects;
   heap_verifier->all_obj_scanner   = verifier_scan_all_objects;
 }
+
+
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.cpp Fri Mar 14 04:21:27 2008
@@ -17,7 +17,7 @@
 
 #include "verifier_common.h"
 #include "verify_gc_effect.h"
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
 #include "../mark_sweep/wspace_mark_sweep.h"
 #endif
 
@@ -103,6 +103,7 @@
     assert(p_obj_information);
     p_obj_information->vt_raw = obj_get_vt_raw(p_obj);
     p_obj_information->address = p_obj;
+    p_obj_information->obj_info=get_obj_info_raw(p_obj)& OBJ_INFO_MASK;
     return (void*) p_obj_information;
   }else{
     REF *p_ref;
@@ -113,7 +114,8 @@
 
       p_obj_information->vt_raw = obj_get_vt_raw(p_obj);
       p_obj_information->address = p_obj;
-
+      p_obj_information->obj_info=get_obj_info_raw(p_obj)& OBJ_INFO_MASK;
+      
       p_ref = (REF *)((POINTER_SIZE_INT)array + (int)array_first_element_offset(array));
 
       unsigned int i = 0;
@@ -128,6 +130,7 @@
       
       p_obj_information->vt_raw = obj_get_vt_raw(p_obj);
       p_obj_information->address = p_obj;
+      p_obj_information->obj_info=get_obj_info_raw(p_obj)& OBJ_INFO_MASK;
 
       int* ref_iterator = object_ref_iterator_init(p_obj);
       
@@ -147,7 +150,7 @@
   GC_Verifier* gc_verifier = heap_verifier->gc_verifier;
   assert(obj_belongs_to_space(p_obj, (Space*)fspace));
   unsigned int forwarded_first_part;
-  if(!(gc_verifier->gc_collect_kind == MINOR_COLLECTION) || !NOS_PARTIAL_FORWARD || heap_verifier->gc_is_gen_mode)
+  if(!verifier_collect_is_minor(gc_verifier) || !NOS_PARTIAL_FORWARD || heap_verifier->gc_is_gen_mode)
     forwarded_first_part = true;
   else
     forwarded_first_part = forward_first_half^1;
@@ -296,13 +299,13 @@
   Heap_Verifier_Metadata* verifier_metadata = heap_verifier->heap_verifier_metadata;
   GC_Verifier* gc_verifier = heap_verifier->gc_verifier;
 
-#ifndef USE_MARK_SWEEP_GC
+#ifndef USE_UNIQUE_MARK_SWEEP_GC
   GC_Gen* gc = (GC_Gen*)heap_verifier->gc;
   Space* mspace = gc_get_mos(gc);
   Space* nspace = gc_get_nos(gc);
   Space* lspace  = gc_get_los(gc);
 
-  if(!gc_verifier->is_before_fallback_collection && gc_verifier->gc_collect_kind == MINOR_COLLECTION){
+  if(!gc_verifier->is_before_fallback_collection && verifier_collect_is_minor(gc_verifier)){
     if(!heap_verifier->is_before_gc){
       assert(!obj_belongs_to_space(p_obj, nspace) || !fspace_object_was_forwarded(p_obj, (Fspace*)nspace, heap_verifier) || obj_belongs_to_survivor_area((Sspace*)nspace, p_obj));
       if(obj_belongs_to_space(p_obj, nspace) && fspace_object_was_forwarded(p_obj, (Fspace*)nspace, heap_verifier) && !obj_belongs_to_survivor_area((Sspace*)nspace, p_obj) ){
@@ -376,12 +379,24 @@
 {
   Live_Object_Inform* obj_inform_1 = (Live_Object_Inform*)*obj_container1;
   Live_Object_Inform* obj_inform_2 = (Live_Object_Inform*)*obj_container2;
+  Boolean ret=TRUE;
+  
   if(((POINTER_SIZE_INT)obj_inform_1->vt_raw) == ((POINTER_SIZE_INT)obj_inform_2->vt_raw)){
+    if(obj_inform_1->obj_info != obj_inform_2->obj_info) {
+    	assert(0);
+    	ret = FALSE;
+        goto free_ref;
+    }
     /*FIXME: erase live object information in compare_function. */
     if( object_has_ref_field((Partial_Reveal_Object*)obj_inform_1) ){
       Live_Object_Ref_Slot_Inform* obj_ref_inform_1 = (Live_Object_Ref_Slot_Inform*)obj_inform_1;
       Live_Object_Ref_Slot_Inform* obj_ref_inform_2 = (Live_Object_Ref_Slot_Inform*)obj_inform_2;
-      
+     
+     if(obj_ref_inform_1->obj_info != obj_ref_inform_2->obj_info) {
+    	assert(0);
+    	ret = FALSE;
+    	goto free_ref;
+    } 
       if (object_is_array((Partial_Reveal_Object*)obj_ref_inform_1)){
         Partial_Reveal_Array* array = (Partial_Reveal_Array*)obj_ref_inform_2->address;
         unsigned int array_length = array->array_len;
@@ -389,10 +404,9 @@
         unsigned int i = 0;
         for(; i<array_length;i++){
           if((POINTER_SIZE_INT)obj_ref_inform_1->ref_slot[i] != (POINTER_SIZE_INT)obj_ref_inform_2->ref_slot[i]){
-            assert(0);
-            STD_FREE(obj_ref_inform_1);
-            STD_FREE(obj_ref_inform_1);
-            return FALSE;
+	    assert(0);
+	    ret = FALSE;
+	    goto free_ref;
           }
         }
       }else{
@@ -403,27 +417,21 @@
         for(; i<num_refs; i++){  
           if((POINTER_SIZE_INT)obj_ref_inform_1->ref_slot[i] != (POINTER_SIZE_INT)obj_ref_inform_2->ref_slot[i]){
             assert(0);
-            STD_FREE(obj_ref_inform_1);
-            STD_FREE(obj_ref_inform_1);
-            return FALSE;
+            ret = FALSE;
+            goto free_ref;
           }
         }
 
       }
-      
-      STD_FREE(obj_ref_inform_1);
-      STD_FREE(obj_ref_inform_2);
-    }else{
-      STD_FREE(obj_inform_1);
-      STD_FREE(obj_inform_2);
-    }  
-    return TRUE;
+    }    
   }else{ 
-    assert(0);
-    STD_FREE(obj_inform_1);
-    STD_FREE(obj_inform_2);
-    return FALSE;
+    assert(0); 
+    ret = FALSE;
   }
+free_ref:
+  STD_FREE(obj_inform_1);
+  STD_FREE(obj_inform_2);
+  return ret;
 }
 
 Boolean compare_obj_hash_inform(POINTER_SIZE_INT* container1,POINTER_SIZE_INT* container2)
@@ -550,6 +558,8 @@
 
 void verifier_reset_hash_distance()
 { hash_obj_distance = 0;}
+
+
 
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.h Fri Mar 14 04:21:27 2008
@@ -27,7 +27,7 @@
   Vector_Block* hashcode_set;
 
   Boolean is_tracing_resurrect_obj;
-  unsigned int gc_collect_kind;
+  unsigned int collect_kind;
   Boolean is_before_fallback_collection;
   
   POINTER_SIZE_INT num_live_objects_before_gc;
@@ -54,14 +54,18 @@
   Boolean is_verification_passed;
 }GC_Verifier;
 
+#define OBJ_INFO_MASK (~0x3ff)
+
 typedef struct Live_Object_Inform_struct{
   VT vt_raw;
   Partial_Reveal_Object* address;
+  Obj_Info_Type obj_info;
 } Live_Object_Inform;
 
 typedef struct Live_Object_Ref_Slot_Inform_Struct{
   VT vt_raw;
   Partial_Reveal_Object* address;
+  Obj_Info_Type obj_info;
   VT ref_slot[1];
 } Live_Object_Ref_Slot_Inform;
 
@@ -88,14 +92,19 @@
 
 void verifier_reset_hash_distance();
 
-inline unsigned int verifier_get_gc_collect_kind(GC_Verifier* gc_verifier)
-{  return gc_verifier->gc_collect_kind;  }
 inline void verifier_set_gc_collect_kind(GC_Verifier* gc_verifier, unsigned int collect_kind)
-{  gc_verifier->gc_collect_kind = collect_kind;  }
+{  gc_verifier->collect_kind = collect_kind;  }
+
+inline Boolean verifier_collect_is_minor(GC_Verifier* gc_verifier)
+{
+  return (gc_verifier->collect_kind & ALGO_MAJOR) == 0; 
+}
 
 inline void verifier_set_fallback_collection(GC_Verifier* gc_verifier, Boolean is_before_fallback)
 {  gc_verifier->is_before_fallback_collection = is_before_fallback;  }
 
 #endif
+
+
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_live_heap.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_live_heap.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_live_heap.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_live_heap.cpp Fri Mar 14 04:21:27 2008
@@ -69,7 +69,7 @@
 
 void verify_heap_before_gc(GC* gc)
 {
-  verifier_set_gc_collect_kind(heap_verifier->gc_verifier, gc->collect_kind);  
+  verifier_set_gc_collect_kind(heap_verifier->gc_verifier, GC_PROP);  
   verifier_set_gen_mode(heap_verifier);
   verifier_reset_mutator_verification(heap_verifier);
   verifier_reset_gc_verification(heap_verifier);
@@ -89,11 +89,10 @@
 }
 
 void verifier_cleanup_block_info(GC* gc);
-extern unsigned int MAJOR_ALGO;
 
 void verify_heap_after_gc(GC* gc)
 {
-  if(MAJOR_ALGO != MAJOR_MARK_SWEEP)
+  if(!major_is_marksweep())
     verifier_cleanup_block_info(gc);
       
   if(need_scan_live_objs(heap_verifier))
@@ -121,7 +120,7 @@
 void event_gc_collect_kind_changed(GC* gc)
 {
   /*GC collection kind were changed from normal MINOR or MAJOR  to FALLBACK MAJOR*/
-  assert(gc_match_kind(gc, FALLBACK_COLLECTION));
+  assert(collect_is_fallback());
   if(!heap_verifier->need_verify_gc) return;
   
   /*finish the fallbacked gc verify*/
@@ -136,7 +135,7 @@
   /*start fallback major gc verify */
   heap_verifier->is_before_gc = TRUE;
   verifier_set_fallback_collection(heap_verifier->gc_verifier, TRUE);  
-  verifier_set_gc_collect_kind(heap_verifier->gc_verifier, gc->collect_kind);
+  verifier_set_gc_collect_kind(heap_verifier->gc_verifier, GC_PROP);
   verifier_set_gen_mode(heap_verifier);
   verifier_reset_gc_verification(heap_verifier);
 
@@ -151,4 +150,6 @@
 
 Heap_Verifier* get_heap_verifier()
 { return heap_verifier; }
+
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_mutator_effect.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_mutator_effect.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_mutator_effect.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_mutator_effect.cpp Fri Mar 14 04:21:27 2008
@@ -330,7 +330,7 @@
 void verifier_mark_wb_slots(Heap_Verifier* heap_verifier)
 {
   GC_Gen* gc = (GC_Gen*)(heap_verifier->gc);
-  if(gc_match_kind((GC*)gc, MAJOR_COLLECTION) ||!gc_is_gen_mode()) return;
+  if(collect_is_major() ||!gc_is_gen_mode()) return;
 
   GC_Metadata*gc_metadata = gc->metadata;
   Space* nspace  = gc_get_nos(gc);
@@ -363,7 +363,7 @@
 void verify_write_barrier(REF* p_ref, Heap_Verifier* heap_verifier)
 {
   GC_Gen* gc    = (GC_Gen*)heap_verifier->gc;
-  if(gc_match_kind((GC*)gc, MAJOR_COLLECTION) ||!gc_is_gen_mode()) return;
+  if(collect_is_major() ||!gc_is_gen_mode()) return;
   
   Space* nspace  = gc_get_nos(gc);
   assert(address_belongs_to_gc_heap((void*)p_ref, (GC *) gc));
@@ -432,6 +432,8 @@
   if(heap_verifier->need_verify_allocation)  verify_allocation(heap_verifier);
 }
  
+
+
 
 
 



Mime
View raw message