4 static const cell context_object_count = 10;
12 /* Assembly code makes assumptions about the layout of this struct */
14 /* C stack pointer on entry */
15 stack_frame *callstack_top;
16 stack_frame *callstack_bottom;
18 /* current datastack top pointer */
21 /* current retain stack top pointer */
24 /* memory region holding current datastack */
25 segment *datastack_region;
27 /* memory region holding current retain stack */
28 segment *retainstack_region;
30 /* context-specific special objects, accessed by context-object and
31 set-context-object primitives */
32 cell context_objects[context_object_count];
36 context(cell ds_size, cell rs_size);
37 void reset_datastack();
38 void reset_retainstack();
39 void reset_context_objects();
43 return *(cell *)datastack;
46 void replace(cell tagged)
48 *(cell *)datastack = tagged;
54 datastack -= sizeof(cell);
58 void push(cell tagged)
60 datastack += sizeof(cell);
64 static const cell stack_reserved = (64 * sizeof(cell));
68 if(datastack + sizeof(cell) < datastack_region->start
69 || datastack + stack_reserved >= datastack_region->end)
72 if(retainstack + sizeof(cell) < retainstack_region->start
73 || retainstack + stack_reserved >= retainstack_region->end)
78 VM_C_API void nest_stacks(factor_vm *vm);
79 VM_C_API void unnest_stacks(factor_vm *vm);