vm: bottom_frame method for contexts
ctx->callstack_bottom - 1 -- the fuck does that mean?!db4
parent
be5c7476d7
commit
40bc8459db
|
@ -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. */
|
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 *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
|
while(frame >= ctx->callstack_top
|
||||||
&& frame_successor(frame) >= ctx->callstack_top
|
&& frame_successor(frame) >= ctx->callstack_top
|
||||||
&& frame_successor(frame_successor(frame)) >= ctx->callstack_top)
|
&& frame_successor(frame_successor(frame)) >= ctx->callstack_top)
|
||||||
|
|
|
@ -73,6 +73,11 @@ struct context {
|
||||||
datastack += sizeof(cell);
|
datastack += sizeof(cell);
|
||||||
replace(tagged);
|
replace(tagged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stack_frame *bottom_frame()
|
||||||
|
{
|
||||||
|
return callstack_bottom - 1;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
VM_C_API context *new_context(factor_vm *parent);
|
VM_C_API context *new_context(factor_vm *parent);
|
||||||
|
|
|
@ -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
|
the signal handler to do its thing, and launch the handler without going
|
||||||
through the resumable subprimitive. */
|
through the resumable subprimitive. */
|
||||||
signal_resumable = false;
|
signal_resumable = false;
|
||||||
stack_frame *frame = ctx->callstack_bottom - 1;
|
stack_frame *frame = ctx->bottom_frame();
|
||||||
|
|
||||||
while((cell)frame >= *sp
|
while((cell)frame >= *sp
|
||||||
&& frame >= ctx->callstack_top
|
&& frame >= ctx->callstack_top
|
||||||
|
|
|
@ -40,10 +40,10 @@ void factor_vm::record_sample()
|
||||||
void factor_vm::record_callstack_sample(cell *begin, cell *end)
|
void factor_vm::record_callstack_sample(cell *begin, cell *end)
|
||||||
{
|
{
|
||||||
*begin = sample_callstacks.size();
|
*begin = sample_callstacks.size();
|
||||||
stack_frame *frame = ctx->callstack_bottom - 1;
|
stack_frame *frame = ctx->bottom_frame();
|
||||||
|
|
||||||
while (frame >= ctx->callstack_top) {
|
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);
|
frame = frame_successor(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue