]> gitweb.factorcode.org Git - factor.git/commitdiff
vm: bottom_frame method for contexts
authorJoe Groff <arcata@gmail.com>
Sat, 29 Oct 2011 22:47:36 +0000 (15:47 -0700)
committerJoe Groff <arcata@gmail.com>
Wed, 2 Nov 2011 20:23:07 +0000 (13:23 -0700)
ctx->callstack_bottom - 1 -- the fuck does that mean?!

vm/callstack.cpp
vm/contexts.hpp
vm/cpu-x86.cpp
vm/sampling_profiler.cpp

index 134a7c78b2854bccc9c7337a28cf526b2429da99..0be681d41c80d44c83dcbdfeffb6385fce3f65f0 100755 (executable)
@@ -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)
index 59df3e68c93a5ea68d648f26eed7f018fcdf2a8e..30ed74ecd963fe7eb74bc2b1f6320e1787a54bb7 100644 (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);
index c27e563a7c654325eb5b524ede5581fe74abd22d..0fc6bbfc413bd30b28b1949b627edaaa30465413 100644 (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
index b7311d78f7568eef5ea2d933b0897e0327420347..ed9358fe8d2f5b356fd272cdab49207fd41935f5 100644 (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);
        }