moved global state from data_gc into vm
							parent
							
								
									80716a1b6e
								
							
						
					
					
						commit
						3025cef1c6
					
				| 
						 | 
				
			
			@ -3,36 +3,6 @@
 | 
			
		|||
namespace factor
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
/* used during garbage collection only */
 | 
			
		||||
zone *newspace;
 | 
			
		||||
bool performing_gc;
 | 
			
		||||
bool performing_compaction;
 | 
			
		||||
cell collecting_gen;
 | 
			
		||||
 | 
			
		||||
/* if true, we are collecting aging space for the second time, so if it is still
 | 
			
		||||
full, we go on to collect tenured */
 | 
			
		||||
bool collecting_aging_again;
 | 
			
		||||
 | 
			
		||||
/* in case a generation fills up in the middle of a gc, we jump back
 | 
			
		||||
up to try collecting the next generation. */
 | 
			
		||||
jmp_buf gc_jmp;
 | 
			
		||||
 | 
			
		||||
gc_stats stats[max_gen_count];
 | 
			
		||||
u64 cards_scanned;
 | 
			
		||||
u64 decks_scanned;
 | 
			
		||||
u64 card_scan_time;
 | 
			
		||||
cell code_heap_scans;
 | 
			
		||||
 | 
			
		||||
/* What generation was being collected when copy_code_heap_roots() was last
 | 
			
		||||
called? Until the next call to add_code_block(), future
 | 
			
		||||
collections of younger generations don't have to touch the code
 | 
			
		||||
heap. */
 | 
			
		||||
cell last_code_heap_scan;
 | 
			
		||||
 | 
			
		||||
/* sometimes we grow the heap */
 | 
			
		||||
bool growing_data_heap;
 | 
			
		||||
data_heap *old_data_heap;
 | 
			
		||||
 | 
			
		||||
void factorvm::init_data_gc()
 | 
			
		||||
{
 | 
			
		||||
	performing_gc = false;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,14 +10,6 @@ struct gc_stats {
 | 
			
		|||
	u64 bytes_copied;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
extern zone *newspace;
 | 
			
		||||
 | 
			
		||||
extern bool performing_compaction;
 | 
			
		||||
extern cell collecting_gen;
 | 
			
		||||
extern bool collecting_aging_again;
 | 
			
		||||
 | 
			
		||||
extern cell last_code_heap_scan;
 | 
			
		||||
 | 
			
		||||
void init_data_gc();
 | 
			
		||||
 | 
			
		||||
void gc();
 | 
			
		||||
| 
						 | 
				
			
			@ -41,8 +33,6 @@ void clear_gc_stats();
 | 
			
		|||
PRIMITIVE(clear_gc_stats);
 | 
			
		||||
PRIMITIVE(become);
 | 
			
		||||
 | 
			
		||||
extern bool growing_data_heap;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
VM_ASM_API void inline_gc(cell *gc_roots_base, cell gc_roots_size);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										30
									
								
								vm/vm.hpp
								
								
								
								
							
							
						
						
									
										30
									
								
								vm/vm.hpp
								
								
								
								
							| 
						 | 
				
			
			@ -170,6 +170,36 @@ struct factorvm {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
	//data_gc
 | 
			
		||||
	/* used during garbage collection only */
 | 
			
		||||
	zone *newspace;
 | 
			
		||||
	bool performing_gc;
 | 
			
		||||
	bool performing_compaction;
 | 
			
		||||
	cell collecting_gen;
 | 
			
		||||
 | 
			
		||||
	/* if true, we collecting aging space for the second time, so if it is still
 | 
			
		||||
	   full, we go on to collect tenured */
 | 
			
		||||
	bool collecting_aging_again;
 | 
			
		||||
 | 
			
		||||
	/* in case a generation fills up in the middle of a gc, we jump back
 | 
			
		||||
	   up to try collecting the next generation. */
 | 
			
		||||
	jmp_buf gc_jmp;
 | 
			
		||||
 | 
			
		||||
	gc_stats stats[max_gen_count];
 | 
			
		||||
	u64 cards_scanned;
 | 
			
		||||
	u64 decks_scanned;
 | 
			
		||||
	u64 card_scan_time;
 | 
			
		||||
	cell code_heap_scans;
 | 
			
		||||
 | 
			
		||||
	/* What generation was being collected when copy_code_heap_roots() was last
 | 
			
		||||
	   called? Until the next call to add_code_block(), future
 | 
			
		||||
	   collections of younger generations don't have to touch the code
 | 
			
		||||
	   heap. */
 | 
			
		||||
	cell last_code_heap_scan;
 | 
			
		||||
 | 
			
		||||
	/* sometimes we grow the heap */
 | 
			
		||||
	bool growing_data_heap;
 | 
			
		||||
	data_heap *old_data_heap;
 | 
			
		||||
 | 
			
		||||
	void init_data_gc();
 | 
			
		||||
	object *copy_untagged_object_impl(object *pointer, cell size);
 | 
			
		||||
	object *copy_object_impl(object *untagged);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue