2 #define ARM64_ALIGN alignas(16)
9 // Context object count and identifiers must be kept in sync with:
10 // core/kernel/kernel.factor
11 static const cell context_object_count = 4;
20 // When the callstack fills up (e.g by to deep recursion), a callstack
21 // overflow error is triggered. So before continuing executing on it
22 // in general_error(), we chop off this many bytes to have some space
23 // to work with. Mac OSX 64 bit needs more than 8192. See issue #1419.
24 static const cell stack_reserved = 16384;
28 // First 5 fields accessed directly by compiler. See basis/vm/vm.factor
30 // Factor callstack pointers
32 ARM64_ALIGN cell callstack_bottom;
34 // current datastack top pointer
37 // current retain stack top pointer
40 // C callstack pointer
43 segment* datastack_seg;
44 segment* retainstack_seg;
45 segment* callstack_seg;
47 // context-specific special objects, accessed by context-object and
48 // set-context-object primitives
49 cell context_objects[context_object_count];
51 context(cell ds_size, cell rs_size, cell cs_size);
54 void reset_datastack();
55 void reset_retainstack();
56 void reset_callstack();
57 void reset_context_objects();
60 void fill_stack_seg(cell top_ptr, segment* seg, cell pattern);
61 vm_error_type address_to_error(cell addr);
63 cell peek() { return *(cell*)datastack; }
65 void replace(cell tagged) { *(cell*)datastack = tagged; }
69 datastack -= sizeof(cell);
73 void push(cell tagged) {
74 datastack += sizeof(cell);
79 VM_C_API context* new_context(factor_vm* parent);
80 VM_C_API void delete_context(factor_vm* parent);
81 VM_C_API void reset_context(factor_vm* parent);
82 VM_C_API cell begin_callback(factor_vm* parent, cell quot);
83 VM_C_API void end_callback(factor_vm* parent);