harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x..@apache.org
Subject svn commit: r519564 [2/2] - in /harmony/enhanced/drlvm/trunk/vm/gc_gen/src: common/ finalizer_weakref/ gen/ mark_compact/ mark_sweep/ thread/ trace_forward/ utils/
Date Sun, 18 Mar 2007 06:02:58 GMT
Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref_metadata.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref_metadata.h?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref_metadata.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref_metadata.h Sat Mar 17 23:02:56 2007
@@ -44,6 +44,8 @@
   
   Pool *repset_pool;                            // repointed reference slot sets
   
+  Pool *fallback_ref_pool;                      // temporary buffer for weakref needing to be put to vm when resurrection fallback happens
+  
   Vector_Block *finalizable_obj_set;            // buffer for finalizable_objects_pool
   Vector_Block *repset;                         // buffer for repset_pool
   
@@ -66,11 +68,13 @@
 extern void gc_reset_finref_metadata(GC *gc);
 
 extern void mutator_add_finalizer(Mutator *mutator, Partial_Reveal_Object *ref);
+extern void gc_add_finalizer(GC *gc, Vector_Block* &vector_block_in_use, Partial_Reveal_Object *ref);
 extern void gc_add_finalizable_obj(GC *gc, Partial_Reveal_Object *ref);
 extern void collector_add_softref(Collector *collector, Partial_Reveal_Object *ref);
 extern void collector_add_weakref(Collector *collector, Partial_Reveal_Object *ref);
 extern void collector_add_phanref(Collector *collector, Partial_Reveal_Object *ref);
-extern void finref_repset_add_entry(GC *gc, Partial_Reveal_Object **ref);
+extern void finref_repset_add_entry(GC *gc, REF* ref);
+extern void finref_add_fallback_ref(GC *gc, Vector_Block* &vector_block_in_use, Partial_Reveal_Object *p_ref);
 
 extern Boolean obj_with_fin_pool_is_empty(GC *gc);
 extern Boolean finalizable_obj_pool_is_empty(GC *gc);

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.cpp?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.cpp Sat Mar 17 23:02:56 2007
@@ -24,6 +24,7 @@
 #include "../finalizer_weakref/finalizer_weakref.h"
 #include "../verify/verify_live_heap.h"
 #include "../common/space_tuner.h"
+#include "../common/compressed_ref.h"
 
 /* fspace size limit is not interesting. only for manual tuning purpose */
 unsigned int min_nos_size_bytes = 16 * MB;
@@ -150,6 +151,8 @@
       free(large_page_hint);
       large_page_hint = NULL;
       printf("GC use small pages.\n");
+    }else{
+      printf("GC use large pages.\n");
     }
   }
   
@@ -173,6 +176,8 @@
 
 #endif  /* STATIC_NOS_MAPPING else */
 
+  HEAP_NULL = (POINTER_SIZE_INT)reserved_base;
+  
   gc_gen->reserved_heap_size = los_size + nos_reserve_size + mos_reserve_size;
   gc_gen->heap_start = reserved_base;
   gc_gen->heap_end = reserved_end;
@@ -329,7 +334,7 @@
 
   gc->collect_result = TRUE;
   
-  if(gc->collect_kind == MINOR_COLLECTION){
+  if(gc_match_kind((GC*)gc, MINOR_COLLECTION)){
     /* FIXME:: move_object is only useful for nongen_slide_copy */
     gc->mos->move_object = FALSE;
     
@@ -346,7 +351,7 @@
 
   }
 
-  if(gc->collect_result == FALSE && gc->collect_kind == MINOR_COLLECTION){
+  if(gc->collect_result == FALSE && gc_match_kind((GC*)gc, MINOR_COLLECTION)){
     
     if(gc_is_gen_mode())
       gc_clear_remset((GC*)gc);  
@@ -374,6 +379,11 @@
   }
   
   if(verify_live_heap) gc_verify_heap((GC*)gc, FALSE);
+
+  /*Fixme: clear root set here to support verify.*/
+#ifdef COMPRESS_REFERENCE
+  gc_set_pool_clear(gc->metadata->gc_uncompressed_rootset_pool);
+#endif
 
   return;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.h?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.h Sat Mar 17 23:02:56 2007
@@ -82,6 +82,7 @@
 
   /* FIXME:: this is wrong! root_set belongs to mutator */
   Vector_Block* root_set;
+  Vector_Block* uncompressed_root_set;
   
   //For_LOS_extend
   Space_Tuner* tuner;  
@@ -171,4 +172,5 @@
 extern Boolean GEN_NONGEN_SWITCH ;
 
 #endif /* ifndef _GC_GEN_H_ */
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen_adapt.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen_adapt.cpp?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen_adapt.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen_adapt.cpp Sat Mar 17 23:02:56 2007
@@ -106,7 +106,7 @@
   POINTER_SIZE_INT nos_free_size = space_free_memory_size(fspace);
   POINTER_SIZE_INT total_free_size = mos_free_size  + nos_free_size;
   
-  if(gc->collect_kind != MINOR_COLLECTION) {
+  if(!gc_match_kind((GC*)gc, MINOR_COLLECTION)) {
     assert(!gc_is_gen_mode());
     
     if(gen_mode_adaptor->major_survive_ratio_threshold != 0 && mspace->survive_ratio > gen_mode_adaptor->major_survive_ratio_threshold){    
@@ -199,9 +199,9 @@
   POINTER_SIZE_INT mos_free_size = space_free_memory_size(mspace);
   POINTER_SIZE_INT nos_free_size = space_free_memory_size(fspace);
   POINTER_SIZE_INT total_free_size = mos_free_size  + nos_free_size;
-  if(gc->collect_kind != MINOR_COLLECTION) gc->force_gen_mode = FALSE;
+  if(!gc_match_kind((GC*)gc, MINOR_COLLECTION)) gc->force_gen_mode = FALSE;
   if(!gc->force_gen_mode){  
-    if(gc->collect_kind != MINOR_COLLECTION){
+    if(!gc_match_kind((GC*)gc, MINOR_COLLECTION)){
       mspace->time_collections += pause_time;
   
       Tslow = (float)pause_time;
@@ -210,7 +210,7 @@
       
       POINTER_SIZE_INT major_survive_size = space_committed_size((Space*)mspace) - mos_free_size;
       /*If major is caused by LOS, or collection kind is EXTEND_COLLECTION, all survive ratio is not updated.*/
-      if((gc->cause != GC_CAUSE_LOS_IS_FULL) && (gc->collect_kind != EXTEND_COLLECTION)){
+      if((gc->cause != GC_CAUSE_LOS_IS_FULL) && (!gc_match_kind((GC*)gc, EXTEND_COLLECTION))){
         survive_ratio = (float)major_survive_size/(float)space_committed_size((Space*)mspace);
         mspace->survive_ratio = survive_ratio;
       }
@@ -289,7 +289,7 @@
   /*
   if(curr_nos_size <= min_nos_size_bytes){
     //after major, should not allow this size 
-    assert(gc->collect_kind == MINOR_COLLECTION);
+    assert(gc_match_kind((GC*)gc, MINOR_COLLECTION));
     return FALSE;
   }
   */
@@ -318,12 +318,6 @@
   return TRUE;;
 }
 
-// this function is added to disambiguate on windows/em64t calls to asm() below 
-POINTER_SIZE_SINT POINTER_SIZE_abs(POINTER_SIZE_SINT x) 
-{
-    return x<0?-x:x;    
-}
-    
 #ifndef STATIC_NOS_MAPPING
 
 void gc_gen_adapt(GC_Gen* gc, int64 pause_time)
@@ -344,7 +338,7 @@
 
   POINTER_SIZE_INT curr_nos_size = space_committed_size((Space*)fspace);
 
-  if( POINTER_SIZE_abs((POINTER_SIZE_SINT)new_nos_size - (POINTER_SIZE_SINT)curr_nos_size) < NOS_COPY_RESERVE_DELTA )
+  if( abs((POINTER_SIZE_SINT)new_nos_size - (POINTER_SIZE_SINT)curr_nos_size) < NOS_COPY_RESERVE_DELTA )
     return;
   
   /* below are ajustment */  
@@ -396,7 +390,7 @@
   
   POINTER_SIZE_INT curr_nos_size = space_committed_size((Space*)fspace);
 
-  if( POINTER_SIZE_abs((POINTER_SIZE_SINT)new_nos_size - (POINTER_SIZE_SINT)curr_nos_size) < NOS_COPY_RESERVE_DELTA )
+  if( abs((POINTER_SIZE_SINT)new_nos_size - (POINTER_SIZE_SINT)curr_nos_size) < NOS_COPY_RESERVE_DELTA )
     return;
       
   POINTER_SIZE_INT used_mos_size = space_used_memory_size((Blocked_Space*)mspace);  

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/fallback_mark_scan.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/fallback_mark_scan.cpp?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/fallback_mark_scan.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/fallback_mark_scan.cpp Sat Mar 17 23:02:56 2007
@@ -23,26 +23,25 @@
 #include "../gen/gen.h"
 #include "../finalizer_weakref/finalizer_weakref.h"
 
-static void scan_slot(Collector* collector, Partial_Reveal_Object** p_ref)
+static void scan_slot(Collector* collector, REF *p_ref)
 {
-  Partial_Reveal_Object* p_obj = *p_ref;
-  if(p_obj==NULL) return;
+  REF ref = *p_ref;
+  if(ref == COMPRESSED_NULL) return;
 
   collector_tracestack_push(collector, p_ref);
-  
   return;
 }
 
-static void scan_object(Collector* collector, Partial_Reveal_Object **p_ref)
+static void scan_object(Collector* collector, REF *p_ref)
 {
-  Partial_Reveal_Object *p_obj = *p_ref;
+  Partial_Reveal_Object *p_obj = read_slot(p_ref);
   assert(p_obj);
   
   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)));
     p_obj = obj_get_fw_in_oi(p_obj);
     assert(p_obj);
-    *p_ref = p_obj;
+    write_slot(p_ref, p_obj);
   }
   
   if(!obj_mark_in_vt(p_obj))
@@ -57,7 +56,7 @@
     
     int32 array_length = vector_get_length((Vector_Handle) array);
     for (int i = 0; i < array_length; i++) {
-      Partial_Reveal_Object** p_ref = (Partial_Reveal_Object**)vector_get_element_address_ref((Vector_Handle) array, i);
+      REF *p_ref = (REF*)vector_get_element_address_ref((Vector_Handle) array, i);
       scan_slot(collector, p_ref);
     }   
     return;
@@ -66,7 +65,7 @@
   /* scan non-array object */
   int *offset_scanner = init_object_scanner(p_obj);
   while (true) {
-    Partial_Reveal_Object** p_ref = (Partial_Reveal_Object**)offset_get_ref(offset_scanner, p_obj);
+    REF *p_ref = (REF*)offset_get_ref(offset_scanner, p_obj);
     if (p_ref == NULL) break; /* terminating ref slot */
   
     scan_slot(collector, p_ref);
@@ -81,13 +80,13 @@
 }
 
 
-static void trace_object(Collector* collector, Partial_Reveal_Object **p_ref)
+static void trace_object(Collector* collector, REF *p_ref)
 { 
   scan_object(collector, p_ref);
   
   Vector_Block* trace_stack = collector->trace_stack;
   while( !vector_stack_is_empty(trace_stack)){
-    p_ref = (Partial_Reveal_Object **)vector_stack_pop(trace_stack); 
+    p_ref = (REF *)vector_stack_pop(trace_stack); 
     scan_object(collector, p_ref);
     trace_stack = collector->trace_stack;
   }
@@ -103,7 +102,7 @@
   GC* gc = collector->gc;
   GC_Metadata* metadata = gc->metadata;
   
-  assert(gc->collect_kind == FALLBACK_COLLECTION);
+  assert(gc_match_kind(gc, FALLBACK_COLLECTION));
 
   /* reset the num_finished_collectors to be 0 by one collector. This is necessary for the barrier later. */
   unsigned int num_active_collectors = gc->num_active_collectors;
@@ -118,12 +117,11 @@
   while(root_set){
     POINTER_SIZE_INT* iter = vector_block_iterator_init(root_set);
     while(!vector_block_iterator_end(root_set,iter)){
-      Partial_Reveal_Object** p_ref = (Partial_Reveal_Object** )*iter;
+      REF *p_ref = (REF *)*iter;
       iter = vector_block_iterator_advance(root_set,iter);
 
-      Partial_Reveal_Object* p_obj = *p_ref;
       /* root ref can't be NULL, (remset may have NULL ref entry, but this function is only for MAJOR_COLLECTION */
-      assert(p_obj != NULL);
+      assert(*p_ref);
       
       collector_tracestack_push(collector, p_ref);
 
@@ -143,7 +141,7 @@
   while(mark_task){
     POINTER_SIZE_INT* iter = vector_block_iterator_init(mark_task);
     while(!vector_block_iterator_end(mark_task,iter)){
-      Partial_Reveal_Object** p_ref = (Partial_Reveal_Object **)*iter;
+      REF* p_ref = (REF *)*iter;
       iter = vector_block_iterator_advance(mark_task,iter);
 
       /* FIXME:: we should not let mark_task empty during working, , other may want to steal it. 
@@ -179,5 +177,5 @@
 
 void trace_obj_in_fallback_marking(Collector *collector, void *p_ref)
 {
-  trace_object(collector, (Partial_Reveal_Object **)p_ref);
+  trace_object(collector, (REF *)p_ref);
 }

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_collect_compact.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_collect_compact.cpp?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_collect_compact.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_collect_compact.cpp Sat Mar 17 23:02:56 2007
@@ -20,6 +20,7 @@
 
 #include "mspace_collect_compact.h"
 
+
 Boolean IS_MOVE_COMPACT;
 
 struct GC_Gen;
@@ -269,8 +270,7 @@
   //For_LOS_extend
   if(gc->tuner->kind != TRANS_NOTHING){
     collector_execute_task(gc, (TaskType)slide_compact_mspace, (Space*)mspace);
-    
-  }else if (gc->collect_kind == FALLBACK_COLLECTION){
+  }else if (gc_match_kind(gc, FALLBACK_COLLECTION)){
     collector_execute_task(gc, (TaskType)slide_compact_mspace, (Space*)mspace);  
     //IS_MOVE_COMPACT = TRUE;
     //collector_execute_task(gc, (TaskType)move_compact_mspace, (Space*)mspace);
@@ -295,6 +295,9 @@
     }
 
   }  
+
   return;  
 } 
+
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_extend_compact.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_extend_compact.cpp?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_extend_compact.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_extend_compact.cpp Sat Mar 17 23:02:56 2007
@@ -149,13 +149,13 @@
     assert(!obj_is_primitive_array(p_obj));
     
     int32 array_length = array->array_len;
-    Partial_Reveal_Object** p_refs = (Partial_Reveal_Object**)((POINTER_SIZE_INT)array + (int)array_first_element_offset(array));
+    REF* p_refs = (REF*)((POINTER_SIZE_INT)array + (int)array_first_element_offset(array));
 
     for (int i = 0; i < array_length; i++) {
-      Partial_Reveal_Object** p_ref = p_refs + i;
-      Partial_Reveal_Object*  p_element = *p_ref;
+      REF* p_ref = p_refs + i;
+      Partial_Reveal_Object*  p_element = read_slot(p_ref);
       if((p_element > start_address) && (p_element < end_address))
-          *p_ref = (Partial_Reveal_Object*)((POINTER_SIZE_INT)p_element - addr_diff);
+        write_slot(p_ref, (Partial_Reveal_Object*)((POINTER_SIZE_INT)p_element - addr_diff));
     }
     return;
   }
@@ -163,12 +163,12 @@
   /* scan non-array object */
   int *offset_scanner = init_object_scanner(p_obj);
   while (true) {
-    Partial_Reveal_Object** p_ref = (Partial_Reveal_Object**)offset_get_ref(offset_scanner, p_obj);
+    REF* p_ref = (REF*)offset_get_ref(offset_scanner, p_obj);
     if (p_ref == NULL) break; /* terminating ref slot */
   
-    Partial_Reveal_Object*  p_element = *p_ref;
+    Partial_Reveal_Object*  p_element = read_slot(p_ref);
     if((p_element > start_address) && (p_element < end_address))
-      *p_ref = (Partial_Reveal_Object*)((POINTER_SIZE_INT)p_element - addr_diff);
+      write_slot(p_ref, (Partial_Reveal_Object*)((POINTER_SIZE_INT)p_element - addr_diff));
     offset_scanner = offset_next_ref(offset_scanner);
   }
 
@@ -204,7 +204,7 @@
 static void gc_reupdate_repointed_sets(GC* gc, Pool* pool, void *start_address, void *end_address, unsigned int addr_diff)
 {
   GC_Metadata *metadata = gc->metadata;
-  assert(gc->collect_kind != MINOR_COLLECTION);
+  assert(gc_match_kind(gc, EXTEND_COLLECTION));
   
   pool_iterator_init(pool);
 
@@ -216,7 +216,7 @@
 
       Partial_Reveal_Object *p_obj = *p_ref;
       if((p_obj > start_address) && (p_obj < end_address))
-          *p_ref = (Partial_Reveal_Object*)((POINTER_SIZE_INT)p_obj - addr_diff);
+        *p_ref = (Partial_Reveal_Object*)((POINTER_SIZE_INT)p_obj - addr_diff);
     }
   }
 }
@@ -227,9 +227,13 @@
   GC_Metadata *metadata = gc->metadata;
 
   /* only for MAJOR_COLLECTION and FALLBACK_COLLECTION */
-  assert(gc->collect_kind != MINOR_COLLECTION);
+  assert(gc_match_kind(gc, EXTEND_COLLECTION));
   
   gc_reupdate_repointed_sets(gc, metadata->gc_rootset_pool, start_address, end_address, addr_diff);
+
+#ifdef COMPRESS_REFERENCE
+  gc_fix_uncompressed_rootset(gc);
+#endif
   
 #ifndef BUILD_IN_REFERENT
   gc_update_finref_repointed_refs(gc);
@@ -252,11 +256,6 @@
     Block_Header *dest_block = GC_BLOCK_HEADER((void *)((POINTER_SIZE_INT)src_base - addr_diff));
     memmove(dest_block->base, src_base, size);
     dest_block->new_free = (void *)((POINTER_SIZE_INT)block_end - addr_diff);
-    if(verify_live_heap)
-      while (p_obj < block_end) {
-        event_collector_doublemove_obj(p_obj, (Partial_Reveal_Object *)((POINTER_SIZE_INT)p_obj - addr_diff), collector);
-         p_obj = obj_end(p_obj);
-      }
   }
 }
 
@@ -271,7 +270,7 @@
   Lspace *lspace = gc_gen->los;
 
   /*For_LOS adaptive: when doing EXTEND_COLLECTION, mspace->survive_ratio should not be updated in gc_decide_next_collect( )*/
-  gc_gen->collect_kind = EXTEND_COLLECTION;
+  gc_gen->collect_kind |= EXTEND_COLLECTION;
   
   unsigned int num_active_collectors = gc_gen->num_active_collectors;
   unsigned int old_num;
@@ -315,7 +314,7 @@
   Lspace *lspace = gc_gen->los;
 
   /*For_LOS adaptive: when doing EXTEND_COLLECTION, mspace->survive_ratio should not be updated in gc_decide_next_collect( )*/
-  gc_gen->collect_kind = EXTEND_COLLECTION;
+  gc_gen->collect_kind |= EXTEND_COLLECTION;
   
   unsigned int num_active_collectors = gc_gen->num_active_collectors;
   unsigned int old_num;

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_move_compact.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_move_compact.cpp?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_move_compact.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_move_compact.cpp Sat Mar 17 23:02:56 2007
@@ -36,7 +36,7 @@
   Block_Header* dest_block = collector->cur_target_block;
   
   void* dest_sector_addr = dest_block->base;
-  Boolean is_fallback = (collector->gc->collect_kind == FALLBACK_COLLECTION);
+  Boolean is_fallback = gc_match_kind(collector->gc, FALLBACK_COLLECTION);
   
  
   while( curr_block ){
@@ -91,11 +91,11 @@
                event_collector_doublemove_obj(rescan_obj, targ_obj, collector);
              else
                event_collector_move_obj(rescan_obj, targ_obj, collector);
-              rescan_obj = block_get_next_marked_object(curr_block, &rescan_pos);  
+              rescan_obj = block_get_next_marked_object(curr_block, &rescan_pos);
               if(rescan_obj == NULL) break;
            }
       }
-         
+      
       memmove(dest_sector_addr, src_sector_addr, curr_sector_size);
 
       dest_sector_addr = (void*)((POINTER_SIZE_INT)dest_sector_addr + curr_sector_size);
@@ -144,10 +144,10 @@
             have references  that are going to be repointed */
   unsigned int old_num = atomic_cas32( &num_marking_collectors, 0, num_active_collectors+1);
 
-  if(gc->collect_kind != FALLBACK_COLLECTION)    
+  if(!gc_match_kind(gc, FALLBACK_COLLECTION))
        mark_scan_heap(collector);  
   else
-       fallback_mark_scan_heap(collector);    
+       fallback_mark_scan_heap(collector);
 
   old_num = atomic_inc32(&num_marking_collectors);
   if( ++old_num == num_active_collectors ){
@@ -163,6 +163,7 @@
       gc_update_weakref_ignore_finref(gc);
     }
 #endif
+
     
     /* let other collectors go */
     num_marking_collectors++; 
@@ -222,7 +223,8 @@
   mspace_reset_after_compaction(mspace);
   fspace_reset_for_allocation(fspace);
 
-  gc_set_pool_clear(gc->metadata->gc_rootset_pool);  
+
+  gc_set_pool_clear(gc->metadata->gc_rootset_pool);
   
   return;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_slide_compact.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_slide_compact.cpp?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_slide_compact.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_slide_compact.cpp Sat Mar 17 23:02:56 2007
@@ -110,7 +110,7 @@
 static void mspace_fix_repointed_refs(Collector* collector, Mspace* mspace)
 {
   Block_Header* curr_block = mspace_block_iterator_next(mspace);
-
+  
   /* for MAJOR_COLLECTION, we must iterate over all compact blocks */
   while( curr_block){
     block_fix_ref_after_repointing(curr_block); 
@@ -242,7 +242,7 @@
     }
     
     Partial_Reveal_Object *next_src_obj = GC_BLOCK_HEADER(first_src_obj)->next_src;
-    if(next_src_obj && GC_BLOCK_HEADER(get_obj_info_raw(next_src_obj)) != next_dest_block){
+    if(next_src_obj && GC_BLOCK_HEADER(uncompress_ref((REF)get_obj_info_raw(next_src_obj))) != next_dest_block){
       next_src_obj = NULL;
     }
     next_dest_block->src = next_src_obj;
@@ -270,7 +270,7 @@
 {
   void *start_pos;
   Block_Header *nos_fw_start_block = (Block_Header *)&mspace->blocks[mspace_free_block_idx - mspace->first_block_idx];
-  Boolean is_fallback = (collector->gc->collect_kind == FALLBACK_COLLECTION);
+  Boolean is_fallback = gc_match_kind(collector->gc, FALLBACK_COLLECTION);
   
   while(Partial_Reveal_Object *p_obj = get_next_first_src_obj(mspace)){
     Block_Header *src_block = GC_BLOCK_HEADER(p_obj);
@@ -340,13 +340,13 @@
   Lspace* lspace = (Lspace*)gc_get_los((GC_Gen*)gc);
   
   unsigned int num_active_collectors = gc->num_active_collectors;
-  
+
   /* Pass 1: **************************************************
      mark all live objects in heap, and save all the slots that 
             have references  that are going to be repointed */
   unsigned int old_num = atomic_cas32( &num_marking_collectors, 0, num_active_collectors+1);
 
-  if(gc->collect_kind != FALLBACK_COLLECTION)
+  if(!gc_match_kind(gc, FALLBACK_COLLECTION))
     mark_scan_heap(collector);
   else
     fallback_mark_scan_heap(collector);
@@ -372,7 +372,7 @@
     num_marking_collectors++; 
   }
   while(num_marking_collectors != num_active_collectors + 1);
-  
+
   /* Pass 2: **************************************************
      assign target addresses for all to-be-moved objects */
   atomic_cas32( &num_repointing_collectors, 0, num_active_collectors+1);
@@ -394,21 +394,17 @@
   }
   while(num_repointing_collectors != num_active_collectors + 1);
   if(!gc->collect_result) return;
-    
+
   /* Pass 3: **************************************************
      update all references whose objects are to be moved */  
   old_num = atomic_cas32( &num_fixing_collectors, 0, num_active_collectors+1);
-
   mspace_fix_repointed_refs(collector, mspace);
-
   old_num = atomic_inc32(&num_fixing_collectors);
   if( ++old_num == num_active_collectors ){
     /* last collector's world here */
     lspace_fix_repointed_refs(collector, lspace);
     gc_fix_rootset(collector);
-    
     gc_init_block_for_sliding_compact(gc, mspace);
-
     num_fixing_collectors++; 
   }
   while(num_fixing_collectors != num_active_collectors + 1);
@@ -421,7 +417,7 @@
   
   atomic_inc32(&num_moving_collectors);
   while(num_moving_collectors != num_active_collectors);
-  
+
   /* Pass 5: **************************************************
      restore obj_info                                         */
   atomic_cas32( &num_restoring_collectors, 0, num_active_collectors+1);
@@ -430,13 +426,13 @@
   
   old_num = atomic_inc32(&num_restoring_collectors);
   if( ++old_num == num_active_collectors ){
-    
+
     update_mspace_info_for_los_extension(mspace);
     
     num_restoring_collectors++;
   }
   while(num_restoring_collectors != num_active_collectors + 1);
-  
+
   /* Dealing with out of memory in mspace */
   if(mspace->free_block_idx > fspace->first_block_idx){
     atomic_cas32( &num_extending_collectors, 0, num_active_collectors);
@@ -446,7 +442,6 @@
     atomic_inc32(&num_extending_collectors);
     while(num_extending_collectors != num_active_collectors);
   }
-  
   if( collector->thread_handle != 0 )
     return;
   
@@ -458,7 +453,7 @@
 
   //For_LOS_extend
   mspace_restore_block_chain(mspace);
-  
+
   gc_set_pool_clear(gc->metadata->gc_rootset_pool);
   
   return;

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/free_area_pool.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/free_area_pool.h?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/free_area_pool.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/free_area_pool.h Sat Mar 17 23:02:56 2007
@@ -33,16 +33,16 @@
 
 typedef struct Lockable_Bidir_List{
   /* <-- First couple of fields overloadded as Bidir_List */
-  unsigned int zero;
+  POINTER_SIZE_INT zero;
   Bidir_List* next;
   Bidir_List* prev;
   /* END of Bidir_List --> */
-  SpinLock lock;  
+  SpinLock lock;	
 }Lockable_Bidir_List;
 
 typedef struct Free_Area{
   /* <-- First couple of fields overloadded as Bidir_List */
-  unsigned int zero;
+  POINTER_SIZE_INT zero;
   Bidir_List* next;
   Bidir_List* prev;
   /* END of Bidir_List --> */
@@ -70,7 +70,7 @@
 typedef struct Free_Area_Pool{
   Lockable_Bidir_List sized_area_list[NUM_FREE_LIST];
   /* each list corresponds to one bit in below vector */
-  unsigned int list_bit_flag[NUM_FLAG_WORDS];
+  POINTER_SIZE_INT list_bit_flag[NUM_FLAG_WORDS];
 }Free_Area_Pool;
 
 #define MAX_LIST_INDEX (NUM_FREE_LIST - 1)
@@ -120,7 +120,7 @@
   /* set bit flag of the list */
   Bidir_List* list = (Bidir_List*)&(pool->sized_area_list[index]);
   if(list->next == list){
-  	pool_list_clear_flag(pool, index);    
+  	pool_list_clear_flag(pool, index);		
   }
 }
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/lspace.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/lspace.cpp?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/lspace.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/lspace.cpp Sat Mar 17 23:02:56 2007
@@ -24,6 +24,13 @@
 struct GC_Gen;
 void gc_set_los(GC_Gen* gc, Space* lspace);
 
+/*Fixme: This macro is for handling HEAP_NULL issues caused by JIT OPT*/
+#ifdef COMPRESS_REFERENCE
+  #define LOS_HEAD_RESERVE_FOR_HEAP_NULL (4*KB)
+#else
+  #define LOS_HEAD_RESERVE_FOR_HEAP_NULL (0*KB)
+#endif
+
 void lspace_initialize(GC* gc, void* start, unsigned int lspace_size)
 {
   Lspace* lspace = (Lspace*)STD_MALLOC( sizeof(Lspace));
@@ -37,9 +44,9 @@
     vm_commit_mem(reserved_base, lspace_size);
   memset(reserved_base, 0, lspace_size);
 
-  lspace->committed_heap_size = committed_size;
-  lspace->reserved_heap_size = committed_size;
-  lspace->heap_start = reserved_base;
+  lspace->committed_heap_size = committed_size - LOS_HEAD_RESERVE_FOR_HEAP_NULL;
+  lspace->reserved_heap_size = committed_size - LOS_HEAD_RESERVE_FOR_HEAP_NULL;
+  lspace->heap_start = (void*)((POINTER_SIZE_INT)reserved_base + LOS_HEAD_RESERVE_FOR_HEAP_NULL);
   lspace->heap_end = (void *)((POINTER_SIZE_INT)reserved_base + committed_size);
 
   lspace->move_object = FALSE;

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.cpp?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.cpp Sat Mar 17 23:02:56 2007
@@ -61,12 +61,12 @@
 /* TO_REMOVE
 
   assert(collector->rep_set==NULL);
-  if( !gc_is_gen_mode() || collector->gc->collect_kind != MINOR_COLLECTION){
+  if( !gc_is_gen_mode() || !gc_match_kind(collector->gc, MINOR_COLLECTION)){
     collector->rep_set = free_set_pool_get_entry(metadata);
   }
 */
   
-  if(gc_is_gen_mode() && collector->gc->collect_kind==MINOR_COLLECTION && NOS_PARTIAL_FORWARD){
+  if(gc_is_gen_mode() && gc_match_kind(collector->gc, MINOR_COLLECTION) && NOS_PARTIAL_FORWARD){
     assert(collector->rem_set==NULL);
     collector->rem_set = free_set_pool_get_entry(metadata);
   }
@@ -102,9 +102,9 @@
 static void assign_collector_with_task(GC* gc, TaskType task_func, Space* space)
 {
   /* FIXME:: to adaptively identify the num_collectors_to_activate */
-  if( MINOR_COLLECTORS && gc->collect_kind == MINOR_COLLECTION){
+  if( MINOR_COLLECTORS && gc_match_kind(gc, MINOR_COLLECTION)){
     gc->num_active_collectors = MINOR_COLLECTORS;      
-  }else if ( MAJOR_COLLECTORS && gc->collect_kind != MINOR_COLLECTION){
+  }else if ( MAJOR_COLLECTORS && !gc_match_kind(gc, MINOR_COLLECTION)){
     gc->num_active_collectors = MAJOR_COLLECTORS;  
   }else{
     gc->num_active_collectors = gc->num_collectors;

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?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- 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 Sat Mar 17 23:02:56 2007
@@ -31,7 +31,7 @@
   Obj_Info_Type oi = get_obj_info_raw(p_obj);
 
   /* forwarded by somebody else */
-  if ((POINTER_SIZE_INT)oi & FORWARD_BIT){
+  if (oi & FORWARD_BIT){
      return NULL;
   }
   
@@ -50,7 +50,8 @@
     
   /* else, take the obj by setting the forwarding flag atomically 
      we don't put a simple bit in vt because we need compute obj size later. */
-  if ((void*)oi != atomic_casptr((volatile void**)get_obj_info_addr(p_obj), (void*)((POINTER_SIZE_INT)p_targ_obj|FORWARD_BIT), (void*)oi)) {
+  REF target = compress_ref(p_targ_obj);
+  if (oi != (Obj_Info_Type)atomic_cas32(get_obj_info_addr(p_obj), ( ( (POINTER_SIZE_INT)target |FORWARD_BIT)), oi)) {
     /* forwarded by other, we need unalloc the allocated obj. We may waste some space if the allocation switched
        block. The remaining part of the switched block cannot be revivied for next allocation of 
        object that has smaller size than this one. */

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?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- 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 Sat Mar 17 23:02:56 2007
@@ -73,9 +73,9 @@
   
   if( p_obj == NULL ) return NULL;
     
-  obj_set_vt((Partial_Reveal_Object*)p_obj, ah);
+  obj_set_vt((Partial_Reveal_Object*)p_obj, (VT)ah);
   
-  if(!IGNORE_FINREF && type_has_finalizer((Partial_Reveal_VTable *)ah))
+  if(!IGNORE_FINREF && type_has_finalizer( (Partial_Reveal_VTable *) uncompress_vt((VT)ah) ))
     mutator_add_finalizer((Mutator*)allocator, (Partial_Reveal_Object*)p_obj);
     
   return (Managed_Object_Handle)p_obj;
@@ -88,14 +88,14 @@
   assert((size % GC_OBJECT_ALIGNMENT) == 0);
   assert(ah);
   
-  if(type_has_finalizer((Partial_Reveal_VTable *)ah))
+  if(type_has_finalizer((Partial_Reveal_VTable *) uncompress_vt((VT)ah)))
     return NULL;
 
 #ifdef GC_OBJ_SIZE_STATISTIC
   gc_alloc_statistic_obj_distrubution(size);
 #endif
   
-  /* object should be handled specially */
+  /* object shoud be handled specially */
   if ( size > GC_OBJ_SIZE_THRESHOLD ) return NULL;
  
   Allocator* allocator = (Allocator*)gc_get_tls();
@@ -105,7 +105,7 @@
   p_obj = (Managed_Object_Handle)thread_local_alloc(size, allocator);
   if(p_obj == NULL) return NULL;
    
-  obj_set_vt((Partial_Reveal_Object*)p_obj, ah);
+  obj_set_vt((Partial_Reveal_Object*)p_obj, (VT)ah);
   
   return p_obj;
 }

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?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- 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 Sat Mar 17 23:02:56 2007
@@ -101,7 +101,7 @@
   unsigned int first_idx = fspace->first_block_idx;
   unsigned int marked_start_idx = 0; //was for oi markbit reset, now useless
   unsigned int marked_last_idx = 0;
-  Boolean is_major_collection = (fspace->gc->collect_kind != MINOR_COLLECTION);
+  Boolean is_major_collection = !gc_match_kind(fspace->gc, MINOR_COLLECTION);
   Boolean gen_mode = gc_is_gen_mode();
 
   if(  is_major_collection || 

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?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- 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 Sat Mar 17 23:02:56 2007
@@ -23,6 +23,7 @@
 #include "../thread/collector.h"
 #include "../common/gc_metadata.h"
 #include "../finalizer_weakref/finalizer_weakref.h"
+#include "../common/compressed_ref.h"
 
 static FORCE_INLINE Boolean fspace_object_to_be_forwarded(Partial_Reveal_Object *p_obj, Fspace *fspace)
 {
@@ -30,13 +31,14 @@
   return forward_first_half? (p_obj < object_forwarding_boundary):(p_obj>=object_forwarding_boundary);
 }
 
-static FORCE_INLINE void scan_slot(Collector* collector, Partial_Reveal_Object **p_ref) 
+static FORCE_INLINE void scan_slot(Collector *collector, REF *p_ref) 
 {
-  Partial_Reveal_Object *p_obj = *p_ref;
-  if (p_obj == NULL) return;  
+  REF ref = *p_ref;
+  if(ref == COMPRESSED_NULL) return;
     
   /* the slot can be in tspace or fspace, we don't care.
      we care only if the reference in the slot is pointing to fspace */
+  Partial_Reveal_Object *p_obj = uncompress_ref(ref);
   if (obj_belongs_to_nos(p_obj))
     collector_tracestack_push(collector, p_ref); 
 
@@ -47,7 +49,7 @@
 {
   if (!object_has_ref_field(p_obj)) return;
     
-  void *slot;
+  REF *p_ref;
 
   /* scan array object */
   if (object_is_array(p_obj)) {
@@ -56,8 +58,8 @@
 
     int32 array_length = vector_get_length((Vector_Handle) array);        
     for (int i = 0; i < array_length; i++) {
-      slot = vector_get_element_address_ref((Vector_Handle) array, i);
-      scan_slot(collector, (Partial_Reveal_Object **)slot);
+      p_ref= (REF *)vector_get_element_address_ref((Vector_Handle) array, i);
+      scan_slot(collector, p_ref);
     }   
     return;
   }
@@ -65,10 +67,10 @@
   /* scan non-array object */
   int *offset_scanner = init_object_scanner(p_obj);
   while (true) {
-    slot = offset_get_ref(offset_scanner, p_obj);
-    if (slot == NULL) break;
+    p_ref = (REF *)offset_get_ref(offset_scanner, p_obj);
+    if (p_ref == NULL) break;
   
-    scan_slot(collector, (Partial_Reveal_Object **)slot);
+    scan_slot(collector, p_ref);
     offset_scanner = offset_next_ref(offset_scanner);
   }
 
@@ -90,17 +92,18 @@
 
 #include "../verify/verify_live_heap.h"
 
-static FORCE_INLINE void forward_object(Collector* collector, Partial_Reveal_Object **p_ref) 
+static FORCE_INLINE void forward_object(Collector *collector, REF *p_ref) 
 {
   Space* space = collector->collect_space; 
   GC* gc = collector->gc;
-  Partial_Reveal_Object *p_obj = *p_ref;
+  Partial_Reveal_Object *p_obj = read_slot(p_ref);
 
   if(!obj_belongs_to_nos(p_obj)) return; 
 
   /* Fastpath: object has already been forwarded, update the ref slot */
   if(obj_is_fw_in_oi(p_obj)) {
-    *p_ref = obj_get_fw_in_oi(p_obj);
+    Partial_Reveal_Object* p_target_obj = obj_get_fw_in_oi(p_obj);
+    write_slot(p_ref, p_target_obj);
     return;
   }
 
@@ -110,7 +113,7 @@
     /* this obj remains in fspace, remember its ref slot for next GC if p_ref is not root. 
        we don't need remember root ref. Actually it's wrong to rem root ref since they change in next GC */
     if( !addr_belongs_to_nos(p_ref) && address_belongs_to_gc_heap(p_ref, gc))
-      collector_remset_add_entry(collector, p_ref); 
+      collector_remset_add_entry(collector, ( Partial_Reveal_Object**) p_ref); 
     
     if(obj_mark_in_oi(p_obj)) 
       scan_object(collector, p_obj);
@@ -136,28 +139,24 @@
 
     Partial_Reveal_Object *p_new_obj = obj_get_fw_in_oi(p_obj);
     assert(p_new_obj);
-    *p_ref = p_new_obj;
+    write_slot(p_ref, p_new_obj);
     return;
   }  
   /* otherwise, we successfully forwarded */
-  *p_ref = p_target_obj;
+  write_slot(p_ref, p_target_obj);
 
-  /* we forwarded it, we need remember it for verification. */
-  if(verify_live_heap) {
-    event_collector_move_obj(p_obj, p_target_obj, collector);
-  }
 
   scan_object(collector, p_target_obj); 
   return;
 }
 
-static void trace_object(Collector* collector, Partial_Reveal_Object **p_ref)
+static void trace_object(Collector *collector, REF *p_ref)
 { 
   forward_object(collector, p_ref);
   
   Vector_Block* trace_stack = (Vector_Block*)collector->trace_stack;
   while( !vector_stack_is_empty(trace_stack)){
-    p_ref = (Partial_Reveal_Object **)vector_stack_pop(trace_stack); 
+    p_ref = (REF *)vector_stack_pop(trace_stack); 
     forward_object(collector, p_ref);
     trace_stack = (Vector_Block*)collector->trace_stack;
   }
@@ -186,10 +185,12 @@
   while(root_set){
     POINTER_SIZE_INT* iter = vector_block_iterator_init(root_set);
     while(!vector_block_iterator_end(root_set,iter)){
-      Partial_Reveal_Object** p_ref = (Partial_Reveal_Object** )*iter;
+      REF *p_ref = (REF *)*iter;
       iter = vector_block_iterator_advance(root_set,iter);
-      if(*p_ref == NULL) continue;  /* root ref cann't be NULL, but remset can be */
-      if(obj_belongs_to_nos(*p_ref)){
+      
+      if(!*p_ref) continue;  /* root ref cann't be NULL, but remset can be */
+      Partial_Reveal_Object *p_obj = read_slot(p_ref);
+      if(obj_belongs_to_nos(p_obj)){
         collector_tracestack_push(collector, p_ref);
       }
     } 
@@ -207,7 +208,7 @@
   while(trace_task){    
     POINTER_SIZE_INT* iter = vector_block_iterator_init(trace_task);
     while(!vector_block_iterator_end(trace_task,iter)){
-      Partial_Reveal_Object** p_ref = (Partial_Reveal_Object** )*iter;
+      REF *p_ref = (REF *)*iter;
       iter = vector_block_iterator_advance(trace_task,iter);
       assert(*p_ref); /* a task can't be NULL, it was checked before put into the task stack */
       /* in sequential version, we only trace same object once, but we were using a local hashset for that,
@@ -259,10 +260,17 @@
   if( collector->thread_handle != 0 ) return;
 
   gc->collect_result = gc_collection_result(gc);
-  if(!gc->collect_result) return;
+  if(!gc->collect_result){
+#ifndef BUILD_IN_REFERENT
+    fallback_finref_cleanup(gc);
+#endif
+    return;
+  }
 
-  if(!IGNORE_FINREF )
+  if(!IGNORE_FINREF ){
     collector_identify_finref(collector);
+    if(!gc->collect_result) return;
+  }
 #ifndef BUILD_IN_REFERENT
   else {
       gc_set_weakref_sets(gc);
@@ -280,5 +288,5 @@
 
 void trace_obj_in_gen_fw(Collector *collector, void *p_ref)
 {
-  trace_object(collector, (Partial_Reveal_Object **)p_ref);
+  trace_object(collector, (REF *)p_ref);
 }

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?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- 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 Sat Mar 17 23:02:56 2007
@@ -27,11 +27,11 @@
 
 #ifdef MARK_BIT_FLIPPING
 
-static FORCE_INLINE void scan_slot(Collector* collector, Partial_Reveal_Object **p_ref) 
+static FORCE_INLINE void scan_slot(Collector *collector, REF *p_ref)
 {
-  Partial_Reveal_Object *p_obj = *p_ref;
-  if(p_obj == NULL) return;  
-    
+  REF ref = *p_ref;
+  if(ref == COMPRESSED_NULL) return;
+  
   collector_tracestack_push(collector, p_ref); 
   return;
 }
@@ -40,13 +40,13 @@
 {
   if (!object_has_ref_field_before_scan(p_obj)) return;
     
-  Partial_Reveal_Object **p_ref;
+  REF *p_ref;
 
   if (object_is_array(p_obj)) {   /* scan array object */
   
     Partial_Reveal_Array* array = (Partial_Reveal_Array*)p_obj;
     unsigned int array_length = array->array_len; 
-    p_ref = (Partial_Reveal_Object**)((POINTER_SIZE_INT)array + (int)array_first_element_offset(array));
+    p_ref = (REF *)((POINTER_SIZE_INT)array + (int)array_first_element_offset(array));
 
     for (unsigned int i = 0; i < array_length; i++) {
       scan_slot(collector, p_ref+i);
@@ -81,10 +81,10 @@
 */
 
 #include "../verify/verify_live_heap.h"
-static FORCE_INLINE void forward_object(Collector* collector, Partial_Reveal_Object **p_ref) 
+static FORCE_INLINE void forward_object(Collector* collector, REF *p_ref) 
 {
   GC* gc = collector->gc;
-  Partial_Reveal_Object *p_obj = *p_ref;
+  Partial_Reveal_Object *p_obj = read_slot(p_ref);
 
   if(!obj_belongs_to_nos(p_obj)){
     if(obj_mark_in_oi(p_obj))
@@ -110,11 +110,11 @@
 
     Partial_Reveal_Object *p_new_obj = obj_get_fw_in_oi(p_obj);
     assert(p_new_obj);
-    *p_ref = p_new_obj;
+    write_slot(p_ref, p_new_obj);
     return;
   }
   /* otherwise, we successfully forwarded */
-  *p_ref = p_target_obj;
+  write_slot(p_ref, p_target_obj);
 
   /* we forwarded it, we need remember it for verification. */
   if(verify_live_heap) {
@@ -125,13 +125,13 @@
   return;
 }
 
-static void trace_object(Collector* collector, Partial_Reveal_Object **p_ref)
+static void trace_object(Collector *collector, REF *p_ref)
 { 
   forward_object(collector, p_ref);
 
   Vector_Block* trace_stack = (Vector_Block*)collector->trace_stack;
   while( !vector_stack_is_empty(trace_stack)){
-    p_ref = (Partial_Reveal_Object **)vector_stack_pop(trace_stack); 
+    p_ref = (REF *)vector_stack_pop(trace_stack); 
     forward_object(collector, p_ref);
     trace_stack = (Vector_Block*)collector->trace_stack;
   }
@@ -159,11 +159,10 @@
   while(root_set){
     POINTER_SIZE_INT* iter = vector_block_iterator_init(root_set);
     while(!vector_block_iterator_end(root_set,iter)){
-      Partial_Reveal_Object** p_ref = (Partial_Reveal_Object** )*iter;
-      iter = vector_block_iterator_advance(root_set,iter);
+      REF *p_ref = (REF *)*iter;
+      iter = vector_block_iterator_advance(root_set, iter);
 
-      Partial_Reveal_Object* p_obj = *p_ref;
-      assert(p_obj != NULL);  /* root ref cann't be NULL, but remset can be */
+      assert(*p_ref);  /* root ref cann't be NULL, but remset can be */
 
       collector_tracestack_push(collector, p_ref);
     } 
@@ -181,8 +180,8 @@
   while(trace_task){    
     POINTER_SIZE_INT* iter = vector_block_iterator_init(trace_task);
     while(!vector_block_iterator_end(trace_task,iter)){
-      Partial_Reveal_Object** p_ref = (Partial_Reveal_Object** )*iter;
-      iter = vector_block_iterator_advance(trace_task,iter);
+      REF *p_ref = (REF *)*iter;
+      iter = vector_block_iterator_advance(trace_task, iter);
       trace_object(collector, p_ref);
       
       if(collector->result == FALSE)  break; /* force return */
@@ -230,10 +229,17 @@
   if( collector->thread_handle != 0 ) return;
 
   gc->collect_result = gc_collection_result(gc);
-  if(!gc->collect_result) return;
+  if(!gc->collect_result){
+#ifndef BUILD_IN_REFERENT
+    fallback_finref_cleanup(gc);
+#endif
+    return;
+  }
 
-  if(!IGNORE_FINREF )
+  if(!IGNORE_FINREF ){
     collector_identify_finref(collector);
+    if(!gc->collect_result) return;
+  }
 #ifndef BUILD_IN_REFERENT
   else {
       gc_set_weakref_sets(gc);
@@ -251,7 +257,7 @@
 
 void trace_obj_in_nongen_fw(Collector *collector, void *p_ref)
 {
-  trace_object(collector, (Partial_Reveal_Object **)p_ref);
+  trace_object(collector, (REF*)p_ref);
 }
 
 #endif /* MARK_BIT_FLIPPING */

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?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- 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 Sat Mar 17 23:02:56 2007
@@ -23,32 +23,29 @@
 
 #include "../common/gc_common.h"
 
-inline unsigned int word_get_first_set_lsb(unsigned int target_word)
+inline unsigned int word_get_first_set_lsb(POINTER_SIZE_INT target_word)
 {
   assert(target_word != 0);
-  unsigned int bit_offset;
-
-#ifdef _EM64T_
+  POINTER_SIZE_INT bit_offset;
 
-#else /* ifdef _EM64T_*/
 #ifdef PLATFORM_POSIX  /* POSIX Platform*/
-  __asm__ __volatile__(
-    "bsf %1,%0\n"
-    :"=r"(bit_offset)
-    :"m"(target_word)
-  );
+    __asm__ __volatile__(
+      "bsf %1,%0\n"
+      :"=r"(bit_offset)
+      :"m"(target_word)
+    );
 #else /*WIN32 Platform*/
-  __asm{
-    bsf eax, target_word
-    mov bit_offset, eax
-  }
+    __asm{
+      bsf eax, target_word
+      mov bit_offset, eax
+    }
 #endif /* ifdef PLATFORM_POSIX else*/
-#endif /* ifdef _EM64T_ else */
-  return bit_offset;
+
+  return (unsigned int)bit_offset;
 
 }
 
-inline unsigned int words_get_next_set_lsb(unsigned int* words, unsigned int count, unsigned int start_idx)
+inline unsigned int words_get_next_set_lsb(POINTER_SIZE_INT* words, unsigned int count, unsigned int start_idx)
 {
   unsigned int bit_offset;
   
@@ -59,10 +56,10 @@
   
   bit_offset = start_idx - start_bit_offset;
   for(unsigned int i = start_word_index; i < count; i ++ ){
-    unsigned int cur_word = *(words + i);
+    POINTER_SIZE_INT cur_word = *(words + i);
     
     if(start_word_index == i){
-      unsigned int mask = ~((1 << start_bit_offset) - 1);
+      POINTER_SIZE_INT mask = ~(((POINTER_SIZE_INT)1 << start_bit_offset) - 1);
       cur_word = cur_word & mask;
     }
   
@@ -71,32 +68,32 @@
        return bit_offset;
      }
      
-     bit_offset += 32;
+     bit_offset += BITS_PER_WORD;
    }
   
   return bit_offset;
 }
 
-inline void words_set_bit(unsigned int* words, unsigned int count, unsigned int start_idx)
+inline void words_set_bit(POINTER_SIZE_INT* words, unsigned int count, unsigned int start_idx)
 {
   assert(start_idx < 128);
   
-  unsigned int word_index = start_idx >> BIT_SHIFT_TO_BITS_PER_WORD;  
+  unsigned int word_index = start_idx >> BIT_SHIFT_TO_BITS_PER_WORD;
   unsigned int bit_offset = start_idx & BIT_MASK_TO_BITS_PER_WORD;
   
   if(word_index >= count) return;
   
-  unsigned int* p_word = words + word_index;
-  unsigned int old_value = *p_word;
-  unsigned int mask = 1 << bit_offset;
-  unsigned int new_value = old_value|mask;
+  POINTER_SIZE_INT* p_word = words + word_index;
+  POINTER_SIZE_INT old_value = *p_word;
+  POINTER_SIZE_INT mask = (POINTER_SIZE_INT)1 << bit_offset;
+  POINTER_SIZE_INT new_value = old_value|mask;
   
   *p_word = new_value;
   
   return;
 }
 
-inline void words_clear_bit(unsigned int* words, unsigned int count, unsigned int start_idx)
+inline void words_clear_bit(POINTER_SIZE_INT* words, unsigned int count, unsigned int start_idx)
 {
   assert(start_idx < 128);
   
@@ -105,10 +102,10 @@
   
   if(word_index >= count) return;
   
-  unsigned int* p_word = words + word_index;
-  unsigned int old_value = *p_word;
-  unsigned int mask = ~(1 << bit_offset);
-  unsigned int new_value = old_value & mask;
+  POINTER_SIZE_INT* p_word = words + word_index;
+  POINTER_SIZE_INT old_value = *p_word;
+  POINTER_SIZE_INT mask = ~((POINTER_SIZE_INT)1 << bit_offset);
+  POINTER_SIZE_INT new_value = old_value & mask;
   
   *p_word = new_value;
   

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?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- 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 Sat Mar 17 23:02:56 2007
@@ -26,20 +26,20 @@
 struct Queue_Node;
 
 typedef struct Queue_Link{
-	struct Queue_Node* ptr;
-	unsigned int count;
+  struct Queue_Node* ptr;
+  unsigned int count;
 }Queue_Link;
 
 typedef struct Queue_Node{
-	__declspec(align(8))
-	Queue_Link next; /* must be aligned to 8Byte*/
-	unsigned int* value;
+  __declspec(align(8))
+  Queue_Link next; /* must be aligned to 8Byte*/
+  unsigned int* value;
 }Queue_Node;
 
 typedef struct Sync_Queue{
-	__declspec(align(8)) 
-	Queue_Link head; /* must be aligned to 8Byte*/
-	Queue_Link tail; 
+  __declspec(align(8)) 
+  Queue_Link head; /* must be aligned to 8Byte*/
+  Queue_Link tail; 
 }Sync_Queue;
 
 inline Queue_Node * new_queue_node()
@@ -56,9 +56,9 @@
 {
   Queue_Node *node = new_queue_node();
   node->next.ptr = NULL;
-	node->next.count = 0;
+  node->next.count = 0;
   queue->head.ptr = queue->tail.ptr = node;
-	queue->head.count = queue->tail.count = 0;
+  queue->head.count = queue->tail.count = 0;
   return;
 }
 
@@ -67,64 +67,63 @@
 
 inline void sync_queue_push(Sync_Queue* queue, unsigned int* value)
 {
-	Queue_Link tail, next, tmp1, tmp2;
-	Queue_Node* node = new_queue_node();
-	node->value = value;
-	node->next.ptr = NULL;
-	while(TRUE){
-  	QLINK_VAL(tail) = QLINK_VAL(queue->tail);
-  	QLINK_VAL(next) = QLINK_VAL(tail.ptr->next);
-  	if( QLINK_VAL(tail) == QLINK_VAL(queue->tail)){
-    	if( next.ptr==NULL ){
-      	tmp1.ptr = node;
-      	tmp1.count = next.count + 1;
-      	node->next.count = tmp1.count; 
-      	QLINK_VAL(tmp2) = atomic_cas64(QLINK_PTR(tail.ptr->next), QLINK_VAL(next), QLINK_VAL(tmp1))
-      	if( QLINK_VAL(tmp1) == QLINK_VAL(tmp2))
+  Queue_Link tail, next, tmp1, tmp2;
+  Queue_Node* node = new_queue_node();
+  node->value = value;
+  node->next.ptr = NULL;
+  while(TRUE){
+    QLINK_VAL(tail) = QLINK_VAL(queue->tail);
+    QLINK_VAL(next) = QLINK_VAL(tail.ptr->next);
+    if( QLINK_VAL(tail) == QLINK_VAL(queue->tail)){
+      if( next.ptr==NULL ){
+        tmp1.ptr = node;
+        tmp1.count = next.count + 1;
+        node->next.count = tmp1.count; 
+        QLINK_VAL(tmp2) = atomic_cas64(QLINK_PTR(tail.ptr->next), QLINK_VAL(next), QLINK_VAL(tmp1))
+        if( QLINK_VAL(tmp1) == QLINK_VAL(tmp2))
           break;
-          
       }else{
-      	tmp1.ptr = next.ptr;
-      	tmp1.count = tail.count + 1;
-      	atomic_cas64(QLINK_PTR(queue->tail), QLINK_VAL(tail), QLINK_VAL(tmp1));
+        tmp1.ptr = next.ptr;
+        tmp1.count = tail.count + 1;
+        atomic_cas64(QLINK_PTR(queue->tail), QLINK_VAL(tail), QLINK_VAL(tmp1));
       }
     }
   }
-	tmp1.ptr = node;
-	tmp1.count = tail.count + 1;
-	atomic_cas64(QLINK_PTR(queue->tail), QLINK_VAL(tail), QLINK_VAL(tmp1));
-	return;
+  tmp1.ptr = node;
+  tmp1.count = tail.count + 1;
+  atomic_cas64(QLINK_PTR(queue->tail), QLINK_VAL(tail), QLINK_VAL(tmp1));
+  return;
 }
 
 Boolean sync_queue_pull(Sync_Queue* queue, unsigned int * pvalue)
 {
-	Queue_Link head, tail, next, tmp1, tmp2;
-	while(TRUE){
-  	QLINK_VAL(head) = QLINK_VAL(queue->head);
-  	QLINK_VAL(tail) = QLINK_VAL(queue->tail);
-  	QLINK_VAL(next) = QLINK_VAL(head.ptr->next);
-    
-  	if( QLINK_VAL(head) == QLINK_VAL(queue->head)){
-    	if( head.ptr== tail.ptr )
+  Queue_Link head, tail, next, tmp1, tmp2;
+  while(TRUE){
+    QLINK_VAL(head) = QLINK_VAL(queue->head);
+    QLINK_VAL(tail) = QLINK_VAL(queue->tail);
+    QLINK_VAL(next) = QLINK_VAL(head.ptr->next);
+
+    if( QLINK_VAL(head) == QLINK_VAL(queue->head)){
+      if( head.ptr== tail.ptr )
       	if( next.ptr == NULL )
-        	return FALSE;
+        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{
+        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));
-      	if( QLINK_VAL(tmp2) == QLINK_VAL(tmp1))
-        	break;
-      }
+        tmp1.ptr = next.ptr;
+        tmp1.count = head.count+1;
+        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;
+  free( head.ptr );
+  return TRUE;
 }
-  
+	
 #endif /* _SYNC_QUEUE_H_ */

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/sync_stack.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/sync_stack.h?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/sync_stack.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/utils/sync_stack.h Sat Mar 17 23:02:56 2007
@@ -106,9 +106,8 @@
   
   while( top_entry != NULL ){
     POINTER_SIZE_INT temp = stack_top_contruct(top_entry->next, version);
-    Stack_Top new_top = *(Stack_Top*)&temp;
-    temp = (POINTER_SIZE_INT)atomic_casptr((volatile void**)&stack->top, *(void**)&new_top, *(void**)&cur_top);
-    if(temp == *(POINTER_SIZE_INT*)&cur_top){ /* got it */ 
+    temp = (POINTER_SIZE_INT)atomic_casptr((volatile void**)&stack->top, (void*)temp, (void*)cur_top);
+    if(temp == *(POINTER_SIZE_INT*)&cur_top){ // got it  
       top_entry->next = NULL;
       return top_entry;
     }
@@ -125,20 +124,18 @@
   node->next = stack_top_get_entry(cur_top);
   POINTER_SIZE_INT new_version = stack_top_get_next_version(cur_top);
   POINTER_SIZE_INT temp = stack_top_contruct(node, new_version);
-  Stack_Top new_top = *(Stack_Top*)&temp;
-  
+ 
   while( TRUE ){
-    temp = (POINTER_SIZE_INT)atomic_casptr((volatile void**)&stack->top, *(void**)&new_top, *(void**)&cur_top);
-    if(temp == *(POINTER_SIZE_INT*)&cur_top){ /* got it */  
+    temp = (POINTER_SIZE_INT)atomic_casptr((volatile void**)&stack->top, (void*)temp, (void*)cur_top);
+    if(temp == *(POINTER_SIZE_INT*)&cur_top){ // got it   
       return TRUE;
     }
     cur_top = stack->top;
     node->next = stack_top_get_entry(cur_top);
     new_version = stack_top_get_next_version(cur_top);
     temp = stack_top_contruct(node, new_version);
-    new_top = *(Stack_Top*)&temp;
   }
-  /* never comes here */
+  // never comes here 
   return FALSE;
 }
 

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?view=diff&rev=519564&r1=519563&r2=519564
==============================================================================
--- 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 Sat Mar 17 23:02:56 2007
@@ -48,7 +48,6 @@
 inline unsigned int vector_block_entry_count(Vector_Block* block)
 { return (unsigned int)(block->tail - block->head); }
 
-
 inline Boolean vector_block_is_full(Vector_Block* block)
 { return block->tail == block->heap_end; }
 
@@ -77,7 +76,7 @@
   block->head = (POINTER_SIZE_INT*)block->entries;
   block->tail = (POINTER_SIZE_INT*)block->entries;
 #ifdef _DEBUG
- memset(block->entries, 0, (POINTER_SIZE_INT)block->heap_end - (POINTER_SIZE_INT)block->entries);
+  memset(block->entries, 0, (POINTER_SIZE_INT)block->heap_end - (POINTER_SIZE_INT)block->entries);
 #endif
 }
 



Mime
View raw message