You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by xl...@apache.org on 2008/01/11 15:38:50 UTC

svn commit: r611186 [3/3] - in /harmony/enhanced/drlvm/trunk/vm/gc_gen/src: common/ finalizer_weakref/ gen/ los/ mark_compact/ mark_sweep/ move_compact/ semi_space/ thread/ trace_forward/ utils/ verify/

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.h?rev=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.h Fri Jan 11 06:38:32 2008
@@ -48,6 +48,7 @@
   GC* gc;
   VmThreadHandle thread_handle;   /* This thread; */
   unsigned int handshake_signal; /*Handshake is used in concurrent GC.*/
+  unsigned int num_alloc_blocks; /* the number of allocated blocks in this collection. */
   /* End of Allocator --> */
 
   /* FIXME:: for testing */

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.h?rev=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.h Fri Jan 11 06:38:32 2008
@@ -29,6 +29,8 @@
 #endif
 
 #include "../semi_space/sspace.h"
+#include "../gen/gen.h"
+
 
 extern Space_Alloc_Func mos_alloc;
 
@@ -63,7 +65,7 @@
   Allocator* allocator = (Allocator*)collector;
   
   /* can also use collector->collect_space->collect_algorithm */
-  if( MINOR_ALGO == MINOR_NONGEN_SEMISPACE_POOL){
+  if( MINOR_ALGO == MINOR_NONGEN_SEMISPACE_POOL || MINOR_ALGO == MINOR_GEN_SEMISPACE_POOL){
 
     p_targ_obj = (Partial_Reveal_Object*)semispace_forward_obj(p_obj, size, allocator);
     if( !p_targ_obj )
@@ -110,19 +112,32 @@
 
   memcpy(p_targ_obj, p_obj, size);  //copy once. 
 
-  /* restore oi, which currently is the forwarding pointer. 
-     for semispace GC, p_targ_obj is still in NOS, we should clear its oi mark_bits. */
-  if( obj_belongs_to_nos(p_targ_obj) || gc_is_gen_mode() )
-    /* we need clear the bit to give a clean status (it's possibly unclean due to partial forwarding) */
-    set_obj_info(p_targ_obj, oi&DUAL_MARKBITS_MASK);
-  else{
+
+  /* restore oi, which currently is the forwarding pointer. */ 
+  if( obj_belongs_to_nos(p_targ_obj)){
+    /* for semispace GC, if p_targ_obj is still in NOS, we should clear its oi mark_bits.
+       we use age bit to represent the obj is in survivor_area. We will clear the bit when the
+       obj is forwarded to MOS. So the bit is exactly the same meaning as in survivor area. */
+    oi = oi | OBJ_AGE_BIT;
+  
+  }else{ /* obj forwarded to mos */
+    /* this is only useful for semispace GC. When an object is forwarded to MOS from survivor
+       area, its age bit should be cleared. We clear it anyway to save the condition checks. */
+    oi = oi & ~OBJ_AGE_BIT;
+
+    if(gc_is_gen_mode()){
+      /* we need clear the bit to give a clean status (it's possibly unclean due to partial forwarding) */   
+      oi = oi & DUAL_MARKBITS_MASK;
 #ifdef MARK_BIT_FLIPPING 
-  /* we mark it to make the object look like other original live objects in MOS */
-    set_obj_info(p_targ_obj, oi|FLIP_MARK_BIT);
-#else 
-    set_obj_info(p_targ_obj, oi);  
+    }else{
+      /* we mark it to make the object look like other original live objects in MOS */
+      oi = oi|FLIP_MARK_BIT;
 #endif // MARK_BIT_FLIPPING 
-  }
+    }
+  
+  }/* obj forwarded to mos */
+  
+  set_obj_info(p_targ_obj, oi); 
   
 #ifdef USE_32BITS_HASHCODE
   if(obj_hashcode_attached){

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/gc_thread.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/gc_thread.cpp?rev=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/gc_thread.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/gc_thread.cpp Fri Jan 11 06:38:32 2008
@@ -25,6 +25,12 @@
 POINTER_SIZE_INT tls_gc_offset;
 hythread_group_t gc_thread_group = NULL;
 
+#if defined(ALLOC_ZEROING) && defined(ALLOC_PREFETCH)
+POINTER_SIZE_INT PREFETCH_DISTANCE = 1024;
+POINTER_SIZE_INT ZEROING_SIZE = 2*KB;
+POINTER_SIZE_INT PREFETCH_STRIDE = 64;
+Boolean PREFETCH_ENABLED = FALSE;
+#endif
 
 void gc_tls_init()
 {

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/gc_thread.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/gc_thread.h?rev=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/gc_thread.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/gc_thread.h Fri Jan 11 06:38:32 2008
@@ -36,7 +36,7 @@
 
 #ifdef _WINDOWS_
 #include <xmmintrin.h>
-#define prefetchnta(pref_addr)	_mm_prefetch((char*)(pref_addr), _MM_HINT_NTA )
+#define prefetchnta(pref_addr)  _mm_prefetch((char*)(pref_addr), _MM_HINT_NTA )
 #else /* _WINDOWS_ */
 #define prefetchnta(pref_addr)  __asm__ ("prefetchnta (%0)"::"r"(pref_addr))
 #endif /* !_WINDOWS_ */
@@ -46,7 +46,7 @@
 extern POINTER_SIZE_INT PREFETCH_STRIDE;
 extern Boolean  PREFETCH_ENABLED;
 #else /* ALLOC_PREFETCH  ^^^^^^^^^^^^^^^^ */
-#define ZEROING_SIZE	2*KB
+#define ZEROING_SIZE  2*KB
 #endif /* !ALLOC_PREFETCH */
 #endif /* ALLOC_ZEROING  ----------------- */
 
@@ -75,6 +75,8 @@
   GC   *gc;
   VmThreadHandle thread_handle;   /* This thread; */
   unsigned int handshake_signal; /*Handshake is used in concurrent GC.*/
+  /* the number of allocated blocks. For collector, it reflects the load balance; for mutator, it reflects mutator activities. */
+  unsigned int num_alloc_blocks; 
 }Allocator;
 
 inline void thread_local_unalloc(unsigned int size, Allocator* allocator)
@@ -103,7 +105,7 @@
   
 #ifdef ALLOC_PREFETCH  
   if(PREFETCH_ENABLED)  {
-    POINTER_SIZE_INT pre_addr = new_free, pref_stride= PREFETCH_STRIDE, pref_dist= new_ceiling + PREFETCH_DISTANCE;    	
+    POINTER_SIZE_INT pre_addr = new_free, pref_stride= PREFETCH_STRIDE, pref_dist= new_ceiling + PREFETCH_DISTANCE;      
     do{
       prefetchnta(pre_addr);
       pre_addr += pref_stride;
@@ -166,7 +168,7 @@
 #else
 #ifdef ALLOC_PREFETCH
     if(PREFETCH_ENABLED) {
-    	POINTER_SIZE_INT pre_addr = (POINTER_SIZE_INT) new_free, pref_stride= PREFETCH_STRIDE, pref_dist= pre_addr + PREFETCH_DISTANCE;    	
+      POINTER_SIZE_INT pre_addr = (POINTER_SIZE_INT) new_free, pref_stride= PREFETCH_STRIDE, pref_dist= pre_addr + PREFETCH_DISTANCE;      
         do{
             prefetchnta(pre_addr);
             pre_addr += pref_stride;

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.cpp?rev=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.cpp Fri Jan 11 06:38:32 2008
@@ -278,4 +278,3 @@
 }
 
 
-

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.h?rev=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/marker.h Fri Jan 11 06:38:32 2008
@@ -31,11 +31,15 @@
   Space* alloc_space;
   GC* gc;
   VmThreadHandle thread_handle;   /* This thread; */
-  unsigned int handshake_signal; /*Handshake is used in concurrent GC.*/
+  unsigned int handshake_signal; /*Handshake is used in concurrent GC.*/  
+  unsigned int num_alloc_blocks; /* the number of allocated blocks in this collection. */
   /* End of Allocator --> */
 
   /* FIXME:: for testing */
   Space* mark_space;
+  
+  /* backup allocator in case there are two target copy spaces, such as semispace GC */
+  Allocator* backup_allocator;
 
   Vector_Block *trace_stack;
   
@@ -95,6 +99,5 @@
 
 
 #endif //_MARKER_H_
-
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.cpp?rev=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.cpp Fri Jan 11 06:38:32 2008
@@ -174,4 +174,3 @@
 
 
 
-

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=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.h Fri Jan 11 06:38:32 2008
@@ -38,7 +38,7 @@
   GC* gc;
   VmThreadHandle thread_handle;   /* This thread; */
   volatile unsigned int handshake_signal; /*Handshake is used in concurrent GC.*/
-  
+  unsigned int num_alloc_blocks; /* the number of allocated blocks since last collection. */
   /* END of Allocator --> */
   
   Vector_Block* rem_set;
@@ -63,9 +63,9 @@
 inline void mutator_post_signal(Mutator* mutator, unsigned int handshake_signal)
 { 
   //FIXME: Need barrier here.
-  //apr_memory_rw_barrier();
+  mem_fence();
   mutator->handshake_signal = handshake_signal; 
-  //apr_memory_rw_barrier();
+  mem_fence();
 }
 
 inline void wait_mutator_signal(Mutator* mutator, unsigned int handshake_signal)

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp?rev=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp Fri Jan 11 06:38:32 2008
@@ -22,6 +22,7 @@
 #include "gc_thread.h"
 #include "../gen/gen.h"
 #include "../mark_sweep/gc_ms.h"
+#include "../move_compact/gc_mc.h"
 #include "../finalizer_weakref/finalizer_weakref.h"
 
 #ifdef GC_GEN_STATS

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=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.cpp Fri Jan 11 06:38:32 2008
@@ -20,16 +20,12 @@
  */
 
 #include "fspace.h"
-#include "../gen/gen.h"
 
 Boolean NOS_PARTIAL_FORWARD = FALSE;
 
 Boolean forward_first_half;
 void* object_forwarding_boundary=NULL;
 
-struct GC_Gen;
-void gc_set_nos(GC_Gen* gc, Space* space);
-
 Fspace *fspace_initialize(GC* gc, void* start, POINTER_SIZE_INT fspace_size, POINTER_SIZE_INT commit_size) 
 {    
   assert( (fspace_size%GC_BLOCK_SIZE_BYTES) == 0 );
@@ -51,7 +47,7 @@
 
 #ifdef STATIC_NOS_MAPPING
   fspace->heap_end = (void *)((POINTER_SIZE_INT)reserved_base + fspace->reserved_heap_size);
-#else /* for dynamic mapping, nos->heap_end is gc->heap_end */
+#else /* for dynamic mapping, fspace->heap_end is gc->heap_end */
   fspace->heap_end = (void *)((POINTER_SIZE_INT)reserved_base + fspace->committed_heap_size);
 #endif
 
@@ -150,7 +146,7 @@
   /* For los extension
    * num_managed_blocks of fspace might be 0.
    * In this case, the last block we found is mos' last block.
-   * And this implementation depends on the fact that mos and nos are continuous.
+   * And this implementation depends on the fact that mos and fspace are continuous.
    */
   int last_block_index = fspace->num_managed_blocks - 1;
   Block_Header *fspace_last_block = (Block_Header*)&fspace->blocks[last_block_index];
@@ -158,6 +154,23 @@
   
   return;
 }
+
+#ifndef STATIC_NOS_MAPPING
+void* fspace_heap_start_adjust(Fspace* fspace, void* new_space_start, POINTER_SIZE_INT new_space_size)
+{
+
+  blocked_space_adjust((Blocked_Space*)fspace, new_space_start, new_space_size);
+  
+  fspace->free_block_idx = fspace->first_block_idx;
+
+  if( NOS_PARTIAL_FORWARD )
+    object_forwarding_boundary = (void*)&fspace->blocks[fspace->num_managed_blocks >>1];
+  else
+    object_forwarding_boundary = (void*)&fspace->blocks[fspace->num_managed_blocks];
+ 
+  return new_space_start; 
+}
+#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=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.h Fri Jan 11 06:38:32 2008
@@ -39,6 +39,16 @@
 Fspace *fspace_initialize(GC* gc, void* start, POINTER_SIZE_INT fspace_size, POINTER_SIZE_INT commit_size);
 void fspace_destruct(Fspace *fspace);
 
+inline POINTER_SIZE_INT fspace_free_space_size(Fspace* nos)
+{ return blocked_space_free_mem_size((Blocked_Space*)nos);}
+
+inline POINTER_SIZE_INT fspace_used_space_size(Fspace* nos)
+{ return blocked_space_used_mem_size((Blocked_Space*)nos);}
+
+#ifndef STATIC_NOS_MAPPING
+void* fspace_heap_start_adjust(Fspace* fspace, void* new_heap_start, POINTER_SIZE_INT new_heap_size);
+#endif
+
 void* fspace_alloc(unsigned size, Allocator *allocator);
 Boolean fspace_alloc_block(Fspace* fspace, Allocator* allocator);
 

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=611186&r1=611185&r2=611186&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 Fri Jan 11 06:38:32 2008
@@ -99,4 +99,3 @@
 }
 
 
-

Modified: 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=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/sspace_temp.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/sspace_temp.cpp Fri Jan 11 06:38:32 2008
@@ -1,14 +0,0 @@
-/* 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;}

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/bit_ops.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/bit_ops.h?rev=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/bit_ops.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/bit_ops.h Fri Jan 11 06:38:32 2008
@@ -31,7 +31,7 @@
 
 #if defined(_IPF_) || defined(_WIN64)
     while( ! (target_word & ((POINTER_SIZE_INT)1 << bit_offset)) ){
-    	bit_offset++;
+      bit_offset++;
     }
 #else /* !_IPF_ && !_WIN64 */
 #ifdef PLATFORM_POSIX  /* linux X86 32/64 */

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/sync_queue.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/sync_queue.h?rev=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/sync_queue.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/sync_queue.h Fri Jan 11 06:38:32 2008
@@ -106,25 +106,25 @@
 
     if( QLINK_VAL(head) == QLINK_VAL(queue->head)){
       if( head.ptr== tail.ptr )
-      	if( next.ptr == NULL )
-        return FALSE;
-      	else{
-        tmp1.ptr = next.ptr;
-        tmp1.count = tail.count+1;
-        atomic_cas64(QLINK_PTR(queue->tail), QLINK_VAL(tail), QLINK_VAL(tmp1));
-      	}
+        if( next.ptr == NULL )
+          return FALSE;
+        else{
+          tmp1.ptr = next.ptr;
+          tmp1.count = tail.count+1;
+          atomic_cas64(QLINK_PTR(queue->tail), QLINK_VAL(tail), QLINK_VAL(tmp1));
+        }
       else{
         *pvalue = next.ptr->value;
         tmp1.ptr = next.ptr;
         tmp1.count = head.count+1;
-        QLINK_VAL(tmp2) =	atomic_cas64(QLINK_PTR(queue->head), QLINK_VAL(head), QLINK_VAL(tmp1));
+        QLINK_VAL(tmp2) =  atomic_cas64(QLINK_PTR(queue->head), QLINK_VAL(head), QLINK_VAL(tmp1));
         if( QLINK_VAL(tmp2) == QLINK_VAL(tmp1))
           break;
-        }
+      }
     }
   }
   free( head.ptr );
   return TRUE;
 }
-	
+  
 #endif /* _SYNC_QUEUE_H_ */

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=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_common.cpp Fri Jan 11 06:38:32 2008
@@ -128,18 +128,17 @@
     }
 
     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);
+      if( gc_match_kind((GC*)gc, MINOR_COLLECTION)){
+        if( nos->collect_algorithm == MINOR_NONGEN_SEMISPACE_POOL || nos->collect_algorithm == MINOR_GEN_SEMISPACE_POOL){
+          if( obj_belongs_to_survivor_area((Sspace*)nos, p_obj)) 
+            return TRUE;            
         }
       }
       
       printf("\nERROR: obj referenced by rootset is in NOS after GC!\n");
       assert(0);
       return FALSE;
-   }
+    }
   }
 #endif
   return TRUE;
@@ -269,7 +268,6 @@
 {
     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_scanner.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_scanner.cpp?rev=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_scanner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verifier_scanner.cpp Fri Jan 11 06:38:32 2008
@@ -36,6 +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;
+
 #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)){
@@ -45,8 +46,17 @@
     }
   }
 #endif
+  
   if(!obj_mark_in_vt(p_obj)) return;
- 
+
+   extern unsigned int MAJOR_ALGO;
+  if( MAJOR_ALGO != MAJOR_MARK_SWEEP && p_obj >= los_boundary ){
+    Block_Header* block = GC_BLOCK_HEADER(p_obj);
+    if( heap_verifier->is_before_gc)  block->num_live_objs++;
+    /* we can't set block->num_live_objs = 0 if !is_before_gc, because the some blocks may be freed hence not
+        visited after GC. So we should reset it in GC space reset functions. */
+  }
+
   verify_object_header(p_obj, heap_verifier); 
   verifier_update_verify_info(p_obj, heap_verifier);
 
