Exemple #1
0
void factor_vm::primitive_inline_cache_stats()
{
	growable_array stats(this);
	stats.add(allot_cell(cold_call_to_ic_transitions));
	stats.add(allot_cell(ic_to_pic_transitions));
	stats.add(allot_cell(pic_to_mega_transitions));
	cell i;
	for(i = 0; i < 4; i++)
		stats.add(allot_cell(pic_counts[i]));
	stats.trim();
	dpush(stats.elements.value());
}
Exemple #2
0
/* Allocates memory */
F_COMPILED *compile_profiling_stub(F_WORD *word)
{
	CELL literals = allot_array_1(tag_object(word));
	REGISTER_ROOT(literals);

	F_ARRAY *quadruple = untag_object(userenv[JIT_PROFILING]);

	CELL code = array_nth(quadruple,0);
	REGISTER_ROOT(code);

	CELL rel_type = allot_cell(to_fixnum(array_nth(quadruple,2))
		| (to_fixnum(array_nth(quadruple,1)) << 8));
	CELL rel_offset = array_nth(quadruple,3) * compiled_code_format();

	CELL relocation = allot_array_2(rel_type,rel_offset);

	UNREGISTER_ROOT(code);
	UNREGISTER_ROOT(literals);

	return add_compiled_block(
		WORD_TYPE,
		untag_object(code),
		NULL, /* no labels */
		untag_object(relocation),
		untag_object(literals));
}
Exemple #3
0
void memory_protection_error(cell addr, stack_frame *native_stack)
{
	if(in_page(addr, ds_bot, 0, -1))
		general_error(ERROR_DS_UNDERFLOW,F,F,native_stack);
	else if(in_page(addr, ds_bot, ds_size, 0))
		general_error(ERROR_DS_OVERFLOW,F,F,native_stack);
	else if(in_page(addr, rs_bot, 0, -1))
		general_error(ERROR_RS_UNDERFLOW,F,F,native_stack);
	else if(in_page(addr, rs_bot, rs_size, 0))
		general_error(ERROR_RS_OVERFLOW,F,F,native_stack);
	else if(in_page(addr, nursery.end, 0, 0))
		critical_error("allot_object() missed GC check",0);
	else
		general_error(ERROR_MEMORY,allot_cell(addr),F,native_stack);
}
Exemple #4
0
void memory_protection_error(CELL addr, F_STACK_FRAME *native_stack)
{
	if(in_page(addr, ds_bot, 0, -1))
		general_error(ERROR_DS_UNDERFLOW,F,F,native_stack);
	else if(in_page(addr, ds_bot, ds_size, 0))
		general_error(ERROR_DS_OVERFLOW,F,F,native_stack);
	else if(in_page(addr, rs_bot, 0, -1))
		general_error(ERROR_RS_UNDERFLOW,F,F,native_stack);
	else if(in_page(addr, rs_bot, rs_size, 0))
		general_error(ERROR_RS_OVERFLOW,F,F,native_stack);
	else if(in_page(addr, nursery.end, 0, 0))
		critical_error("allot_object() missed GC check",0);
	else if(in_page(addr, gc_locals_region->start, 0, -1))
		critical_error("gc locals underflow",0);
	else if(in_page(addr, gc_locals_region->end, 0, 0))
		critical_error("gc locals overflow",0);
	else if(in_page(addr, extra_roots_region->start, 0, -1))
		critical_error("extra roots underflow",0);
	else if(in_page(addr, extra_roots_region->end, 0, 0))
		critical_error("extra roots overflow",0);
	else
		general_error(ERROR_MEMORY,allot_cell(addr),F,native_stack);
}
Exemple #5
0
/* address of an object representing a C pointer. Explicitly throw an error
if the object is a byte array, as a sanity check. */
void factor_vm::primitive_alien_address()
{
	ctx->push(allot_cell((cell)pinned_alien_offset(ctx->pop())));
}
Exemple #6
0
void factor_vm::primitive_size()
{
	ctx->push(allot_cell(object_size(ctx->pop())));
}
Exemple #7
0
void factor_vm::signal_error(int signal, stack_frame *native_stack)
{
    general_error(ERROR_SIGNAL,allot_cell(signal),false_object,native_stack);
}