vm: fix crash in profiler
							parent
							
								
									279d1169d2
								
							
						
					
					
						commit
						84e191704e
					
				| 
						 | 
					@ -50,7 +50,7 @@ template<typename Visitor> struct code_block_visitor {
 | 
				
			||||||
				if(w->code)
 | 
									if(w->code)
 | 
				
			||||||
					w->code = visitor(w->code);
 | 
										w->code = visitor(w->code);
 | 
				
			||||||
				if(w->profiling)
 | 
									if(w->profiling)
 | 
				
			||||||
					w->code = visitor(w->profiling);
 | 
										w->profiling = visitor(w->profiling);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
				parent->update_word_xt(w);
 | 
									parent->update_word_xt(w);
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -183,11 +183,8 @@ template<typename TargetGeneration, typename Policy> struct collector {
 | 
				
			||||||
			cell *slot_ptr = (cell *)start;
 | 
								cell *slot_ptr = (cell *)start;
 | 
				
			||||||
			cell *end_ptr = (cell *)end;
 | 
								cell *end_ptr = (cell *)end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if(slot_ptr != end_ptr)
 | 
								for(; slot_ptr < end_ptr; slot_ptr++)
 | 
				
			||||||
			{
 | 
									workhorse.visit_handle(slot_ptr);
 | 
				
			||||||
				for(; slot_ptr < end_ptr; slot_ptr++)
 | 
					 | 
				
			||||||
					workhorse.visit_handle(slot_ptr);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,17 +25,16 @@ void factor_vm::set_profiling(bool profiling)
 | 
				
			||||||
	if(profiling == profiling_p)
 | 
						if(profiling == profiling_p)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	profiling_p = profiling;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Push everything to tenured space so that we can heap scan
 | 
						/* Push everything to tenured space so that we can heap scan
 | 
				
			||||||
	and allocate profiling blocks if necessary */
 | 
						and allocate profiling blocks if necessary */
 | 
				
			||||||
	primitive_full_gc();
 | 
						primitive_full_gc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	data_root<array> words(find_all_words(),this);
 | 
						data_root<array> words(find_all_words(),this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cell i;
 | 
						profiling_p = profiling;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cell length = array_capacity(words.untagged());
 | 
						cell length = array_capacity(words.untagged());
 | 
				
			||||||
	for(i = 0; i < length; i++)
 | 
						for(cell i = 0; i < length; i++)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		tagged<word> word(array_nth(words.untagged(),i));
 | 
							tagged<word> word(array_nth(words.untagged(),i));
 | 
				
			||||||
		if(profiling)
 | 
							if(profiling)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,18 +8,14 @@ template<typename Visitor> struct slot_visitor {
 | 
				
			||||||
	explicit slot_visitor<Visitor>(factor_vm *parent_, Visitor visitor_) :
 | 
						explicit slot_visitor<Visitor>(factor_vm *parent_, Visitor visitor_) :
 | 
				
			||||||
		parent(parent_), visitor(visitor_) {}
 | 
							parent(parent_), visitor(visitor_) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cell visit_pointer(cell pointer)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		object *untagged = untag<object>(pointer);
 | 
					 | 
				
			||||||
		untagged = visitor(untagged);
 | 
					 | 
				
			||||||
		return RETAG(untagged,TAG(pointer));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	void visit_handle(cell *handle)
 | 
						void visit_handle(cell *handle)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		cell pointer = *handle;
 | 
							cell pointer = *handle;
 | 
				
			||||||
		if(!immediate_p(pointer))
 | 
							if(immediate_p(pointer)) return;
 | 
				
			||||||
			*handle = visit_pointer(pointer);
 | 
					
 | 
				
			||||||
 | 
							object *untagged = untag<object>(pointer);
 | 
				
			||||||
 | 
							untagged = visitor(untagged);
 | 
				
			||||||
 | 
							*handle = RETAG(untagged,TAG(pointer));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void visit_slots(object *ptr, cell payload_start)
 | 
						void visit_slots(object *ptr, cell payload_start)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue