harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x..@apache.org
Subject svn commit: r650422 [2/2] - in /harmony/enhanced/drlvm/trunk/vm/gc_gen/src: common/ finalizer_weakref/ gen/ los/ mark_compact/ mark_sweep/ thread/ trace_forward/ verify/
Date Tue, 22 Apr 2008 08:52:41 GMT
Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.cpp?rev=650422&r1=650421&r2=650422&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.cpp Tue Apr 22 01:52:29 2008
@@ -60,10 +60,10 @@
 {
   if(status){
     gc_set_gen_flag(); 
-    gc_set_barrier_function(WRITE_BARRIER_REM_SOURCE_REF);
+    gc_set_barrier_function(WB_REM_SOURCE_REF);
   }else{
     gc_clear_gen_flag();
-    gc_set_barrier_function(WRITE_BARRIER_REM_NIL);
+    gc_set_barrier_function(WB_REM_NIL);
   }
  
   HelperClass_set_GenMode(status);   
@@ -780,7 +780,6 @@
   gc->collect_result = TRUE;
 #ifdef GC_GEN_STATS
   gc_gen_stats_reset_before_collection(gc);
-  gc_gen_collector_stats_reset(gc);
 #endif
 
   nos_prepare_for_collection(nos);
@@ -814,7 +813,6 @@
 #ifdef GC_GEN_STATS
       gc->stats->num_minor_collections++;
 #endif
-      if(LOS_ADJUST_BOUNDARY) gc->tuner->kind=TRANS_NOTHING;
       los_collection(los);
     }
     
@@ -912,10 +910,14 @@
   }
   
   gc_gen_update_space_info_after_gc(gc);
-
+  if(gc_is_gen_mode()) {
+    gc_reset_collectors_rem_set((GC*)gc);
+  }
+  
 #ifdef GC_GEN_STATS
   gc_gen_stats_update_after_collection(gc);
   gc_gen_stats_verbose(gc);
+  gc_gen_collector_stats_reset(gc);
 #endif
 
   INFO2("gc.process", "GC: end of GC_Gen\n");
@@ -987,12 +989,12 @@
   }
 }
 
-void gc_gen_collection_verbose_info(GC_Gen *gc, int64 pause_time, int64 mutator_time)
+void gc_gen_collection_verbose_info(GC_Gen *gc, int64 pause_time, int64 time_mutator)
 {
 
 #ifdef GC_GEN_STATS
   GC_Gen_Stats* stats = ((GC_Gen*)gc)->stats;
-  stats->total_mutator_time += mutator_time;
+  stats->total_mutator_time += time_mutator;
   stats->total_pause_time += pause_time;
 #endif
 
@@ -1035,7 +1037,7 @@
   }
 
   INFO2("gc.collect","GC: pause time: "<<(pause_time>>10)<<"ms"
-    <<"\nGC: mutator time from last collection: "<<(mutator_time>>10)<<"ms\n");
+    <<"\nGC: mutator time from last collection: "<<(time_mutator>>10)<<"ms\n");
 
 }
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.h?rev=650422&r1=650421&r2=650422&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.h Tue Apr 22 01:52:29 2008
@@ -102,10 +102,10 @@
   unsigned int gc_concurrent_status;
   Collection_Scheduler* collection_scheduler;
 
-  SpinLock concurrent_mark_lock;
-  SpinLock enumerate_rootset_lock;
-  SpinLock concurrent_sweep_lock;
-  SpinLock collection_scheduler_lock;
+  SpinLock lock_con_mark;
+  SpinLock lock_enum;
+  SpinLock lock_con_sweep;
+  SpinLock lock_collect_sched;
 
   
   /* system info */
@@ -133,7 +133,7 @@
 
 void gc_gen_initialize(GC_Gen *gc, POINTER_SIZE_INT initial_heap_size, POINTER_SIZE_INT final_heap_size);
 void gc_gen_destruct(GC_Gen *gc);
-void gc_gen_collection_verbose_info(GC_Gen *gc, int64 pause_time, int64 mutator_time);
+void gc_gen_collection_verbose_info(GC_Gen *gc, int64 pause_time, int64 time_mutator);
 void gc_gen_space_verbose_info(GC_Gen *gc);
 void gc_gen_init_verbose(GC_Gen *gc);
 void gc_gen_wrapup_verbose(GC_Gen* gc);
@@ -213,6 +213,8 @@
 #endif
 
 #endif /* ifndef _GC_GEN_H_ */
+
+
 
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen_stats.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen_stats.cpp?rev=650422&r1=650421&r2=650422&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen_stats.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen_stats.cpp Tue Apr 22 01:52:29 2008
@@ -143,7 +143,7 @@
 {
   Collector** collector = gc->collectors;
   GC_Gen_Collector_Stats* stats;
-  for (unsigned int i=0; i<gc->num_collectors; i++){
+  for (unsigned int i=0; i<gc->num_active_collectors; i++){
     stats = (GC_Gen_Collector_Stats*)collector[i]->stats;
     memset(stats, 0, sizeof(GC_Gen_Collector_Stats));
   }

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace.h?rev=650422&r1=650421&r2=650422&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace.h Tue Apr 22 01:52:29 2008
@@ -90,7 +90,7 @@
 {
   if(!lspace) return 0;
   /* FIXME:: */
-  assert(lspace->committed_heap_size > (POINTER_SIZE_INT)lspace->last_surviving_size + (POINTER_SIZE_INT)lspace->last_alloced_size);
+  assert(lspace->committed_heap_size >= (POINTER_SIZE_INT)lspace->last_surviving_size + (POINTER_SIZE_INT)lspace->last_alloced_size);
   return (lspace->committed_heap_size - (POINTER_SIZE_INT)lspace->last_surviving_size - (POINTER_SIZE_INT)lspace->last_alloced_size);
 }
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace_alloc_collect.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace_alloc_collect.cpp?rev=650422&r1=650421&r2=650422&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace_alloc_collect.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace_alloc_collect.cpp Tue Apr 22 01:52:29 2008
@@ -205,8 +205,6 @@
     POINTER_SIZE_INT alloc_size = ALIGN_UP_TO_KILO(size);
     Lspace* lspace = (Lspace*)gc_get_los((GC_Gen*)allocator->gc);
     Free_Area_Pool* pool = lspace->free_pool;
-
-    gc_try_schedule_collection(allocator->gc, GC_CAUSE_NIL);
     
     while( try_count < 2 ){
         if(p_result = lspace_try_alloc(lspace, alloc_size))
@@ -367,26 +365,26 @@
             blocked_space_shrink((Blocked_Space*)nos, trans_size);
           } else {
             POINTER_SIZE_INT mos_free_size= blocked_space_free_mem_size((Blocked_Space*)mos);
-            void *uncommit_base=(void*)((POINTER_SIZE_INT)nos->heap_end-trans_size);
-            vm_decommit_mem(uncommit_base,trans_size);
+            void *decommit_base=(void*)((POINTER_SIZE_INT)nos->heap_end-trans_size);
+            vm_decommit_mem(decommit_base,trans_size);
             unsigned int reduced_mos_size = trans_size - nos->committed_heap_size;
             unsigned int size=round_down_to_size(mos_free_size-reduced_mos_size,SPACE_ALLOC_UNIT);
-            unsigned int nos_size=(unsigned int )(size*nos->survive_ratio/(nos->survive_ratio+mos->survive_ratio));
+            unsigned int nos_size= mos_free_size - reduced_mos_size ;
             if(nos_size<GC_BLOCK_SIZE_BYTES)  nos_size=GC_BLOCK_SIZE_BYTES;
             nos_size=round_up_to_size(nos_size, GC_BLOCK_SIZE_BYTES);
-            mos->num_managed_blocks-=((nos_size+reduced_mos_size)>>GC_BLOCK_SHIFT_COUNT);
+            mos->num_managed_blocks -= (( mos_free_size )>>GC_BLOCK_SHIFT_COUNT);
             mos->num_used_blocks = mos->free_block_idx-mos->first_block_idx;
             mos->num_total_blocks=mos->num_managed_blocks;
-            mos->ceiling_block_idx-=((nos_size+reduced_mos_size)>>GC_BLOCK_SHIFT_COUNT);
+            mos->ceiling_block_idx -= (( mos_free_size )>>GC_BLOCK_SHIFT_COUNT);
             assert(mos->num_used_blocks<=mos->num_managed_blocks);
             void *start_address=(void*)&(mos->blocks[mos->num_managed_blocks]);
-            assert(start_address< uncommit_base);
+            assert(start_address< decommit_base);
             mos->heap_end = start_address;
             mos->committed_heap_size = (POINTER_SIZE_INT) start_address - (POINTER_SIZE_INT) mos->heap_start;
-            nos->heap_start = start_address;
-            nos->heap_end = uncommit_base;
-            nos->committed_heap_size=nos->reserved_heap_size = (POINTER_SIZE_INT)uncommit_base- (POINTER_SIZE_INT) start_address;   
-            nos->num_total_blocks=nos->num_managed_blocks=nos_size>>GC_BLOCK_SHIFT_COUNT;
+            nos_boundary = nos->heap_start = start_address;
+            nos->heap_end = decommit_base;
+            nos->committed_heap_size = nos->reserved_heap_size = (POINTER_SIZE_INT)decommit_base- (POINTER_SIZE_INT) start_address;   
+            nos->num_total_blocks = nos->num_managed_blocks = nos_size>>GC_BLOCK_SHIFT_COUNT;
             nos->free_block_idx=nos->first_block_idx=GC_BLOCK_INDEX_FROM(gc->heap_start,start_address);
             nos->ceiling_block_idx=nos->first_block_idx+nos->num_managed_blocks-1;
             nos->num_used_blocks = 0;
@@ -540,6 +538,8 @@
   TRACE2("gc.process", "GC: end of lspace sweep algo ...\n");
   return;
 }
+
+
 
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_move_compact.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_move_compact.cpp?rev=650422&r1=650421&r2=650422&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_move_compact.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_move_compact.cpp Tue Apr 22 01:52:29 2008
@@ -224,11 +224,9 @@
 #endif
     gc_identify_dead_weak_roots(gc);
 
-#ifndef LOS_ADJUST_BOUNDARY
 #ifdef USE_32BITS_HASHCODE
-    if(is_fallback)
+    if((!LOS_ADJUST_BOUNDARY) && (is_fallback))
       fallback_clear_fwd_obj_oi_init(collector);
-#endif
 #endif
     debug_num_compact_blocks = 0;
     /* let other collectors go */

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/gc_ms.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/gc_ms.cpp?rev=650422&r1=650421&r2=650422&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/gc_ms.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/gc_ms.cpp Tue Apr 22 01:52:29 2008
@@ -81,7 +81,7 @@
 }
 
 void wspace_mark_scan_concurrent(Marker* marker);
-void gc_ms_start_concurrent_mark(GC_MS* gc, unsigned int num_markers)
+void gc_ms_start_con_mark(GC_MS* gc, unsigned int num_markers)
 {
   if(gc->num_active_markers == 0)
     pool_iterator_init(gc->metadata->gc_rootset_pool);
@@ -90,7 +90,7 @@
 }
 
 void wspace_mark_scan_mostly_concurrent(Marker* marker);
-void gc_ms_start_most_concurrent_mark(GC_MS* gc, unsigned int num_markers)
+void gc_ms_start_mostly_con_mark(GC_MS* gc, unsigned int num_markers)
 {
   if(gc->num_active_markers == 0)
     pool_iterator_init(gc->metadata->gc_rootset_pool);
@@ -98,7 +98,7 @@
   marker_execute_task_concurrent((GC*)gc,(TaskType)wspace_mark_scan_mostly_concurrent,(Space*)gc->wspace, num_markers);
 }
 
-void gc_ms_start_final_mark_after_concurrent(GC_MS* gc, unsigned int num_markers)
+void gc_ms_start_mostly_con_final_mark(GC_MS* gc, unsigned int num_markers)
 {
   pool_iterator_init(gc->metadata->gc_rootset_pool);
   
@@ -112,7 +112,7 @@
 
   Mutator *mutator = gc->mutator_list;
   while(mutator){
-    wait_mutator_signal(mutator, MUTATOR_ENTER_ALLOCATION_MARK);
+    wait_mutator_signal(mutator, HSIG_MUTATOR_SAFE);
     mutator = mutator->next;
   }
 
@@ -120,12 +120,12 @@
 }
 
 void wspace_sweep_concurrent(Collector* collector);
-void gc_ms_start_concurrent_sweep(GC_MS* gc, unsigned int num_collectors)
+void gc_ms_start_con_sweep(GC_MS* gc, unsigned int num_collectors)
 {
   ops_color_flip();
   mem_fence();
-  gc_disable_alloc_obj_live();
   gc_check_mutator_allocation((GC*)gc);
+  gc_disable_alloc_obj_live();
   wspace_init_pfc_pool_iterator(gc->wspace);
   
   collector_execute_task_concurrent((GC*)gc, (TaskType)wspace_sweep_concurrent, (Space*)gc->wspace, num_collectors);
@@ -133,14 +133,14 @@
   collector_release_weakref_sets((GC*)gc, num_collectors);
 }
 
-void gc_ms_start_concurrent_mark(GC_MS* gc)
+void gc_ms_start_con_mark(GC_MS* gc)
 {
   pool_iterator_init(gc->metadata->gc_rootset_pool);
   
   marker_execute_task_concurrent((GC*)gc,(TaskType)wspace_mark_scan_concurrent,(Space*)gc->wspace);
 }
 
-void gc_ms_update_space_statistics(GC_MS* gc)
+void gc_ms_update_space_stat(GC_MS* gc)
 {
   POINTER_SIZE_INT num_live_obj = 0;
   POINTER_SIZE_INT size_live_obj = 0;  
@@ -157,25 +157,25 @@
     size_live_obj += collector->live_obj_size;
   }
 
-  lock(gc->mutator_list_lock);
-  Mutator* mutator = gc->mutator_list;
-  while (mutator) {
-    new_obj_size += mutator->new_obj_size;
-    mutator->new_obj_size = 0;
-    mutator = mutator->next;
-  }  
-  unlock(gc->mutator_list_lock);
+  new_obj_size = gc_get_new_object_size((GC*)gc, TRUE);
 
-  wspace_stat->size_new_obj += new_obj_size;
+  wspace_stat->size_new_obj = new_obj_size;
   
   wspace_stat->num_live_obj = num_live_obj;
   wspace_stat->size_live_obj = size_live_obj;  
   wspace_stat->last_size_free_space = wspace_stat->size_free_space;
   wspace_stat->size_free_space = gc->committed_heap_size - size_live_obj;/*TODO:inaccurate value.*/  
-  wspace_stat->space_utilization_ratio = (float)wspace_stat->size_new_obj / wspace_stat->last_size_free_space;;
+  wspace_stat->space_utilization_ratio = (float)wspace_stat->size_new_obj / wspace_stat->last_size_free_space;
+
+  INFO2("gc.space.stat","[GC][Space Stat] num_live_obj        : "<<wspace_stat->num_live_obj<<" ");
+  INFO2("gc.space.stat","[GC][Space Stat] size_live_obj       : "<<wspace_stat->size_live_obj<<" ");
+  INFO2("gc.space.stat","[GC][Space Stat] size_free_space     : "<<wspace_stat->size_free_space<<" ");
+  INFO2("gc.space.stat","[GC][Space Stat] last_size_free_space: "<<wspace_stat->last_size_free_space<<" ");
+  INFO2("gc.space.stat","[GC][Space Stat] size_new_obj        : "<<wspace_stat->size_new_obj<<" ");  
+  INFO2("gc.space.stat","[GC][Space Stat] utilization_ratio   : "<<wspace_stat->space_utilization_ratio<<" ");
 }
 
-void gc_ms_reset_space_statistics(GC_MS* gc)
+void gc_ms_reset_space_stat(GC_MS* gc)
 {
   Space_Statistics* wspace_stat = gc->wspace->space_statistic;
   wspace_stat->size_new_obj = 0;

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/gc_ms.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/gc_ms.h?rev=650422&r1=650421&r2=650422&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/gc_ms.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/gc_ms.h Tue Apr 22 01:52:29 2008
@@ -73,10 +73,10 @@
   unsigned int gc_concurrent_status;
   Collection_Scheduler* collection_scheduler;
 
-  SpinLock concurrent_mark_lock;
-  SpinLock enumerate_rootset_lock;
-  SpinLock concurrent_sweep_lock;
-  SpinLock collection_scheduler_lock;
+  SpinLock lock_con_mark;
+  SpinLock lock_enum;
+  SpinLock lock_con_sweep;
+  SpinLock lock_collect_sched;
   
   /* system info */
   unsigned int _system_alloc_unit;
@@ -115,12 +115,12 @@
 void gc_ms_reclaim_heap(GC_MS *gc);
 void gc_ms_iterate_heap(GC_MS *gc);
 
-void gc_ms_start_concurrent_mark(GC_MS* gc);
-void gc_ms_start_concurrent_mark(GC_MS* gc, unsigned int num_markers);
-void gc_ms_update_space_statistics(GC_MS* gc);
-void gc_ms_start_concurrent_sweep(GC_MS* gc, unsigned int num_collectors);
-void gc_ms_start_most_concurrent_mark(GC_MS* gc, unsigned int num_markers);
-void gc_ms_start_final_mark_after_concurrent(GC_MS* gc, unsigned int num_markers);
-void gc_ms_reset_space_statistics(GC_MS* gc);
+void gc_ms_start_con_mark(GC_MS* gc);
+void gc_ms_start_con_mark(GC_MS* gc, unsigned int num_markers);
+void gc_ms_update_space_stat(GC_MS* gc);
+void gc_ms_start_con_sweep(GC_MS* gc, unsigned int num_collectors);
+void gc_ms_start_mostly_con_mark(GC_MS* gc, unsigned int num_markers);
+void gc_ms_start_mostly_con_final_mark(GC_MS* gc, unsigned int num_markers);
+void gc_ms_reset_space_stat(GC_MS* gc);
 
 #endif // _GC_MS_H_

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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -125,15 +125,6 @@
   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);
@@ -153,12 +144,12 @@
         /* Put local pfc to the according pools */
         for(unsigned int j = 0; j < chunk_ptr_num; ++j){
           if(chunk_ptrs[j]){
-            if(!USE_CONCURRENT_GC){
+            if(!gc_is_specify_con_gc()){
               wspace_put_pfc(wspace, chunk_ptrs[j]);
             }else{
               Chunk_Header* chunk_to_rem = chunk_ptrs[j];
               chunk_to_rem->status = CHUNK_USED | CHUNK_NORMAL;
-              wspace_register_used_chunk(wspace, chunk_to_rem);
+              wspace_reg_used_chunk(wspace, chunk_to_rem);
             }
           }
         }
@@ -243,13 +234,13 @@
   wspace_alloc_info_summary();
 #endif
 #ifdef SSPACE_CHUNK_INFO
-  wspace_chunks_info(wspace, FALSE);
+  wspace_chunks_info(wspace, TRUE);
 #endif
   wspace_clear_used_chunk_pool(wspace);
 
 
   wspace_decide_compaction_need(wspace);
-  if(wspace->need_compact && major_is_marksweep()){
+  if(wspace->need_compact && gc_is_kind(ALGO_MARKSWEEP)){
     assert(!collect_move_object());
     GC_PROP |= ALGO_MS_COMPACT;
   }
@@ -279,7 +270,7 @@
 #endif
 
 #ifdef SSPACE_CHUNK_INFO
-  wspace_chunks_info(wspace, FALSE);
+  wspace_chunks_info(wspace, TRUE);
 #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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -91,7 +91,6 @@
 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);
 

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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -17,7 +17,6 @@
 
 #include "wspace.h"
 #include "wspace_chunk.h"
-//#include "wspace_mark_sweep.h"
 #include "wspace_alloc.h"
 #include "gc_ms.h"
 #include "../gen/gen.h"
@@ -85,25 +84,28 @@
   Chunk_Header **chunks = allocator->local_chunks[seg_index];
   Chunk_Header *chunk = chunks[index];  
   if(!chunk){
-    mutator_post_signal((Mutator*) allocator,DISABLE_COLLECTOR_SWEEP_LOCAL_CHUNKS);
+    mutator_post_signal((Mutator*) allocator,HSIG_DISABLE_SWEEP_LOCAL_CHUNKS);
     
     chunk = wspace_get_pfc(wspace, seg_index, index);
     //if(!chunk) chunk = wspace_steal_pfc(wspace, seg_index, index);
-    if(!chunk) return NULL;
+    if(!chunk){
+      mutator_post_signal((Mutator*) allocator,HSIG_MUTATOR_SAFE);
+      return NULL;
+    }
     chunk->status |= CHUNK_IN_USE;
     chunks[index] = chunk;
     
-    mutator_post_signal((Mutator*) allocator,ENABLE_COLLECTOR_SWEEP_LOCAL_CHUNKS);
+    mutator_post_signal((Mutator*) allocator,HSIG_MUTATOR_SAFE);
   }
   
-  mutator_post_signal((Mutator*) allocator,MUTATOR_ENTER_ALLOCATION_MARK);
+  mutator_post_signal((Mutator*) allocator,HSIG_MUTATOR_ENTER_ALLOC_MARK);
   void *p_obj = alloc_in_chunk(chunks[index]);
-  mutator_post_signal((Mutator*) allocator,MUTATOR_EXIT_ALLOCATION_MARK);
+  mutator_post_signal((Mutator*) allocator,HSIG_MUTATOR_SAFE);
 
   if(chunk->slot_index == MAX_SLOT_INDEX){
     chunk->status = CHUNK_USED | CHUNK_NORMAL;
     /*register to used chunk list.*/
-    wspace_register_used_chunk(wspace,chunk);
+    wspace_reg_used_chunk(wspace,chunk);
     chunks[index] = NULL;
     chunk = NULL;
   }
@@ -119,6 +121,7 @@
   wspace_verify_alloc(p_obj, size);
 #endif
 
+  if(p_obj) ((Mutator*)allocator)->new_obj_size += size;
   return p_obj;
 }
 
@@ -137,38 +140,39 @@
     Chunk_Header **chunks = allocator->local_chunks[seg_index];
     chunk = chunks[index];
     if(!chunk){
-      mutator_post_signal((Mutator*) allocator,DISABLE_COLLECTOR_SWEEP_LOCAL_CHUNKS);
+      mutator_post_signal((Mutator*) allocator,HSIG_DISABLE_SWEEP_LOCAL_CHUNKS);
       chunk = wspace_get_pfc(wspace, seg_index, index);
       if(!chunk){
         chunk = (Chunk_Header*)wspace_get_normal_free_chunk(wspace);
         if(chunk) normal_chunk_init(chunk, size);
       }
       //if(!chunk) chunk = wspace_steal_pfc(wspace, seg_index, index);
-      if(!chunk) return NULL;
+      if(!chunk){
+        mutator_post_signal((Mutator*) allocator,HSIG_MUTATOR_SAFE);
+        return NULL;
+      }
       chunk->status |= CHUNK_IN_USE;
       chunks[index] = chunk;
-      mutator_post_signal((Mutator*) allocator,ENABLE_COLLECTOR_SWEEP_LOCAL_CHUNKS);
+      mutator_post_signal((Mutator*) allocator,HSIG_MUTATOR_SAFE);
     }    
     
-    mutator_post_signal((Mutator*) allocator,MUTATOR_ENTER_ALLOCATION_MARK);
+    mutator_post_signal((Mutator*) allocator,HSIG_MUTATOR_ENTER_ALLOC_MARK);
     p_obj = alloc_in_chunk(chunks[index]);
-    mutator_post_signal((Mutator*) allocator,MUTATOR_EXIT_ALLOCATION_MARK);
+    mutator_post_signal((Mutator*) allocator,HSIG_MUTATOR_SAFE);
     
     if(chunk->slot_index == MAX_SLOT_INDEX){
       chunk->status = CHUNK_USED | CHUNK_NORMAL;
       /*register to used chunk list.*/
-      wspace_register_used_chunk(wspace,chunk);
+      wspace_reg_used_chunk(wspace,chunk);
       chunks[index] = NULL;
     }
     
-  } else {
-    gc_try_schedule_collection(allocator->gc, GC_CAUSE_NIL);
-
-    mutator_post_signal((Mutator*) allocator,DISABLE_COLLECTOR_SWEEP_GLOBAL_CHUNKS);
+  } else {  
+    mutator_post_signal((Mutator*) allocator,HSIG_DISABLE_SWEEP_GLOBAL_CHUNKS);
 
-    if(USE_CONCURRENT_SWEEP){
-      while(gc_is_sweeping_global_normal_chunk()){
-        mutator_post_signal((Mutator*) allocator,ENABLE_COLLECTOR_SWEEP_GLOBAL_CHUNKS);
+    if(gc_is_specify_con_sweep()){
+      while(gc_is_sweep_global_normal_chunk()){
+        mutator_post_signal((Mutator*) allocator,HSIG_MUTATOR_SAFE);
       }  
     }
 
@@ -178,13 +182,16 @@
       if(chunk) normal_chunk_init(chunk, size);
     }
     //if(!chunk) chunk = wspace_steal_pfc(wspace, seg_index, index);
-    if(!chunk) return NULL;
+    if(!chunk) {
+      mutator_post_signal((Mutator*) allocator,HSIG_MUTATOR_SAFE);
+      return NULL;
+    }
     p_obj = alloc_in_chunk(chunk);
 
     if(chunk->slot_index == MAX_SLOT_INDEX){
       chunk->status = CHUNK_USED | CHUNK_NORMAL;
       /*register to used chunk list.*/
-      wspace_register_used_chunk(wspace,chunk);
+      wspace_reg_used_chunk(wspace,chunk);
       chunk = NULL;
     }
     
@@ -192,7 +199,7 @@
       wspace_put_pfc(wspace, chunk);
     }
     
-    mutator_post_signal((Mutator*) allocator,ENABLE_COLLECTOR_SWEEP_GLOBAL_CHUNKS);
+    mutator_post_signal((Mutator*) allocator,HSIG_MUTATOR_SAFE);
   }
   
   return p_obj;
@@ -202,8 +209,6 @@
 {
   assert(size > SUPER_OBJ_THRESHOLD);
 
-  gc_try_schedule_collection(allocator->gc, GC_CAUSE_NIL);
-
   unsigned int chunk_size = SUPER_SIZE_ROUNDUP(size);
   assert(chunk_size > SUPER_OBJ_THRESHOLD);
   assert(!(chunk_size & CHUNK_GRANULARITY_LOW_MASK));
@@ -217,18 +222,17 @@
   if(!chunk) return NULL;
   abnormal_chunk_init(chunk, chunk_size, size);
   
-  mutator_post_signal((Mutator*) allocator,MUTATOR_ENTER_ALLOCATION_MARK);  
+  mutator_post_signal((Mutator*) allocator,HSIG_MUTATOR_ENTER_ALLOC_MARK);  
   if(is_obj_alloced_live()){
     chunk->table[0] |= cur_mark_black_color  ;
   } 
-  mutator_post_signal((Mutator*) allocator,MUTATOR_EXIT_ALLOCATION_MARK);
-  //mem_fence();
+  mutator_post_signal((Mutator*) allocator,HSIG_MUTATOR_SAFE);
   
   chunk->table[0] |= cur_alloc_color;
   set_super_obj_mask(chunk->base);
   assert(chunk->status == CHUNK_ABNORMAL);
   chunk->status = CHUNK_ABNORMAL| CHUNK_USED;
-  wspace_register_used_chunk(wspace, chunk);
+  wspace_reg_used_chunk(wspace, chunk);
   assert(get_obj_info_raw((Partial_Reveal_Object*)chunk->base) & SUPER_OBJ_MASK);
   return chunk->base;
 }
@@ -251,10 +255,8 @@
 #endif
 
 #ifdef WSPACE_CONCURRENT_GC_STATS
-  if(p_obj && gc_is_concurrent_mark_phase()) ((Partial_Reveal_Object*)p_obj)->obj_info |= NEW_OBJ_MASK;
+  if(p_obj && gc_con_is_in_marking()) ((Partial_Reveal_Object*)p_obj)->obj_info |= NEW_OBJ_MASK;
 #endif
-
-  if(p_obj) ((Mutator*)allocator)->new_obj_size += size;
   
   return p_obj;
 }
@@ -263,6 +265,9 @@
 void *wspace_alloc(unsigned size, Allocator *allocator)
 {
   void *p_obj = NULL;
+  
+  if(gc_is_specify_con_gc())
+    gc_sched_collection(allocator->gc, GC_CAUSE_CONCURRENT_GC);
   
   /* First, try to allocate object from TLB (thread local chunk) */
   p_obj = wspace_try_alloc(size, allocator);

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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -23,9 +23,9 @@
 #include "../common/gc_concurrent.h"
 #include "../common/collection_scheduler.h"
 
-extern POINTER_SIZE_INT cur_alloc_color;
-extern POINTER_SIZE_INT cur_alloc_mask;
-extern POINTER_SIZE_INT cur_mark_mask;
+extern volatile POINTER_SIZE_INT cur_alloc_color;
+extern volatile POINTER_SIZE_INT cur_alloc_mask;
+extern volatile POINTER_SIZE_INT cur_mark_mask;
 
 
 inline Boolean slot_is_alloc_in_table(POINTER_SIZE_INT *table, unsigned int slot_index)
@@ -186,9 +186,7 @@
   /*mark black is placed here because of race condition between ops color flip. */
   if(p_obj && is_obj_alloced_live())
     obj_mark_black_in_table((Partial_Reveal_Object*)p_obj, chunk->slot_size);
-  
-  //mem_fence();
-  
+    
   alloc_slot_in_table(table, slot_index);
   if(chunk->status & CHUNK_NEED_ZEROING)
     memset(p_obj, 0, chunk->slot_size);

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_chunk.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_chunk.cpp?rev=650422&r1=650421&r2=650422&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_chunk.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_chunk.cpp Tue Apr 22 01:52:29 2008
@@ -597,11 +597,37 @@
   return NULL;
 }
 
+static POINTER_SIZE_INT free_mem_in_used_chunk_list(Wspace *wspace, Boolean show_chunk_info)
+{
+  POINTER_SIZE_INT used_chunk_size = 0;
+  POINTER_SIZE_INT used_chunk_num  = 0;
+  POINTER_SIZE_INT free_mem_size   = 0;
+  Pool* used_chunk_pool = wspace->used_chunk_pool;
+  if(used_chunk_pool) {
+    pool_iterator_init(used_chunk_pool);
+    Chunk_Header* used_chunk = (Chunk_Header*)pool_iterator_next(used_chunk_pool);
+    while(used_chunk != NULL){
+      used_chunk_num ++;
+      used_chunk_size += CHUNK_SIZE(used_chunk);
+      if(used_chunk->status & CHUNK_NORMAL) {
+        free_mem_size += (used_chunk->slot_num - used_chunk->alloc_num) * used_chunk->slot_size;
+      }
+      used_chunk = (Chunk_Header*)pool_iterator_next(used_chunk_pool);
+    }
+  }
+#ifdef SSPACE_CHUNK_INFO
+      if(show_chunk_info)
+        printf("Used chunk num: %d\tTotal Size: %d\tFragmentation Ratio: %f\n", used_chunk_num, used_chunk_size, (float)free_mem_size/used_chunk_size);
+#endif
+  return free_mem_size;
+}
+
 static POINTER_SIZE_INT free_mem_in_pfc_pools(Wspace *wspace, Boolean show_chunk_info)
 {
   Size_Segment **size_segs = wspace->size_segments;
   Pool ***pfc_pools = wspace->pfc_pools;
   POINTER_SIZE_INT free_mem_size = 0;
+  POINTER_SIZE_INT total_pfc_size = 0;
   
   for(unsigned int i = 0; i < SIZE_SEGMENT_NUM; ++i){
     for(unsigned int j = 0; j < size_segs[i]->chunk_num; ++j){
@@ -627,9 +653,15 @@
         printf("Size: %x\tchunk num: %d\tLive Ratio: %f\n", NORMAL_INDEX_TO_SIZE(j, size_segs[i]), chunk_num, (float)alloc_num/total_slot_num);
 #endif
       free_mem_size += NORMAL_INDEX_TO_SIZE(j, size_segs[i]) * (total_slot_num-alloc_num);
+      total_pfc_size += NORMAL_INDEX_TO_SIZE(j, size_segs[i]) * total_slot_num;
       assert(free_mem_size < wspace->committed_heap_size);
     }
   }
+
+#ifdef SSPACE_CHUNK_INFO
+      if(show_chunk_info)
+        printf("Total PFC pool Size: %d\tFragmentation Ratio: %f\n", total_pfc_size,  (float)free_mem_size/total_pfc_size);
+#endif
   
   return free_mem_size;
 }
@@ -656,6 +688,11 @@
       printf("Free Size: %x\tnum: %d\n", chunk_size, chunk_num);
 #endif
   }
+
+#ifdef SSPACE_CHUNK_INFO
+    if(show_chunk_info)
+      printf("Total Size in FreeList: %d\n", free_mem_size);
+#endif
   
   return free_mem_size;
 }
@@ -675,6 +712,11 @@
     assert(free_mem_size <= wspace->committed_heap_size);
     chunk = chunk->next;
   }
+
+#ifdef SSPACE_CHUNK_INFO
+    if(show_chunk_info)
+      printf("Total Size in HyperFreeList: %d\n", free_mem_size);
+#endif
   
   return free_mem_size;
 }
@@ -717,6 +759,7 @@
   if(!show_info) return;
   
   POINTER_SIZE_INT free_mem_size = free_mem_in_wspace(wspace, TRUE);
+  free_mem_size += free_mem_in_used_chunk_list(wspace, TRUE);
   
   float free_mem_ratio = (float)free_mem_size / wspace->committed_heap_size;
   printf("\n\nFree mem ratio: %f\n\n", free_mem_ratio);
@@ -852,7 +895,7 @@
 }
 
 unsigned int *shift_table;
-unsigned short *compact_table[MAX_SLOT_SIZE_AFTER_SHIFTING];
+unsigned short *compact_table[MAX_SLOT_SIZE_AFTER_SHIFTING+1];
 unsigned int mask[MAX_SLOT_SIZE_AFTER_SHIFTING];
 static int already_inited = 0;
 void fastdiv_init()
@@ -909,5 +952,7 @@
 }
 
 #endif
+
+
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_chunk.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_chunk.h?rev=650422&r1=650421&r2=650422&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_chunk.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_chunk.h Tue Apr 22 01:52:29 2008
@@ -18,6 +18,10 @@
 #ifndef _SSPACE_CHUNK_H_
 #define _SSPACE_CHUNK_H_
 
+#ifdef USE_32BITS_HASHCODE
+#include "hashcode.h"
+#endif
+
 #include "wspace.h"
 
 #define SSPACE_USE_FASTDIV
@@ -33,7 +37,7 @@
 #define INIT_ALLOC_SIZE (128 * 1024)
 
 extern unsigned int *shift_table;
-extern unsigned short *compact_table[MAX_SLOT_SIZE_AFTER_SHIFTING];
+extern unsigned short *compact_table[MAX_SLOT_SIZE_AFTER_SHIFTING+1];
 extern unsigned int mask[MAX_SLOT_SIZE_AFTER_SHIFTING];
 extern void fastdiv_init(void);
 
@@ -97,6 +101,9 @@
   unsigned int slot_num;
   unsigned int slot_index;      /* the index of which is the first free slot in this chunk */
   unsigned int alloc_num;       /* the index of which is the first free slot in this chunk */
+#ifdef USE_32BITS_HASHCODE
+  Hashcode_Buf* hashcode_buf; /*hash code entry list*/
+#endif  
   POINTER_SIZE_INT table[1];
 } Chunk_Header;
 
@@ -208,6 +215,7 @@
     chunk->next->prev = chunk->prev;
   else
     list->tail = chunk->prev;
+  --list->chunk_num;
 }
 
 inline void move_free_chunks_between_lists(Free_Chunk_List *to_list, Free_Chunk_List *from_list)
@@ -269,7 +277,7 @@
   chunk->table[last_word_index] &= depadding_mask;
 }
 
-extern POINTER_SIZE_INT cur_alloc_mask;
+extern volatile POINTER_SIZE_INT cur_alloc_mask;
 /* Used for allocating a fixed-size chunk from free area lists */
 inline void normal_chunk_init(Chunk_Header *chunk, unsigned int slot_size)
 {
@@ -285,6 +293,9 @@
   chunk->slot_index = 0;
   chunk->alloc_num = 0;
   chunk->base = NORMAL_CHUNK_BASE(chunk);
+#ifdef USE_32BITS_HASHCODE
+  chunk->hashcode_buf = NULL;
+#endif
   memset(chunk->table, 0, NORMAL_CHUNK_TABLE_SIZE_BYTES(chunk));//memset table
   //chunk_pad_last_index_word(chunk, cur_alloc_mask);
   fastdiv_init();
@@ -304,6 +315,9 @@
   chunk->slot_num = 1;
   chunk->slot_index = 0;
   chunk->base = ABNORMAL_CHUNK_BASE(chunk);
+#ifdef USE_32BITS_HASHCODE
+  chunk->hashcode_buf = NULL;
+#endif
 }
 
 
@@ -388,7 +402,7 @@
   Chunk_Header *chunk = (Chunk_Header*)pool_get_entry(pfc_pool);
 
   /*2. If in concurrent sweeping phase, search PFC backup pool*/
-  if(!chunk && gc_is_concurrent_sweep_phase()){
+  if(!chunk && gc_con_is_in_sweeping()){
     pfc_pool = wspace->pfc_pools_backup[seg_index][index];
     chunk = (Chunk_Header*)pool_get_entry(pfc_pool);
   }
@@ -492,7 +506,7 @@
   return;
 }
 
-inline void wspace_register_used_chunk(Wspace* wspace, Chunk_Header* chunk)
+inline void wspace_reg_used_chunk(Wspace* wspace, Chunk_Header* chunk)
 {
   pool_put_entry(wspace->used_chunk_pool, chunk);
   return;
@@ -504,7 +518,7 @@
   return;
 }
 
-inline void wspace_register_unreusable_normal_chunk(Wspace* wspace, Chunk_Header* chunk)
+inline void wspace_reg_unreusable_normal_chunk(Wspace* wspace, Chunk_Header* chunk)
 {
   pool_put_entry(wspace->unreusable_normal_chunk_pool, chunk);
   return;
@@ -515,7 +529,7 @@
   return (Chunk_Header*)pool_get_entry(wspace->unreusable_normal_chunk_pool);
 }
 
-inline void wspace_register_live_abnormal_chunk(Wspace* wspace, Chunk_Header* chunk)
+inline void wspace_reg_live_abnormal_chunk(Wspace* wspace, Chunk_Header* chunk)
 {
   pool_put_entry(wspace->live_abnormal_chunk_pool, chunk);
   return;
@@ -550,5 +564,13 @@
 extern void gc_clear_collector_local_chunks(GC *gc);
 
 extern void wspace_collect_free_chunks_to_list(Wspace *wspace, Free_Chunk_List *list);
+
+#ifdef USE_32BITS_HASHCODE  
+inline int obj_lookup_hashcode_in_chunk_buf(Partial_Reveal_Object *p_obj)
+{
+  Hashcode_Buf* hashcode_buf = NORMAL_CHUNK_HEADER(p_obj)->hashcode_buf;
+  return hashcode_buf_lookup(p_obj,hashcode_buf);
+}
+#endif
 
 #endif //#ifndef _SSPACE_CHUNK_H_

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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -20,6 +20,10 @@
 #include "wspace_mark_sweep.h"
 #include "wspace_verify.h"
 
+#ifdef USE_32BITS_HASHCODE
+#include "../common/hashcode.h"
+#endif
+ 
 
 #define PFC_SORT_NUM  8
 
@@ -165,24 +169,61 @@
   unsigned int alloc_num = src->alloc_num;
   assert(alloc_num);
   
+#ifdef USE_32BITS_HASHCODE
+  Hashcode_Buf*  old_hashcode_buf = src->hashcode_buf;
+  Hashcode_Buf* new_hashcode_buf = dest->hashcode_buf;
+#endif
+
   while(alloc_num && dest){
     Partial_Reveal_Object *p_obj = next_alloc_slot_in_chunk(src);
-    void *target = alloc_in_chunk(dest);
+    Partial_Reveal_Object *target = (Partial_Reveal_Object *)alloc_in_chunk(dest);
 
     if(dest->slot_index == MAX_SLOT_INDEX){
       dest->status = CHUNK_USED | CHUNK_NORMAL;      
-      wspace_register_used_chunk(wspace,dest);
+      wspace_reg_used_chunk(wspace,dest);
       dest = NULL;
     }
     
     assert(p_obj && target);
     memcpy(target, p_obj, slot_size);
+
+#ifdef USE_32BITS_HASHCODE
+  if(hashcode_is_set(p_obj)){
+    int hashcode;
+    if(new_hashcode_buf == NULL) {
+      new_hashcode_buf = hashcode_buf_create();
+      hashcode_buf_init(new_hashcode_buf);
+      dest->hashcode_buf = new_hashcode_buf;
+    }
+    if(hashcode_is_buffered(p_obj)){
+      /*already buffered objects;*/
+      hashcode = hashcode_buf_lookup(p_obj, old_hashcode_buf);
+      hashcode_buf_update(target, hashcode, new_hashcode_buf);
+    }else{
+      /*objects need buffering.*/
+      hashcode = hashcode_gen(p_obj);
+      hashcode_buf_update(target, hashcode, new_hashcode_buf);
+      Obj_Info_Type oi = get_obj_info_raw(target);
+      set_obj_info(target, oi | HASHCODE_BUFFERED_BIT);
+    }
+  }
+#endif
+
+
 #ifdef SSPACE_VERIFY
     wspace_modify_mark_in_compact(target, p_obj, slot_size);
 #endif
     obj_set_fw_in_oi(p_obj, target);
     --alloc_num;
   }
+
+#ifdef USE_32BITS_HASHCODE
+  if(alloc_num == 0) {
+    if(old_hashcode_buf) hashcode_buf_destory(old_hashcode_buf);
+    src->hashcode_buf = NULL;
+  }
+#endif
+
   
   /* dest might be set to NULL, so we use *dest_ptr here */
   assert((*dest_ptr)->alloc_num <= (*dest_ptr)->slot_num);
@@ -233,6 +274,8 @@
     }
   }
 }
+
+
 
 
 

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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -19,7 +19,7 @@
 #include "../finalizer_weakref/finalizer_weakref.h"
 #include "../thread/marker.h"
 
-volatile Boolean need_terminate_concurrent_mark;
+volatile Boolean need_terminate_mostly_con_mark;
 
 Boolean obj_is_marked_in_table(Partial_Reveal_Object *obj);
 
@@ -87,15 +87,15 @@
 }
 
 /* for marking phase termination detection */
-void wspace_mark_scan_mostly_concurrent_reset()
-{ need_terminate_concurrent_mark = FALSE; }
+void mostly_con_mark_terminate_reset()
+{ need_terminate_mostly_con_mark = FALSE; }
 
-void wspace_mark_scan_mostly_concurrent_terminate()
-{ need_terminate_concurrent_mark = TRUE; }
+void terminate_mostly_con_mark()
+{ need_terminate_mostly_con_mark = TRUE; }
 
 static Boolean concurrent_mark_need_terminating(GC* gc)
 {
-  if(need_terminate_concurrent_mark) return TRUE;
+  if(need_terminate_mostly_con_mark) return TRUE;
     
   GC_Metadata *metadata = gc->metadata;
   return pool_is_empty(metadata->gc_dirty_set_pool);
@@ -122,11 +122,9 @@
   while(root_set){
     POINTER_SIZE_INT *iter = vector_block_iterator_init(root_set);
     while(!vector_block_iterator_end(root_set,iter)){
-      REF *p_ref = (REF *)*iter;
+      Partial_Reveal_Object *p_obj = (Partial_Reveal_Object *)*iter;
       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 ALGO_MAJOR */
       assert(p_obj!=NULL);
       assert(address_belongs_to_gc_heap(p_obj, gc));
       if(obj_mark_gray_in_table(p_obj))
@@ -137,8 +135,6 @@
   /* put back the last trace_stack task */
   pool_put_entry(metadata->mark_task_pool, marker->trace_stack);
   
-  marker_notify_mark_root_done(marker);
-
   marker->trace_stack = free_task_pool_get_entry(metadata);
 
 retry:
@@ -223,6 +219,8 @@
   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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -96,7 +96,7 @@
 
 void wspace_mark_scan_concurrent(Marker* marker)
 {
-  int64 time_mark_start = time_now();
+  marker->time_measurement_start = time_now();
   GC *gc = marker->gc;
   GC_Metadata *metadata = gc->metadata;
   
@@ -111,11 +111,9 @@
   while(root_set){
     POINTER_SIZE_INT *iter = vector_block_iterator_init(root_set);
     while(!vector_block_iterator_end(root_set,iter)){
-      REF *p_ref = (REF *)*iter;
+      Partial_Reveal_Object *p_obj = (Partial_Reveal_Object *)*iter;
       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 ALGO_MAJOR */
       assert(p_obj!=NULL);
       assert(address_belongs_to_gc_heap(p_obj, gc));
       if(obj_mark_gray_in_table(p_obj))
@@ -126,8 +124,6 @@
   /* put back the last trace_stack task */
   pool_put_entry(metadata->mark_task_pool, marker->trace_stack);
   
-  marker_notify_mark_root_done(marker);
-
   marker->trace_stack = free_task_pool_get_entry(metadata);
 
 retry:
@@ -219,8 +215,8 @@
   marker->trace_stack = NULL;
   assert(pool_is_empty(metadata->gc_dirty_set_pool));
 
-  int64 time_mark = time_now() - time_mark_start;
-  marker->time_mark = time_mark;
+  marker->time_measurement_end = time_now();
+  marker->time_mark = marker->time_measurement_end - marker->time_measurement_start;
   
   return;
 }
@@ -230,6 +226,8 @@
   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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -25,16 +25,31 @@
 #include "../common/fix_repointed_refs.h"
 #include "../common/gc_concurrent.h"
 
-POINTER_SIZE_INT cur_alloc_mask = (~MARK_MASK_IN_TABLE) & FLIP_COLOR_MASK_IN_TABLE;
-POINTER_SIZE_INT cur_mark_mask = MARK_MASK_IN_TABLE;
-POINTER_SIZE_INT cur_alloc_color = OBJ_COLOR_WHITE;
-POINTER_SIZE_INT cur_mark_gray_color = OBJ_COLOR_GRAY;
-POINTER_SIZE_INT cur_mark_black_color = OBJ_COLOR_BLACK;
+volatile POINTER_SIZE_INT cur_alloc_mask = (~MARK_MASK_IN_TABLE) & FLIP_COLOR_MASK_IN_TABLE;
+volatile POINTER_SIZE_INT cur_mark_mask = MARK_MASK_IN_TABLE;
+volatile POINTER_SIZE_INT cur_alloc_color = OBJ_COLOR_WHITE;
+volatile POINTER_SIZE_INT cur_mark_gray_color = OBJ_COLOR_GRAY;
+volatile POINTER_SIZE_INT cur_mark_black_color = OBJ_COLOR_BLACK;
 
 static Chunk_Header_Basic *volatile next_chunk_for_fixing;
 
 
 /******************** General interfaces for Mark-Sweep-Compact ***********************/
+Boolean obj_is_mark_black_in_table(Partial_Reveal_Object *obj)
+{
+  POINTER_SIZE_INT *p_color_word;
+  unsigned int index_in_word;
+  p_color_word = get_color_word_in_table(obj, index_in_word);
+  POINTER_SIZE_INT current_word = *p_color_word;
+  POINTER_SIZE_INT mark_black_color = cur_mark_black_color << index_in_word;
+  
+  if(current_word & mark_black_color)
+    return TRUE;
+  else
+    return FALSE;
+  
+}
+
 void gc_init_collector_free_chunk_list(Collector *collector)
 {
   Free_Chunk_List *list = (Free_Chunk_List*)STD_MALLOC(sizeof(Free_Chunk_List));

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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -52,11 +52,11 @@
   //#define DIRY_MASK_IN_TABLE   ((POINTER_SIZE_INT)0x44444444)
 #endif
 
-extern POINTER_SIZE_INT cur_alloc_color;
-extern POINTER_SIZE_INT cur_mark_gray_color;
-extern POINTER_SIZE_INT cur_mark_black_color;
-extern POINTER_SIZE_INT cur_alloc_mask;
-extern POINTER_SIZE_INT cur_mark_mask;
+extern volatile POINTER_SIZE_INT cur_alloc_color;
+extern volatile POINTER_SIZE_INT cur_mark_gray_color;
+extern volatile POINTER_SIZE_INT cur_mark_black_color;
+extern volatile POINTER_SIZE_INT cur_alloc_mask;
+extern volatile POINTER_SIZE_INT cur_mark_mask;
 
 inline Boolean is_super_obj(Partial_Reveal_Object *obj)
 {
@@ -155,20 +155,7 @@
     return FALSE;
 }
 
-FORCE_INLINE Boolean obj_is_mark_black_in_table(Partial_Reveal_Object *obj)
-{
-  POINTER_SIZE_INT *p_color_word;
-  unsigned int index_in_word;
-  p_color_word = get_color_word_in_table(obj, index_in_word);
-  POINTER_SIZE_INT current_word = *p_color_word;
-  POINTER_SIZE_INT mark_black_color = cur_mark_black_color << index_in_word;
-  
-  if(current_word & mark_black_color)
-    return TRUE;
-  else
-    return FALSE;
-  
-}
+Boolean obj_is_mark_black_in_table(Partial_Reveal_Object *obj);
 
 FORCE_INLINE Boolean obj_is_mark_black_in_table(Partial_Reveal_Object *obj, unsigned int size)
 {
@@ -431,7 +418,6 @@
 {
   POINTER_SIZE_INT temp = cur_alloc_color;
   cur_alloc_color = cur_mark_black_color;
-  //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.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_sweep.cpp?rev=650422&r1=650421&r2=650422&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_sweep.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_sweep.cpp Tue Apr 22 01:52:29 2008
@@ -132,21 +132,21 @@
     }
   }
   assert(live_num <= slot_num);
-  //chunk->alloc_num = live_num;
   collector->live_obj_size += live_num * chunk->slot_size;
   collector->live_obj_num += live_num;
 
   if(!live_num){  /* all objects in this chunk are dead */
     collector_add_free_chunk(collector, (Free_Chunk*)chunk);
-  } else if(chunk_is_reusable(chunk)){  /* most objects in this chunk are swept, add chunk to pfc list*/
-    chunk->alloc_num = live_num;
+  } else {
+   chunk->alloc_num = live_num;    
+   if(chunk_is_reusable(chunk)){  /* most objects in this chunk are swept, add chunk to pfc list*/
     //chunk_pad_last_index_word((Chunk_Header*)chunk, cur_mark_mask);
     wspace_put_pfc(wspace, chunk);
     assert(chunk->next != chunk);
-  }else{  /* the rest: chunks with free rate < PFC_REUSABLE_RATIO. we don't use them */
-    chunk->alloc_num = live_num;    
+   }else{  /* the rest: chunks with free rate < PFC_REUSABLE_RATIO. we don't use them */
     chunk->status = CHUNK_USED | CHUNK_NORMAL;
-    wspace_register_used_chunk(wspace,chunk);
+    wspace_reg_used_chunk(wspace,chunk);
+   }
   }
 }
 
@@ -160,7 +160,7 @@
   }
   else {
     chunk->status = CHUNK_ABNORMAL| CHUNK_USED;
-    wspace_register_used_chunk(wspace,chunk);
+    wspace_reg_used_chunk(wspace,chunk);
     collector->live_obj_size += CHUNK_SIZE(chunk);
     collector->live_obj_num++;
   }

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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -4,7 +4,7 @@
 #include "gc_ms.h"
 #include "../gen/gen.h"
 
-static void collector_sweep_normal_chunk_concurrent(Collector *collector, Wspace *wspace, Chunk_Header *chunk)
+static void collector_sweep_normal_chunk_con(Collector *collector, Wspace *wspace, Chunk_Header *chunk)
 {
   unsigned int slot_num = chunk->slot_num;
   unsigned int live_num = 0;
@@ -27,16 +27,17 @@
 
   if(!live_num){  /* all objects in this chunk are dead */
     collector_add_free_chunk(collector, (Free_Chunk*)chunk);
-   } else if(!chunk_is_reusable(chunk)){  /* most objects in this chunk are swept, add chunk to pfc list*/
+   } else {
     chunk->alloc_num = live_num;
-    wspace_register_unreusable_normal_chunk(wspace, chunk);
+   if(!chunk_is_reusable(chunk)){  /* most objects in this chunk are swept, add chunk to pfc list*/
+    wspace_reg_unreusable_normal_chunk(wspace, chunk);
    } else {  /* most objects in this chunk are swept, add chunk to pfc list*/
-    chunk->alloc_num = live_num;
     wspace_put_pfc_backup(wspace, chunk);
+   }
   }
 }
 
-static inline void collector_sweep_abnormal_chunk_concurrent(Collector *collector, Wspace *wspace, Chunk_Header *chunk)
+static inline void collector_sweep_abnormal_chunk_con(Collector *collector, Wspace *wspace, Chunk_Header *chunk)
 {
   assert(chunk->status == (CHUNK_ABNORMAL | CHUNK_USED));
   POINTER_SIZE_INT *table = chunk->table;
@@ -45,20 +46,20 @@
     collector_add_free_chunk(collector, (Free_Chunk*)chunk);
   }
   else {
-    wspace_register_live_abnormal_chunk(wspace, chunk);
+    wspace_reg_live_abnormal_chunk(wspace, chunk);
     collector->live_obj_size += CHUNK_SIZE(chunk);
     collector->live_obj_num++;
   }
 }
 
-static void wspace_sweep_chunk_concurrent(Wspace* wspace, Collector* collector, Chunk_Header_Basic* chunk)
+static void wspace_sweep_chunk_con(Wspace* wspace, Collector* collector, Chunk_Header_Basic* chunk)
 {  
   if(chunk->status & CHUNK_NORMAL){   /* chunk is used as a normal sized obj chunk */
     assert(chunk->status == (CHUNK_NORMAL | CHUNK_USED));
-    collector_sweep_normal_chunk_concurrent(collector, wspace, (Chunk_Header*)chunk);
+    collector_sweep_normal_chunk_con(collector, wspace, (Chunk_Header*)chunk);
   } else {  /* chunk is used as a super obj chunk */
     assert(chunk->status == (CHUNK_ABNORMAL | CHUNK_USED));
-    collector_sweep_abnormal_chunk_concurrent(collector, wspace, (Chunk_Header*)chunk);
+    collector_sweep_abnormal_chunk_con(collector, wspace, (Chunk_Header*)chunk);
   }
 }
 
@@ -248,7 +249,7 @@
   /* release local chunks of each mutator in unique mark-sweep GC */
   Mutator *mutator = gc->mutator_list;
   while(mutator){
-    wait_mutator_signal(mutator, DISABLE_COLLECTOR_SWEEP_LOCAL_CHUNKS);
+    wait_mutator_signal(mutator, HSIG_MUTATOR_SAFE);
     allocator_sweep_local_chunks((Allocator*)mutator);
     mutator = mutator->next;
   }
@@ -257,7 +258,7 @@
 #endif
 }
 
-static void gc_check_mutator_local_chunks(GC *gc, unsigned int handshake_signal)
+static void gc_wait_mutator_signal(GC *gc, unsigned int handshake_signal)
 {
   lock(gc->mutator_list_lock);     // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
 
@@ -284,6 +285,9 @@
   GC *gc = collector->gc;
   Wspace *wspace = gc_get_wspace(gc);
 
+  collector->live_obj_size = 0;
+  collector->live_obj_num = 0;
+
   unsigned int num_active_collectors = gc->num_active_collectors;
   
   atomic_cas32(&num_sweeping_collectors, 0, num_active_collectors+1);
@@ -295,7 +299,7 @@
   /*1. Grab chunks from used list, sweep the chunk and push back to PFC backup list & free list.*/
   chunk_to_sweep = chunk_pool_get_chunk(used_chunk_pool);
   while(chunk_to_sweep != NULL){
-    wspace_sweep_chunk_concurrent(wspace, collector, chunk_to_sweep);
+    wspace_sweep_chunk_con(wspace, collector, chunk_to_sweep);
     chunk_to_sweep = chunk_pool_get_chunk(used_chunk_pool);
   }
 
@@ -308,7 +312,7 @@
       while(chunk_to_sweep != NULL){
         assert(chunk_to_sweep->status == (CHUNK_NORMAL | CHUNK_NEED_ZEROING));
         chunk_to_sweep->status = CHUNK_NORMAL | CHUNK_USED;
-        wspace_sweep_chunk_concurrent(wspace, collector, chunk_to_sweep);
+        wspace_sweep_chunk_con(wspace, collector, chunk_to_sweep);
         chunk_to_sweep = chunk_pool_get_chunk(pfc_pool);
       }
     }
@@ -323,8 +327,8 @@
     gc_sweep_mutator_local_chunks(wspace->gc);
 
     /*4. Sweep gloabl alloc normal chunks again*/
-    gc_set_sweeping_global_normal_chunk();
-    gc_check_mutator_local_chunks(wspace->gc, DISABLE_COLLECTOR_SWEEP_GLOBAL_CHUNKS);
+    gc_set_sweep_global_normal_chunk();
+    gc_wait_mutator_signal(wspace->gc, HSIG_MUTATOR_SAFE);
     wspace_init_pfc_pool_iterator(wspace);
     Pool* pfc_pool = wspace_grab_next_pfc_pool(wspace);
     while(pfc_pool != NULL){
@@ -333,7 +337,7 @@
         while(chunk_to_sweep != NULL){
           assert(chunk_to_sweep->status == (CHUNK_NORMAL | CHUNK_NEED_ZEROING));
           chunk_to_sweep->status = CHUNK_NORMAL | CHUNK_USED;
-          wspace_sweep_chunk_concurrent(wspace, collector, chunk_to_sweep);
+          wspace_sweep_chunk_con(wspace, collector, chunk_to_sweep);
           chunk_to_sweep = chunk_pool_get_chunk(pfc_pool);
         }
       }
@@ -344,20 +348,20 @@
     /*4. Check the used list again.*/
     chunk_to_sweep = chunk_pool_get_chunk(used_chunk_pool);
     while(chunk_to_sweep != NULL){
-      wspace_sweep_chunk_concurrent(wspace, collector, chunk_to_sweep);
+      wspace_sweep_chunk_con(wspace, collector, chunk_to_sweep);
       chunk_to_sweep = chunk_pool_get_chunk(used_chunk_pool);
     }
 
     /*5. Switch the PFC backup list to PFC list.*/
     wspace_exchange_pfc_pool(wspace);
     
-    gc_unset_sweeping_global_normal_chunk();
+    gc_unset_sweep_global_normal_chunk();
 
     /*6. Put back live abnormal chunk and normal unreusable chunk*/
     Chunk_Header* used_abnormal_chunk = wspace_get_live_abnormal_chunk(wspace);
     while(used_abnormal_chunk){      
       used_abnormal_chunk->status = CHUNK_USED | CHUNK_ABNORMAL;
-      wspace_register_used_chunk(wspace,used_abnormal_chunk);
+      wspace_reg_used_chunk(wspace,used_abnormal_chunk);
       used_abnormal_chunk = wspace_get_live_abnormal_chunk(wspace);
     }
     pool_empty(wspace->live_abnormal_chunk_pool);
@@ -365,7 +369,7 @@
     Chunk_Header* unreusable_normal_chunk = wspace_get_unreusable_normal_chunk(wspace);
     while(unreusable_normal_chunk){  
       unreusable_normal_chunk->status = CHUNK_USED | CHUNK_NORMAL;
-      wspace_register_used_chunk(wspace,unreusable_normal_chunk);
+      wspace_reg_used_chunk(wspace,unreusable_normal_chunk);
       unreusable_normal_chunk = wspace_get_unreusable_normal_chunk(wspace);
     }
     pool_empty(wspace->unreusable_normal_chunk_pool);
@@ -382,6 +386,8 @@
   while(num_sweeping_collectors != num_active_collectors + 1);  
   collector->time_measurement_end = time_now();
 }
+
+
 
 
 

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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -145,7 +145,8 @@
     collector_reset_thread(collector);
     collector->task_func = task_func;
     collector->collect_space = space;
-    notify_collector_to_work(collector);
+    collector->collector_is_active = TRUE;
+    notify_collector_to_work(collector);    
   }
   return;
 }
@@ -362,6 +363,8 @@
   }
   return time_collector;
 }
+
+
 
 
 

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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -44,16 +44,6 @@
   vm_set_event(marker->task_finished_event);
 }
 
-void wait_marker_finish_mark_root(Marker* marker)
-{
-  vm_wait_event(marker->markroot_finished_event);
-}
-
-void marker_notify_mark_root_done(Marker* marker)
-{
-  vm_set_event(marker->markroot_finished_event);
-}
-
 static int marker_thread_func(void *arg) 
 {
   Marker* marker = (Marker *)arg;
@@ -205,7 +195,8 @@
     
     marker_reset_thread(marker);
     marker->task_func = task_func;
-    marker->mark_space= space;
+    marker->mark_space= space;    
+    marker->marker_is_active = TRUE;
     notify_marker_to_work(marker);
   }
   return;
@@ -224,38 +215,15 @@
     marker_reset_thread(marker);
     marker->task_func = task_func;
     marker->mark_space= space;
-    notify_marker_to_work(marker);
+    marker->marker_is_active = TRUE;
+    notify_marker_to_work(marker);    
   }
   return;
 }
 
-void wait_mark_root_finish(GC* gc)
-{
-  unsigned int num_marker = gc->num_active_markers;
-  for(unsigned int i=0; i<num_marker; i++)
-  {
-    Marker* marker = gc->markers[i];
-    wait_marker_finish_mark_root(marker);
-  }  
-  return;
-}
-
-void wait_mark_root_finish(GC* gc, unsigned int num_markers)
-{
-  unsigned int num_active_marker = gc->num_active_markers;
-  unsigned int i= num_active_marker - num_markers;
-  for(; i < num_active_marker; i++)
-  {
-    Marker* marker = gc->markers[i];
-    wait_marker_finish_mark_root(marker);
-  }  
-  return;
-}
-
 void marker_execute_task(GC* gc, TaskType task_func, Space* space)
 {
   assign_marker_with_task(gc, task_func, space);  
-  wait_mark_root_finish(gc);
   wait_mark_finish(gc);    
   return;
 }
@@ -263,7 +231,6 @@
 void marker_execute_task_concurrent(GC* gc, TaskType task_func, Space* space)
 {
   assign_marker_with_task(gc, task_func, space);
-  wait_mark_root_finish(gc);
   return;
 }
 
@@ -273,7 +240,6 @@
   if(num_markers > num_free_markers) 
     num_markers = num_free_markers;
   assign_marker_with_task(gc, task_func, space,num_markers);
-  wait_mark_root_finish(gc, num_markers);
   return;
 }
 
@@ -290,6 +256,8 @@
   }
   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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -94,12 +94,13 @@
 void marker_execute_task_concurrent(GC* gc, TaskType task_func, Space* space, unsigned int num_markers);
 void marker_execute_task_concurrent(GC* gc, TaskType task_func, Space* space);
 
-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_
+
+
 
 
 

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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -64,6 +64,8 @@
   return;
 }
 
+void mutator_register_new_obj_size(Mutator * mutator);
+
 void mutator_destruct(GC* gc, void *unused_gc_information)
 {
 
@@ -75,9 +77,9 @@
   lock(gc->mutator_list_lock);     // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
 
 #ifdef USE_UNIQUE_MARK_SWEEP_GC
-    allocactor_destruct_local_chunks((Allocator*)mutator);
-    allocator_register_new_obj_size((Allocator*)mutator);
+  allocactor_destruct_local_chunks((Allocator*)mutator);
 #endif
+  mutator_register_new_obj_size(mutator);
 
   volatile Mutator *temp = gc->mutator_list;
   if (temp == mutator) {  /* it is at the head of the list */
@@ -176,7 +178,7 @@
   return NULL;
 }
 
-void gc_start_mutator_time_measurement(GC* gc)
+void gc_start_mutator_time_measure(GC* gc)
 {
   lock(gc->mutator_list_lock);
   Mutator* mutator = gc->mutator_list;
@@ -204,6 +206,31 @@
   }  
   unlock(gc->mutator_list_lock);
   return time_mutator;
+}
+
+static POINTER_SIZE_INT size_new_obj_desturcted_mutator_alloced;
+
+void mutator_register_new_obj_size(Mutator * mutator)
+{
+  size_new_obj_desturcted_mutator_alloced += mutator->new_obj_size;
+}
+
+POINTER_SIZE_INT gc_get_new_object_size(GC* gc, Boolean need_reset)
+{
+  POINTER_SIZE_INT new_obj_size = 0;
+
+  lock(gc->mutator_list_lock);
+  Mutator* mutator = gc->mutator_list;
+  while (mutator) {
+    new_obj_size += mutator->new_obj_size;
+    if(need_reset) mutator->new_obj_size = 0;
+    mutator = mutator->next;
+  }  
+  unlock(gc->mutator_list_lock);
+
+  new_obj_size += size_new_obj_desturcted_mutator_alloced;
+  if(need_reset) size_new_obj_desturcted_mutator_alloced = 0;
+  return new_obj_size;
 }
 
 

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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -62,19 +62,19 @@
 
 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);
+void gc_start_mutator_time_measure(GC* gc);
 int64 gc_get_mutator_time(GC* gc);
+POINTER_SIZE_INT gc_get_new_object_size(GC* gc, Boolean need_reset);
 
 inline void mutator_post_signal(Mutator* mutator, unsigned int handshake_signal)
 { 
-  //FIXME: Need barrier here.
   mem_fence();
   mutator->handshake_signal = handshake_signal; 
   mem_fence();
 }
 
 inline void wait_mutator_signal(Mutator* mutator, unsigned int handshake_signal)
-{ while(mutator->handshake_signal == handshake_signal); }
+{ while(mutator->handshake_signal != handshake_signal); }
 
 
 #endif /*ifndef _MUTATOR_H_ */

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_alloc.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_alloc.cpp?rev=650422&r1=650421&r2=650422&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_alloc.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_alloc.cpp Tue Apr 22 01:52:29 2008
@@ -61,8 +61,6 @@
   p_return = thread_local_alloc(size, allocator);
   if (p_return)  return p_return;
 
-  gc_try_schedule_collection(allocator->gc, GC_CAUSE_NIL);
-
   /* ran out local block, grab a new one*/  
   Fspace* fspace = (Fspace*)allocator->alloc_space;
   int attempts = 0;
@@ -97,4 +95,6 @@
   return p_return;
   
 }
+
+
 

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=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -218,7 +218,6 @@
   GC* gc    =  heap_verifier->gc;
   Heap_Verifier_Metadata* verifier_metadata = heap_verifier->heap_verifier_metadata;
   verifier_update_info_before_resurrect(heap_verifier);
-  return;
 #ifndef BUILD_IN_REFERENT
   heap_verifier->gc_verifier->is_tracing_resurrect_obj = TRUE;
   if(heap_verifier->is_before_gc){
@@ -440,6 +439,8 @@
   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_live_heap.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_live_heap.cpp?rev=650422&r1=650421&r2=650422&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 Tue Apr 22 01:52:29 2008
@@ -123,6 +123,9 @@
   assert(collect_is_fallback());
   if(!heap_verifier->need_verify_gc) return;
   
+  if(!major_is_marksweep())
+    verifier_cleanup_block_info(gc);
+
   /*finish the fallbacked gc verify*/
   heap_verifier->is_before_gc = FALSE;
   verifier_set_fallback_collection(heap_verifier->gc_verifier, TRUE);  
@@ -150,6 +153,8 @@
 
 Heap_Verifier* get_heap_verifier()
 { return heap_verifier; }
+
+
 
 
 



Mime
View raw message