4 inline static cell callstack_size(cell size)
6 return sizeof(callstack) + size;
9 stack_frame *fix_callstack_top(stack_frame *top, stack_frame *bottom);
10 stack_frame *frame_successor(stack_frame *frame);
11 code_block *frame_code(stack_frame *frame);
12 cell frame_executing(stack_frame *frame);
13 cell frame_scan(stack_frame *frame);
14 cell frame_type(stack_frame *frame);
17 PRIMITIVE(set_callstack);
18 PRIMITIVE(callstack_to_array);
19 PRIMITIVE(innermost_stack_frame_executing);
20 PRIMITIVE(innermost_stack_frame_scan);
21 PRIMITIVE(set_innermost_stack_frame_quot);
23 VM_ASM_API void save_callstack_bottom(stack_frame *callstack_bottom);
25 template<typename T> void iterate_callstack(cell top, cell bottom, T &iterator)
27 stack_frame *frame = (stack_frame *)bottom - 1;
29 while((cell)frame >= top)
32 frame = frame_successor(frame);
36 /* This is a little tricky. The iterator may allocate memory, so we
37 keep the callstack in a GC root and use relative offsets */
38 template<typename T> void iterate_callstack_object(callstack *stack_, T &iterator)
40 gc_root<callstack> stack(stack_);
41 fixnum frame_offset = untag_fixnum(stack->length) - sizeof(stack_frame);
43 while(frame_offset >= 0)
45 stack_frame *frame = stack->frame_at(frame_offset);
46 frame_offset -= frame->size;