From beb71ce49b25c1091db45a91a19a31998c8096d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Tue, 4 Aug 2015 00:06:57 +0200 Subject: [PATCH] VM: merge full_collector.hpp into full_collector.cpp --- GNUmakefile | 1 - vm/full_collector.cpp | 22 ++++++++++++++++++++++ vm/full_collector.hpp | 25 ------------------------- vm/master.hpp | 1 - 4 files changed, 22 insertions(+), 27 deletions(-) delete mode 100644 vm/full_collector.hpp diff --git a/GNUmakefile b/GNUmakefile index e5a6d5dee8..e98dbd07af 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -115,7 +115,6 @@ ifdef CONFIG vm/slot_visitor.hpp \ vm/collector.hpp \ vm/to_tenured_collector.hpp \ - vm/full_collector.hpp \ vm/arrays.hpp \ vm/math.hpp \ vm/byte_arrays.hpp \ diff --git a/vm/full_collector.cpp b/vm/full_collector.cpp index f3bc39870a..ce693a8170 100644 --- a/vm/full_collector.cpp +++ b/vm/full_collector.cpp @@ -2,6 +2,28 @@ namespace factor { +struct full_policy { + factor_vm* parent; + tenured_space* tenured; + + explicit full_policy(factor_vm* parent) + : parent(parent), tenured(parent->data->tenured) {} + + bool should_copy_p(object* untagged) { + return !tenured->contains_p(untagged); + } + + void promoted_object(object* obj) { + tenured->state.set_marked_p((cell)obj, obj->size()); + parent->mark_stack.push_back((cell)obj); + } + + void visited_object(object* obj) { + if (!tenured->state.marked_p((cell)obj)) + promoted_object(obj); + } +}; + /* After a sweep, invalidate any code heap roots which are not marked, so that if a block makes a tail call to a generic word, and the PIC compiler triggers a GC, and the caller block gets GCd as a result, diff --git a/vm/full_collector.hpp b/vm/full_collector.hpp deleted file mode 100644 index 80dd59a33b..0000000000 --- a/vm/full_collector.hpp +++ /dev/null @@ -1,25 +0,0 @@ -namespace factor { - -struct full_policy { - factor_vm* parent; - tenured_space* tenured; - - explicit full_policy(factor_vm* parent) - : parent(parent), tenured(parent->data->tenured) {} - - bool should_copy_p(object* untagged) { - return !tenured->contains_p(untagged); - } - - void promoted_object(object* obj) { - tenured->state.set_marked_p((cell)obj, obj->size()); - parent->mark_stack.push_back((cell)obj); - } - - void visited_object(object* obj) { - if (!tenured->state.marked_p((cell)obj)) - promoted_object(obj); - } -}; - -} diff --git a/vm/master.hpp b/vm/master.hpp index a657093fdf..90ec5e595d 100644 --- a/vm/master.hpp +++ b/vm/master.hpp @@ -133,7 +133,6 @@ namespace factor { struct factor_vm; } #include "slot_visitor.hpp" #include "collector.hpp" #include "to_tenured_collector.hpp" -#include "full_collector.hpp" #include "arrays.hpp" #include "math.hpp" #include "byte_arrays.hpp"