3 // Context object count and identifiers must be kept in sync with:
4 // core/kernel/kernel.factor
5 static const cell context_object_count
= 4;
14 // When the callstack fills up (e.g by to deep recursion), a callstack
15 // overflow error is triggered. So before continuing executing on it
16 // in general_error(), we chop off this many bytes to have some space
17 // to work with. Mac OSX 64 bit needs more than 8192. See issue #1419.
18 static const cell stack_reserved
= 16384;
22 // First 5 fields accessed directly by compiler. See basis/vm/vm.factor
24 // Factor callstack pointers
26 cell callstack_bottom
;
28 // current datastack top pointer
31 // current retain stack top pointer
34 // C callstack pointer
37 segment
* datastack_seg
;
38 segment
* retainstack_seg
;
39 segment
* callstack_seg
;
41 // context-specific special objects, accessed by context-object and
42 // set-context-object primitives
43 cell context_objects
[context_object_count
];
45 context(cell ds_size
, cell rs_size
, cell cs_size
);
48 void reset_datastack();
49 void reset_retainstack();
50 void reset_callstack();
51 void reset_context_objects();
54 void fill_stack_seg(cell top_ptr
, segment
* seg
, cell pattern
);
55 vm_error_type
address_to_error(cell addr
);
57 cell
peek() { return *(cell
*)datastack
; }
59 void replace(cell tagged
) { *(cell
*)datastack
= tagged
; }
63 datastack
-= sizeof(cell
);
67 void push(cell tagged
) {
68 datastack
+= sizeof(cell
);
73 VM_C_API context
* new_context(factor_vm
* parent
);
74 VM_C_API
void delete_context(factor_vm
* parent
);
75 VM_C_API
void reset_context(factor_vm
* parent
);
76 VM_C_API cell
begin_callback(factor_vm
* parent
, cell quot
);
77 VM_C_API
void end_callback(factor_vm
* parent
);