mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-04 00:30:30 +02:00
frames, values: BUILDING_LIBGUILE-guarded defs to internal headers
I was writing the trace function, which is included by Whippet, which doesn't have the BUILDING_LIBGUILE define. It is just as fine to put these in private headers; better, even. * libguile/frames-internal.h: * libguile/values-internal.h: New files. * libguile/Makefile.am (noinst_HEADERS): Add new files. * libguile/backtrace.c: * libguile/continuations.c: * libguile/control.c: * libguile/eval.c: * libguile/frames.c: * libguile/frames.h: * libguile/gsubr.c: * libguile/init.c: * libguile/intrinsics.c: * libguile/numbers.c: * libguile/print.c: * libguile/smob.c: * libguile/smob.h: * libguile/stacks.c: * libguile/stacks.h: * libguile/values.c: * libguile/values.h: * libguile/vm.c: Include new files.
This commit is contained in:
parent
65a265adea
commit
6a32628e18
21 changed files with 213 additions and 148 deletions
|
@ -118,91 +118,6 @@ union scm_vm_stack_element
|
|||
* Heap frames
|
||||
*/
|
||||
|
||||
#ifdef BUILDING_LIBGUILE
|
||||
|
||||
struct scm_frame
|
||||
{
|
||||
void *stack_holder;
|
||||
ptrdiff_t fp_offset;
|
||||
ptrdiff_t sp_offset;
|
||||
uint32_t *ip;
|
||||
};
|
||||
|
||||
struct scm_vm_frame
|
||||
{
|
||||
scm_t_bits tag_and_flags;
|
||||
struct scm_frame frame;
|
||||
};
|
||||
|
||||
enum scm_vm_frame_kind
|
||||
{
|
||||
SCM_VM_FRAME_KIND_VM,
|
||||
SCM_VM_FRAME_KIND_CONT
|
||||
};
|
||||
|
||||
static inline int
|
||||
scm_is_vm_frame (SCM x)
|
||||
{
|
||||
return SCM_HAS_TYP7 (x, scm_tc7_frame);
|
||||
}
|
||||
|
||||
#define SCM_VM_FRAME_P(x) (scm_is_vm_frame (x))
|
||||
#define SCM_VALIDATE_VM_FRAME(p,x) SCM_MAKE_VALIDATE (p, x, VM_FRAME_P)
|
||||
|
||||
static inline struct scm_vm_frame*
|
||||
scm_vm_frame (SCM x)
|
||||
{
|
||||
if (!scm_is_vm_frame (x))
|
||||
abort ();
|
||||
return (struct scm_vm_frame *) SCM_UNPACK_POINTER (x);
|
||||
}
|
||||
|
||||
static inline enum scm_vm_frame_kind
|
||||
scm_vm_frame_kind (struct scm_vm_frame *frame)
|
||||
{
|
||||
return (enum scm_vm_frame_kind) (frame->tag_and_flags >> 8);
|
||||
}
|
||||
|
||||
SCM_INTERNAL union scm_vm_stack_element*
|
||||
scm_vm_frame_stack_top (struct scm_vm_frame *frame);
|
||||
|
||||
static inline union scm_vm_stack_element*
|
||||
scm_vm_frame_fp (struct scm_vm_frame *frame)
|
||||
{
|
||||
return scm_vm_frame_stack_top (frame) - frame->frame.fp_offset;
|
||||
}
|
||||
|
||||
static inline union scm_vm_stack_element*
|
||||
scm_vm_frame_sp (struct scm_vm_frame *frame)
|
||||
{
|
||||
return scm_vm_frame_stack_top (frame) - frame->frame.sp_offset;
|
||||
}
|
||||
|
||||
static inline uint32_t*
|
||||
scm_vm_frame_ip (struct scm_vm_frame *frame)
|
||||
{
|
||||
return frame->frame.ip;
|
||||
}
|
||||
|
||||
/* See notes in frames.c before using this. */
|
||||
SCM_INTERNAL SCM scm_c_frame_closure (enum scm_vm_frame_kind kind,
|
||||
const struct scm_frame *frame);
|
||||
|
||||
SCM_INTERNAL SCM scm_c_make_frame (enum scm_vm_frame_kind kind,
|
||||
const struct scm_frame *frame);
|
||||
|
||||
SCM_INTERNAL int scm_c_frame_previous (enum scm_vm_frame_kind kind,
|
||||
struct scm_frame *frame);
|
||||
|
||||
static inline void
|
||||
scm_frame_init_from_vm_frame (struct scm_frame *frame,
|
||||
const struct scm_vm_frame *vm_frame)
|
||||
{
|
||||
memcpy (frame, &vm_frame->frame, sizeof (*frame));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
SCM_API SCM scm_frame_p (SCM obj);
|
||||
SCM_API SCM scm_frame_procedure_name (SCM frame);
|
||||
SCM_API SCM scm_frame_call_representation (SCM frame);
|
||||
|
@ -215,8 +130,4 @@ SCM_API SCM scm_frame_return_address (SCM frame);
|
|||
SCM_API SCM scm_frame_dynamic_link (SCM frame);
|
||||
SCM_API SCM scm_frame_previous (SCM frame);
|
||||
|
||||
SCM_INTERNAL void scm_i_frame_print (SCM frame, SCM port,
|
||||
scm_print_state *pstate);
|
||||
SCM_INTERNAL void scm_init_frames (void);
|
||||
|
||||
#endif /* _SCM_FRAMES_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue