vm: bottom_frame method for contexts

ctx->callstack_bottom - 1 -- the fuck does that mean?!
db4
Joe Groff 2011-10-29 15:47:36 -07:00
parent be5c7476d7
commit 40bc8459db
4 changed files with 9 additions and 4 deletions

View File

@ -28,7 +28,7 @@ called by continuation implementation, and user code shouldn't
be calling it at all, so we leave it as it is for now. */
stack_frame *factor_vm::second_from_top_stack_frame(context *ctx)
{
stack_frame *frame = ctx->callstack_bottom - 1;
stack_frame *frame = ctx->bottom_frame();
while(frame >= ctx->callstack_top
&& frame_successor(frame) >= ctx->callstack_top
&& frame_successor(frame_successor(frame)) >= ctx->callstack_top)

View File

@ -73,6 +73,11 @@ struct context {
datastack += sizeof(cell);
replace(tagged);
}
stack_frame *bottom_frame()
{
return callstack_bottom - 1;
}
};
VM_C_API context *new_context(factor_vm *parent);

View File

@ -13,7 +13,7 @@ void factor_vm::dispatch_signal_handler(cell *sp, cell *pc, cell handler)
the signal handler to do its thing, and launch the handler without going
through the resumable subprimitive. */
signal_resumable = false;
stack_frame *frame = ctx->callstack_bottom - 1;
stack_frame *frame = ctx->bottom_frame();
while((cell)frame >= *sp
&& frame >= ctx->callstack_top

View File

@ -40,10 +40,10 @@ void factor_vm::record_sample()
void factor_vm::record_callstack_sample(cell *begin, cell *end)
{
*begin = sample_callstacks.size();
stack_frame *frame = ctx->callstack_bottom - 1;
stack_frame *frame = ctx->bottom_frame();
while (frame >= ctx->callstack_top) {
sample_callstacks.push_back((code_block*)frame->entry_point - 1);
sample_callstacks.push_back(frame_code(frame));
frame = frame_successor(frame);
}