From: Taylor R. Campbell Date: Tue, 17 Jul 2007 04:40:19 +0000 (+0000) Subject: Fix bug in liarc object initialization: dload_initialize_file must X-Git-Tag: 20090517-FFI~492 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=f3aef05f0d2eb6ccda9af5e4f1f1535cf34f4a40;p=mit-scheme.git Fix bug in liarc object initialization: dload_initialize_file must return the complete object name with the prefix in order for it to be properly loaded. Formerly it was returning only the name without the prefix, so the run-time system thought that the load failed, even though it registered the object by its full URI, and so the top-level forms would not be executed until the file was loaded a second time. --- diff --git a/v7/src/microcode/cmpauxmd/c.c b/v7/src/microcode/cmpauxmd/c.c index ff2d48a5a..79746f6ea 100644 --- a/v7/src/microcode/cmpauxmd/c.c +++ b/v7/src/microcode/cmpauxmd/c.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: c.c,v 1.23 2007/06/06 19:42:41 cph Exp $ +$Id: c.c,v 1.24 2007/07/17 04:40:19 riastradh Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -131,7 +131,6 @@ static compiled_block_t ** compiled_entries = 0; static int declare_compiled_code_ns_1 (const char *, entry_count_t, liarc_code_proc_t *); -static const char * compute_full_name (const char *); static bool grow_compiled_blocks (void); static bool grow_compiled_entries (entry_count_t); static int declare_trampoline_block (entry_count_t); @@ -317,7 +316,7 @@ declare_compiled_code_ns (const char * name, { void * p = dstack_position; int rc - = (declare_compiled_code_ns_1 ((compute_full_name (name)), + = (declare_compiled_code_ns_1 ((liarc_object_file_name (name)), n_block_entries, code_proc)); dstack_set_position (p); @@ -380,8 +379,8 @@ declare_compiled_code_ns_1 (const char * name, return (-1); } -static const char * -compute_full_name (const char * name) +const char * +liarc_object_file_name (const char * name) { const char * prefix; char * full; @@ -456,7 +455,7 @@ int declare_compiled_data_ns (const char * name, liarc_data_proc_t * data_proc) { void * p = dstack_position; - const char * full = (compute_full_name (name)); + const char * full = (liarc_object_file_name (name)); compiled_block_t * block = (find_compiled_block (full)); dstack_set_position (p); if (! ((block != 0) @@ -471,7 +470,7 @@ int declare_data_object (const char * name, liarc_object_proc_t * object_proc) { void * p = dstack_position; - const char * full = (compute_full_name (name)); + const char * full = (liarc_object_file_name (name)); compiled_block_t * block = (find_compiled_block (full)); if (block == 0) { diff --git a/v7/src/microcode/liarc.h b/v7/src/microcode/liarc.h index 0faf6f3fe..961654e36 100644 --- a/v7/src/microcode/liarc.h +++ b/v7/src/microcode/liarc.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: liarc.h,v 1.31 2007/06/06 19:42:40 cph Exp $ +$Id: liarc.h,v 1.32 2007/07/17 04:40:19 riastradh Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -404,23 +404,26 @@ dload_initialize_data (void) \ #define DECLARE_DYNAMIC_INITIALIZATION(name, nonce) \ const char dload_nonce [] = nonce; \ \ -char * \ +const char * \ dload_initialize_file (void) \ { \ return \ ((((dload_initialize_code ()) == 0) \ && ((dload_initialize_data ()) == 0)) \ - ? name \ + ? (liarc_object_file_name (name)) \ : 0); \ } #define DECLARE_DYNAMIC_OBJECT_INITIALIZATION(name, nonce) \ const char dload_nonce [] = nonce; \ \ -char * \ +const char * \ dload_initialize_file (void) \ { \ - return (((dload_initialize_data ()) == 0) ? name : 0); \ + return \ + (((dload_initialize_data ()) == 0) \ + ? (liarc_object_file_name (name)) \ + : 0); \ } #else /* !ENABLE_LIARC_FILE_INIT */ @@ -453,6 +456,8 @@ extern int declare_data_object (const char *, liarc_object_proc_t *); extern int declare_compiled_code_mult (unsigned, const struct liarc_code_S *); extern int declare_compiled_data_mult (unsigned, const struct liarc_data_S *); +extern const char * liarc_object_file_name (const char *); + extern SCHEME_OBJECT unstackify (unsigned char *, size_t, entry_count_t); extern int multiply_with_overflow (long, long, long *);