harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x..@apache.org
Subject svn commit: r606876 [6/6] - in /harmony/enhanced/drlvm/trunk/vm/gc_gen/src: common/ finalizer_weakref/ gen/ jni/ los/ mark_compact/ mark_sweep/ semi_space/ thread/ trace_forward/ utils/ verify/
Date Wed, 26 Dec 2007 10:17:15 GMT
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=606876&r1=606875&r2=606876&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 Wed Dec 26 02:17:10 2007
@@ -21,7 +21,7 @@
 
 #include "mutator.h"
 #include "../trace_forward/fspace.h"
-#include "../mark_sweep/sspace.h"
+#include "../mark_sweep/wspace.h"
 #include "../finalizer_weakref/finalizer_weakref.h"
 
 struct GC_Gen;
@@ -38,7 +38,7 @@
     mutator->rem_set = free_set_pool_get_entry(gc->metadata);
     assert(vector_block_is_empty(mutator->rem_set));
   }
-  mutator->dirty_obj_snapshot = free_set_pool_get_entry(gc->metadata);
+  mutator->dirty_set = free_set_pool_get_entry(gc->metadata);
   
   if(!IGNORE_FINREF )
     mutator->obj_with_fin = finref_get_free_block(gc);
@@ -69,12 +69,13 @@
 
   alloc_context_reset((Allocator*)mutator);
 
-#ifdef USE_MARK_SWEEP_GC
-  allocactor_destruct_local_chunks((Allocator*)mutator);
-#endif
 
   lock(gc->mutator_list_lock);     // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
 
+#ifdef USE_MARK_SWEEP_GC
+    allocactor_destruct_local_chunks((Allocator*)mutator);
+#endif
+
   volatile Mutator *temp = gc->mutator_list;
   if (temp == mutator) {  /* it is at the head of the list */
     gc->mutator_list = temp->next;
@@ -99,13 +100,16 @@
     mutator->obj_with_fin = NULL;
   }
 
-  if( mutator->dirty_obj_snapshot != NULL){
-    if(vector_block_is_empty(mutator->dirty_obj_snapshot))
-      pool_put_entry(gc->metadata->free_set_pool, mutator->dirty_obj_snapshot);
-    else /* FIXME:: this condition may be released. */
-      pool_put_entry(gc->metadata->dirty_obj_snaptshot_pool, mutator->dirty_obj_snapshot);
+  lock(mutator->dirty_set_lock);
+  if( mutator->dirty_set != NULL){
+    if(vector_block_is_empty(mutator->dirty_set))
+      pool_put_entry(gc->metadata->free_set_pool, mutator->dirty_set);
+    else{ /* FIXME:: this condition may be released. */
+      pool_put_entry(gc->metadata->gc_dirty_set_pool, mutator->dirty_set);
+      mutator->dirty_set = NULL;
+    }
   }
-  
+  unlock(mutator->dirty_set_lock);
   //gc_set_tls(NULL);
   
   return;
@@ -132,32 +136,14 @@
   return;
 }
 
