1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 01:00:20 +02:00

Heap frames have a "frame kind" bit

* libguile/frames.h (enum scm_vm_frame_kind, SCM_VM_FRAME_KIND)
  (scm_c_make_frame): Add a "frame kind" bit to the first word.  This
  will allow the "stack holder" to be a non-SCM object.

* libguile/continuations.c (scm_i_continuation_to_frame):
* libguile/frames.c (scm_c_make_frame, scm_frame_previous)
* libguile/stacks.c (scm_make_stack):
* libguile/vm.c (vm_dispatch_hook): Adapt frame creators to set the
  frame kind bit.
This commit is contained in:
Andy Wingo 2013-11-21 17:13:18 +01:00
parent 0bca90aac9
commit 050a40db5b
5 changed files with 18 additions and 8 deletions

View file

@ -146,7 +146,14 @@ struct scm_frame
scm_t_uint32 *ip;
};
enum scm_vm_frame_kind
{
SCM_VM_FRAME_KIND_VM,
SCM_VM_FRAME_KIND_CONT
};
#define SCM_VM_FRAME_P(x) (SCM_HAS_TYP7 (x, scm_tc7_frame))
#define SCM_VM_FRAME_KIND(x) ((enum scm_vm_frame_kind) (SCM_CELL_WORD_0 (x) >> 8))
#define SCM_VM_FRAME_DATA(x) ((struct scm_frame*)SCM_CELL_WORD_1 (x))
#define SCM_VM_FRAME_STACK_HOLDER(f) SCM_VM_FRAME_DATA (f)->stack_holder
#define SCM_VM_FRAME_FP_OFFSET(f) SCM_VM_FRAME_DATA (f)->fp_offset
@ -160,7 +167,8 @@ struct scm_frame
SCM_INTERNAL SCM* scm_i_frame_stack_base (SCM frame);
SCM_INTERNAL scm_t_ptrdiff scm_i_frame_offset (SCM frame);
SCM_INTERNAL SCM scm_c_make_frame (SCM stack_holder, scm_t_ptrdiff fp_offset,
SCM_INTERNAL SCM scm_c_make_frame (enum scm_vm_frame_kind vm_frame_kind,
SCM stack_holder, scm_t_ptrdiff fp_offset,
scm_t_ptrdiff sp_offset, scm_t_uint32 *ip);
#endif