harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r464099 - in /incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src: collect.cpp collect.h collect_slide_compact.cpp
Date Sun, 15 Oct 2006 02:33:51 GMT
Author: geirm
Date: Sat Oct 14 19:33:49 2006
New Revision: 464099

URL: http://svn.apache.org/viewvc?view=rev&rev=464099
Log:
HARMONY-1762

Weak references processing is splited into 2 phases on compaction algorithm.
1 phase: check reachability of referent, remember the reference or referent for update during
compaction.
2 phase: vm_enqueue_reference() if the referent is not reachable.

Algorithm of enumeration is the following:
enumerate world
enumerate (phase1) process weak and soft references
enumerate finalizible objects.
compaction
enqueue weak and soft references
....

Enumeration of finalizible objects may add more weak references which was not enumerated,
but which will be enqueued. 
This is the enumeration problem.

Ubuntu 6 - smoke, c-unit, ~kernel, testcase


Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/collect.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/collect.h
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/collect_slide_compact.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/collect.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/collect.cpp?view=diff&rev=464099&r1=464098&r2=464099
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/collect.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/collect.cpp Sat Oct 14 19:33:49 2006
@@ -216,6 +216,7 @@
         TRACE2("gc.ref", "process_special_references: reference enquequed");
         vm_enqueue_reference((Managed_Object_Handle)ref);
     }
+    array.clear();
 }
 
 // scan only finalizible object, without enqueue
@@ -230,9 +231,9 @@
     notify_gc_start(); 
 
     object_count = 0;
-    soft_references.clear();
-    weak_references.clear();
-    phantom_references.clear();
+    assert (soft_references.empty());
+    assert (weak_references.empty());
+    assert (phantom_references.empty());
     soft_refs = weak_refs = phantom_refs = 0;
 }
 
@@ -276,13 +277,13 @@
         gc_slide_process_special_references(weak_references);
         process_finalizable_objects();
     }
+    gc_slide_process_special_references(soft_references);
+    gc_slide_process_special_references(weak_references);
     gc_slide_process_special_references(phantom_references);
 
     TIME(gc_slide_move_all,());
     roots_update();
-    gc_slide_postprocess_special_references(soft_references);
-    gc_slide_postprocess_special_references(weak_references);
-    gc_slide_postprocess_special_references(phantom_references);
+    gc_slide_postprocess_special_references();
     gc_deallocate_mark_bits();
     finalize_objects();
 
@@ -345,6 +346,8 @@
         heap.Tcopy = (float) gc_time.dt();
         return res;
     }
+    process_special_references(soft_references);
+    process_special_references(weak_references);
     process_special_references(phantom_references);
     roots_update();
     finalize_objects();
@@ -374,6 +377,8 @@
     TIME(process_special_references,(soft_references));
     TIME(process_special_references,(weak_references));
     TIME(process_finalizable_objects,());
+    TIME(process_special_references,(soft_references));
+    TIME(process_special_references,(weak_references));
     TIME(process_special_references,(phantom_references));
     roots_update();
     TIME(finalize_objects,());

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/collect.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/collect.h?view=diff&rev=464099&r1=464098&r2=464099
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/collect.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/collect.h Sat Oct 14 19:33:49 2006
@@ -77,7 +77,7 @@
 void gc_slide_add_root_set_entry(Slot slot);
 void gc_slide_move_all();
 void gc_slide_process_special_references(reference_vector& array);
-void gc_slide_postprocess_special_references(reference_vector& array);
+void gc_slide_postprocess_special_references();
 
 void transition_copy_to_sliding_compaction(fast_list<Slot,65536>& slots);
 void gc_slide_process_transitional_slots(fast_list<Slot,65536>& slots);

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/collect_slide_compact.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/collect_slide_compact.cpp?view=diff&rev=464099&r1=464098&r2=464099
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/collect_slide_compact.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/collect_slide_compact.cpp Sat Oct
14 19:33:49 2006
@@ -32,6 +32,7 @@
 unsigned char *mark_bits;
 int mark_bits_size;
 fast_list<Partial_Reveal_Object*, 65536> objects;
+reference_vector references_to_enqueue;
 
 static inline bool
 is_compaction_object(Partial_Reveal_Object *refobj) {
@@ -603,7 +604,8 @@
 
         // object not marked, clear reference
         slot.write((Partial_Reveal_Object*) heap_null);
-        Slot root = make_direct_root(&*i);
+        references_to_enqueue.push_back(obj);
+        Slot root = make_direct_root(&references_to_enqueue.back());
 
         if (is_forwarded_object(obj)) {
             update_forwarded_reference(obj, root);
@@ -611,16 +613,18 @@
             enqueue_reference(obj, root);
         }
     }
+    array.clear();
 }
 
-void gc_slide_postprocess_special_references(reference_vector& array) {
-    for(reference_vector::iterator i = array.begin();
-            i != array.end(); ++i) {
+void gc_slide_postprocess_special_references() {
+    for(reference_vector::iterator i = references_to_enqueue.begin();
+            i != references_to_enqueue.end(); ++i) {
         Partial_Reveal_Object *obj = *i;
 
-        if (obj == heap_null) continue;
+        assert (obj != heap_null);
         vm_enqueue_reference((Managed_Object_Handle)obj);
     }
+    references_to_enqueue.clear();
 }
 
 // transition from coping collector code



Mime
View raw message