示例#1
0
void throw_error(cell error, stack_frame *callstack_top)
{
	/* If the error handler is set, we rewind any C stack frames and
	pass the error to user-space. */
	if(userenv[BREAK_ENV] != F)
	{
		/* If error was thrown during heap scan, we re-enable the GC */
		gc_off = false;

		/* Reset local roots */
		gc_locals = gc_locals_region->start - sizeof(cell);
		gc_bignums = gc_bignums_region->start - sizeof(cell);

		/* If we had an underflow or overflow, stack pointers might be
		out of bounds */
		fix_stacks();

		dpush(error);

		/* Errors thrown from C code pass NULL for this parameter.
		Errors thrown from Factor code, or signal handlers, pass the
		actual stack pointer at the time, since the saved pointer is
		not necessarily up to date at that point. */
		if(callstack_top)
		{
			callstack_top = fix_callstack_top(callstack_top,
				stack_chain->callstack_bottom);
		}
		else
			callstack_top = stack_chain->callstack_top;

		throw_impl(userenv[BREAK_ENV],callstack_top);
	}
	/* Error was thrown in early startup before error handler is set, just
	crash. */
	else
	{
		print_string("You have triggered a bug in Factor. Please report.\n");
		print_string("early_error: ");
		print_obj(error);
		nl();
		factorbug();
	}
}
示例#2
0
void factor_vm::throw_error(cell error, stack_frame *callstack_top)
{
    /* If the error handler is set, we rewind any C stack frames and
    pass the error to user-space. */
    if(!current_gc && to_boolean(special_objects[OBJ_BREAK]))
    {
        /* If error was thrown during heap scan, we re-enable the GC */
        gc_off = false;

        /* Reset local roots */
        data_roots.clear();
        bignum_roots.clear();
        code_roots.clear();

        /* If we had an underflow or overflow, stack pointers might be
        out of bounds */
        fix_stacks();

        dpush(error);

        /* Errors thrown from C code pass NULL for this parameter.
        Errors thrown from Factor code, or signal handlers, pass the
        actual stack pointer at the time, since the saved pointer is
        not necessarily up to date at that point. */
        if(callstack_top)
            callstack_top = fix_callstack_top(callstack_top,ctx->callstack_bottom);
        else
            callstack_top = ctx->callstack_top;

        throw_impl(special_objects[OBJ_BREAK],callstack_top,this);
    }
    /* Error was thrown in early startup before error handler is set, just
    crash. */
    else
    {
        std::cout << "You have triggered a bug in Factor. Please report.\n";
        std::cout << "early_error: ";
        print_obj(error);
        std::cout << std::endl;
        factorbug();
    }
}
示例#3
0
文件: errors.c 项目: ehird/factor
void primitive_call_clear(void)
{
	throw_impl(dpop(),stack_chain->callstack_bottom);
}
示例#4
0
void factor_vm::primitive_call_clear()
{
    throw_impl(dpop(),ctx->callstack_bottom,this);
}