mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 13:30:26 +02:00
Inline "struct scm_frame" into tagged frame objects
This avoids an indirection and will make the tracer's job easier. * libguile/frames.h (struct scm_vm_frame): New data type. (scm_is_vm_frame): (scm_vm_frame): (scm_vm_frame_kind): (scm_vm_frame_fp): (scm_vm_frame_sp): (scm_vm_frame_ip): (scm_frame_init_from_vm_frame): New helpers. * libguile/frames.c: * libguile/stacks.c: * libguile/stacks.h: * libguile/vm.c: Update all users of SCM_VM_FRAME_* macros to use new helpers.
This commit is contained in:
parent
75842cf215
commit
aa73d31ded
5 changed files with 101 additions and 57 deletions
|
@ -276,8 +276,7 @@ static void
|
|||
invoke_hook (scm_thread *thread, SCM hook)
|
||||
{
|
||||
struct scm_vm *vp = &thread->vm;
|
||||
struct scm_frame c_frame;
|
||||
scm_t_cell *frame;
|
||||
struct scm_vm_frame *frame;
|
||||
SCM scm_frame;
|
||||
int saved_trace_level;
|
||||
uint8_t saved_compare_result;
|
||||
|
@ -296,17 +295,14 @@ invoke_hook (scm_thread *thread, SCM hook)
|
|||
while the stack frame represented by the frame object is visible, so it
|
||||
seems reasonable to limit the lifetime of frame objects. */
|
||||
|
||||
c_frame.stack_holder = vp;
|
||||
c_frame.fp_offset = vp->stack_top - vp->fp;
|
||||
c_frame.sp_offset = vp->stack_top - vp->sp;
|
||||
c_frame.ip = vp->ip;
|
||||
|
||||
/* Arrange for FRAME to be 8-byte aligned, like any other cell. */
|
||||
frame = alloca (sizeof (*frame) + 8);
|
||||
frame = (scm_t_cell *) ROUND_UP ((uintptr_t) frame, 8UL);
|
||||
|
||||
frame->word_0 = SCM_PACK (scm_tc7_frame | (SCM_VM_FRAME_KIND_VM << 8));
|
||||
frame->word_1 = SCM_PACK_POINTER (&c_frame);
|
||||
frame = (struct scm_vm_frame *) ROUND_UP ((uintptr_t) frame, 8UL);
|
||||
frame->tag_and_flags = scm_tc7_frame | (SCM_VM_FRAME_KIND_VM << 8);
|
||||
frame->frame.stack_holder = vp;
|
||||
frame->frame.fp_offset = vp->stack_top - vp->fp;
|
||||
frame->frame.sp_offset = vp->stack_top - vp->sp;
|
||||
frame->frame.ip = vp->ip;
|
||||
|
||||
scm_frame = SCM_PACK_POINTER (frame);
|
||||
scm_c_run_hookn (hook, &scm_frame, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue