harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x..@apache.org
Subject svn commit: r637062 [1/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
Author: xli
Date: Fri Mar 14 04:21:27 2008
New Revision: 637062

URL: http://svn.apache.org/viewvc?rev=637062&view=rev
Log:
HARMONY-5605 : [drlvm][gc] collect_kind refactoring for better modularity

Added:
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_options.cpp   (with props)
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_properties.h   (with props)
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/move_compact/gc_mc.cpp   (with props)
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/uneven_map.h   (with props)
Modified:
    harmony/enhanced/drlvm/trunk/make/vm/gc_gen.xml
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/collection_scheduler.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/collection_scheduler.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/compressed_ref.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/fix_repointed_refs.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_block.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_concurrent.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_concurrent.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_barrier.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_metadata.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_space.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/large_pages.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/mark_scan_pool.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/object_status.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/space_tuner.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/weak_roots.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref_metadata.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref_metadata.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen_adapt.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen_stats.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen_utils.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/jni/java_natives.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/jni/java_support.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/free_area_pool.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/free_area_pool.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/los/lspace_alloc_collect.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/fallback_mark_scan.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_alloc.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_collect_compact.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_collect_compact.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_extend_compact.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_move_compact.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_slide_compact.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/space_tune_mark_scan.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/gc_ms.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/gc_ms.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_alloc.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_alloc.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_compact.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_concurrent_gc_stats.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_fallback_mark.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_mostly_concurrent.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_otf_concurrent.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_sweep.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_mark_sweep.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_sweep_concurrent.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/wspace_verify.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/move_compact/gc_mc.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace_forward.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace_gen_ss_pool.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/semi_space/sspace_nongen_ss_pool.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/gc_thread.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_nongen_forward_pool.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/vector_block.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_scanner.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_live_heap.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_mutator_effect.cpp

Modified: harmony/enhanced/drlvm/trunk/make/vm/gc_gen.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/make/vm/gc_gen.xml?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/make/vm/gc_gen.xml (original)
+++ harmony/enhanced/drlvm/trunk/make/vm/gc_gen.xml Fri Mar 14 04:21:27 2008
@@ -59,6 +59,21 @@
                 <include name="vmcore/src/util/win/include" if="is.windows"/>
                 <include name="vmcore/src/util/linux/include" if="is.unix"/>
             </dirset>
+            <dirset dir="${vm.home}/gc_gen/src">
+            	<include name="common" />
+                <include name="gen" />
+                <include name="mark_compact" />
+                <include name="mark_sweep" />
+                <include name="move_compact" />
+                <include name="semi_space" />
+                <include name="los" />
+                <include name="thread" />
+                <include name="trace_forward" />
+                <include name="utils" />
+                <include name="jni" />
+                <include name="verify" />
+                <include name="finalizer_weakref" />
+            </dirset>
         </path>
         
         <compiler id="cpp.compiler" extends="common.cpp.compiler">
@@ -69,6 +84,7 @@
                 <include name="gen/*.cpp" />
                 <include name="mark_compact/*.cpp" />
                 <include name="mark_sweep/*.cpp" />
+                <include name="move_compact/*.cpp" />
                 <include name="semi_space/*.cpp" />
                 <include name="los/*.cpp" />
                 <include name="thread/*.cpp" />

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/collection_scheduler.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/collection_scheduler.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/collection_scheduler.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/collection_scheduler.cpp Fri Mar 14 04:21:27 2008
@@ -21,11 +21,14 @@
 #include "../mark_sweep/wspace.h"
 #include "collection_scheduler.h"
 #include "gc_concurrent.h"
+#include "../thread/marker.h"
 #include "../verify/verify_live_heap.h"
 
 #define NUM_TRIAL_COLLECTION 10
+#define MAX_DELAY_TIME 0x7fFfFfFf
+#define MAX_TRACING_RATE 2
 
-static int64 time_delay_to_start_mark = 0;
+static int64 time_delay_to_start_mark = MAX_DELAY_TIME;
 
 void collection_scheduler_initialize(GC* gc)
 {
@@ -36,7 +39,7 @@
   
   collection_scheduler->gc = gc;
   gc->collection_scheduler = collection_scheduler;
-  time_delay_to_start_mark = 0;
+  time_delay_to_start_mark = MAX_DELAY_TIME;
   
   return;
 }
@@ -49,20 +52,18 @@
 {
   if(!USE_CONCURRENT_MARK) return FALSE;
   //FIXME: GEN mode also needs the support of starting mark after thread resume.
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
   if(gc_is_concurrent_mark_phase() || gc_mark_is_concurrent()) return FALSE;
 
   int64 time_current = time_now();
   if( time_current - get_collection_end_time() > time_delay_to_start_mark) 
     return TRUE;
-  else return FALSE;
-#else
-  /*FIXME: concurrent mark is not support in GC_GEN*/
-  assert(0);
-  if(gc_next_collection_kind((GC_Gen*)gc) == MAJOR_COLLECTION)
-    return TRUE;
   else 
     return FALSE;
+#else
+  /*FIXME: concurrent mark is not supported in GC_GEN*/
+  assert(0);
+  return FALSE;
 #endif
 }
 
@@ -96,7 +97,7 @@
 void gc_update_collection_scheduler(GC* gc, int64 time_mutator, int64 time_mark)
 {
   //FIXME: support GEN GC.
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
 
   Collection_Scheduler* collection_scheduler = gc->collection_scheduler;   
   Space* space = NULL;
@@ -109,27 +110,36 @@
   unsigned int num_slot   = collection_scheduler->num_slot_in_window;
   
   collection_scheduler->num_obj_traced_window[slot_index] = space_stat->num_live_obj;
-  collection_scheduler->size_alloced_window[slot_index] = space_stat->last_size_free_space;
+  collection_scheduler->size_alloced_window[slot_index] = space_stat->size_new_obj;
+  collection_scheduler->space_utilization_rate[slot_index] = space_stat->space_utilization_ratio;
 
   collection_scheduler->last_mutator_time = time_mutator;
   collection_scheduler->last_collector_time = time_mark;
+  INFO2("gc.con","last_size_free_space"<<(space_stat->last_size_free_space)<<"  new obj num "<<collection_scheduler->size_alloced_window[slot_index]<<" ");
+  if(NUM_TRIAL_COLLECTION == 0 || gc->num_collections < NUM_TRIAL_COLLECTION)
+    return;
+  INFO2("gc.con","num_live_obj "<<(space_stat->num_live_obj)<<"  last_size_free_space"<<(space_stat->last_size_free_space)<<" ");
   
   collection_scheduler->alloc_rate_window[slot_index] 
     = time_mutator == 0 ? 0 : (float)collection_scheduler->size_alloced_window[slot_index] / time_mutator; 
       
   collection_scheduler->trace_rate_window[slot_index]
-    = time_mark == 0 ? 0 : (float)collection_scheduler->num_obj_traced_window[slot_index] / time_mark;
-
+    = time_mark == 0 ? MAX_TRACING_RATE : (float)collection_scheduler->num_obj_traced_window[slot_index] / time_mark;
+  
+  INFO2("gc.con","mutator time "<<(time_mutator>>10)<<"  collection time "<<(time_mark>>10)<<" ");
+  
   collection_scheduler->num_slot_in_window = num_slot >= STATISTICS_SAMPLING_WINDOW_SIZE ? num_slot : (++num_slot);
   collection_scheduler->last_slot_index_in_window = (++slot_index)% STATISTICS_SAMPLING_WINDOW_SIZE;
 
   float sum_alloc_rate = 0;
   float sum_trace_rate = 0;
+  float sum_space_util_ratio = 0;
 
   unsigned int i;
   for(i = 0; i < collection_scheduler->num_slot_in_window; i++){
     sum_alloc_rate += collection_scheduler->alloc_rate_window[i];
     sum_trace_rate += collection_scheduler->trace_rate_window[i];
+    sum_space_util_ratio += collection_scheduler->space_utilization_rate[i];
   }
 
   TRACE2("gc.con","Allocation Rate: ");
@@ -145,14 +155,19 @@
 
   float average_alloc_rate = sum_alloc_rate / collection_scheduler->num_slot_in_window;
   float average_trace_rate = sum_trace_rate / collection_scheduler->num_slot_in_window;
+  float average_space_util_ratio = sum_space_util_ratio / collection_scheduler->num_slot_in_window;
 
-  if(average_alloc_rate == 0 || average_trace_rate == 0){
+  INFO2("gc.con","averAllocRate: "<<average_alloc_rate<<"averTraceRate: "<<average_trace_rate<<" ");
+
+  if(average_alloc_rate == 0 ){
     time_delay_to_start_mark = 0;
+  }else if(average_trace_rate == 0){
+    time_delay_to_start_mark = MAX_DELAY_TIME;
   }else{
-    float time_alloc_expected = space_stat->size_free_space / average_alloc_rate;
+    float time_alloc_expected = (space_stat->size_free_space * average_space_util_ratio) / average_alloc_rate;
     float time_trace_expected = space_stat->num_live_obj / average_trace_rate;
 
-
+    INFO2("gc.con","[Concurrent GC] expected alloc time "<<time_alloc_expected<<"  expected collect time  "<<time_trace_expected<<" ");
     if(time_alloc_expected > time_trace_expected){
       if(gc_concurrent_match_algorithm(OTF_REM_OBJ_SNAPSHOT_ALGO)||gc_concurrent_match_algorithm(OTF_REM_NEW_TARGET_ALGO)){
         collection_scheduler->time_delay_to_start_mark = (int64)((time_alloc_expected - time_trace_expected)*0.65);
@@ -224,7 +239,7 @@
   if(gc_need_start_concurrent_mark(gc)){
     vm_gc_lock_enum();    
     int64 pause_start = time_now();
-    INFO2("gc.con", "[Concurrent GC] concurrent mark start ...\n");
+    INFO2("gc.con", "[Concurrent GC] concurrent mark start ...");
     gc_start_concurrent_mark(gc);
     vm_gc_unlock_enum();
     INFO2("gc.con","[Concurrent GC] pause time of concurrent enumeration:  "<<((unsigned int)((time_now()-pause_start)>>10))<<"  ms \n");
@@ -234,6 +249,7 @@
 
   if(gc_need_start_concurrent_sweep(gc)){
     gc->num_collections++;
+    INFO2("gc.con", "[Concurrent GC] collection number:"<< gc->num_collections<<" ");
     gc_start_concurrent_sweep(gc);
     unlock(gc->collection_scheduler_lock);
     return TRUE;
@@ -245,6 +261,8 @@
     int disable_count = hythread_reset_suspend_disable();    
     gc_prepare_rootset(gc);
     gc_reset_after_concurrent_collection(gc);
+    gc_start_mutator_time_measurement(gc);
+    set_collection_end_time();
     vm_resume_threads_after();
     hythread_set_suspend_disable(disable_count);
     vm_gc_unlock_enum();
@@ -256,4 +274,5 @@
   return FALSE;
 
 }
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/collection_scheduler.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/collection_scheduler.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/collection_scheduler.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/collection_scheduler.h Fri Mar 14 04:21:27 2008
@@ -37,6 +37,7 @@
   
   float alloc_rate_window[STATISTICS_SAMPLING_WINDOW_SIZE];
   float trace_rate_window[STATISTICS_SAMPLING_WINDOW_SIZE];
+  float space_utilization_rate[STATISTICS_SAMPLING_WINDOW_SIZE];
   POINTER_SIZE_INT num_obj_traced_window[STATISTICS_SAMPLING_WINDOW_SIZE];
   POINTER_SIZE_INT size_alloced_window[STATISTICS_SAMPLING_WINDOW_SIZE];
 } Collection_Scheduler;
@@ -51,4 +52,6 @@
 
 
 #endif
+
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/compressed_ref.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/compressed_ref.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/compressed_ref.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/compressed_ref.cpp Fri Mar 14 04:21:27 2008
@@ -32,7 +32,7 @@
 }Compressed_Root;
 
 POINTER_SIZE_INT vtable_base = 0;
-POINTER_SIZE_INT HEAP_NULL = 0;
+POINTER_SIZE_INT HEAP_BASE = 0;
 
 void gc_set_uncompressed_rootset(GC *gc)
 {
@@ -69,5 +69,7 @@
     }
   }
 }
+
+
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/fix_repointed_refs.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/fix_repointed_refs.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/fix_repointed_refs.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/fix_repointed_refs.h Fri Mar 14 04:21:27 2008
@@ -24,7 +24,7 @@
 
 #include "gc_common.h"
 #include "compressed_ref.h"
-extern Boolean IS_MOVE_COMPACT;
+#include "../finalizer_weakref/finalizer_weakref.h"
 extern void* los_boundary;
 
 inline void slot_fix(REF* p_ref)
@@ -40,7 +40,7 @@
   
 #endif
 
-  if(IS_MOVE_COMPACT){
+  if(collect_is_compact_move()){
     /* This condition is removed because we do los sliding compaction at every major compaction after add los minor sweep. */
     //if(obj_is_moved(p_obj)) 
     /*Fixme: los_boundery ruined the modularity of gc_common.h*/
@@ -93,6 +93,13 @@
      REF* p_ref = object_ref_iterator_get(ref_iterator+i, p_obj);        
      slot_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_fix(p_ref);
+  }
+#endif
 
   return;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_block.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_block.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_block.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_block.h Fri Mar 14 04:21:27 2008
@@ -47,9 +47,7 @@
   void* ceiling;                    
   void* new_free; /* used only during compaction */
   unsigned int block_idx;           
-#ifdef USE_UNIQUE_MOVE_COMPACT_GC
-  unsigned int num_multi_block; /*number of block in large block*/
-#endif
+  unsigned int num_multi_block; /* number of blocks in large block */
   volatile unsigned int status;
 
   volatile unsigned int num_live_objs; /* for verification debugging */
@@ -63,9 +61,6 @@
   Hashcode_Buf* hashcode_buf; /*hash code entry list*/
 #endif
   Block_Header* next;
-#ifdef USE_UNIQUE_MOVE_COMPACT_GC
-  Block_Header* next_large_block; /*used to link free super large block in gc_mc*/
-#endif
   POINTER_SIZE_INT table[1]; /* entry num == OFFSET_TABLE_SIZE_WORDS */
 }Block_Header;
 
@@ -106,18 +101,15 @@
 #define ADDRESS_OFFSET_TO_BLOCK_HEADER(addr) ((unsigned int)((POINTER_SIZE_INT)addr&GC_BLOCK_LOW_MASK))
 #define ADDRESS_OFFSET_IN_BLOCK_BODY(addr) ((unsigned int)(ADDRESS_OFFSET_TO_BLOCK_HEADER(addr)- GC_BLOCK_HEADER_SIZE_BYTES))
 
-#ifdef USE_UNIQUE_MOVE_COMPACT_GC
-#define NUM_BLOCKS_PER_LARGE_OBJECT(size) (((size)+GC_BLOCK_HEADER_SIZE_BYTES+ GC_BLOCK_SIZE_BYTES-1)/GC_BLOCK_SIZE_BYTES)
-#endif
+#define NUM_BLOCKS_IN_LARGE_BLOCK_FOR_SIZE(size) ((unsigned int)(((size)+ GC_BLOCK_HEADER_SIZE_BYTES + GC_BLOCK_SIZE_BYTES - 1)>>GC_BLOCK_SHIFT_COUNT))
+
 inline void block_init(Block_Header* block)
 {
   block->free = (void*)((POINTER_SIZE_INT)block + GC_BLOCK_HEADER_SIZE_BYTES);
   block->ceiling = (void*)((POINTER_SIZE_INT)block + GC_BLOCK_SIZE_BYTES); 
   block->base = block->free;
   block->new_free = block->free;
-#ifdef USE_UNIQUE_MOVE_COMPACT_GC
   block->num_multi_block = 0;
-#endif
   block->status = BLOCK_FREE;
   block->dest_counter = 0;
   block->src = NULL;
@@ -278,6 +270,8 @@
 /* blocked_space hashcode_buf ops --> */
 
 #endif //#ifndef _BLOCK_H_
+
+
 
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.cpp Fri Mar 14 04:21:27 2008
@@ -37,338 +37,16 @@
 
 unsigned int SPACE_ALLOC_UNIT;
 
-extern char* GC_VERIFY;
-
-extern POINTER_SIZE_INT NOS_SIZE;
-extern POINTER_SIZE_INT MIN_NOS_SIZE;
-extern POINTER_SIZE_INT INIT_LOS_SIZE;
-extern POINTER_SIZE_INT TOSPACE_SIZE;
-extern POINTER_SIZE_INT MOS_RESERVE_SIZE;
-
-extern Boolean FORCE_FULL_COMPACT;
-
-extern unsigned int NUM_MARKERS;
-extern unsigned int NUM_COLLECTORS;
-extern unsigned int MINOR_COLLECTORS;
-extern unsigned int MAJOR_COLLECTORS;
-
-extern Boolean IGNORE_VTABLE_TRACING;
-
-POINTER_SIZE_INT HEAP_SIZE_DEFAULT = 256 * MB;
-POINTER_SIZE_INT min_heap_size_bytes = 16 * MB;
-POINTER_SIZE_INT max_heap_size_bytes = 0;
-
-extern Boolean JVMTI_HEAP_ITERATION ;
-
-extern Boolean IS_MOVE_COMPACT;
-extern Boolean USE_CONCURRENT_GC;
-
-static int get_int_property(const char *property_name)
-{
-    assert(property_name);
-    char *value = get_property(property_name, VM_PROPERTIES);
-    int return_value;
-    if (NULL != value)
-    {
-        return_value = atoi(value);
-        destroy_property_value(value);
-    }else{
-        DIE2("gc.base","Warning: property value "<<property_name<<"is not set!");
-        exit(0);
-    }
-      
-    return return_value;
-}
-
-static Boolean get_boolean_property(const char *property_name)
-{
-  assert(property_name);
-  char *value = get_property(property_name, VM_PROPERTIES);
-  if (NULL == value){
-    DIE2("gc.base","Warning: property value "<<property_name<<" is not set!");
-    exit(0);
-  }
-  
-  Boolean return_value;
-  if (0 == strcmp("no", value)
-      || 0 == strcmp("off", value)
-      || 0 == strcmp("false", value)
-      || 0 == strcmp("0", value))
-  {
-    return_value = FALSE;
-  }
-  else if (0 == strcmp("yes", value)
-           || 0 == strcmp("on", value)
-           || 0 == strcmp("true", value)
-           || 0 == strcmp("1", value))
-  {
-    return_value = TRUE;
-  }else{
-    DIE2("gc.base","Warning: property value "<<property_name<<" is not set! Use upper case?");
-    exit(0);
-  }
-    
-  destroy_property_value(value);
-  return return_value;
-}
-
-static size_t get_size_property(const char* name) 
-{
-  char* size_string = get_property(name, VM_PROPERTIES);
-  size_t size = atol(size_string);
-  int sizeModifier = tolower(size_string[strlen(size_string) - 1]);
-  destroy_property_value(size_string);
-
-  size_t unit = 1;
-  switch (sizeModifier) {
-  case 'k': unit = 1024; break;
-  case 'm': unit = 1024 * 1024; break;
-  case 'g': unit = 1024 * 1024 * 1024;break;
-  }
-
-  size_t res = size * unit;
-  if (res / unit != size) {
-    /* overflow happened */
-    return 0;
-  }
-  return res;
-}
-
-void gc_parse_options(GC* gc) 
-{
-  TRACE2("gc.process", "GC: parse options ...\n");
-  if (!get_boolean_property("vm.assert_dialog", TRUE, VM_PROPERTIES))
-    disable_assert_dialogs();
-  
-  POINTER_SIZE_INT max_heap_size = HEAP_SIZE_DEFAULT;
-  POINTER_SIZE_INT min_heap_size = min_heap_size_bytes;
-  
-  if (is_property_set("gc.mx", VM_PROPERTIES) == 1) {
-    max_heap_size = get_size_property("gc.mx");
-
-    if (max_heap_size < min_heap_size){
-      max_heap_size = min_heap_size;
-      WARN2("gc.base","Warning: Max heap size you set is too small, reset to "<<max_heap_size/MB<<" MB!");
-    }
-    if (0 == max_heap_size){
-      max_heap_size = HEAP_SIZE_DEFAULT;
-      WARN2("gc.base","Warning: Max heap size you set euqals to zero, reset to "<<max_heap_size/MB<<" MB!");
-    }
- 
-    min_heap_size = max_heap_size / 10;
-    if (min_heap_size < min_heap_size_bytes){
-      min_heap_size = min_heap_size_bytes;
-//      printf("Min heap size: too small, reset to %d MB! \n", min_heap_size/MB);
-    }
-  }
-
-  if (is_property_set("gc.ms", VM_PROPERTIES) == 1) {
-    min_heap_size = get_size_property("gc.ms");
-    if (min_heap_size < min_heap_size_bytes){
-      min_heap_size = min_heap_size_bytes;
-      WARN2("gc.base","Warning: Min heap size you set is too small, reset to "<<min_heap_size/MB<<" MB!");
-    } 
-  }
-
-  if (min_heap_size > max_heap_size){
-    max_heap_size = min_heap_size;
-    WARN2("gc.base","Warning: Max heap size is too small, reset to "<<max_heap_size/MB<<" MB!");
-  }
-
-  min_heap_size_bytes = min_heap_size;
-  max_heap_size_bytes = max_heap_size;
-
-  if (is_property_set("gc.nos_size", VM_PROPERTIES) == 1) {
-    NOS_SIZE = get_size_property("gc.nos_size");
-  }
-
-  if (is_property_set("gc.min_nos_size", VM_PROPERTIES) == 1) {
-    MIN_NOS_SIZE = get_size_property("gc.min_nos_size");
-  }
-
-  if (is_property_set("gc.init_los_size", VM_PROPERTIES) == 1) {
-    INIT_LOS_SIZE = get_size_property("gc.init_los_size");
-  }  
-
-  if (is_property_set("gc.num_collectors", VM_PROPERTIES) == 1) {
-    unsigned int num = get_int_property("gc.num_collectors");
-    NUM_COLLECTORS = (num==0)? NUM_COLLECTORS:num;
-  }
-
-  if (is_property_set("gc.num_markers", VM_PROPERTIES) == 1) {
-    unsigned int num = get_int_property("gc.num_markers");
-    NUM_MARKERS = (num==0)? NUM_MARKERS:num;
-  }
-
-  /* GC algorithm decision */
-  /* Step 1: */
-  char* minor_algo = NULL;
-  char* major_algo = NULL;
-  
-  if (is_property_set("gc.minor_algorithm", VM_PROPERTIES) == 1) {
-    minor_algo = get_property("gc.minor_algorithm", VM_PROPERTIES);
-  }
-  
-  if (is_property_set("gc.major_algorithm", VM_PROPERTIES) == 1) {
-    major_algo = get_property("gc.major_algorithm", VM_PROPERTIES);
-  }
-  
-  gc_decide_collection_algorithm((GC_Gen*)gc, minor_algo, major_algo);
-  gc->generate_barrier = gc_is_gen_mode();
-
-  if( minor_algo) destroy_property_value(minor_algo);
-  if( major_algo) destroy_property_value(major_algo);
-
-  /* Step 2: */
-  /* NOTE:: this has to stay after above!! */
-  if (is_property_set("gc.force_major_collect", VM_PROPERTIES) == 1) {
-    FORCE_FULL_COMPACT = get_boolean_property("gc.force_major_collect");
-    if(FORCE_FULL_COMPACT){
-      gc_disable_gen_mode();
-      gc->generate_barrier = FALSE;
-    }
-  }
-
-  /* Step 3: */
-  /* NOTE:: this has to stay after above!! */
-  if (is_property_set("gc.generate_barrier", VM_PROPERTIES) == 1) {
-    Boolean generate_barrier = get_boolean_property("gc.generate_barrier");
-    gc->generate_barrier = generate_barrier || gc->generate_barrier;
-  }
-
-  if (is_property_set("gc.tospace_size", VM_PROPERTIES) == 1) {
-    TOSPACE_SIZE = get_size_property("gc.tospace_size");
-  }
-
-  if (is_property_set("gc.mos_reserve_size", VM_PROPERTIES) == 1) {
-    MOS_RESERVE_SIZE = get_size_property("gc.mos_reserve_size");
-  }
-
-  if (is_property_set("gc.nos_partial_forward", VM_PROPERTIES) == 1) {
-    NOS_PARTIAL_FORWARD = get_boolean_property("gc.nos_partial_forward");
-  }
-    
-  if (is_property_set("gc.minor_collectors", VM_PROPERTIES) == 1) {
-    MINOR_COLLECTORS = get_int_property("gc.minor_collectors");
-  }
-
-  if (is_property_set("gc.major_collectors", VM_PROPERTIES) == 1) {
-    MAJOR_COLLECTORS = get_int_property("gc.major_collectors");
-  }
-
-  if (is_property_set("gc.ignore_finref", VM_PROPERTIES) == 1) {
-    IGNORE_FINREF = get_boolean_property("gc.ignore_finref");
-  }
-
-  if (is_property_set("gc.verify", VM_PROPERTIES) == 1) {
-    char* value = get_property("gc.verify", VM_PROPERTIES);
-    GC_VERIFY = strdup(value);
-    destroy_property_value(value);
-  }
-
-  if (is_property_set("gc.gen_nongen_switch", VM_PROPERTIES) == 1){
-    GEN_NONGEN_SWITCH= get_boolean_property("gc.gen_nongen_switch");
-    gc->generate_barrier = TRUE;
-  }
-
-  if (is_property_set("gc.heap_iteration", VM_PROPERTIES) == 1) {
-    JVMTI_HEAP_ITERATION = get_boolean_property("gc.heap_iteration");
-  }
-
-  if (is_property_set("gc.ignore_vtable_tracing", VM_PROPERTIES) == 1) {
-    IGNORE_VTABLE_TRACING = get_boolean_property("gc.ignore_vtable_tracing");
-  }
-
-  if (is_property_set("gc.use_large_page", VM_PROPERTIES) == 1){
-    char* value = get_property("gc.use_large_page", VM_PROPERTIES);
-    large_page_hint = strdup(value);
-    destroy_property_value(value);
-  }
-
-  if (is_property_set("gc.concurrent_gc", VM_PROPERTIES) == 1){
-    Boolean use_all_concurrent_phase= get_boolean_property("gc.concurrent_gc");
-    if(use_all_concurrent_phase){
-      USE_CONCURRENT_ENUMERATION = TRUE;
-      USE_CONCURRENT_MARK = TRUE;
-      USE_CONCURRENT_SWEEP = TRUE;
-      gc->generate_barrier = TRUE;
-    }
-  }
-
-  if (is_property_set("gc.concurrent_enumeration", VM_PROPERTIES) == 1){
-    USE_CONCURRENT_ENUMERATION= get_boolean_property("gc.concurrent_enumeration");
-    if(USE_CONCURRENT_ENUMERATION){
-      USE_CONCURRENT_GC = TRUE;      
-      gc->generate_barrier = TRUE;
-    }
-  }
-
-  if (is_property_set("gc.concurrent_mark", VM_PROPERTIES) == 1){
-    USE_CONCURRENT_MARK= get_boolean_property("gc.concurrent_mark");
-    if(USE_CONCURRENT_MARK){
-      USE_CONCURRENT_GC = TRUE;      
-      gc->generate_barrier = TRUE;
-    }
-  }
-
-  if (is_property_set("gc.concurrent_sweep", VM_PROPERTIES) == 1){
-    USE_CONCURRENT_SWEEP= get_boolean_property("gc.concurrent_sweep");
-    if(USE_CONCURRENT_SWEEP){
-      USE_CONCURRENT_GC = TRUE;
-    }
-  }
-
-  char* concurrent_algo = NULL;
-  
-  if (is_property_set("gc.concurrent_algorithm", VM_PROPERTIES) == 1) {
-    concurrent_algo = get_property("gc.concurrent_algorithm", VM_PROPERTIES);
-  }
-  
-  gc_decide_concurrent_algorithm(gc, concurrent_algo);
-
-#if defined(ALLOC_ZEROING) && defined(ALLOC_PREFETCH)
-  if(is_property_set("gc.prefetch",VM_PROPERTIES) ==1) {
-    PREFETCH_ENABLED = get_boolean_property("gc.prefetch");
-  }
-
-  if(is_property_set("gc.prefetch_distance",VM_PROPERTIES)==1) {
-    PREFETCH_DISTANCE = get_size_property("gc.prefetch_distance");
-    if(!PREFETCH_ENABLED) {
-      WARN2("gc.prefetch_distance","Warning: Prefetch distance set with Prefetch disabled!");
-    }
-  }
-
-  if(is_property_set("gc.prefetch_stride",VM_PROPERTIES)==1) {
-    PREFETCH_STRIDE = get_size_property("gc.prefetch_stride");
-    if(!PREFETCH_ENABLED) {
-      WARN2("gc.prefetch_stride","Warning: Prefetch stride set  with Prefetch disabled!");
-    }  
-  }
-  
-  if(is_property_set("gc.zeroing_size",VM_PROPERTIES)==1) {
-    ZEROING_SIZE = get_size_property("gc.zeroing_size");
-  }   
-#endif
-
-#ifdef PREFETCH_SUPPORTED
-  if(is_property_set("gc.mark_prefetch",VM_PROPERTIES) ==1) {
-    mark_prefetch = get_boolean_property("gc.mark_prefetch");
-  }  
-#endif
-
-  return;
-}
-
 void gc_assign_free_area_to_mutators(GC* 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_assign_free_area_to_mutators((GC_Gen*)gc);
 #endif
 }
 
 void gc_init_collector_alloc(GC* gc, Collector* collector)
 {
-#ifndef USE_MARK_SWEEP_GC
+#ifndef USE_UNIQUE_MARK_SWEEP_GC
   gc_gen_init_collector_alloc((GC_Gen*)gc, collector);
 #else    
   gc_init_collector_free_chunk_list(collector);
@@ -377,14 +55,14 @@
 
 void gc_reset_collector_alloc(GC* gc, 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_reset_collector_alloc((GC_Gen*)gc, collector);
 #endif    
 }
 
 void gc_destruct_collector_alloc(GC* gc, Collector* collector)
 {
-#ifndef USE_MARK_SWEEP_GC
+#ifndef USE_UNIQUE_MARK_SWEEP_GC
   gc_gen_destruct_collector_alloc((GC_Gen*)gc, collector);
 #endif    
 }
@@ -398,6 +76,22 @@
 int64 get_collection_end_time()
 { return collection_end_time; }
 
+void set_collection_end_time()
+{ collection_end_time = time_now(); }
+
+void gc_decide_collection_kind(GC* gc, unsigned int cause)
+{
+  /* this is for debugging and for gen-nongen-switch. */
+  gc->last_collect_kind = GC_PROP;
+
+#if !defined(USE_UNIQUE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
+  
+  gc_gen_decide_collection_kind((GC_Gen*)gc, cause);
+
+#endif
+
+}
+
 void gc_prepare_rootset(GC* gc)
 {
   /* Stop the threads and collect the roots. */
@@ -423,10 +117,11 @@
      to avoid racing with mutators. */
   gc->num_collections++;
   gc->cause = gc_cause;
-  gc_decide_collection_kind((GC_Gen*)gc, gc_cause);
+
+  gc_decide_collection_kind(gc, gc_cause);
 
 #ifdef MARK_BIT_FLIPPING
-  if(gc_match_kind(gc, MINOR_COLLECTION)) mark_bit_flip();
+  if(collect_is_minor()) mark_bit_flip();
 #endif
 
   if(!USE_CONCURRENT_GC){
@@ -454,35 +149,38 @@
     
     if(!IGNORE_FINREF ) gc_set_obj_with_fin(gc);
 
-#if defined(USE_MARK_SWEEP_GC)
+#if defined(USE_UNIQUE_MARK_SWEEP_GC)
     gc_ms_reclaim_heap((GC_MS*)gc);
 #elif defined(USE_UNIQUE_MOVE_COMPACT_GC)
     gc_mc_reclaim_heap((GC_MC*)gc);
 #else
     gc_gen_reclaim_heap((GC_Gen*)gc, collection_start_time);
 #endif
+
   }
 
   collection_end_time = time_now(); 
 
-#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_collection_verbose_info((GC_Gen*)gc, collection_end_time - collection_start_time, mutator_time);
   gc_gen_space_verbose_info((GC_Gen*)gc);
 #endif
 
   if(gc_is_gen_mode()) gc_prepare_mutator_remset(gc);
   
-  int64 mark_time = 0;
+  int64 collection_time = 0;
   if(USE_CONCURRENT_GC && gc_mark_is_concurrent()){
-    mark_time = gc_get_concurrent_mark_time(gc);
+    collection_time = gc_get_concurrent_mark_time(gc);
     gc_reset_concurrent_mark(gc);
+  }else{
+    collection_time = time_now()-collection_start_time;
    }
 
   if(USE_CONCURRENT_GC && gc_sweep_is_concurrent()){
     gc_reset_concurrent_sweep(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)
   if(USE_CONCURRENT_GC && gc_need_start_concurrent_mark(gc))
     gc_start_concurrent_mark(gc);
 #endif
@@ -500,20 +198,27 @@
 #ifndef BUILD_IN_REFERENT
   } else {
     gc_clear_weakref_pools(gc);
+    gc_clear_finref_repset_pool(gc);
 #endif
   }
 
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
   gc_ms_update_space_statistics((GC_MS*)gc);
 #endif
 
   gc_assign_free_area_to_mutators(gc);
   
-  if(USE_CONCURRENT_GC) gc_update_collection_scheduler(gc, mutator_time, mark_time);
-  
+  if(USE_CONCURRENT_GC) gc_update_collection_scheduler(gc, mutator_time, collection_time);
+
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
+  gc_ms_reset_space_statistics((GC_MS*)gc);
+#endif
+
   vm_reclaim_native_objs();
   gc->in_collection = FALSE;
 
+  gc_reset_collector_state(gc);
+
   gc_clear_dirty_set(gc);
   
   vm_resume_threads_after();
@@ -524,6 +229,8 @@
   INFO2("gc.con","pause time:  "<<((unsigned int)(pause_time>>10))<<"  ms \n");
   return;
 }
+
+
 
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h Fri Mar 14 04:21:27 2008
@@ -35,14 +35,19 @@
 
 #include "gc_for_class.h"
 #include "gc_platform.h"
+#include "gc_properties.h"
 
 #include "../common/gc_for_barrier.h"
 
 /* 
-#define USE_MARK_SWEEP_GC  //define it to only use Mark-Sweep GC (no NOS, no LOS).
+#define USE_UNIQUE_MARK_SWEEP_GC  //define it to only use Mark-Sweep GC (no NOS, no LOS).
+#define USE_UNIQUE_MOVE_COMPACT_GC //define it to only use Move-Compact GC (no NOS, no LOS).
 */
-//#define USE_UNIQUE_MOVE_COMPACT_GC //define it to only use Move-Compact GC (no NOS, no LOS).
+
 #define GC_GEN_STATS
+#define USE_32BITS_HASHCODE
+#define GC_LOS_OBJ_SIZE_THRESHOLD (5*KB)
+
 #define null 0
 
 #define KB  (1<<10)
@@ -77,76 +82,11 @@
 #define BYTES_OF_POINTER_SIZE_INT (sizeof(POINTER_SIZE_INT))
 #define BIT_SHIFT_TO_BYTES_OF_POINTER_SIZE_INT ((sizeof(POINTER_SIZE_INT)==4)? 2: 3)
 
-#define GC_OBJ_SIZE_THRESHOLD (5*KB)
-
-#define USE_32BITS_HASHCODE
-
-/* define it to use only mark-sweep GC for entire heap management */
-//#define USE_MARK_SWEEP_GC
-
 typedef void (*TaskType)(void*);
 
-enum Collection_Algorithm{
-  COLLECTION_ALGOR_NIL,
-  
-  MINOR_GEN_FORWARD_POOL,
-  MINOR_NONGEN_FORWARD_POOL,
-  
-  MINOR_GEN_SEMISPACE_POOL,
-  MINOR_NONGEN_SEMISPACE_POOL,  
-  
-  MAJOR_COMPACT_SLIDE,
-  MAJOR_COMPACT_MOVE,
-  MAJOR_MARK_SWEEP  
-};
-
-/* Possible combinations:
- * MINOR_COLLECTION
- * NORMAL_MAJOR_COLLECTION
- * FALLBACK_COLLECTION
- * NORMAL_MAJOR_COLLECTION | EXTEND_COLLECTION
- * FALLBACK_COLLECTION | EXTEND_COLLECTION
- * MS_COLLECTION
- * MS_COMPACT_COLLECTION
- */
-enum Collection_Kind {
-  /* Two main kinds: generational GC and mark-sweep GC; this is decided at compiling time */
-  GEN_GC = 0x1,
-  MARK_SWEEP_GC = 0x2,
-  MOVE_COMPACT_NO_LOS = 0x4,
-  /* Mask of bits standing for two basic kinds */
-  GC_BASIC_KIND_MASK = ~(unsigned int)0x7,
-  
-  /* Sub-kinds of generational GC use the 4~7th LSB */
-  MINOR_COLLECTION = 0x11,  /* 0x10 & GEN_GC */
-  MAJOR_COLLECTION = 0x21,  /* 0x20 & GEN_GC */
-  
-  /* Sub-kinds of major collection use the 8~11th LSB */
-  NORMAL_MAJOR_COLLECTION = 0x121,  /* 0x100 & MAJOR_COLLECTION */
-  FALLBACK_COLLECTION = 0x221,  /* 0x200 & MAJOR_COLLECTION */
-  EXTEND_COLLECTION = 0x421,  /* 0x400 & MAJOR_COLLECTION */
-  
-  /* Sub-kinds of mark-sweep GC use the 12~15th LSB */
-  MS_COLLECTION = 0x1002,  /* 0x1000 & MARK_SWEEP_GC */
-  MS_COMPACT_COLLECTION = 0x2002,  /* 0x2000 & MARK_SWEEP_GC */
-  MC_COLLECTION = 0x1004
-};
-
-extern Boolean IS_FALLBACK_COMPACTION;  /* only for mark/fw bits debugging purpose */
-
-enum GC_CAUSE{
-  GC_CAUSE_NIL,
-  GC_CAUSE_NOS_IS_FULL,
-  GC_CAUSE_LOS_IS_FULL,
-  GC_CAUSE_COS_IS_FULL,
-  GC_CAUSE_WSPACE_IS_FULL,
-  GC_CAUSE_RUNTIME_FORCE_GC
-};
-
-
-extern POINTER_SIZE_INT HEAP_NULL;
+extern POINTER_SIZE_INT HEAP_BASE;
 
-//#define COMPRESS_REFERENCE // Now passed from outside 
+//#define COMPRESS_REFERENCE // Now it's a VM-wide macro, defined in build file 
 
 #if !defined(POINTER64) && defined(COMPRESS_REFERENCE)
 #error "32-bit architecture does not support references compression"
@@ -166,13 +106,13 @@
 #ifdef COMPRESS_REFERENCE
   if(!p_obj){
           /*Fixme: em64t: vm performs a simple compress/uncompress machenism
-           i.e. just add or minus HEAP_NULL to p_obj
+           i.e. just add or minus HEAP_BASE to p_obj
            But in gc we distinguish zero from other p_obj
            Now only in prefetch next live object we can hit this point. */
     return (REF)0;
   }
   else
-    return (REF) ((POINTER_SIZE_INT) p_obj - HEAP_NULL);
+    return (REF) ((POINTER_SIZE_INT) p_obj - HEAP_BASE);
 #else
     return (REF)p_obj;
 #endif
@@ -184,7 +124,7 @@
   if(!ref){
     return NULL; 
   }
-  return (Partial_Reveal_Object *)(HEAP_NULL + ref);
+  return (Partial_Reveal_Object *)(HEAP_BASE + ref);
 
 #else
   return (Partial_Reveal_Object *)ref;
@@ -316,7 +256,7 @@
 
 inline void obj_set_fw_in_oi(Partial_Reveal_Object *obj, void *dest)
 { 
-  assert(IS_FALLBACK_COMPACTION || (!(get_obj_info_raw(obj) & FLIP_FORWARD_BIT))); 
+  assert(collect_is_fallback() || (!(get_obj_info_raw(obj) & FLIP_FORWARD_BIT))); 
   /* This assert should always exist except it's fall back compaction. In fall-back compaction
      an object can be marked in last time minor collection, which is exactly this time's fw bit,
      because the failed minor collection flipped the bits. */
@@ -499,6 +439,14 @@
 
 }GC;
 
+
+inline Boolean collect_last_is_minor(GC* gc)
+{
+  return (Boolean)((gc->last_collect_kind & ALGO_MAJOR) == 0);
+}
+
+/* ============================================================================ */
+
 void mark_scan_pool(Collector* collector);
 
 inline void mark_scan_heap(Collector* collector)
@@ -515,30 +463,17 @@
 
 Boolean obj_belongs_to_gc_heap(Partial_Reveal_Object* p_obj);
 
-/* gc must match exactly that kind if returning TRUE */
-inline Boolean gc_match_kind(GC *gc, unsigned int kind)
-{
-  assert(gc->collect_kind && kind);
-  return (Boolean)((gc->collect_kind & kind) == kind);
-}
-/* multi_kinds is a combination of multi collect kinds
- * gc must match one of them.
- */
-inline Boolean gc_match_either_kind(GC *gc, unsigned int multi_kinds)
-{
-  multi_kinds &= GC_BASIC_KIND_MASK;
-  assert(gc->collect_kind && multi_kinds);
-  return (Boolean)(gc->collect_kind & multi_kinds);
-}
+inline void gc_reset_collector_state(GC* gc){ gc->num_active_collectors = 0;}
 
 inline unsigned int gc_get_processor_num(GC* gc) { return gc->_num_processors; }
 
-void gc_parse_options(GC* gc);
+GC* gc_parse_options();
 void gc_reclaim_heap(GC* gc, unsigned int gc_cause);
 void gc_prepare_rootset(GC* gc);
 
 
 int64 get_collection_end_time();
+void set_collection_end_time();
 
 /* generational GC related */
 
@@ -562,6 +497,7 @@
 void gc_init_collector_alloc(GC* gc, Collector* collector);
 void gc_reset_collector_alloc(GC* gc, Collector* collector);
 void gc_destruct_collector_alloc(GC* gc, Collector* collector);
+void gc_decide_collection_kind(GC* gc, unsigned int cause);
 
 FORCE_INLINE Boolean addr_belongs_to_nos(void* addr)
 { return addr >= nos_boundary; }

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_concurrent.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_concurrent.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_concurrent.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_concurrent.cpp Fri Mar 14 04:21:27 2008
@@ -45,7 +45,7 @@
 {
   if(!is_mark_finished(gc)){
     lock(gc->concurrent_mark_lock);
-#ifndef USE_MARK_SWEEP_GC
+#ifndef USE_UNIQUE_MARK_SWEEP_GC
     gc_gen_start_concurrent_mark((GC_Gen*)gc);
 #else
     if(gc_concurrent_match_algorithm(OTF_REM_OBJ_SNAPSHOT_ALGO)){
@@ -76,7 +76,7 @@
 {
   wait_mark_finish(gc);
   gc_set_barrier_function(WRITE_BARRIER_REM_NIL);
-  mem_fence();
+  //mem_fence(); we do not need memory fence here.
   gc_check_mutator_barrier(gc);
   gc_set_concurrent_status(gc,GC_CONCURRENT_STATUS_NIL);
 }
@@ -106,12 +106,14 @@
   }
   gc_set_concurrent_status(gc, GC_CONCURRENT_MARK_PHASE);
 
-  gc_decide_collection_kind((GC_Gen*)gc, GC_CAUSE_NIL);
+#ifndef USE_UNIQUE_MARK_SWEEP_GC
+  gc_decide_collection_kind((GC*)gc, GC_CAUSE_NIL);
+#endif
 
   num_marker = gc_decide_marker_number(gc);
   
   /*start concurrent mark*/
-#ifndef USE_MARK_SWEEP_GC
+#ifndef USE_UNIQUE_MARK_SWEEP_GC
   gc_gen_start_concurrent_mark((GC_Gen*)gc);
 #else
   if(gc_concurrent_match_algorithm(OTF_REM_OBJ_SNAPSHOT_ALGO)){
@@ -150,21 +152,35 @@
     wspace_mark_scan_mostly_concurrent_terminate();
   
   gc_wait_concurrent_mark_finish(gc);
+
+  int disable_count;   
+  if(!is_STW){
+    /*suspend the mutators.*/   
+    lock(gc->enumerate_rootset_lock);    
+    gc_clear_rootset(gc);
+    gc_metadata_verify(gc, TRUE);
+    gc_reset_rootset(gc);    
+    disable_count = hythread_reset_suspend_disable();
+    vm_enumerate_root_set_all_threads();
+    gc_copy_interior_pointer_table_to_rootset();
+    gc_set_rootset(gc); 
+  }
+
   
   if(gc_concurrent_match_algorithm(MOSTLY_CONCURRENT_ALGO)){
     /*If gc use mostly concurrent algorithm, there's a final marking pause. 
           Suspend the mutators once again and finish the marking phase.*/
-    int disable_count;   
-    if(!is_STW){
-      /*suspend the mutators.*/   
-      lock(gc->enumerate_rootset_lock);
-      gc_metadata_verify(gc, TRUE);
-      gc_reset_rootset(gc);    
-      disable_count = hythread_reset_suspend_disable();
-      vm_enumerate_root_set_all_threads();
-      gc_copy_interior_pointer_table_to_rootset();
-      gc_set_rootset(gc); 
-    }
+//    int disable_count;   
+//    if(!is_STW){
+//      /*suspend the mutators.*/   
+//      lock(gc->enumerate_rootset_lock);
+//      gc_metadata_verify(gc, TRUE);
+//      gc_reset_rootset(gc);    
+//      disable_count = hythread_reset_suspend_disable();
+//      vm_enumerate_root_set_all_threads();
+//      gc_copy_interior_pointer_table_to_rootset();
+//      gc_set_rootset(gc); 
+//    }
 
     /*prepare dirty object*/
     gc_prepare_dirty_set(gc);
@@ -172,7 +188,7 @@
     gc_set_weakref_sets(gc);
         
     /*start STW mark*/
-#ifndef USE_MARK_SWEEP_GC
+#ifndef USE_UNIQUE_MARK_SWEEP_GC
     assert(0);
 #else
     gc_ms_start_final_mark_after_concurrent((GC_MS*)gc, MIN_NUM_MARKERS);
@@ -180,13 +196,22 @@
     
     wspace_mark_scan_mostly_concurrent_reset();
     gc_clear_dirty_set(gc);
-    if(!is_STW){
-      unlock(gc->enumerate_rootset_lock);
-      vm_resume_threads_after();    
-      assert(hythread_is_suspend_enabled());
-      hythread_set_suspend_disable(disable_count);
-    }
+//    if(!is_STW){
+//      unlock(gc->enumerate_rootset_lock);
+//      vm_resume_threads_after();    
+//      assert(hythread_is_suspend_enabled());
+//      hythread_set_suspend_disable(disable_count);
+//    }
   }
+
+  
+  if(!is_STW){    
+    unlock(gc->enumerate_rootset_lock);
+    vm_resume_threads_after();    
+    assert(hythread_is_suspend_enabled());
+    hythread_set_suspend_disable(disable_count);
+  }
+  
   gc_reset_dirty_set(gc);
 }
 
@@ -237,7 +262,7 @@
   gc_identify_dead_weak_roots(gc);
   
   /*start concurrent mark*/
-#ifndef USE_MARK_SWEEP_GC
+#ifndef USE_UNIQUE_MARK_SWEEP_GC
   assert(0);
 #else
   gc_ms_start_concurrent_sweep((GC_MS*)gc, MIN_NUM_MARKERS);
@@ -288,6 +313,10 @@
 
 void gc_reset_after_concurrent_collection(GC* gc)
 {
+
+  int64 mutator_time = gc_get_mutator_time(gc);
+  int64 collection_time = gc_get_collector_time(gc) + gc_get_marker_time(gc);
+
   /*FIXME: enable concurrent GEN mode.*/
   gc_reset_interior_pointer_table();
   if(gc_is_gen_mode()) gc_prepare_mutator_remset(gc);
@@ -302,14 +331,17 @@
     gc_activate_finref_threads((GC*)gc);
 #ifndef BUILD_IN_REFERENT
   } else {
-    gc_clear_weakref_pools(gc);
+    gc_clear_weakref_pools(gc);    
+    gc_clear_finref_repset_pool(gc);
 #endif
   }
 
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
   gc_ms_update_space_statistics((GC_MS*)gc);
 #endif
 
+  gc_reset_collector_state(gc);
+
   gc_clear_dirty_set(gc);
 
   vm_reclaim_native_objs();
@@ -322,9 +354,15 @@
   if(USE_CONCURRENT_GC && gc_sweep_is_concurrent()){
     gc_reset_concurrent_sweep(gc);
   }
+  
+  gc_update_collection_scheduler(gc, mutator_time, collection_time);
+
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
+  gc_ms_reset_space_statistics((GC_MS*)gc);
+#endif
 }
 
-void gc_decide_concurrent_algorithm(GC* gc, char* concurrent_algo)
+void gc_decide_concurrent_algorithm(char* concurrent_algo)
 {
   if(!concurrent_algo){
     CONCURRENT_ALGO = OTF_REM_OBJ_SNAPSHOT_ALGO;

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_concurrent.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_concurrent.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_concurrent.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_concurrent.h Fri Mar 14 04:21:27 2008
@@ -154,7 +154,7 @@
 void gc_reset_after_concurrent_collection(GC* gc);
 void gc_check_concurrent_phase(GC * gc);
 
-void gc_decide_concurrent_algorithm(GC* gc, char* concurrent_algo);
+void gc_decide_concurrent_algorithm(char* concurrent_algo);
 
 void gc_reset_concurrent_sweep(GC* gc);
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_barrier.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_barrier.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_barrier.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_barrier.cpp Fri Mar 14 04:21:27 2008
@@ -261,8 +261,8 @@
 /* FIXME:: this is not the right interface for write barrier */
 void gc_heap_slot_write_ref (Managed_Object_Handle p_obj_holding_ref,Managed_Object_Handle *p_slot, Managed_Object_Handle p_target)
 { 
-  Mutator *mutator = (Mutator *)gc_get_tls();  
-  mutator_post_signal(mutator,MUTATOR_ENTER_BARRIER);
+  //Mutator *mutator = (Mutator *)gc_get_tls();  
+  //mutator_post_signal(mutator,MUTATOR_ENTER_BARRIER);
 
   switch(write_barrier_function){
     case WRITE_BARRIER_REM_NIL:
@@ -293,7 +293,7 @@
       return;
   }
 
-  mutator_post_signal(mutator,MUTATOR_EXIT_BARRIER);
+  //mutator_post_signal(mutator,MUTATOR_EXIT_BARRIER);
   return;
 }
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp Fri Mar 14 04:21:27 2008
@@ -58,7 +58,6 @@
 static void init_gc_helpers()
 {
     set_property("vm.component.classpath.gc_gen", "gc_gen.jar", VM_PROPERTIES);
-
     vm_helper_register_magic_helper(VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE, "org/apache/harmony/drlvm/gc_gen/GCHelper", "alloc");
     vm_helper_register_magic_helper(VM_RT_NEW_VECTOR_USING_VTABLE,  "org/apache/harmony/drlvm/gc_gen/GCHelper", "allocArray");
     vm_helper_register_magic_helper(VM_RT_GC_HEAP_WRITE_REF,  "org/apache/harmony/drlvm/gc_gen/GCHelper", "write_barrier_slot_rem");
@@ -71,19 +70,10 @@
 
   vm_gc_lock_init();
 
-#if defined(USE_MARK_SWEEP_GC)
-unsigned int gc_struct_size = sizeof(GC_MS);
-#elif defined(USE_UNIQUE_MOVE_COMPACT_GC)
-unsigned int gc_struct_size = sizeof(GC_MC);
-#else
-unsigned int gc_struct_size = sizeof(GC_Gen);
-#endif
-  GC* gc = (GC*)STD_MALLOC(gc_struct_size);
+  GC* gc = gc_parse_options();
   assert(gc);
-  memset(gc, 0, sizeof(GC));  
-  p_global_gc = gc;
 
-  gc_parse_options(gc);
+  p_global_gc = gc;
 
 #ifdef BUILD_IN_REFERENT
    if( ! IGNORE_FINREF){
@@ -104,7 +94,7 @@
   
   gc_metadata_initialize(gc); /* root set and mark stack */
 
-#if defined(USE_MARK_SWEEP_GC)
+#if defined(USE_UNIQUE_MARK_SWEEP_GC)
   gc_ms_initialize((GC_MS*)gc, min_heap_size_bytes, max_heap_size_bytes);
 #elif defined(USE_UNIQUE_MOVE_COMPACT_GC)
   gc_mc_initialize((GC_MC*)gc, min_heap_size_bytes, max_heap_size_bytes);
@@ -140,7 +130,7 @@
   INFO2("gc.process", "GC: call GC wrapup ....");
   GC* gc =  p_global_gc;
 
-#if defined(USE_MARK_SWEEP_GC)
+#if defined(USE_UNIQUE_MARK_SWEEP_GC)
  gc_ms_destruct((GC_MS*)gc);
 #elif defined(USE_UNIQUE_MOVE_COMPACT_GC)
  gc_mc_destruct((GC_MC*)gc);
@@ -186,7 +176,7 @@
      FIXME:: nos_boundary is a static field in GCHelper.java for fast write barrier, not a real object reference 
      this should be fixed that magic Address field should not be enumerated. */
 #ifdef COMPRESS_REFERENCE
-  if (p_obj == (Partial_Reveal_Object*)HEAP_NULL || p_obj == NULL || p_obj == nos_boundary ) return;
+  if (p_obj == (Partial_Reveal_Object*)HEAP_BASE || p_obj == NULL || p_obj == nos_boundary ) return;
 #else
   if (p_obj == NULL || p_obj == nos_boundary ) return;
 #endif  
@@ -229,7 +219,7 @@
      FIXME:: nos_boundary is a static field in GCHelper.java for fast write barrier, not a real object reference
      this should be fixed that magic Address field should not be enumerated. */
 #ifdef COMPRESS_REFERENCE
-  if (p_obj == (Partial_Reveal_Object*)HEAP_NULL || p_obj == NULL || p_obj == nos_boundary ) return;
+  if (p_obj == (Partial_Reveal_Object*)HEAP_BASE || p_obj == NULL || p_obj == nos_boundary ) return;
 #else
   if (p_obj == NULL || p_obj == nos_boundary ) return;
 #endif
@@ -265,7 +255,7 @@
 
 int64 gc_free_memory()
 {
-#if defined(USE_MARK_SWEEP_GC)
+#if defined(USE_UNIQUE_MARK_SWEEP_GC)
   return (int64)gc_ms_free_memory_size((GC_MS*)p_global_gc);
 #elif defined(USE_UNIQUE_MOVE_COMPACT_GC)
   return (int64)gc_mc_free_memory_size((GC_MC*)p_global_gc);
@@ -277,7 +267,7 @@
 /* java heap size.*/
 int64 gc_total_memory() 
 {
-#if defined(USE_MARK_SWEEP_GC)
+#if defined(USE_UNIQUE_MARK_SWEEP_GC)
   return (int64)((POINTER_SIZE_INT)gc_ms_total_memory_size((GC_MS*)p_global_gc));
 #elif defined(USE_UNIQUE_MOVE_COMPACT_GC)
   return (int64)((POINTER_SIZE_INT)gc_mc_total_memory_size((GC_MC*)p_global_gc));
@@ -288,7 +278,7 @@
 
 int64 gc_max_memory() 
 {
-#if defined(USE_MARK_SWEEP_GC)
+#if defined(USE_UNIQUE_MARK_SWEEP_GC)
     return (int64)((POINTER_SIZE_INT)gc_ms_total_memory_size((GC_MS*)p_global_gc));
 #elif defined(USE_UNIQUE_MOVE_COMPACT_GC)
     return (int64)((POINTER_SIZE_INT)gc_mc_total_memory_size((GC_MC*)p_global_gc));
@@ -361,7 +351,7 @@
 #else //USE_32BITS_HASHCODE
 int32 gc_get_hashcode(Managed_Object_Handle p_object)
 {
-#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)
   return (int32)0;//p_object;
 #endif
 
@@ -421,7 +411,7 @@
     // data structures in not consistent for heap iteration
     if (!JVMTI_HEAP_ITERATION) return;
 
-#if defined(USE_MARK_SWEEP_GC)
+#if defined(USE_UNIQUE_MARK_SWEEP_GC)
   gc_ms_iterate_heap((GC_MS*)p_global_gc);
 #elif defined(USE_UNIQUE_MOVE_COMPACT_GC)
   gc_mc_iterate_heap((GC_MC*)p_global_gc);
@@ -444,4 +434,6 @@
 {
   return address_belongs_to_gc_heap(p_obj, p_global_gc);  
 }
+
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_metadata.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_metadata.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_metadata.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_metadata.cpp Fri Mar 14 04:21:27 2008
@@ -167,13 +167,10 @@
   return block;
 }
 
-extern Boolean IS_MOVE_COMPACT;
-
 static void gc_update_repointed_sets(GC* gc, Pool* pool, Boolean double_fix)
 {
   GC_Metadata* metadata = gc->metadata;
   
-  /* NOTE:: this is destructive to the root sets. */
   pool_iterator_init(pool);
   Vector_Block* root_set = pool_iterator_next(pool);
 
@@ -184,23 +181,19 @@
       iter = vector_block_iterator_advance(root_set,iter);
 
       Partial_Reveal_Object* p_obj = read_slot(p_ref);
-      if(IS_MOVE_COMPACT){
-      /*This condition is removed because we do los sliding compaction at every major compaction after add los minor sweep.*/
-      //if(obj_is_moved(p_obj)) 
-        /*Fixme: los_boundery ruined the modularity of gc_common.h*/
-        if(p_obj < los_boundary){
-          p_obj = obj_get_fw_in_oi(p_obj);
-        }else{
-          p_obj = obj_get_fw_in_table(p_obj);
+      if( collect_is_compact_move()){ /* move-compact uses offset table */
+          /*This condition is removed because we do los sliding compaction at every major compaction after add los minor sweep.*/
+          //if(obj_is_moved(p_obj)) 
+          /*Fixme: los_boundery ruined the modularity of gc_common.h*/
+        if( gc_has_los() && p_obj < los_boundary){
+            p_obj = obj_get_fw_in_oi(p_obj);
+        }else{ /* this is the case with unique move_compact */
+            p_obj = obj_get_fw_in_table(p_obj);
         }
 
         write_slot(p_ref, p_obj);
-        
-      }else if(gc_match_kind(gc, MC_COLLECTION)){
-        p_obj = obj_get_fw_in_table(p_obj);
-        write_slot(p_ref, p_obj);
-        
-      }else{
+
+      }else{ /* this is the case of non-move-compact major collection, such as slide-compact and mark-sweep */
         if(obj_is_fw_in_oi(p_obj)){
           /* Condition obj_is_moved(p_obj) is for preventing mistaking previous mark bit of large obj as fw bit when fallback happens.
            * Because until fallback happens, perhaps the large obj hasn't been marked. So its mark bit remains as the last time.
@@ -218,11 +211,12 @@
             assert(address_belongs_to_gc_heap(p_obj, gc));
           }
           write_slot(p_ref, p_obj);
-        }
-      }
-    }
+        } /* obj is forwarded */
+      } /* collect is not move-compact */
+        
+    } /* while root_set has entry */
     root_set = pool_iterator_next(pool);
-  } 
+  } /* while pool has root_set */
   
   return;
 }
@@ -233,8 +227,8 @@
 
   gc_update_weak_roots(gc, double_fix);
 
-  /* MINOR_COLLECTION doesn't need rootset update, but need reset */
-  if( !gc_match_kind(gc, MINOR_COLLECTION)){
+  /* ALGO_MINOR doesn't need rootset update, but need reset */
+  if( !collect_is_minor()){
     gc_update_repointed_sets(gc, gc->metadata->gc_rootset_pool, double_fix);
 #ifndef BUILD_IN_REFERENT
     gc_update_finref_repointed_refs(gc, double_fix);
@@ -302,8 +296,8 @@
     collector->rem_set = NULL;
   }
   
-  assert(gc_match_either_kind(gc, MINOR_COLLECTION|NORMAL_MAJOR_COLLECTION));
-  if( gc_match_kind(gc, NORMAL_MAJOR_COLLECTION )){
+  assert( collect_is_major_normal() || collect_is_minor());
+  if( collect_is_major_normal() ){
     /* all the remsets are useless now */
     /* clean and put back mutator remsets */
 #ifdef USE_REM_SLOTS  
@@ -341,7 +335,7 @@
         root_set = pool_get_entry( collector_remset_pool );
     }
 
-  }else{ /* generational MINOR_COLLECTION */
+  }else{ /* generational ALGO_MINOR */
 
     /* all the remsets are put into the shared pool */
 #ifdef USE_REM_SLOTS
@@ -433,7 +427,7 @@
 void gc_clear_remset(GC* gc)
 {
   /* this function clears all the remset before fallback */
-  assert(gc_match_kind(gc, FALLBACK_COLLECTION));
+  assert(collect_is_fallback());
   
   /* rootset pool has some entries that are actually remset, because all the remsets are put into rootset pool 
      before the collection. gc->root_set is a pointer pointing to the boundary between remset and rootset in the pool */
@@ -583,7 +577,7 @@
       while(!vector_block_iterator_end(local_dirty_set,iter)){
         Partial_Reveal_Object* p_obj = (Partial_Reveal_Object*) *iter;
         iter = vector_block_iterator_advance(local_dirty_set, iter);
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
         assert(obj_is_mark_black_in_table(p_obj));
 #endif
       }
@@ -605,7 +599,7 @@
         while(!vector_block_iterator_end(dirty_set,iter)){
           Partial_Reveal_Object* p_obj = (Partial_Reveal_Object*) *iter;          
           iter = vector_block_iterator_advance(dirty_set, iter);
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
           assert(obj_is_mark_black_in_table(p_obj));
 #endif
         }
@@ -657,4 +651,6 @@
 
 void free_set_pool_put_entry(Vector_Block* block, GC_Metadata *metadata)
 { pool_put_entry(metadata->free_set_pool, block); }
+
+
 

Added: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_options.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_options.cpp?rev=637062&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_options.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_options.cpp Fri Mar 14 04:21:27 2008
@@ -0,0 +1,418 @@
+/*
+ *  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"
+
+extern char* GC_VERIFY;
+extern POINTER_SIZE_INT NOS_SIZE;
+extern POINTER_SIZE_INT MIN_NOS_SIZE;
+extern POINTER_SIZE_INT INIT_LOS_SIZE;
+extern POINTER_SIZE_INT TOSPACE_SIZE;
+extern POINTER_SIZE_INT MOS_RESERVE_SIZE;
+
+extern Boolean GEN_NONGEN_SWITCH;
+
+extern Boolean FORCE_FULL_COMPACT;
+
+extern unsigned int NUM_MARKERS;
+extern unsigned int NUM_COLLECTORS;
+extern unsigned int MINOR_COLLECTORS;
+extern unsigned int MAJOR_COLLECTORS;
+
+extern Boolean IGNORE_VTABLE_TRACING;
+extern Boolean IGNORE_FINREF;
+
+extern Boolean JVMTI_HEAP_ITERATION ;
+
+extern Boolean USE_CONCURRENT_GC;
+extern Boolean USE_CONCURRENT_ENUMERATION;
+extern Boolean USE_CONCURRENT_MARK;
+extern Boolean USE_CONCURRENT_SWEEP;
+
+
+POINTER_SIZE_INT HEAP_SIZE_DEFAULT = 256 * MB;
+POINTER_SIZE_INT min_heap_size_bytes = 16 * MB;
+POINTER_SIZE_INT max_heap_size_bytes = 0;
+
+
+unsigned int GC_PROP;
+
+GC* gc_mc_create();
+GC* gc_ms_create();
+
+static GC* gc_decide_collection_algo(char* unique_algo, Boolean has_los)
+{
+  /* if unique_algo is not set, gc_gen_decide_collection_algo is called. */
+  assert(unique_algo);
+  
+  GC_PROP = ALGO_POOL_SHARE | ALGO_DEPTH_FIRST;
+  
+  assert(!has_los); /* currently unique GCs don't use LOS */
+  if(has_los) 
+    GC_PROP |= ALGO_HAS_LOS;
+  
+  Boolean use_default = FALSE;
+
+  GC* gc;
+  
+  string_to_upper(unique_algo);
+   
+  if(!strcmp(unique_algo, "MOVE_COMPACT")){
+    GC_PROP |= ALGO_COMPACT_MOVE;
+    gc = gc_mc_create();  
+
+  }else if(!strcmp(unique_algo, "MARK_SWEEP")){
+    GC_PROP |= ALGO_MS_NORMAL;
+    gc = gc_ms_create();
+  }else{
+    WARN2("gc.base","\nWarning: GC algorithm setting incorrect. Will use default value.\n");
+    GC_PROP |= ALGO_COMPACT_MOVE;
+    gc = gc_mc_create();  
+  }
+
+  return gc;
+}
+
+static int get_int_property(const char *property_name)
+{
+    assert(property_name);
+    char *value = get_property(property_name, VM_PROPERTIES);
+    int return_value;
+    if (NULL != value)
+    {
+        return_value = atoi(value);
+        destroy_property_value(value);
+    }else{
+        DIE2("gc.base","Warning: property value "<<property_name<<"is not set!");
+        exit(0);
+    }
+      
+    return return_value;
+}
+
+static Boolean get_boolean_property(const char *property_name)
+{
+  assert(property_name);
+  char *value = get_property(property_name, VM_PROPERTIES);
+  if (NULL == value){
+    DIE2("gc.base","Warning: property value "<<property_name<<" is not set!");
+    exit(0);
+  }
+  
+  Boolean return_value;
+  if (0 == strcmp("no", value)
+      || 0 == strcmp("off", value)
+      || 0 == strcmp("false", value)
+      || 0 == strcmp("0", value))
+  {
+    return_value = FALSE;
+  }
+  else if (0 == strcmp("yes", value)
+           || 0 == strcmp("on", value)
+           || 0 == strcmp("true", value)
+           || 0 == strcmp("1", value))
+  {
+    return_value = TRUE;
+  }else{
+    DIE2("gc.base","Warning: property value "<<property_name<<" is not set! Use upper case?");
+    exit(0);
+  }
+    
+  destroy_property_value(value);
+  return return_value;
+}
+
+static size_t get_size_property(const char* name) 
+{
+  char* size_string = get_property(name, VM_PROPERTIES);
+  size_t size = atol(size_string);
+  int sizeModifier = tolower(size_string[strlen(size_string) - 1]);
+  destroy_property_value(size_string);
+
+  size_t unit = 1;
+  switch (sizeModifier) {
+  case 'k': unit = 1024; break;
+  case 'm': unit = 1024 * 1024; break;
+  case 'g': unit = 1024 * 1024 * 1024;break;
+  }
+
+  size_t res = size * unit;
+  if (res / unit != size) {
+    /* overflow happened */
+    return 0;
+  }
+  return res;
+}
+
+void gc_decide_concurrent_algorithm(char* concurrent_algo);
+GC* gc_gen_decide_collection_algo(char* minor_algo, char* major_algo, Boolean has_los);
+void gc_set_gen_mode(Boolean status);
+
+GC* gc_parse_options() 
+{
+  TRACE2("gc.process", "GC: parse options ...\n");
+  if (!get_boolean_property("vm.assert_dialog", TRUE, VM_PROPERTIES))
+    disable_assert_dialogs();
+
+  GC* gc;
+  
+  /* GC algorithm decision */
+  /* Step 1: */
+  char* minor_algo = NULL;
+  char* major_algo = NULL;
+  char* unique_algo = NULL;
+  
+  if (is_property_set("gc.minor_algorithm", VM_PROPERTIES) == 1) {
+    minor_algo = get_property("gc.minor_algorithm", VM_PROPERTIES);
+  }
+  
+  if (is_property_set("gc.major_algorithm", VM_PROPERTIES) == 1) {
+    major_algo = get_property("gc.major_algorithm", VM_PROPERTIES);
+  }
+    
+  if (is_property_set("gc.uniqe_algorithm", VM_PROPERTIES) == 1) {
+    unique_algo = get_property("gc.unique_algorithm", VM_PROPERTIES);
+  }
+
+  Boolean has_los = FALSE;
+  if (is_property_set("gc.has_los", VM_PROPERTIES) == 1) {
+    has_los = get_boolean_property("gc.has_los");
+  }
+
+  if(unique_algo){
+    if(minor_algo || major_algo){
+      WARN2("gc.base","Warning: generational options cannot be set with unique_algo, ignored.");
+    }
+    gc = gc_decide_collection_algo(unique_algo, has_los);
+    destroy_property_value(unique_algo);  
+  
+  }else{ /* default */
+    gc = gc_gen_decide_collection_algo(minor_algo, major_algo, has_los);
+    if( minor_algo) destroy_property_value(minor_algo);
+    if( major_algo) destroy_property_value(major_algo);
+  }
+  
+  if (is_property_set("gc.gen_mode", VM_PROPERTIES) == 1) {
+    Boolean gen_mode = get_boolean_property("gc.gen_mode");
+    gc_set_gen_mode(gen_mode);
+  }
+
+  /* Step 2: */
+
+  /* NOTE:: this has to stay after above!! */
+  if (is_property_set("gc.force_major_collect", VM_PROPERTIES) == 1) {
+    FORCE_FULL_COMPACT = get_boolean_property("gc.force_major_collect");
+    if(FORCE_FULL_COMPACT){
+      gc_set_gen_mode(FALSE);
+    }
+  }
+
+  /* Step 3: */
+  /* NOTE:: this has to stay after above!! */
+  gc->generate_barrier = gc_is_gen_mode();
+  
+  if (is_property_set("gc.generate_barrier", VM_PROPERTIES) == 1) {
+    Boolean generate_barrier = get_boolean_property("gc.generate_barrier");
+    gc->generate_barrier = (generate_barrier || gc->generate_barrier);
+  }
+  
+/* ///////////////////////////////////////////////////   */
+  
+  POINTER_SIZE_INT max_heap_size = HEAP_SIZE_DEFAULT;
+  POINTER_SIZE_INT min_heap_size = min_heap_size_bytes;
+  
+  if (is_property_set("gc.mx", VM_PROPERTIES) == 1) {
+    max_heap_size = get_size_property("gc.mx");
+
+    if (max_heap_size < min_heap_size){
+      max_heap_size = min_heap_size;
+      WARN2("gc.base","Warning: Max heap size you set is too small, reset to "<<max_heap_size/MB<<" MB!");
+    }
+    if (0 == max_heap_size){
+      max_heap_size = HEAP_SIZE_DEFAULT;
+      WARN2("gc.base","Warning: Max heap size you set euqals to zero, reset to "<<max_heap_size/MB<<" MB!");
+    }
+ 
+    min_heap_size = max_heap_size / 10;
+    if (min_heap_size < min_heap_size_bytes){
+      min_heap_size = min_heap_size_bytes;
+      //printf("Min heap size: too small, reset to %d MB! \n", min_heap_size/MB);
+    }
+  }
+
+  if (is_property_set("gc.ms", VM_PROPERTIES) == 1) {
+    min_heap_size = get_size_property("gc.ms");
+    if (min_heap_size < min_heap_size_bytes){
+      min_heap_size = min_heap_size_bytes;
+      WARN2("gc.base","Warning: Min heap size you set is too small, reset to "<<min_heap_size/MB<<" MB!");
+    } 
+  }
+
+  if (min_heap_size > max_heap_size){
+    max_heap_size = min_heap_size;
+    WARN2("gc.base","Warning: Max heap size is too small, reset to "<<max_heap_size/MB<<" MB!");
+  }
+
+  min_heap_size_bytes = min_heap_size;
+  max_heap_size_bytes = max_heap_size;
+
+  if (is_property_set("gc.nos_size", VM_PROPERTIES) == 1) {
+    NOS_SIZE = get_size_property("gc.nos_size");
+  }
+
+  if (is_property_set("gc.min_nos_size", VM_PROPERTIES) == 1) {
+    MIN_NOS_SIZE = get_size_property("gc.min_nos_size");
+  }
+
+  if (is_property_set("gc.init_los_size", VM_PROPERTIES) == 1) {
+    INIT_LOS_SIZE = get_size_property("gc.init_los_size");
+  }  
+
+  if (is_property_set("gc.num_collectors", VM_PROPERTIES) == 1) {
+    unsigned int num = get_int_property("gc.num_collectors");
+    NUM_COLLECTORS = (num==0)? NUM_COLLECTORS:num;
+  }
+
+  if (is_property_set("gc.num_markers", VM_PROPERTIES) == 1) {
+    unsigned int num = get_int_property("gc.num_markers");
+    NUM_MARKERS = (num==0)? NUM_MARKERS:num;
+  }
+
+  if (is_property_set("gc.tospace_size", VM_PROPERTIES) == 1) {
+    TOSPACE_SIZE = get_size_property("gc.tospace_size");
+  }
+
+  if (is_property_set("gc.mos_reserve_size", VM_PROPERTIES) == 1) {
+    MOS_RESERVE_SIZE = get_size_property("gc.mos_reserve_size");
+  }
+
+  if (is_property_set("gc.nos_partial_forward", VM_PROPERTIES) == 1) {
+    NOS_PARTIAL_FORWARD = get_boolean_property("gc.nos_partial_forward");
+  }
+    
+  if (is_property_set("gc.minor_collectors", VM_PROPERTIES) == 1) {
+    MINOR_COLLECTORS = get_int_property("gc.minor_collectors");
+  }
+
+  if (is_property_set("gc.major_collectors", VM_PROPERTIES) == 1) {
+    MAJOR_COLLECTORS = get_int_property("gc.major_collectors");
+  }
+
+  if (is_property_set("gc.ignore_finref", VM_PROPERTIES) == 1) {
+    IGNORE_FINREF = get_boolean_property("gc.ignore_finref");
+  }
+
+  if (is_property_set("gc.verify", VM_PROPERTIES) == 1) {
+    char* value = get_property("gc.verify", VM_PROPERTIES);
+    GC_VERIFY = strdup(value);
+    destroy_property_value(value);
+  }
+
+  if (is_property_set("gc.gen_nongen_switch", VM_PROPERTIES) == 1){
+    GEN_NONGEN_SWITCH= get_boolean_property("gc.gen_nongen_switch");
+    gc->generate_barrier = TRUE;
+  }
+
+  if (is_property_set("gc.heap_iteration", VM_PROPERTIES) == 1) {
+    JVMTI_HEAP_ITERATION = get_boolean_property("gc.heap_iteration");
+  }
+
+  if (is_property_set("gc.ignore_vtable_tracing", VM_PROPERTIES) == 1) {
+    IGNORE_VTABLE_TRACING = get_boolean_property("gc.ignore_vtable_tracing");
+  }
+
+  if (is_property_set("gc.use_large_page", VM_PROPERTIES) == 1){
+    char* value = get_property("gc.use_large_page", VM_PROPERTIES);
+    large_page_hint = strdup(value);
+    destroy_property_value(value);
+  }
+
+  if (is_property_set("gc.concurrent_gc", VM_PROPERTIES) == 1){
+    Boolean use_all_concurrent_phase= get_boolean_property("gc.concurrent_gc");
+    if(use_all_concurrent_phase){
+      USE_CONCURRENT_ENUMERATION = TRUE;
+      USE_CONCURRENT_MARK = TRUE;
+      USE_CONCURRENT_SWEEP = TRUE;
+      gc->generate_barrier = TRUE;
+    }
+  }
+
+  if (is_property_set("gc.concurrent_enumeration", VM_PROPERTIES) == 1){
+    USE_CONCURRENT_ENUMERATION= get_boolean_property("gc.concurrent_enumeration");
+    if(USE_CONCURRENT_ENUMERATION){
+      USE_CONCURRENT_GC = TRUE;      
+      gc->generate_barrier = TRUE;
+    }
+  }
+
+  if (is_property_set("gc.concurrent_mark", VM_PROPERTIES) == 1){
+    USE_CONCURRENT_MARK= get_boolean_property("gc.concurrent_mark");
+    if(USE_CONCURRENT_MARK){
+      USE_CONCURRENT_GC = TRUE;      
+      gc->generate_barrier = TRUE;
+    }
+  }
+
+  if (is_property_set("gc.concurrent_sweep", VM_PROPERTIES) == 1){
+    USE_CONCURRENT_SWEEP= get_boolean_property("gc.concurrent_sweep");
+    if(USE_CONCURRENT_SWEEP){
+      USE_CONCURRENT_GC = TRUE;
+    }
+  }
+
+  char* concurrent_algo = NULL;
+  
+  if (is_property_set("gc.concurrent_algorithm", VM_PROPERTIES) == 1) {
+    concurrent_algo = get_property("gc.concurrent_algorithm", VM_PROPERTIES);
+  }
+  
+  gc_decide_concurrent_algorithm(concurrent_algo);
+
+#if defined(ALLOC_ZEROING) && defined(ALLOC_PREFETCH)
+  if(is_property_set("gc.prefetch",VM_PROPERTIES) ==1) {
+    PREFETCH_ENABLED = get_boolean_property("gc.prefetch");
+  }
+
+  if(is_property_set("gc.prefetch_distance",VM_PROPERTIES)==1) {
+    PREFETCH_DISTANCE = get_size_property("gc.prefetch_distance");
+    if(!PREFETCH_ENABLED) {
+      WARN2("gc.prefetch_distance","Warning: Prefetch distance set with Prefetch disabled!");
+    }
+  }
+
+  if(is_property_set("gc.prefetch_stride",VM_PROPERTIES)==1) {
+    PREFETCH_STRIDE = get_size_property("gc.prefetch_stride");
+    if(!PREFETCH_ENABLED) {
+      WARN2("gc.prefetch_stride","Warning: Prefetch stride set  with Prefetch disabled!");
+    }  
+  }
+  
+  if(is_property_set("gc.zeroing_size",VM_PROPERTIES)==1) {
+    ZEROING_SIZE = get_size_property("gc.zeroing_size");
+  }   
+#endif
+
+#ifdef PREFETCH_SUPPORTED
+  if(is_property_set("gc.mark_prefetch",VM_PROPERTIES) ==1) {
+    mark_prefetch = get_boolean_property("gc.mark_prefetch");
+  }  
+#endif
+
+  return gc;
+}
+
+

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

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h Fri Mar 14 04:21:27 2008
@@ -25,6 +25,7 @@
 #include "port_vmem.h"
 #include "port_atomic.h"
 #include "port_malloc.h"
+#include "port_barriers.h"
 
 #include <assert.h>
 
@@ -81,6 +82,10 @@
 #define PREFETCH(x) 
 #endif
 
+#ifdef PREFETCH_SUPPORTED
+extern Boolean mark_prefetch;
+#endif
+
 #define ABS_DIFF(x, y) (((x)>(y))?((x)-(y)):((y)-(x)))
 #define USEC_PER_SEC INT64_C(1000000)
 
@@ -287,8 +292,7 @@
 
 inline void mem_fence()
 {
-  //FIXME: enable mem fence.
-  //apr_memory_rw_barrier(); 
+  port_rw_barrier(); 
 }
 
 inline int64 time_now() 

Added: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_properties.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_properties.h?rev=637062&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_properties.h (added)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_properties.h Fri Mar 14 04:21:27 2008
@@ -0,0 +1,229 @@
+/*
+ *  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 _GC_PROPERTIES
+#define _GC_PROPERTIES
+
+enum GC_CAUSE{
+  GC_CAUSE_NIL,
+  GC_CAUSE_NOS_IS_FULL,
+  GC_CAUSE_LOS_IS_FULL,
+  GC_CAUSE_MOS_IS_FULL,
+  GC_CAUSE_RUNTIME_FORCE_GC
+};
+
+extern unsigned int GC_PROP;
+
+/* ============================================================================ */
+/* legal collection kinds:
+   for ALGO_HAS_NOS:
+     MINOR (i.e., !ALGO_MAJOR)
+
+       ALGO_COPY_SEMISPACE
+       ALGO_COPY_FORWARD
+        
+     ALGO_MAJOR_FALLBACK
+     ALGO_MAJOR_NORMAL
+
+       ALGO_MS_NORMAL
+       ALGO_MS_COMPACT
+       ALGO_COMPACT_SLIDE
+       ALGO_COMPACT_MOVE
+
+  for !ALGO_HAS_NOS (and actually !ALGO_HAS_LOS)
+     ALGO_COMPACT_MOVE
+     ALGO_MS_NORMAL
+     ALGO_MS_COMPACT
+*/
+
+enum GC_Property{
+  ALGO_HAS_NOS          = 0x1,
+  ALGO_HAS_LOS          = 0x2,
+  ALGO_IS_GEN           = 0x4,
+  
+  ALGO_COPY_FORWARD     = 0x10,
+  ALGO_COPY_SEMISPACE   = 0x20, 
+  
+  ALGO_COMPACT_MOVE     = 0x40,
+  ALGO_COMPACT_SLIDE    = 0x80,
+  ALGO_COMPACT_MASK     = 0xc0,
+  
+  ALGO_MARKSWEEP        = 0x100,
+  ALGO_MS_NORMAL        = 0x300,  /* ALGO_MARKSWEEP|0x200 */
+  ALGO_MS_COMPACT       = 0x500,  /* ALGO_MARKSWEEP|0x400 */
+  ALGO_MARKSWEEP_MASK   = 0x700,
+        
+  ALGO_WORK_STEAL       = 0x1000,
+  ALGO_TASK_PUSH        = 0x2000,
+  ALGO_POOL_SHARE       = 0x4000,
+  
+  ALGO_BREADTH_FIRST    = 0x10000,
+  ALGO_DEPTH_FIRST      = 0x20000,
+  ALGO_REORDERING       = 0x40000,
+
+  ALGO_MAJOR            = 0x100000,
+  ALGO_MAJOR_NORMAL     = 0x300000,  /* ALGO_MAJOR|0x200000 */
+  ALGO_MAJOR_FALLBACK   = 0x500000,  /* ALGO_MAJOR|0x400000 */
+  ALGO_MAJOR_MASK       = 0x700000,
+
+  ALGO_CON              = 0x1000000,
+  ALGO_CON_MARK         = 0x3000000,  /* ALGO_CON|0x2000000 */
+  ALGO_CON_SWEEP        = 0x5000000,  /* ALGO_CON|0x4000000 */
+  ALGO_CON_ENUM         = 0x9000000,  /* ALGO_CON|0x8000000 */
+
+};
+
+FORCE_INLINE Boolean gc_is_kind(unsigned int kind)
+{
+  return (Boolean)((GC_PROP & kind) == kind);
+}
+
+FORCE_INLINE void gc_set_gen_flag()
+{
+  GC_PROP |= ALGO_IS_GEN;  
+}
+
+FORCE_INLINE void gc_clear_gen_flag()
+{
+  GC_PROP &= ~ALGO_IS_GEN;  
+}
+
+FORCE_INLINE Boolean gc_is_gen_mode()
+{
+  return gc_is_kind(ALGO_IS_GEN);
+}
+
+FORCE_INLINE Boolean gc_has_los()
+{
+  return gc_is_kind(ALGO_HAS_LOS);
+}
+
+FORCE_INLINE Boolean gc_has_nos()
+{
+  return gc_is_kind(ALGO_HAS_NOS);
+}
+
+FORCE_INLINE Boolean collect_is_major()
+{
+  return gc_is_kind(ALGO_MAJOR);
+}
+
+FORCE_INLINE Boolean collect_is_minor()
+{
+  return gc_has_nos() && !collect_is_major();
+}
+
+FORCE_INLINE Boolean collect_is_major_normal()
+{
+  return gc_is_kind(ALGO_MAJOR_NORMAL);
+}
+
+FORCE_INLINE void collect_set_major_normal()
+{
+  GC_PROP &= ~ALGO_MAJOR_MASK;
+  GC_PROP |= ALGO_MAJOR_NORMAL;
+}
+
+FORCE_INLINE void collect_set_minor()
+{
+  assert( gc_has_nos());
+  GC_PROP &= ~ALGO_MAJOR_MASK;
+}
+
+FORCE_INLINE Boolean collect_is_fallback()
+{
+  return gc_is_kind(ALGO_MAJOR_FALLBACK);
+}
+
+FORCE_INLINE Boolean major_is_marksweep()
+{
+  return gc_is_kind(ALGO_MARKSWEEP|ALGO_HAS_NOS);
+}
+
+FORCE_INLINE Boolean major_is_compact_move()
+{
+  return gc_is_kind(ALGO_COMPACT_MOVE|ALGO_HAS_NOS);
+}
+
+FORCE_INLINE void major_set_compact_move()
+{
+  GC_PROP &= ~ALGO_COMPACT_MASK;
+  GC_PROP |= ALGO_COMPACT_MOVE;  
+}
+
+FORCE_INLINE Boolean major_is_compact_slide()
+{
+  return gc_is_kind(ALGO_COMPACT_SLIDE|ALGO_HAS_NOS);
+}
+
+FORCE_INLINE void major_set_compact_slide()
+{
+  GC_PROP &= ~ALGO_COMPACT_MASK;
+  GC_PROP |= ALGO_COMPACT_SLIDE;  
+}
+
+FORCE_INLINE Boolean minor_is_semispace()
+{
+  return gc_is_kind(ALGO_COPY_SEMISPACE|ALGO_HAS_NOS);  
+}
+
+FORCE_INLINE Boolean minor_is_forward()
+{
+  return gc_is_kind(ALGO_COPY_FORWARD|ALGO_HAS_NOS);  
+}
+
+FORCE_INLINE Boolean collect_move_object()
+{
+ if(gc_has_nos())
+   return collect_is_minor() || 
+         (collect_is_major() && !gc_is_kind(ALGO_MS_NORMAL));
+ else
+   return !gc_is_kind(ALGO_MS_NORMAL);  
+}
+
+FORCE_INLINE Boolean collect_is_compact_move()
+{
+  if(gc_has_nos())
+    return collect_is_major() && gc_is_kind(ALGO_COMPACT_MOVE);
+  else
+    return gc_is_kind(ALGO_COMPACT_MOVE);    
+}
+
+FORCE_INLINE Boolean collect_is_ms_compact()
+{
+  if(gc_has_nos())
+    return collect_is_major() && gc_is_kind(ALGO_MS_COMPACT);
+  else
+    return gc_is_kind(ALGO_MS_COMPACT);    
+}
+
+FORCE_INLINE void collect_set_ms_normal()
+{
+  GC_PROP &= ~ALGO_MARKSWEEP_MASK;
+  GC_PROP |= ALGO_MS_NORMAL;
+
+}
+
+/* This is to distinct from the case of non-moving or trace-moving, where root slots
+   either are updated on-the-fly, or need not updating. The kind below needs to update
+   root slots after collection in an extra phase. i.e., collect_mark_and_move */
+FORCE_INLINE Boolean collect_need_update_repset()
+{
+  return (gc_is_kind(ALGO_MAJOR) || gc_is_kind(ALGO_MS_COMPACT));
+}
+
+#endif /* #ifndef _GC_PROPERTIES */

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

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_space.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_space.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_space.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_space.h Fri Mar 14 04:21:27 2008
@@ -31,6 +31,8 @@
   POINTER_SIZE_INT size_live_obj;
   POINTER_SIZE_INT size_free_space;
   POINTER_SIZE_INT last_size_free_space;
+  POINTER_SIZE_INT size_new_obj;
+  float space_utilization_ratio;
 }Space_Statistics;
 
 struct GC;

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/large_pages.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/large_pages.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/large_pages.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/large_pages.cpp Fri Mar 14 04:21:27 2008
@@ -56,7 +56,7 @@
 Boolean release_lock_memory_priv()
 {
   HANDLE process = GetCurrentProcess();
-  return set_privilege(process, SE_LOCK_MEMORY_NAME, TRUE);
+  return set_privilege(process, SE_LOCK_MEMORY_NAME, FALSE);
 }
 
 void* alloc_large_pages(size_t size, const char* hint)

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/mark_scan_pool.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/mark_scan_pool.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/mark_scan_pool.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/mark_scan_pool.cpp Fri Mar 14 04:21:27 2008
@@ -147,7 +147,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 put 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/common/object_status.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/object_status.h?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/object_status.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/object_status.h Fri Mar 14 04:21:27 2008
@@ -55,7 +55,7 @@
   return !obj_is_marked_in_vt(p_obj);
 }
 
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
 inline Boolean obj_is_dead_in_mark_sweep_gc(Partial_Reveal_Object *p_obj)
 {
   return !obj_is_mark_black_in_table(p_obj);
@@ -72,7 +72,7 @@
 {
   assert(p_obj);
 
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
   return obj_is_dead_in_mark_sweep_gc(p_obj);
 #endif
 
@@ -80,12 +80,12 @@
   return obj_is_dead_in_move_compact_no_los_gc(p_obj);
 #endif
 
-  if(gc_match_kind(gc, MINOR_COLLECTION)){
+  if(collect_is_minor()){
     if(gc_is_gen_mode())
       return obj_is_dead_in_gen_minor_gc(p_obj);
     else
       return obj_is_dead_in_nongen_minor_gc(p_obj);
-  } else if(gc_get_mos((GC_Gen*)gc)->collect_algorithm == MAJOR_MARK_SWEEP){
+  } else if(major_is_marksweep()){
     return obj_is_dead_in_sweep_major_gc(p_obj);
   } else {
     return obj_is_dead_in_compact_major_gc(p_obj);
@@ -100,7 +100,7 @@
 {
   /* assert(!gc_obj_is_dead(gc, p_obj)); commented out for weakroot */
 
-#ifdef USE_MARK_SWEEP_GC
+#ifdef USE_UNIQUE_MARK_SWEEP_GC
   Wspace *wspace = gc_ms_get_wspace((GC_MS*)gc);
   return wspace->move_object;
 #endif
@@ -109,9 +109,9 @@
   Cspace *cspace = gc_mc_get_cspace((GC_MC*)gc);
   return cspace->move_object;
 #endif
-  if(gc_match_kind(gc, MINOR_COLLECTION)){
+  if(collect_is_minor()){
     if(!obj_belongs_to_nos(p_obj)) return FALSE;
-    if(MINOR_ALGO == MINOR_NONGEN_SEMISPACE_POOL || MINOR_ALGO == MINOR_GEN_SEMISPACE_POOL)
+    if(minor_is_semispace())
       return TRUE;
     else if(gc_is_gen_mode())
       return fspace_obj_to_be_forwarded(p_obj);

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/space_tuner.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/space_tuner.cpp?rev=637062&r1=637061&r2=637062&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/space_tuner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/space_tuner.cpp Fri Mar 14 04:21:27 2008
@@ -96,7 +96,7 @@
   * Else, we call the marking function for space tuning.  */
 void gc_compute_space_tune_size_before_marking(GC* gc)
 {
-  if(gc_match_kind(gc, MINOR_COLLECTION))  return;
+  if(collect_is_minor())  return;
   
   gc_decide_space_tune(gc);
   
@@ -204,13 +204,14 @@
     memset(collector->segment_live_size, 0, sizeof(POINTER_SIZE_INT) * NORMAL_SIZE_SEGMENT_NUM);
   }
   
-  //POINTER_SIZE_INT additional_non_los_size = ((collector_num * 2) << GC_BLOCK_SHIFT_COUNT) + (non_los_live_obj_size >> GC_BLOCK_SHIFT_COUNT) * (GC_OBJ_SIZE_THRESHOLD/4);
+  //POINTER_SIZE_INT additional_non_los_size = ((collector_num * 2) << GC_BLOCK_SHIFT_COUNT) + (non_los_live_obj_size >> GC_BLOCK_SHIFT_COUNT) * (GC_LOS_OBJ_SIZE_THRESHOLD/4);
   double additional_non_los_size = 0;
   for(unsigned int i = 0; i < NORMAL_SIZE_SEGMENT_NUM; i++) {
     additional_non_los_size += (double)segment_live_size[i] * SEGMENT_INDEX_TO_SIZE(i) / non_los_live_obj_size;
   }
   additional_non_los_size *= 1.2; // in case of some cases worse than average one
   POINTER_SIZE_INT non_los_live_block = non_los_live_obj_size / (GC_BLOCK_BODY_SIZE_BYTES-(POINTER_SIZE_INT)additional_non_los_size);
+  non_los_live_block += collector_num << 2;
   non_los_live_obj_size = (non_los_live_block << GC_BLOCK_SHIFT_COUNT);
   if(non_los_live_obj_size > non_los_size)
     non_los_live_obj_size = non_los_size;
@@ -264,7 +265,7 @@
       assert(max_heap_size_bytes >= gc->committed_heap_size);
       POINTER_SIZE_INT extend_heap_size = 0;
       POINTER_SIZE_INT potential_max_tuning_size = max_tuning_size + max_heap_size_bytes - gc->committed_heap_size;
-      potential_max_tuning_size -= LOS_HEAD_RESERVE_FOR_HEAP_NULL;
+      potential_max_tuning_size -= LOS_HEAD_RESERVE_FOR_HEAP_BASE;
 
       //debug_adjust
       assert(!(potential_max_tuning_size % SPACE_ALLOC_UNIT));
@@ -438,7 +439,7 @@
 void  gc_space_tuner_reset(GC* gc)
 {
   Space_Tuner* tuner = gc->tuner;
-  if( gc_match_kind(gc, MAJOR_COLLECTION)){
+  if( collect_is_major()){
     /*Clear the fields every major collection except the wast area statistic.*/
     tuner->tuning_size = 0;
     tuner->interim_blocks = NULL;
@@ -536,4 +537,6 @@
   STD_FREE(tuner->interim_blocks);
   return;
 }
+
+
 



Mime
View raw message