]> gitweb.factorcode.org Git - factor.git/commitdiff
vm: method to calculate frame size for address
authorJoe Groff <arcata@gmail.com>
Wed, 30 Nov 2011 20:57:35 +0000 (12:57 -0800)
committerJoe Groff <arcata@gmail.com>
Wed, 14 Dec 2011 17:56:47 +0000 (09:56 -0800)
If we're before the prolog or or in a leaf procedure, the stack frame is really a leaf frame created by the signal handler, with a known fixed size, instead of the real stack frame (if any) with a different size.

vm/code_blocks.hpp

index d14a55c479fcf074cf452f7a2e00ae602c8727ee..34aeed787de0113a5f4c9f754219f459e49b77de 100644 (file)
@@ -61,6 +61,19 @@ struct code_block
                        return (header >> 20) & 0xFF0;
        }
 
+       cell stack_frame_size_for_address(cell addr) const
+       {
+               cell natural_frame_size = stack_frame_size();
+               /* The first instruction in a code block is the prolog safepoint,
+               and a leaf procedure code block will record a frame size of zero.
+               If we're seeing a stack frame in either of these cases, it's a
+               fake "leaf frame" set up by the signal handler. */
+               if (natural_frame_size == 0 || (void*)addr == entry_point())
+                       return LEAF_FRAME_SIZE;
+               else
+                       return natural_frame_size;
+       }
+
        void set_stack_frame_size(cell frame_size)
        {
                FACTOR_ASSERT(size() < 0xFFFFFF);