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
parent
5b9aee2c91
commit
ef38688e87
|
@ -61,6 +61,19 @@ struct code_block
|
||||||
return (header >> 20) & 0xFF0;
|
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)
|
void set_stack_frame_size(cell frame_size)
|
||||||
{
|
{
|
||||||
FACTOR_ASSERT(size() < 0xFFFFFF);
|
FACTOR_ASSERT(size() < 0xFFFFFF);
|
||||||
|
|
Loading…
Reference in New Issue