6 void factor_vm::c_to_factor(cell quot)
8 /* First time this is called, wrap the c-to-factor sub-primitive inside
9 of a callback stub, which saves and restores non-volatile registers
10 per platform ABI conventions, so that the Factor compiler can treat
11 all registers as volatile */
14 tagged<word> c_to_factor_word(special_objects[C_TO_FACTOR_WORD]);
15 code_block *c_to_factor_block = callbacks->add(c_to_factor_word.value(),0);
16 void* func = c_to_factor_block->entry_point();
17 CODE_TO_FUNCTION_POINTER_CALLBACK(this, func);
18 c_to_factor_func = (c_to_factor_func_type)func;
20 c_to_factor_func(quot);
23 template<typename Func> Func factor_vm::get_entry_point(cell n)
25 /* We return word->code->entry_point() and not word->entry_point,
26 because if profiling is enabled, we don't want to go through the
27 entry point's profiling stub. This clobbers registers, since entry
28 points use the C ABI and not the Factor ABI. */
29 tagged<word> entry_point_word(special_objects[n]);
30 return (Func)entry_point_word->code->entry_point();
33 void factor_vm::unwind_native_frames(cell quot, stack_frame *to)
35 tagged<word> entry_point_word(special_objects[UNWIND_NATIVE_FRAMES_WORD]);
36 void *func = entry_point_word->code->entry_point();
37 CODE_TO_FUNCTION_POINTER(func);
38 ((unwind_native_frames_func_type)func)(quot,to);
41 cell factor_vm::get_fpu_state()
43 tagged<word> entry_point_word(special_objects[GET_FPU_STATE_WORD]);
44 void *func = entry_point_word->code->entry_point();
45 CODE_TO_FUNCTION_POINTER(func);
46 return ((get_fpu_state_func_type)func)();
49 void factor_vm::set_fpu_state(cell state)
51 tagged<word> entry_point_word(special_objects[SET_FPU_STATE_WORD]);
52 void *func = entry_point_word->code->entry_point();
53 CODE_TO_FUNCTION_POINTER(func);
54 ((set_fpu_state_func_type)func)(state);