@@ -216,13 +226,13 @@
     verifier_copy_pool(verifier_metadata->obj_with_fin_pool, gc->finref_metadata->obj_with_fin_pool);
     verifier_trace_objsets(heap_verifier, verifier_metadata->obj_with_fin_pool);
   }else{
-	  if(!heap_verifier->gc_verifier->is_before_fallback_collection){
+    if(!heap_verifier->gc_verifier->is_before_fallback_collection){
       verify_live_finalizable_obj(heap_verifier, gc->finref_metadata->obj_with_fin_pool);
       verifier_copy_pool_reverse_order(verifier_metadata->finalizable_obj_pool, gc->finref_metadata->finalizable_obj_pool);
       verifier_trace_objsets(heap_verifier, verifier_metadata->finalizable_obj_pool);
       verifier_clear_pool(verifier_metadata->finalizable_obj_pool, heap_verifier->heap_verifier_metadata->free_set_pool, FALSE);
     }else{
-      verifier_trace_objsets(heap_verifier, verifier_metadata->obj_with_fin_pool );	
+      verifier_trace_objsets(heap_verifier, verifier_metadata->obj_with_fin_pool );  
     }
     verifier_clear_pool(verifier_metadata->obj_with_fin_pool, heap_verifier->heap_verifier_metadata->free_set_pool, FALSE);
   }
@@ -431,7 +441,6 @@
   heap_verifier->live_obj_scanner = verifier_scan_live_objects;
   heap_verifier->all_obj_scanner   = verifier_scan_all_objects;
 }
