Fix bug in liarc object initialization: dload_initialize_file must
authorTaylor R. Campbell <net/mumble/campbell>
Tue, 17 Jul 2007 04:40:19 +0000 (04:40 +0000)
committerTaylor R. Campbell <net/mumble/campbell>
Tue, 17 Jul 2007 04:40:19 +0000 (04:40 +0000)
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.

v7/src/microcode/cmpauxmd/c.c
v7/src/microcode/liarc.h

index ff2d48a5a3b81dbe25fa087541f3811ed3c1291f..79746f6ea075df02bf63268da18ceea447f647c0 100644 (file)
@@ -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);
 }
 \f
-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)
     {
index 0faf6f3fe6b160e26711e484b9e387f9b3709dd1..961654e36d8a104f24aee01092c52949aa31d213 100644 (file)
@@ -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 *);