-/*
-Boolean gc_local_snapshot_is_empty(GC* gc)
+Boolean gc_local_dirtyset_is_empty(GC* gc)
 {
   lock(gc->mutator_list_lock);
 
   Mutator *mutator = gc->mutator_list;
   while (mutator) {
-    if(mutator->concurrent_mark_handshake_status != LOCAL_SNAPSHOT_CONTAINER_IS_EMPTY){
-      unlock(gc->mutator_list_lock); 
-      return FALSE;
-    }
-    mutator = mutator->next;
-  }  
-
-  unlock(gc->mutator_list_lock); 
-  return TRUE;
-}*/
-
-Boolean gc_local_snapshot_is_empty(GC* gc)
-{
-  lock(gc->mutator_list_lock);
-
-  Mutator *mutator = gc->mutator_list;
-  while (mutator) {
-    Vector_Block* local_snapshot_set = mutator->dirty_obj_snapshot;
-    if(!vector_block_is_empty(local_snapshot_set)){
+    Vector_Block* local_dirty_set = mutator->dirty_set;
+    if(!vector_block_is_empty(local_dirty_set)){
       unlock(gc->mutator_list_lock); 
       return FALSE;
     }
@@ -168,16 +154,16 @@
   return TRUE;
 }
 
-Vector_Block* gc_get_local_snapshot(GC* gc, unsigned int shared_id)
+Vector_Block* gc_get_local_dirty_set(GC* gc, unsigned int shared_id)
 {
   lock(gc->mutator_list_lock);
 
   Mutator *mutator = gc->mutator_list;
   while (mutator) {
-    Vector_Block* local_snapshot = mutator->dirty_obj_snapshot;
-    if(!vector_block_is_empty(local_snapshot) && vector_block_set_shared(local_snapshot,shared_id)){
+    Vector_Block* local_dirty_set = mutator->dirty_set;
+    if(!vector_block_is_empty(local_dirty_set) && vector_block_set_shared(local_dirty_set,shared_id)){
       unlock(gc->mutator_list_lock); 
-      return local_snapshot;
+      return local_dirty_set;
     }
     mutator = mutator->next;
   }  
@@ -185,5 +171,7 @@
   unlock(gc->mutator_list_lock); 
   return NULL;
 }
+
+
 
 

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=606876&r1=606875&r2=606876&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 Wed Dec 26 02:17:10 2007
@@ -37,12 +37,17 @@
   Space* alloc_space;
   GC* gc;
   VmThreadHandle thread_handle;   /* This thread; */
+  volatile unsigned int handshake_signal; /*Handshake is used in concurrent GC.*/
+  
   /* END of Allocator --> */
   
   Vector_Block* rem_set;
   Vector_Block* obj_with_fin;
   Mutator* next;  /* The gc info area associated with the next active thread. */
-  Vector_Block* dirty_obj_snapshot;
+  Vector_Block* dirty_set;
+  SpinLock dirty_set_lock;
+  unsigned int dirty_obj_slot_num; //only ON_THE_FLY
+  unsigned int dirty_obj_num; //concurrent mark  
 } Mutator;
 
 void mutator_initialize(GC* gc, void* tls_gc_info);
@@ -52,6 +57,19 @@
 void gc_reset_mutator_context(GC* gc);
 void gc_prepare_mutator_remset(GC* gc);
 
-Boolean gc_local_snapshot_is_empty(GC* gc);
-Vector_Block* gc_get_local_snapshot(GC* gc, unsigned int shared_id);
+Boolean gc_local_dirtyset_is_empty(GC* gc);
+Vector_Block* gc_get_local_dirty_set(GC* gc, unsigned int shared_id);
+
+inline void mutator_post_signal(Mutator* mutator, unsigned int handshake_signal)
+{ 
+  //FIXME: Need barrier here.
+  //apr_memory_rw_barrier();
+  mutator->handshake_signal = handshake_signal; 
+  //apr_memory_rw_barrier();
+}
+
+inline void wait_mutator_signal(Mutator* mutator, unsigned int handshake_signal)
+{ while(mutator->handshake_signal == handshake_signal); }
+
+
 #endif /*ifndef _MUTATOR_H_ */

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp?rev=606876&r1=606875&r2=606876&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp Wed Dec 26 02:17:10
2007
@@ -30,6 +30,8 @@
 
 //#define GC_OBJ_SIZE_STATISTIC
 
+volatile Boolean obj_alloced_live = FALSE;
+
 #ifdef GC_OBJ_SIZE_STATISTIC
 #define GC_OBJ_SIZE_STA_MAX 256*KB
 unsigned int obj_size_distribution_map[GC_OBJ_SIZE_STA_MAX>>10];
@@ -68,7 +70,7 @@
   size = (size & NEXT_TO_HIGH_BIT_CLEAR_MASK);
   
   Allocator* allocator = (Allocator*)gc_get_tls();
-  Boolean type_has_fin = type_has_finalizer((Partial_Reveal_VTable*)uncompress_vt((VT)ah));
+  Boolean type_has_fin = type_has_finalizer((Partial_Reveal_VTable*)decode_vt((VT)ah));
   
   if(type_has_fin && !IGNORE_FINREF && mutator_need_block)
     vm_heavy_finalizer_block_mutator();
@@ -77,7 +79,11 @@
   gc_alloc_statistic_obj_distrubution(size);
 #endif
 
-#ifndef USE_MARK_SWEEP_GC
+#if defined(USE_MARK_SWEEP_GC)
+  p_obj = (Managed_Object_Handle)gc_ms_alloc(size, allocator);
+#elif defined(USE_UNIQUE_MOVE_COMPACT_GC)
+  p_obj = (Managed_Object_Handle)gc_mc_alloc(size, allocator);
+#else
   if ( size > GC_OBJ_SIZE_THRESHOLD ){
     p_obj = (Managed_Object_Handle)los_alloc(size, allocator);
 #ifdef GC_GEN_STATS
@@ -90,8 +96,6 @@
   }else{
       p_obj = (Managed_Object_Handle)nos_alloc(size, allocator);
   }
-#else
-  p_obj = (Managed_Object_Handle)gc_ms_alloc(size, allocator);
 #endif
 
   if( p_obj == NULL )
@@ -114,7 +118,7 @@
   assert((size % GC_OBJECT_ALIGNMENT) == 0);
   assert(ah);
   
-  if(type_has_finalizer((Partial_Reveal_VTable *) uncompress_vt((VT)ah)))
+  if(type_has_finalizer((Partial_Reveal_VTable *) decode_vt((VT)ah)))
     return NULL;
 
 #ifdef GC_OBJ_SIZE_STATISTIC
@@ -128,10 +132,12 @@
  
   /* Try to allocate an object from the current Thread Local Block */
   Managed_Object_Handle p_obj;
-#ifndef USE_MARK_SWEEP_GC
-  p_obj = (Managed_Object_Handle)thread_local_alloc(size, allocator);
-#else
+#if defined(USE_MARK_SWEEP_GC)
   p_obj = (Managed_Object_Handle)gc_ms_fast_alloc(size, allocator);
+#elif defined(USE_UNIQUE_MOVE_COMPACT_GC)
+  p_obj = (Managed_Object_Handle)gc_mc_fast_alloc(size, allocator);
+#else
+  p_obj = (Managed_Object_Handle)thread_local_alloc(size, allocator);
 #endif
   if(p_obj == NULL) return NULL;
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.cpp?rev=606876&r1=606875&r2=606876&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.cpp Wed Dec 26 02:17:10
2007
@@ -27,14 +27,6 @@
 Boolean forward_first_half;
 void* object_forwarding_boundary=NULL;
 
-static void fspace_destruct_blocks(Fspace* fspace)
-{   
-#ifdef USE_32BITS_HASHCODE
-  space_desturct_blocks((Blocked_Space*)fspace);
-#endif
-  return;
-}
-
 struct GC_Gen;
 void gc_set_nos(GC_Gen* gc, Space* space);
 
@@ -101,7 +93,10 @@
 
 void fspace_destruct(Fspace *fspace) 
 {
-  fspace_destruct_blocks(fspace);
+#ifdef USE_32BITS_HASHCODE
+  space_desturct_blocks((Blocked_Space*)fspace);
+#endif
+
   STD_FREE(fspace);   
 }
 
@@ -119,7 +114,7 @@
     fspace->free_block_idx = first_idx;
     fspace->ceiling_block_idx = first_idx + fspace->num_managed_blocks - 1;  
     forward_first_half = TRUE; /* only useful for not-FORWARD_ALL*/
-	fspace->num_used_blocks = 0;
+    fspace->num_used_blocks = 0;
   
   }else{    
     if(forward_first_half){
@@ -163,31 +158,6 @@
   
   return;
 }
-
-#ifdef USE_32BITS_HASHCODE
-Block_Header* fspace_next_block;
-
-void fspace_block_iterate_init(Fspace* fspace)
-{
-  fspace_next_block = (Block_Header*) fspace->blocks;
-}
-
-Block_Header* fspace_get_next_block()
-{
-  Block_Header* curr_block = (Block_Header*) fspace_next_block;
-  while(fspace_next_block != NULL){
-    Block_Header* next_block = curr_block->next;
-
-    Block_Header* temp = (Block_Header*)atomic_casptr((volatile void**)&fspace_next_block,
next_block, curr_block);
-    if(temp != curr_block){
-      curr_block = (Block_Header*) fspace_next_block;
-      continue;
-    }
-    return curr_block;
-  }
-  return NULL;
-}
-#endif
 
 void collector_execute_task(GC* gc, TaskType task_func, Space* space);
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.h?rev=606876&r1=606875&r2=606876&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.h Wed Dec 26 02:17:10
2007
@@ -40,6 +40,7 @@
 void fspace_destruct(Fspace *fspace);
 
 void* fspace_alloc(unsigned size, Allocator *allocator);
+Boolean fspace_alloc_block(Fspace* fspace, Allocator* allocator);
 
 void fspace_reset_after_collection(Fspace* fspace);
 
@@ -59,8 +60,4 @@
 
 void fspace_collection(Fspace* fspace);
 
-#ifdef USE_32BITS_HASHCODE
-void fspace_block_iterate_init(Fspace* fspace);
-Block_Header* fspace_get_next_block();
-#endif
 #endif // _FROM_SPACE_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=606876&r1=606875&r2=606876&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 Wed Dec 26 02:17:10
2007
@@ -23,7 +23,7 @@
 #include "../common/gc_concurrent.h"
 #include "../common/collection_scheduler.h"
 
-static Boolean fspace_alloc_block(Fspace* fspace, Allocator* allocator)
+Boolean fspace_alloc_block(Fspace* fspace, Allocator* allocator)
 {    
   alloc_context_reset(allocator);
 
@@ -61,8 +61,8 @@
   p_return = thread_local_alloc(size, allocator);
   if (p_return)  return p_return;
 
-  if(gc_need_start_concurrent_mark(allocator->gc))
-    gc_start_concurrent_mark(allocator->gc);
+  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 +97,6 @@
   return p_return;
   
 }
+
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_gen_forward_pool.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_gen_forward_pool.cpp?rev=606876&r1=606875&r2=606876&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_gen_forward_pool.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_gen_forward_pool.cpp Wed
Dec 26 02:17:10 2007
@@ -52,8 +52,8 @@
 static FORCE_INLINE void scan_object(Collector* collector, Partial_Reveal_Object *p_obj)

 {
   assert((((POINTER_SIZE_INT)p_obj) % GC_OBJECT_ALIGNMENT) == 0);
-  Partial_Reveal_VTable *vtable = uncompress_vt(obj_get_vt(p_obj));
-  if(VTABLE_TRACING)
+  Partial_Reveal_VTable *vtable = decode_vt(obj_get_vt(p_obj));
+  if(TRACE_JLC_VIA_VTABLE)
     if(vtable->vtmark == VT_UNMARKED) {
       vtable->vtmark = VT_MARKED;
       trace_forwarded_gen_jlC_from_vtable(collector, vtable->jlC);

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_nongen_forward_pool.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_nongen_forward_pool.cpp?rev=606876&r1=606875&r2=606876&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_nongen_forward_pool.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_nongen_forward_pool.cpp
Wed Dec 26 02:17:10 2007
@@ -40,16 +40,21 @@
   return;
 }
 
-void trace_forwarded_nongen_jlC_from_vtable(Collector* collector, Partial_Reveal_Object *p_obj)
;
+/* forward declaration */
+static void forward_jlc_instance(Collector* collector, Partial_Reveal_Object *p_obj);
+
 static FORCE_INLINE void scan_object(Collector* collector, Partial_Reveal_Object *p_obj)

 {
   assert((((POINTER_SIZE_INT)p_obj) % GC_OBJECT_ALIGNMENT) == 0);
-  Partial_Reveal_VTable *vtable = uncompress_vt(obj_get_vt(p_obj));
-  if(VTABLE_TRACING)
+  
+  Partial_Reveal_VTable *vtable = decode_vt(obj_get_vt(p_obj));
+  if(TRACE_JLC_VIA_VTABLE){
     if(vtable->vtmark == VT_UNMARKED) {
       vtable->vtmark = VT_MARKED;
-      trace_forwarded_nongen_jlC_from_vtable(collector, vtable->jlC);
+      forward_jlc_instance(collector, vtable->jlC);
     }
+  }
+    
   if (!object_has_ref_field_before_scan(p_obj)) return;
     
   REF *p_ref;
@@ -142,9 +147,13 @@
   return;
 }
 
-void trace_forwarded_nongen_jlC_from_vtable(Collector* collector, Partial_Reveal_Object *p_obj)

-//Forward the vtable->jlc and trace the forwarded object. But do not update the vtable->jlc
but leave them for weakroots updating
-//We probably do not need this function if we do not perform class unloading in copy-collections.
That means all vtable->jlc would be strong roots in this algorithm
+/*
+ Forward the vtable->jlc and trace the forwarded object. 
+ But do not update the vtable->jlc but leave them for weakroots updating
+ We probably do not need this function if we do not perform class unloading in minor collections.

+ That means all the weakroots to jlc instances are treated as strong roots.
+*/
+static void forward_jlc_instance(Collector* collector, Partial_Reveal_Object *p_obj) 
 {
   if(!obj_belongs_to_nos(p_obj)){
     if(obj_mark_in_oi(p_obj))
@@ -157,7 +166,7 @@
   if( p_target_obj == NULL ){
     if(collector->result == FALSE ){
       vector_stack_clear(collector->trace_stack);
-      return;
+      return; /* FIXME: the failure result is not propagated back to GC */
     }
     assert(obj_get_fw_in_oi(p_obj));
     return;

Added: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/sspace_temp.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/sspace_temp.cpp?rev=606876&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/sspace_temp.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/sspace_temp.cpp Wed Dec 26 02:17:10
2007
@@ -0,0 +1,14 @@
+/* this file is temporarily existent for developing semi-space algorithm */
+#include "../semi_space/sspace.h"
+
+Sspace *sspace_initialize(GC* gc, void* start, POINTER_SIZE_INT sspace_size, POINTER_SIZE_INT
commit_size){return null;}
+void sspace_destruct(Sspace *sspace){ return;}
+
+void* sspace_alloc(unsigned size, Allocator *allocator){return NULL;}
+void* semispace_alloc(unsigned size, Allocator *allocator){return NULL;}
+
+Boolean sspace_alloc_block(Sspace* sspace, Allocator* allocator){return FALSE;}
+
+void sspace_collection(Sspace* sspace){return;}
+void sspace_reset_after_collection(Sspace* sspace){return;}
+void sspace_prepare_for_collection(Sspace* sspace){return;}

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

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/vector_block.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/vector_block.h?rev=606876&r1=606875&r2=606876&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/vector_block.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/vector_block.h Wed Dec 26 02:17:10 2007
@@ -88,6 +88,20 @@
 #endif
   return value;
 }
+inline void vector_block_add_entry_to_index(Vector_Block* block, unsigned int index, POINTER_SIZE_INT
value)
+{
+#ifdef _DEBUG 
+  assert(index < VECTOR_BLOCK_ENTRY_NUM);
+#endif
+  block->entries[index] = value;
+}
+inline POINTER_SIZE_INT vector_block_get_entry_from_index(Vector_Block* block, unsigned int
index)
+{
+#ifdef _DEBUG 
+  assert(index < VECTOR_BLOCK_ENTRY_NUM);
+#endif
+  return block->entries[index];
+}
 
 #define VECTOR_BLOCK_SHARE_BIT 0x01
 #define VECTOR_BLOCK_FULL_BIT  0x02

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.cpp?rev=606876&r1=606875&r2=606876&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.cpp Wed Dec 26 02:17:10
2007
@@ -85,10 +85,11 @@
 {
   Partial_Reveal_Object* p_obj = read_slot(p_ref);
   assert(address_belongs_to_gc_heap(p_obj,heap_verifier->gc));
-#ifndef USE_MARK_SWEEP_GC
+#if !defined(USE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
   GC_Gen* gc    = (GC_Gen*)heap_verifier->gc;
   Space* mspace = gc_get_mos(gc);
   Space* lspace  = gc_get_los(gc);
+  Space* nos = gc_get_nos(gc);
 
   if(p_obj == NULL){
     if(gc_match_kind((GC*)gc, MAJOR_COLLECTION) ||(!heap_verifier->gc_is_gen_mode &&
!NOS_PARTIAL_FORWARD)){
@@ -115,7 +116,7 @@
       assert(0);
       return FALSE;
     }
-#ifndef USE_MARK_SWEEP_GC
+#if !defined(USE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
   }else{
     if(heap_verifier->gc_verifier->is_before_fallback_collection){
       if(!address_belongs_to_gc_heap(p_obj, heap_verifier->gc)){
@@ -127,8 +128,16 @@
     }
 
     if(!address_belongs_to_space(p_obj, mspace) && !address_belongs_to_space(p_obj,
lspace) && !NOS_PARTIAL_FORWARD){
+      if( nos->collect_algorithm == MINOR_NONGEN_SEMISPACE_POOL){
+        if( obj_belongs_to_survivor_area((Sspace*)nos, p_obj)) return TRUE;
+        else{
+          printf("\nERROR: obj referenced by rootset is not in survivor_area after semispace
GC!\n");
+          assert(0);
+        }
+      }
+      
+      printf("\nERROR: obj referenced by rootset is in NOS after GC!\n");
       assert(0);
-      printf("\nERROR: obj referenced by rootset is in nos after GC!\n");
       return FALSE;
    }
   }
@@ -260,5 +269,7 @@
 {
     printf(" %-14s:    %-7s |   Before %10d   |   After %10d   |\n", "hashcode", "NUM", gc_verifier->num_hash_before_gc,
gc_verifier->num_hash_after_gc);
 }
+
+
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.h?rev=606876&r1=606875&r2=606876&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.h Wed Dec 26 02:17:10
2007
@@ -23,12 +23,13 @@
 #include "../common/gc_space.h"
 #include "../gen/gen.h"
 #include "../mark_sweep/gc_ms.h"
+#include "../semi_space/sspace.h"
 #include "../common/space_tuner.h"
 #ifdef USE_32BITS_HASHCODE
 #include "../common/hashcode.h"
 #endif
 #ifdef USE_MARK_SWEEP_GC
-#include "../mark_sweep/sspace_mark_sweep.h"
+#include "../mark_sweep/wspace_mark_sweep.h"
 #endif
 #include "../common/gc_concurrent.h"
 
@@ -116,10 +117,8 @@
   assert(address_belongs_to_gc_heap(read_slot(p_ref), (GC*)heap_verifier->gc));
   Partial_Reveal_Object* UNUSED p_obj = read_slot(p_ref);
   assert(p_obj);
-  assert(uncompress_vt(obj_get_vt(p_obj)));
-  assert(!address_belongs_to_gc_heap(uncompress_vt(obj_get_vt(p_obj)), (GC*)heap_verifier->gc));
-
-//ynhe
+  assert(decode_vt(obj_get_vt(p_obj)));
+  assert(!address_belongs_to_gc_heap(decode_vt(obj_get_vt(p_obj)), (GC*)heap_verifier->gc));
 
 #ifdef USE_MARK_SWEEP_GC
   GC_MS* gc = (GC_MS*)heap_verifier->gc;
@@ -129,7 +128,6 @@
     if(!obj_is_alloc_in_color_table(p_obj))
       printf("\nERROR: obj after GC should be set its alloc color!\n");
   }else{
-    //ynhe
     if(gc_mark_is_concurrent())
       assert(obj_is_mark_black_in_table(p_obj));
   }
@@ -148,7 +146,9 @@
   assert(address_belongs_to_gc_heap(p_obj, (GC*)heap_verifier->gc));
 
   assert(obj_get_vt(p_obj));
-  assert(!address_belongs_to_gc_heap(uncompress_vt(obj_get_vt(p_obj)), (GC*)heap_verifier->gc));
+
+  /*FIXME:: should add more sanity checks, such as vt->gcvt->class... */
+  assert(!address_belongs_to_gc_heap(decode_vt(obj_get_vt(p_obj)), (GC*)heap_verifier->gc));
 }
 
 

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=606876&r1=606875&r2=606876&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 Wed Dec 26 02:17:10
2007
@@ -36,7 +36,7 @@
 static FORCE_INLINE void scan_object(Heap_Verifier* heap_verifier, Partial_Reveal_Object
*p_obj) 
 {
   GC_Verifier* gc_verifier = heap_verifier->gc_verifier;
-#ifndef USE_MARK_SWEEP_GC
+#if !defined(USE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
   if(gc_verifier->is_before_fallback_collection) {
     if(obj_belongs_to_nos(p_obj) && obj_is_fw_in_oi(p_obj)){
       assert(obj_get_vt(p_obj) == obj_get_vt(obj_get_fw_in_oi(p_obj)));
@@ -364,7 +364,7 @@
 
 void verifier_scan_all_objects(Heap_Verifier* heap_verifier)
 {
-#ifndef USE_MARK_SWEEP_GC
+#if !defined(USE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
   GC_Gen* gc       = (GC_Gen*)heap_verifier->gc;
   Space* fspace     = gc_get_nos(gc);
   Space* mspace   = gc_get_mos(gc);
@@ -412,7 +412,7 @@
 
 void verifier_scan_unreachable_objects(Heap_Verifier* heap_verifier)
 {
-#ifndef USE_MARK_SWEEP_GC
+#if !defined(USE_MARK_SWEEP_GC) && !defined(USE_UNIQUE_MOVE_COMPACT_GC)
   if(heap_verifier->is_before_gc) return;
   GC_Gen* gc       = (GC_Gen*)heap_verifier->gc;  
   Space* mspace   = gc_get_mos(gc);
@@ -431,5 +431,7 @@
   heap_verifier->live_obj_scanner = verifier_scan_live_objects;
   heap_verifier->all_obj_scanner   = verifier_scan_all_objects;
 }
+
+
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.cpp?rev=606876&r1=606875&r2=606876&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.cpp Wed Dec 26 02:17:10
2007
@@ -18,7 +18,7 @@
 #include "verifier_common.h"
 #include "verify_gc_effect.h"
 #ifdef USE_MARK_SWEEP_GC
-#include "../mark_sweep/sspace_mark_sweep.h"
+#include "../mark_sweep/wspace_mark_sweep.h"
 #endif
 
 static POINTER_SIZE_INT hash_obj_distance = 0;
@@ -325,7 +325,6 @@
     if(!obj_is_alloc_in_color_table(p_obj))
       printf("\nERROR: obj after GC should be set its alloc color!\n");
   }else{
-    //ynhe
     if(gc_mark_is_concurrent())
       assert(obj_is_mark_black_in_table(p_obj));
   }
@@ -550,6 +549,8 @@
 
 void verifier_reset_hash_distance()
 { hash_obj_distance = 0;}
+
+
 
 
 

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=606876&r1=606875&r2=606876&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 Wed Dec 26 02:17:10
2007
@@ -146,6 +146,30 @@
 Heap_Verifier* get_heap_verifier()
 { return heap_verifier; }
 
+/* this is tempoprarily used to check the rootset sanity after fallback mark-scan */
+void gc_verify_rootset(GC* gc)
+{
+  Heap_Verifier_Metadata* verifier_metadata = heap_verifier->heap_verifier_metadata;
+  Pool* root_set_pool = verifier_metadata->root_set_pool;
+
+  pool_iterator_init(root_set_pool);
+  Vector_Block* root_set = pool_iterator_next(root_set_pool);
+  
+  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;
+      iter = vector_block_iterator_advance(root_set,iter);
+      Partial_Reveal_Object* p_obj = read_slot(p_ref);
+      if(obj_belongs_to_nos(p_obj)){
+        assert(!obj_is_fw_in_oi(p_obj));
+      }
+      verify_object_header(p_obj, heap_verifier);      
+    } 
+    root_set = pool_iterator_next(root_set_pool);
+  }
+  return;
+}
 
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_live_heap.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_live_heap.h?rev=606876&r1=606875&r2=606876&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_live_heap.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_live_heap.h Wed Dec 26 02:17:10
2007
@@ -25,8 +25,9 @@
 void gc_init_heap_verification(GC* gc);
 void gc_terminate_heap_verification(GC* gc);
 void gc_verify_heap(GC* gc, Boolean is_before_gc);
-
+void gc_verify_rootset(GC* gc);
 
 void event_mutator_allocate_newobj(Partial_Reveal_Object* p_newobj, POINTER_SIZE_INT size,
VT vt_raw);
 void event_gc_collect_kind_changed(GC* gc);
+
 #endif



Mime
View raw message