4 /* Assembly code makes assumptions about the layout of this struct */
6 /* C stack pointer on entry */
7 stack_frame *callstack_top;
8 stack_frame *callstack_bottom;
10 /* current datastack top pointer */
13 /* current retain stack top pointer */
16 /* memory region holding current datastack */
17 segment *datastack_region;
19 /* memory region holding current retain stack */
20 segment *retainstack_region;
22 /* saved special_objects slots on entry to callback */
24 cell current_callback_save;
28 context(cell ds_size, cell rs_size);
32 return *(cell *)datastack;
35 void replace(cell tagged)
37 *(cell *)datastack = tagged;
43 datastack -= sizeof(cell);
47 void push(cell tagged)
49 datastack += sizeof(cell);
53 void reset_datastack()
55 datastack = datastack_region->start - sizeof(cell);
58 void reset_retainstack()
60 retainstack = retainstack_region->start - sizeof(cell);
63 static const cell stack_reserved = (64 * sizeof(cell));
67 if(datastack + sizeof(cell) < datastack_region->start
68 || datastack + stack_reserved >= datastack_region->end)
71 if(retainstack + sizeof(cell) < retainstack_region->start
72 || retainstack + stack_reserved >= retainstack_region->end)
77 VM_C_API void nest_stacks(factor_vm *vm);
78 VM_C_API void unnest_stacks(factor_vm *vm);