4 inline static cell callstack_size(cell size)
6 return sizeof(callstack) + size;
9 VM_ASM_API void save_callstack_bottom(stack_frame *callstack_bottom, factor_vm *vm);
11 /* This is a little tricky. The iterator may allocate memory, so we
12 keep the callstack in a GC root and use relative offsets */
13 template<typename TYPE> void factor_vm::iterate_callstack_object(callstack *stack_, TYPE &iterator)
15 gc_root<callstack> stack(stack_,this);
16 fixnum frame_offset = untag_fixnum(stack->length) - sizeof(stack_frame);
18 while(frame_offset >= 0)
20 stack_frame *frame = stack->frame_at(frame_offset);
21 frame_offset -= frame->size;
26 template<typename TYPE> void factor_vm::iterate_callstack(cell top, cell bottom, TYPE &iterator)
28 stack_frame *frame = (stack_frame *)bottom - 1;
30 while((cell)frame >= top)
33 frame = frame_successor(frame);
37 /* Every object has a regular representation in the runtime, which makes GC
38 much simpler. Every slot of the object until binary_payload_start is a pointer
39 to some other object. */
41 inline void factor_vm::do_slots(cell obj, void (* iter)(cell *,factor_vm*))
44 cell payload_start = binary_payload_start((object *)obj);
45 cell end = obj + payload_start;
51 iter((cell *)scan,this);