vm: More allocates comments.
							parent
							
								
									dbfa185eef
								
							
						
					
					
						commit
						86649ce1c0
					
				| 
						 | 
				
			
			@ -324,8 +324,8 @@ bignum *factor_vm::bignum_remainder(bignum * numerator, bignum * denominator)
 | 
			
		|||
		}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
/* cell_to_bignum, fixnum_to_bignum, long_long_to_bignum, ulong_long_to_bignum */
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
#define FOO_TO_BIGNUM(name,type,stype,utype)				\
 | 
			
		||||
bignum * factor_vm::name##_to_bignum(type n)				\
 | 
			
		||||
{									\
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -167,6 +167,7 @@ struct object_accumulator {
 | 
			
		|||
	}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
cell factor_vm::instances(cell type)
 | 
			
		||||
{
 | 
			
		||||
	object_accumulator accum(type);
 | 
			
		||||
| 
						 | 
				
			
			@ -174,6 +175,7 @@ cell factor_vm::instances(cell type)
 | 
			
		|||
	return std_vector_to_array(accum.objects);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
void factor_vm::primitive_all_instances()
 | 
			
		||||
{
 | 
			
		||||
	primitive_full_gc();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -81,6 +81,7 @@ void factor_vm::init_parameters_from_args(vm_parameters *p, int argc, vm_char **
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
/* Compile code in boot image so that we can execute the startup quotation */
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
void factor_vm::prepare_boot_image()
 | 
			
		||||
{
 | 
			
		||||
	std::cout << "*** Stage 2 early init... " << std::flush;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -474,6 +474,7 @@ double factor_vm::to_double(cell value)
 | 
			
		|||
 | 
			
		||||
/* The fixnum+, fixnum- and fixnum* primitives are defined in cpu_*.S. On
 | 
			
		||||
overflow, they call these functions. */
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
inline void factor_vm::overflow_fixnum_add(fixnum x, fixnum y)
 | 
			
		||||
{
 | 
			
		||||
	ctx->replace(tag<bignum>(fixnum_to_bignum(
 | 
			
		||||
| 
						 | 
				
			
			@ -485,6 +486,7 @@ VM_C_API void overflow_fixnum_add(fixnum x, fixnum y, factor_vm *parent)
 | 
			
		|||
	parent->overflow_fixnum_add(x,y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
inline void factor_vm::overflow_fixnum_subtract(fixnum x, fixnum y)
 | 
			
		||||
{
 | 
			
		||||
	ctx->replace(tag<bignum>(fixnum_to_bignum(
 | 
			
		||||
| 
						 | 
				
			
			@ -496,6 +498,7 @@ VM_C_API void overflow_fixnum_subtract(fixnum x, fixnum y, factor_vm *parent)
 | 
			
		|||
	parent->overflow_fixnum_subtract(x,y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
inline void factor_vm::overflow_fixnum_multiply(fixnum x, fixnum y)
 | 
			
		||||
{
 | 
			
		||||
	bignum *bx = fixnum_to_bignum(x);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,6 +47,7 @@ void factor_vm::primitive_set_slot()
 | 
			
		|||
	write_barrier(slot_ptr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
cell factor_vm::clone_object(cell obj_)
 | 
			
		||||
{
 | 
			
		||||
	data_root<object> obj(obj_,this);
 | 
			
		||||
| 
						 | 
				
			
			@ -63,6 +64,7 @@ cell factor_vm::clone_object(cell obj_)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
void factor_vm::primitive_clone()
 | 
			
		||||
{
 | 
			
		||||
	ctx->replace(clone_object(ctx->peek()));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -156,6 +156,7 @@ void quotation_jit::emit_epilog(bool safepoint, bool stack_frame)
 | 
			
		|||
	if(stack_frame) emit(parent->special_objects[JIT_EPILOG]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory conditionally */
 | 
			
		||||
void quotation_jit::emit_quot(cell quot_)
 | 
			
		||||
{
 | 
			
		||||
	data_root<quotation> quot(quot_,parent);
 | 
			
		||||
| 
						 | 
				
			
			@ -341,6 +342,7 @@ code_block *factor_vm::jit_compile_quot(cell owner_, cell quot_, bool relocating
 | 
			
		|||
	return compiled;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
void factor_vm::jit_compile_quot(cell quot_, bool relocating)
 | 
			
		||||
{
 | 
			
		||||
	data_root<quotation> quot(quot_,this);
 | 
			
		||||
| 
						 | 
				
			
			@ -351,6 +353,7 @@ void factor_vm::jit_compile_quot(cell quot_, bool relocating)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
void factor_vm::primitive_jit_compile()
 | 
			
		||||
{
 | 
			
		||||
	jit_compile_quot(ctx->pop(),true);
 | 
			
		||||
| 
						 | 
				
			
			@ -361,8 +364,8 @@ void *factor_vm::lazy_jit_compile_entry_point()
 | 
			
		|||
	return untag<word>(special_objects[LAZY_JIT_COMPILE_WORD])->entry_point;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
/* push a new quotation on the stack */
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
void factor_vm::primitive_array_to_quotation()
 | 
			
		||||
{
 | 
			
		||||
	quotation *quot = allot<quotation>(sizeof(quotation));
 | 
			
		||||
| 
						 | 
				
			
			@ -398,6 +401,7 @@ fixnum factor_vm::quot_code_offset_to_scan(cell quot_, cell offset)
 | 
			
		|||
	return compiler.get_position();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
cell factor_vm::lazy_jit_compile(cell quot_)
 | 
			
		||||
{
 | 
			
		||||
	data_root<quotation> quot(quot_,this);
 | 
			
		||||
| 
						 | 
				
			
			@ -410,6 +414,7 @@ cell factor_vm::lazy_jit_compile(cell quot_)
 | 
			
		|||
	return quot.value();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
VM_C_API cell lazy_jit_compile(cell quot, factor_vm *parent)
 | 
			
		||||
{
 | 
			
		||||
	return parent->lazy_jit_compile(quot);
 | 
			
		||||
| 
						 | 
				
			
			@ -427,11 +432,13 @@ void factor_vm::primitive_quot_compiled_p()
 | 
			
		|||
	ctx->push(tag_boolean(quot_compiled_p(quot.untagged())));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
cell factor_vm::find_all_quotations()
 | 
			
		||||
{
 | 
			
		||||
	return instances(QUOTATION_TYPE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
void factor_vm::initialize_all_quotations()
 | 
			
		||||
{
 | 
			
		||||
	data_root<array> quotations(find_all_quotations(),this);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,8 @@
 | 
			
		|||
namespace factor
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
/* push a new tuple on the stack, filling its slots with f */
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
void factor_vm::primitive_tuple()
 | 
			
		||||
{
 | 
			
		||||
	data_root<tuple_layout> layout(ctx->pop(),this);
 | 
			
		||||
| 
						 | 
				
			
			@ -16,8 +16,8 @@ void factor_vm::primitive_tuple()
 | 
			
		|||
	ctx->push(t.value());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
/* push a new tuple on the stack, filling its slots from the stack */
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
void factor_vm::primitive_tuple_boa()
 | 
			
		||||
{
 | 
			
		||||
	data_root<tuple_layout> layout(ctx->pop(),this);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,8 @@
 | 
			
		|||
namespace factor
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
/* Compile a word definition with the non-optimizing compiler. Allocates memory */
 | 
			
		||||
/* Compile a word definition with the non-optimizing compiler. */
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
void factor_vm::jit_compile_word(cell word_, cell def_, bool relocating)
 | 
			
		||||
{
 | 
			
		||||
	data_root<word> word(word_,this);
 | 
			
		||||
| 
						 | 
				
			
			@ -21,11 +22,13 @@ void factor_vm::jit_compile_word(cell word_, cell def_, bool relocating)
 | 
			
		|||
	if(to_boolean(word->pic_tail_def)) jit_compile_quot(word->pic_tail_def,relocating);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
cell factor_vm::find_all_words()
 | 
			
		||||
{
 | 
			
		||||
	return instances(WORD_TYPE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocates memory */
 | 
			
		||||
void factor_vm::compile_all_words()
 | 
			
		||||
{
 | 
			
		||||
	data_root<array> words(find_all_words(),this);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue