From 3b9e095b44a618b9e5781adfaa287e14b0f44d03 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 5 Feb 2009 13:44:06 +0100 Subject: fix boot program detection, which in turn makes `make-stack' actually work * libguile/programs.h (SCM_F_PROGRAM_IS_BOOT, SCM_PROGRAM_IS_BOOT): Flags for determining if a program is a boot program. It turns out that our heuristics e.g. in stacks.c would catch non-boot programs, like programs that end with (goto/args 1), because the 1 is the same byte as `halt'. That took a while to find... * libguile/stacks.c (stack_depth, read_frames): Use the new boot prog macros. (scm_make_stack): Assert that we read the number of frames that we said we would. * libguile/vm.c (really_make_boot_program): Mark boot programs appropriately. --- libguile/programs.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libguile/programs.h') diff --git a/libguile/programs.h b/libguile/programs.h index 7d9478877..263228bec 100644 --- a/libguile/programs.h +++ b/libguile/programs.h @@ -53,12 +53,15 @@ typedef unsigned char scm_byte_t; extern scm_t_bits scm_tc16_program; +#define SCM_F_PROGRAM_IS_BOOT (1<<0) + #define SCM_PROGRAM_P(x) (SCM_SMOB_PREDICATE (scm_tc16_program, x)) #define SCM_PROGRAM_OBJCODE(x) (SCM_SMOB_OBJECT (x)) #define SCM_PROGRAM_OBJTABLE(x) (SCM_SMOB_OBJECT_2 (x)) #define SCM_PROGRAM_EXTERNALS(x) (SCM_SMOB_OBJECT_3 (x)) #define SCM_PROGRAM_DATA(x) (SCM_OBJCODE_DATA (SCM_PROGRAM_OBJCODE (x))) #define SCM_VALIDATE_PROGRAM(p,x) SCM_MAKE_VALIDATE (p, x, PROGRAM_P) +#define SCM_PROGRAM_IS_BOOT(x) (SCM_SMOB_FLAGS (x) & SCM_F_PROGRAM_IS_BOOT) extern SCM scm_make_program (SCM objcode, SCM objtable, SCM externals); -- cgit v1.2.3