-
 
 
 

Added: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_blocked_space.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_blocked_space.cpp?rev=611186&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_blocked_space.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_blocked_space.cpp Fri Jan 11 06:38:32 2008
@@ -0,0 +1,38 @@
+/*
+ *  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 "../gen/gen.h"
+
+static void blocked_space_clear_info(Blocked_Space* space)
+{  
+  for(unsigned int i=0; i < space->num_managed_blocks; i++){
+    Block_Header* block = (Block_Header*)&(space->blocks[i]);
+    block->num_live_objs = 0;
+  }
+  return;
+}
+
+void verifier_cleanup_block_info(GC* gc)
+{
+  Blocked_Space* space = (Blocked_Space*)gc_get_mos((GC_Gen*)gc);
+  blocked_space_clear_info(space);  
+
+  space = (Blocked_Space*)gc_get_nos((GC_Gen*)gc);
+  blocked_space_clear_info(space);  
+
+  return;
+}

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

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=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_gc_effect.cpp Fri Jan 11 06:38:32 2008
@@ -304,8 +304,8 @@
 
   if(!gc_verifier->is_before_fallback_collection && gc_verifier->gc_collect_kind == MINOR_COLLECTION){
     if(!heap_verifier->is_before_gc){
-      assert(!obj_belongs_to_space(p_obj, nspace) ||!fspace_object_was_forwarded(p_obj, (Fspace*)nspace, heap_verifier));
-      if(obj_belongs_to_space(p_obj, nspace) && fspace_object_was_forwarded(p_obj, (Fspace*)nspace, heap_verifier)){
+      assert(!obj_belongs_to_space(p_obj, nspace) || !fspace_object_was_forwarded(p_obj, (Fspace*)nspace, heap_verifier) || obj_belongs_to_survivor_area((Sspace*)nspace, p_obj));
+      if(obj_belongs_to_space(p_obj, nspace) && fspace_object_was_forwarded(p_obj, (Fspace*)nspace, heap_verifier) && !obj_belongs_to_survivor_area((Sspace*)nspace, p_obj) ){
         gc_verifier->is_verification_passed = FALSE;
       }
     }
@@ -446,6 +446,21 @@
 {
   GC_Verifier* gc_verifier = heap_verifier->gc_verifier;
   
+  Heap_Verifier_Metadata* verifier_metadata = heap_verifier->heap_verifier_metadata;
+  Pool* free_pool = verifier_metadata->free_set_pool;
+
+  Boolean passed = verifier_compare_objs_pools(verifier_metadata->objects_pool_before_gc, 
+                    verifier_metadata->objects_pool_after_gc , free_pool, compare_live_obj_inform);
+  if(!passed)     gc_verifier->is_verification_passed = FALSE;
+#ifndef BUILD_IN_REFERENT
+  passed = verifier_compare_objs_pools(verifier_metadata->resurrect_objects_pool_before_gc, 
+                    verifier_metadata->resurrect_objects_pool_after_gc , free_pool, compare_live_obj_inform);
+  if(!passed)     gc_verifier->is_verification_passed = FALSE;
+#endif
+  passed = verifier_compare_objs_pools(verifier_metadata->hashcode_pool_before_gc, 
+                    verifier_metadata->hashcode_pool_after_gc , free_pool, compare_obj_hash_inform);
+  if(!passed)     gc_verifier->is_verification_passed = FALSE;
+
   if(gc_verifier->num_live_objects_before_gc != gc_verifier->num_live_objects_after_gc){
     gc_verifier->is_verification_passed = FALSE;
     printf("\nERROR: live objects number error!\n");
@@ -478,20 +493,6 @@
     gc_verifier->is_verification_passed = FALSE;
   }
 
-  Heap_Verifier_Metadata* verifier_metadata = heap_verifier->heap_verifier_metadata;
-  Pool* free_pool = verifier_metadata->free_set_pool;
-
-  Boolean passed = verifier_compare_objs_pools(verifier_metadata->objects_pool_before_gc, 
-                    verifier_metadata->objects_pool_after_gc , free_pool, compare_live_obj_inform);
-  if(!passed)     gc_verifier->is_verification_passed = FALSE;
-#ifndef BUILD_IN_REFERENT
-  passed = verifier_compare_objs_pools(verifier_metadata->resurrect_objects_pool_before_gc, 
-                    verifier_metadata->resurrect_objects_pool_after_gc , free_pool, compare_live_obj_inform);
-  if(!passed)     gc_verifier->is_verification_passed = FALSE;
-#endif
-  passed = verifier_compare_objs_pools(verifier_metadata->hashcode_pool_before_gc, 
-                    verifier_metadata->hashcode_pool_after_gc , free_pool, compare_obj_hash_inform);
-  if(!passed)     gc_verifier->is_verification_passed = FALSE;
 }
 
 
@@ -549,7 +550,6 @@
 
 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=611186&r1=611185&r2=611186&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_live_heap.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_live_heap.cpp Fri Jan 11 06:38:32 2008
@@ -88,8 +88,14 @@
 
 }
 
+void verifier_cleanup_block_info(GC* gc);
+extern unsigned int MAJOR_ALGO;
+
 void verify_heap_after_gc(GC* gc)
 {
+  if(MAJOR_ALGO != MAJOR_MARK_SWEEP)
+    verifier_cleanup_block_info(gc);
+      
   if(need_scan_live_objs(heap_verifier))
     (*heap_verifier->live_obj_scanner)(heap_verifier);
   if(need_verify_gc_effect(heap_verifier))
@@ -145,31 +151,5 @@
 
 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=611186&r1=611185&r2=611186&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 Fri Jan 11 06:38:32 2008
@@ -25,7 +25,6 @@
 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);