| 
									
										
										
										
											2009-10-07 16:48:09 -04:00
										 |  |  | #include "master.hpp"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace factor | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-23 19:51:08 -05:00
										 |  |  | to_tenured_collector::to_tenured_collector(factor_vm *parent_) : | 
					
						
							| 
									
										
										
										
											2009-10-20 23:20:49 -04:00
										 |  |  | 	collector<tenured_space,to_tenured_policy>( | 
					
						
							| 
									
										
										
										
											2009-11-23 19:51:08 -05:00
										 |  |  | 		parent_, | 
					
						
							|  |  |  | 		parent_->data->tenured, | 
					
						
							|  |  |  | 		to_tenured_policy(parent_)) {} | 
					
						
							| 
									
										
										
										
											2009-10-07 16:48:09 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-20 23:20:49 -04:00
										 |  |  | void to_tenured_collector::tenure_reachable_objects() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-11-23 19:51:08 -05:00
										 |  |  | 	std::vector<cell> *mark_stack = &parent->mark_stack; | 
					
						
							| 
									
										
										
										
											2009-10-20 23:20:49 -04:00
										 |  |  | 	while(!mark_stack->empty()) | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2009-11-23 19:51:08 -05:00
										 |  |  | 		cell ptr = mark_stack->back(); | 
					
						
							| 
									
										
										
										
											2009-10-20 23:20:49 -04:00
										 |  |  | 		mark_stack->pop_back(); | 
					
						
							| 
									
										
										
										
											2009-11-23 19:51:08 -05:00
										 |  |  | 		this->trace_object((object *)ptr); | 
					
						
							| 
									
										
										
										
											2009-10-20 23:20:49 -04:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-08 03:10:28 -04:00
										 |  |  | void factor_vm::collect_to_tenured() | 
					
						
							| 
									
										
										
										
											2009-10-07 16:48:09 -04:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-10-16 03:55:02 -04:00
										 |  |  | 	/* Copy live objects from aging space to tenured space. */ | 
					
						
							| 
									
										
										
										
											2009-10-08 03:10:28 -04:00
										 |  |  | 	to_tenured_collector collector(this); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-23 19:51:08 -05:00
										 |  |  | 	mark_stack.clear(); | 
					
						
							| 
									
										
										
										
											2009-10-21 20:41:54 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-08 03:10:28 -04:00
										 |  |  | 	collector.trace_roots(); | 
					
						
							|  |  |  | 	collector.trace_contexts(); | 
					
						
							| 
									
										
										
										
											2009-10-27 00:57:26 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-04 16:21:45 -04:00
										 |  |  | 	gc_event *event = current_gc->event; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if(event) event->started_card_scan(); | 
					
						
							| 
									
										
										
										
											2009-10-09 02:37:45 -04:00
										 |  |  | 	collector.trace_cards(data->tenured, | 
					
						
							|  |  |  | 		card_points_to_aging, | 
					
						
							| 
									
										
										
										
											2009-10-30 04:15:50 -04:00
										 |  |  | 		full_unmarker()); | 
					
						
							| 
									
										
										
										
											2010-09-04 16:21:45 -04:00
										 |  |  | 	if(event) event->ended_card_scan(collector.cards_scanned,collector.decks_scanned); | 
					
						
							| 
									
										
										
										
											2009-10-27 00:57:26 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-04 16:21:45 -04:00
										 |  |  | 	if(event) event->started_code_scan(); | 
					
						
							| 
									
										
										
										
											2009-10-09 00:10:32 -04:00
										 |  |  | 	collector.trace_code_heap_roots(&code->points_to_aging); | 
					
						
							| 
									
										
										
										
											2010-09-04 16:21:45 -04:00
										 |  |  | 	if(event) event->ended_code_scan(collector.code_blocks_scanned); | 
					
						
							| 
									
										
										
										
											2009-10-27 00:57:26 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-20 23:20:49 -04:00
										 |  |  | 	collector.tenure_reachable_objects(); | 
					
						
							| 
									
										
										
										
											2009-10-27 00:57:26 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-21 20:41:54 -04:00
										 |  |  | 	data->reset_generation(&nursery); | 
					
						
							| 
									
										
										
										
											2009-10-20 14:13:39 -04:00
										 |  |  | 	data->reset_generation(data->aging); | 
					
						
							| 
									
										
										
										
											2009-10-21 20:41:54 -04:00
										 |  |  | 	code->clear_remembered_set(); | 
					
						
							| 
									
										
										
										
											2009-10-07 16:48:09 -04:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |