예제 #1
0
파일: contexts.cpp 프로젝트: doublec/factor
void context::reset()
{
	reset_datastack();
	reset_retainstack();
	reset_callstack();
	reset_context_objects();
}
예제 #2
0
/* called on entry into a compiled callback */
void factor_vm::nest_stacks(stack_frame *magic_frame)
{
	context *new_ctx = alloc_context();

	new_ctx->callstack_bottom = (stack_frame *)-1;
	new_ctx->callstack_top = (stack_frame *)-1;

	/* note that these register values are not necessarily valid stack
	pointers. they are merely saved non-volatile registers, and are
	restored in unnest_stacks(). consider this scenario:
	- factor code calls C function
	- C function saves ds/cs registers (since they're non-volatile)
	- C function clobbers them
	- C function calls Factor callback
	- Factor callback returns
	- C function restores registers
	- C function returns to Factor code */
	new_ctx->datastack_save = ds;
	new_ctx->retainstack_save = rs;

	new_ctx->magic_frame = magic_frame;

	/* save per-callback special_objects */
	new_ctx->current_callback_save = special_objects[OBJ_CURRENT_CALLBACK];
	new_ctx->catchstack_save = special_objects[OBJ_CATCHSTACK];

	new_ctx->next = ctx;
	ctx = new_ctx;

	reset_datastack();
	reset_retainstack();
}
예제 #3
0
void context::fix_stacks() {
  if (datastack + sizeof(cell) < datastack_seg->start ||
      datastack + stack_reserved >= datastack_seg->end)
    reset_datastack();

  if (retainstack + sizeof(cell) < retainstack_seg->start ||
      retainstack + stack_reserved >= retainstack_seg->end)
    reset_retainstack();
}
예제 #4
0
	void fix_stacks()
	{
		if(datastack + sizeof(cell) < datastack_region->start
			|| datastack + stack_reserved >= datastack_region->end)
			reset_datastack();

		if(retainstack + sizeof(cell) < retainstack_region->start
			|| retainstack + stack_reserved >= retainstack_region->end)
			reset_retainstack();
	}
예제 #5
0
void factor_vm::fix_stacks()
{
	if(ds + sizeof(cell) < ds_bot || ds + stack_reserved >= ds_top) reset_datastack();
	if(rs + sizeof(cell) < rs_bot || rs + stack_reserved >= rs_top) reset_retainstack();
}