diff options
author | Andy Wingo <wingo@pobox.com> | 2009-12-03 13:09:58 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-12-03 14:42:51 +0100 |
commit | aa3f69519f1af3fcf31cf36be33776db3fedf65a (patch) | |
tree | 5f2a4ab2d8332b5754693d4dc7997ed96cd7985d /libguile/frames.h | |
parent | 14aa25e410d49586c8ff9b4a80d2b6046b769905 (diff) | |
download | guile-aa3f69519f1af3fcf31cf36be33776db3fedf65a.tar.gz |
replace frame implementation with VM frames
* libguile/stacks.h: Rework so that a stack doesn't copy information out
of VM frames, it just holds onto a VM frame, along with the stack id
and length. VM frames are now the only representation of frames in
Guile.
(scm_t_info_frame, SCM_FRAME_N_SLOTS, SCM_FRAME_REF, SCM_FRAME_NUMBER)
(SCM_FRAME_FLAGS, SCM_FRAME_SOURCE, SCM_FRAME_PROC, SCM_FRAME_ARGS)
(SCM_FRAME_PREV, SCM_FRAME_NEXT)
(SCM_FRAMEF_VOID, SCM_FRAMEF_REAL, SCM_FRAMEF_PROC)
(SCM_FRAMEF_EVAL_ARGS, SCM_FRAMEF_OVERFLOW)
(SCM_FRAME_VOID_P, SCM_FRAME_REAL_P, SCM_FRAME_PROC_P)
(SCM_FRAME_EVAL_ARGS_P, SCM_FRAME_OVERFLOW_P): Remove these macros
corresponding to the old frame implementation.
(scm_frame_p scm_frame_source, scm_frame_procedure)
(scm_frame_arguments): These definitions are now in frames.h.
(scm_last_stack_frame): Remove declaration of previously-removed
constructor. Probably should re-instate it though.
(scm_frame_number, scm_frame_previous, scm_frame_next)
(scm_frame_real_p, scm_frame_procedure_p, scm_frame_evaluating_args_p)
(scm_frame_overflow_p) : Remove these procedures corresponding to the
old stack implementation.
* libguile/stacks.c: Update for new frames implementation.
* libguile/frames.h:
* libguile/frames.c: Rename functions operating on VM frames to have a
scm_frame prefix, not scm_vm_frame -- because they really are the only
frames we have. Rename corresponding Scheme functions too, from
vm-frame-foo to frame-foo.
* libguile/deprecated.h: Remove scm_stack and scm_info_frame data types.
* libguile/vm.c (vm_dispatch_hook): Adapt to scm_c_make_frame name
change.
* module/system/vm/frame.scm: No need to export functions provided
frames.c now, as we load those procedures into the default environment
now. Rename functions, and remove a couple of outdated, unused
functions. The bottom half of this file is still bitrotten, though.
* libguile/backtrace.c: Rework to operate on the new frame
representation. Also fix a bug displaying file names for compiled
procedures.
* libguile/init.c: Load the VM much earlier, just because we can. Also
it allows us to have frames.[ch] loaded in time for stacks to be
initialized, so that scm_frame_arguments can do the right thing.
Diffstat (limited to 'libguile/frames.h')
-rw-r--r-- | libguile/frames.h | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/libguile/frames.h b/libguile/frames.h index f744c2b24..45ade5a10 100644 --- a/libguile/frames.h +++ b/libguile/frames.h @@ -27,6 +27,16 @@ * VM frames */ +/* + * It's a little confusing, but there are two representations of frames in this + * file: frame pointers and Scheme objects wrapping those frame pointers. The + * former uses the SCM_FRAME_... macro prefix, the latter SCM_VM_FRAME_.. + * prefix. + * + * The confusing thing is that only Scheme frame objects have functions that use + * them, and they use the scm_frame_.. prefix. Hysterical raisins. + */ + /* VM Frame Layout --------------- @@ -77,9 +87,9 @@ * Heap frames */ -SCM_API scm_t_bits scm_tc16_vm_frame; +SCM_API scm_t_bits scm_tc16_frame; -struct scm_vm_frame +struct scm_frame { SCM stack_holder; SCM *fp; @@ -88,8 +98,8 @@ struct scm_vm_frame scm_t_ptrdiff offset; }; -#define SCM_VM_FRAME_P(x) SCM_SMOB_PREDICATE (scm_tc16_vm_frame, x) -#define SCM_VM_FRAME_DATA(x) ((struct scm_vm_frame*)SCM_SMOB_DATA (x)) +#define SCM_VM_FRAME_P(x) SCM_SMOB_PREDICATE (scm_tc16_frame, x) +#define SCM_VM_FRAME_DATA(x) ((struct scm_frame*)SCM_SMOB_DATA (x)) #define SCM_VM_FRAME_STACK_HOLDER(f) SCM_VM_FRAME_DATA(f)->stack_holder #define SCM_VM_FRAME_FP(f) SCM_VM_FRAME_DATA(f)->fp #define SCM_VM_FRAME_SP(f) SCM_VM_FRAME_DATA(f)->sp @@ -97,21 +107,21 @@ struct scm_vm_frame #define SCM_VM_FRAME_OFFSET(f) SCM_VM_FRAME_DATA(f)->offset #define SCM_VALIDATE_VM_FRAME(p,x) SCM_MAKE_VALIDATE (p, x, VM_FRAME_P) -SCM_API SCM scm_c_make_vm_frame (SCM stack_holder, SCM *fp, SCM *sp, - scm_t_uint8 *ip, scm_t_ptrdiff offset); -SCM_API SCM scm_vm_frame_p (SCM obj); -SCM_API SCM scm_vm_frame_program (SCM frame); -SCM_API SCM scm_vm_frame_arguments (SCM frame); -SCM_API SCM scm_vm_frame_source (SCM frame); -SCM_API SCM scm_vm_frame_num_locals (SCM frame); -SCM_API SCM scm_vm_frame_local_ref (SCM frame, SCM index); -SCM_API SCM scm_vm_frame_local_set_x (SCM frame, SCM index, SCM val); -SCM_API SCM scm_vm_frame_instruction_pointer (SCM frame); -SCM_API SCM scm_vm_frame_return_address (SCM frame); -SCM_API SCM scm_vm_frame_mv_return_address (SCM frame); -SCM_API SCM scm_vm_frame_dynamic_link (SCM frame); - -SCM_API SCM scm_c_vm_frame_prev (SCM frame); +SCM_API SCM scm_c_make_frame (SCM stack_holder, SCM *fp, SCM *sp, + scm_t_uint8 *ip, scm_t_ptrdiff offset); +SCM_API SCM scm_frame_p (SCM obj); +SCM_API SCM scm_frame_procedure (SCM frame); +SCM_API SCM scm_frame_arguments (SCM frame); +SCM_API SCM scm_frame_source (SCM frame); +SCM_API SCM scm_frame_num_locals (SCM frame); +SCM_API SCM scm_frame_local_ref (SCM frame, SCM index); +SCM_API SCM scm_frame_local_set_x (SCM frame, SCM index, SCM val); +SCM_API SCM scm_frame_instruction_pointer (SCM frame); +SCM_API SCM scm_frame_return_address (SCM frame); +SCM_API SCM scm_frame_mv_return_address (SCM frame); +SCM_API SCM scm_frame_dynamic_link (SCM frame); + +SCM_API SCM scm_c_frame_prev (SCM frame); SCM_INTERNAL void scm_bootstrap_frames (void); SCM_INTERNAL void scm_init_frames (void); |