vm: method to calculate frame size for address

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.
db4
Joe Groff 2011-11-30 12:57:35 -08:00
parent 5b9aee2c91
commit ef38688e87
1 changed files with 13 additions and 0 deletions

View 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);