]> gitweb.factorcode.org Git - factor.git/commitdiff
VM: the copying_collector only contained one method, so it can easily be
authorBjörn Lindqvist <bjourne@gmail.com>
Mon, 4 May 2015 01:50:02 +0000 (03:50 +0200)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 10 May 2015 03:04:21 +0000 (20:04 -0700)
merged with its base class

GNUmakefile
vm/aging_collector.cpp
vm/collector.hpp
vm/copying_collector.hpp [deleted file]
vm/master.hpp
vm/nursery_collector.cpp
vm/vm.hpp

index 8bb924a995c2ca03175b5fc20cd492d16a9a949e..2089b0787a147030e1500d78682e9f5dd42723d6 100644 (file)
@@ -115,7 +115,6 @@ ifdef CONFIG
                vm/callstack.hpp \
                vm/slot_visitor.hpp \
                vm/collector.hpp \
-               vm/copying_collector.hpp \
                vm/nursery_collector.hpp \
                vm/aging_collector.hpp \
                vm/to_tenured_collector.hpp \
index cd6b031383d796efdf01a1ecbebf3bbd5462dd58..0765409d90821687a3003e6401f8b00e54c3d282 100644 (file)
@@ -36,9 +36,9 @@ void factor_vm::collect_aging() {
     std::swap(data->aging, data->aging_semispace);
     data->reset_aging();
 
-    copying_collector<aging_space, aging_policy> collector(this,
-                                                           this->data->aging,
-                                                           aging_policy(this));
+    collector<aging_space, aging_policy> collector(this,
+                                                   this->data->aging,
+                                                   aging_policy(this));
 
     collector.visitor.visit_all_roots();
     collector.cheneys_algorithm();
index ce8b6445b8d5ab0ae92524ffd9d2067c67cd3688..791446e9fee1f77c66a41e2eed892b4526ee8000 100644 (file)
@@ -69,6 +69,7 @@ template <typename TargetGeneration, typename Policy> struct collector {
   cell cards_scanned;
   cell decks_scanned;
   cell code_blocks_scanned;
+  cell scan;
 
   collector(factor_vm* parent, TargetGeneration* target, Policy policy)
       : parent(parent),
@@ -79,7 +80,9 @@ template <typename TargetGeneration, typename Policy> struct collector {
         visitor(parent, workhorse),
         cards_scanned(0),
         decks_scanned(0),
-        code_blocks_scanned(0) {}
+        code_blocks_scanned(0) {
+    scan = target->start + target->occupied_space();
+  }
 
   void trace_code_heap_roots(std::set<code_block*>* remembered_set) {
     std::set<code_block*>::const_iterator iter = remembered_set->begin();
@@ -173,6 +176,13 @@ template <typename TargetGeneration, typename Policy> struct collector {
       }
     }
   }
+
+  void cheneys_algorithm() {
+    while (scan && scan < this->target->here) {
+      this->visitor.visit_object((object*)scan);
+      scan = this->target->next_object_after(scan);
+    }
+  }
 };
 
 }
diff --git a/vm/copying_collector.hpp b/vm/copying_collector.hpp
deleted file mode 100644 (file)
index 911363f..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace factor {
-
-template <typename TargetGeneration, typename Policy>
-struct copying_collector : collector<TargetGeneration, Policy> {
-  cell scan;
-
-  copying_collector(factor_vm* parent, TargetGeneration* target,
-                    Policy policy)
-      : collector<TargetGeneration, Policy>(parent, target, policy),
-        scan(target->here) {}
-
-  void cheneys_algorithm() {
-    while (scan && scan < this->target->here) {
-      this->visitor.visit_object((object*)scan);
-      scan = this->target->next_object_after(scan);
-    }
-  }
-};
-
-}
index 2110ddd230e5428b25127ce37d24fd1578bd00c4..27e823252f749b8dfac3640eae77266280716be1 100644 (file)
@@ -135,7 +135,6 @@ namespace factor { struct factor_vm; }
 #include "callstack.hpp"
 #include "slot_visitor.hpp"
 #include "collector.hpp"
-#include "copying_collector.hpp"
 #include "nursery_collector.hpp"
 #include "aging_collector.hpp"
 #include "to_tenured_collector.hpp"
index 72c7df0eabd6d48e4aa3b5471b0b9d2793d1c738..2ba4937c8eb17b2be1f7c869a3895ee99c06f360 100644 (file)
@@ -5,9 +5,9 @@ namespace factor {
 void factor_vm::collect_nursery() {
   /* Copy live objects from the nursery (as determined by the root set and
      marked cards in aging and tenured) to aging space. */
-  copying_collector<aging_space, nursery_policy> collector(this,
-                                                           this->data->aging,
-                                                           nursery_policy(this));
+  collector<aging_space, nursery_policy> collector(this,
+                                                   this->data->aging,
+                                                   nursery_policy(this));
 
   collector.visitor.visit_all_roots();
   gc_event* event = current_gc->event;
index a6988c2de5440ecfaa5f9586be346b95b21f8a56..efc3ea06e6f1b14c86610ec5d1a5f337ea231fca 100644 (file)
--- a/vm/vm.hpp
+++ b/vm/vm.hpp
@@ -355,7 +355,6 @@ struct factor_vm {
   void end_gc();
   void set_current_gc_op(gc_op op);
   void start_gc_again();
-  void update_code_heap_for_minor_gc(std::set<code_block*>* remembered_set);
   void collect_nursery();
   void collect_aging();
   void collect_to_tenured();