VM: the aging_policy and nursery_policy classes are so small that they
can be in the same cpp file with the methods that use themdb4
							parent
							
								
									e4bb3058e0
								
							
						
					
					
						commit
						0a6486ef78
					
				| 
						 | 
				
			
			@ -115,8 +115,6 @@ ifdef CONFIG
 | 
			
		|||
		vm/callstack.hpp \
 | 
			
		||||
		vm/slot_visitor.hpp \
 | 
			
		||||
		vm/collector.hpp \
 | 
			
		||||
		vm/nursery_collector.hpp \
 | 
			
		||||
		vm/aging_collector.hpp \
 | 
			
		||||
		vm/to_tenured_collector.hpp \
 | 
			
		||||
		vm/full_collector.hpp \
 | 
			
		||||
		vm/arrays.hpp \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,25 @@
 | 
			
		|||
 | 
			
		||||
namespace factor {
 | 
			
		||||
 | 
			
		||||
struct aging_policy {
 | 
			
		||||
  factor_vm* parent;
 | 
			
		||||
  aging_space* aging;
 | 
			
		||||
  tenured_space* tenured;
 | 
			
		||||
 | 
			
		||||
  explicit aging_policy(factor_vm* parent)
 | 
			
		||||
      : parent(parent),
 | 
			
		||||
        aging(parent->data->aging),
 | 
			
		||||
        tenured(parent->data->tenured) {}
 | 
			
		||||
 | 
			
		||||
  bool should_copy_p(object* untagged) {
 | 
			
		||||
    return !(aging->contains_p(untagged) || tenured->contains_p(untagged));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void promoted_object(object* obj) {}
 | 
			
		||||
 | 
			
		||||
  void visited_object(object* obj) {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void factor_vm::collect_aging() {
 | 
			
		||||
  /* Promote objects referenced from tenured space to tenured space, copy
 | 
			
		||||
     everything else to the aging semi-space, and reset the nursery pointer. */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,22 +0,0 @@
 | 
			
		|||
namespace factor {
 | 
			
		||||
 | 
			
		||||
struct aging_policy {
 | 
			
		||||
  factor_vm* parent;
 | 
			
		||||
  aging_space* aging;
 | 
			
		||||
  tenured_space* tenured;
 | 
			
		||||
 | 
			
		||||
  explicit aging_policy(factor_vm* parent)
 | 
			
		||||
      : parent(parent),
 | 
			
		||||
        aging(parent->data->aging),
 | 
			
		||||
        tenured(parent->data->tenured) {}
 | 
			
		||||
 | 
			
		||||
  bool should_copy_p(object* untagged) {
 | 
			
		||||
    return !(aging->contains_p(untagged) || tenured->contains_p(untagged));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void promoted_object(object* obj) {}
 | 
			
		||||
 | 
			
		||||
  void visited_object(object* obj) {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -135,8 +135,6 @@ namespace factor { struct factor_vm; }
 | 
			
		|||
#include "callstack.hpp"
 | 
			
		||||
#include "slot_visitor.hpp"
 | 
			
		||||
#include "collector.hpp"
 | 
			
		||||
#include "nursery_collector.hpp"
 | 
			
		||||
#include "aging_collector.hpp"
 | 
			
		||||
#include "to_tenured_collector.hpp"
 | 
			
		||||
#include "full_collector.hpp"
 | 
			
		||||
#include "arrays.hpp"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,20 @@
 | 
			
		|||
 | 
			
		||||
namespace factor {
 | 
			
		||||
 | 
			
		||||
struct nursery_policy {
 | 
			
		||||
  factor_vm* parent;
 | 
			
		||||
 | 
			
		||||
  explicit nursery_policy(factor_vm* parent) : parent(parent) {}
 | 
			
		||||
 | 
			
		||||
  bool should_copy_p(object* obj) {
 | 
			
		||||
    return parent->data->nursery->contains_p(obj);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void promoted_object(object* obj) {}
 | 
			
		||||
 | 
			
		||||
  void visited_object(object* obj) {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
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. */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,17 +0,0 @@
 | 
			
		|||
namespace factor {
 | 
			
		||||
 | 
			
		||||
struct nursery_policy {
 | 
			
		||||
  factor_vm* parent;
 | 
			
		||||
 | 
			
		||||
  explicit nursery_policy(factor_vm* parent) : parent(parent) {}
 | 
			
		||||
 | 
			
		||||
  bool should_copy_p(object* obj) {
 | 
			
		||||
    return parent->data->nursery->contains_p(obj);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void promoted_object(object* obj) {}
 | 
			
		||||
 | 
			
		||||
  void visited_object(object* obj) {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue