properly integrate vm bootstrapping into init.c
authorAndy Wingo <wingo@pobox.com>
Tue, 5 Jan 2010 17:50:17 +0000 (18:50 +0100)
committerAndy Wingo <wingo@pobox.com>
Thu, 7 Jan 2010 22:42:41 +0000 (23:42 +0100)
* libguile/Makefile.am (modinclude_HEADERS):
* libguile/vm-bootstrap.h: Remove vm-bootstrap.h.

* libguile/frames.c: No more vm-bootstrap.h.

* libguile/instructions.c (scm_init_instructions):
* libguile/objcodes.c (scm_init_objcodes):
* libguile/programs.c (scm_init_programs): No need to call
  scm_bootstrap_vm, init.c does that for us.

* libguile/vm.c (scm_bootstrap_vm): No need call e.g.
  scm_bootstrap_frames, init.c does that. Remove a twice-calling guard,
  should be unnecessary. Don't define the load-compiled subr here.

* libguile/load.c (scm_init_load): Define the load-compiled subr here.

* libguile/vm.h: Declare scm_bootstrap_vm here.

* libguile/init.c (scm_i_init_guile): Properly integrate VM
  bootstrapping into this file.

libguile/Makefile.am
libguile/frames.c
libguile/init.c
libguile/instructions.c
libguile/load.c
libguile/objcodes.c
libguile/programs.c
libguile/vm-bootstrap.h [deleted file]
libguile/vm.c
libguile/vm.h

index 838946769ffe989506ceee10335c9234264968ae..856c87a9ff102174e3dbd272ee6151de91e1aae1 100644 (file)
@@ -569,7 +569,6 @@ modinclude_HEADERS =                                \
        values.h                                \
        variable.h                              \
        vectors.h                               \
-       vm-bootstrap.h                          \
        vm-engine.h                             \
        vm-expand.h                             \
        vm.h                                    \
index 5077d8e4f79a2975eba9a8de0de16318447adff5..29c14c8f13a21d772ac29d3d865491b909e972bf 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include "_scm.h"
-#include "vm-bootstrap.h"
 #include "frames.h"
 
 \f
index 21fefb43fabc56237359ae898dfabe6d6ffefeee..e2e90a1d756aa60a9d5a0b6d7d7b675a60748e9d 100644 (file)
@@ -57,6 +57,7 @@
 #include "libguile/filesys.h"
 #include "libguile/fluids.h"
 #include "libguile/fports.h"
+#include "libguile/frames.h"
 #include "libguile/gc.h"
 #include "libguile/gdbint.h"
 #include "libguile/generalized-arrays.h"
@@ -68,6 +69,7 @@
 #include "libguile/hooks.h"
 #include "libguile/gettext.h"
 #include "libguile/i18n.h"
+#include "libguile/instructions.h"
 #include "libguile/iselect.h"
 #include "libguile/ioext.h"
 #include "libguile/keywords.h"
@@ -80,6 +82,7 @@
 #include "libguile/modules.h"
 #include "libguile/net_db.h"
 #include "libguile/numbers.h"
+#include "libguile/objcodes.h"
 #include "libguile/objprop.h"
 #include "libguile/options.h"
 #include "libguile/pairs.h"
@@ -91,6 +94,7 @@
 #include "libguile/print.h"
 #include "libguile/procprop.h"
 #include "libguile/procs.h"
+#include "libguile/programs.h"
 #include "libguile/promises.h"
 #include "libguile/properties.h"
 #include "libguile/array-map.h"
 #include "libguile/variable.h"
 #include "libguile/vectors.h"
 #include "libguile/version.h"
-#include "libguile/vm-bootstrap.h"
+#include "libguile/vm.h"
 #include "libguile/vports.h"
 #include "libguile/weaks.h"
 #include "libguile/guardians.h"
@@ -518,7 +522,11 @@ scm_i_init_guile (SCM_STACKITEM *base)
   scm_init_arrays ();    /* Requires smob_prehistory, array-handle */
   scm_init_array_map ();
 
-  scm_bootstrap_vm ();  /* requires smob_prehistory, gc_permanent_object */
+  scm_bootstrap_frames (); /* requires smob_prehistory */
+  scm_bootstrap_instructions ();
+  scm_bootstrap_objcodes (); /* requires smob_prehistory */
+  scm_bootstrap_programs ();
+  scm_bootstrap_vm ();  /* requires smob_prehistory */
 
   scm_init_frames ();   /* Requires smob_prehistory */
   scm_init_stacks ();   /* Requires strings, struct, frames */
index c8d95cc9bea9bd7d0ed035b3425b1e81f2eb7558..4c1f9f16f287c4cfe50263a4f093f11303acab06 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -23,7 +23,6 @@
 #include <string.h>
 
 #include "_scm.h"
-#include "vm-bootstrap.h"
 #include "instructions.h"
 
 struct scm_instruction {
@@ -205,8 +204,6 @@ scm_bootstrap_instructions (void)
 void
 scm_init_instructions (void)
 {
-  scm_bootstrap_vm ();
-
 #ifndef SCM_MAGIC_SNARFER
 #include "libguile/instructions.x"
 #endif
index 7c2dcfbe1f4e34673bc9295df42f8f63b9ce851e..abd5b1ca3dafa8498f7d9a3a1caa83b73cd0de92 100644 (file)
@@ -908,6 +908,10 @@ scm_init_load ()
   scm_fluid_set_x (the_reader, SCM_BOOL_F);
   scm_c_define("current-reader", the_reader);
 
+  scm_c_define ("load-compiled",
+                scm_c_make_gsubr ("load-compiled/vm", 1, 0, 0,
+                                  scm_load_compiled_with_vm));
+
   init_build_info ();
 
 #include "libguile/load.x"
index f73265727297ce9a5244316b3fdefeec21db5001..cd5506f53511d62cfbc220ccdb392063cf57fa77 100644 (file)
@@ -30,7 +30,6 @@
 #include <alignof.h>
 
 #include "_scm.h"
-#include "vm-bootstrap.h"
 #include "programs.h"
 #include "objcodes.h"
 
@@ -274,8 +273,6 @@ scm_bootstrap_objcodes (void)
 void
 scm_init_objcodes (void)
 {
-  scm_bootstrap_vm ();
-
 #ifndef SCM_MAGIC_SNARFER
 #include "libguile/objcodes.x"
 #endif
index fdc0c32a9a105193eca5d2e79d68b13e6ab6f9b0..d5b3b1aa4763651f37f18a14f5117ffc1d27ad8b 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <string.h>
 #include "_scm.h"
-#include "vm-bootstrap.h"
 #include "instructions.h"
 #include "modules.h"
 #include "programs.h"
@@ -338,8 +337,6 @@ scm_bootstrap_programs (void)
 void
 scm_init_programs (void)
 {
-  scm_bootstrap_vm ();
-  
 #ifndef SCM_MAGIC_SNARFER
 #include "libguile/programs.x"
 #endif
diff --git a/libguile/vm-bootstrap.h b/libguile/vm-bootstrap.h
deleted file mode 100644 (file)
index 7ba1a93..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-#ifndef _SCM_VM_BOOTSTRAP_H_
-#define _SCM_VM_BOOTSTRAP_H_
-
-SCM_INTERNAL void scm_bootstrap_vm (void);
-
-#endif /* _SCM_VM_BOOTSTRAP_H_ */
-
-/*
-  Local Variables:
-  c-file-style: "gnu"
-  End:
-*/
index a5b5a558e1a3fb7a65ed6c394154731cb0fe62b3..5d0c4c9bc952ca65d7e6cc93fbed01c54a927be4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -28,7 +28,6 @@
 #include <gc/gc_mark.h>
 
 #include "_scm.h"
-#include "vm-bootstrap.h"
 #include "frames.h"
 #include "instructions.h"
 #include "objcodes.h"
@@ -654,30 +653,14 @@ SCM scm_load_compiled_with_vm (SCM file)
 void
 scm_bootstrap_vm (void)
 {
-  static int strappage = 0;
-  
-  if (strappage)
-    return;
-
-  scm_bootstrap_frames ();
-  scm_bootstrap_instructions ();
-  scm_bootstrap_objcodes ();
-  scm_bootstrap_programs ();
-
   scm_tc16_vm_cont = scm_make_smob_type ("vm-cont", 0);
 
   scm_tc16_vm = scm_make_smob_type ("vm", 0);
   scm_set_smob_apply (scm_tc16_vm, scm_vm_apply, 1, 0, 1);
 
-  scm_c_define ("load-compiled",
-                scm_c_make_gsubr ("load-compiled/vm", 1, 0, 0,
-                                  scm_load_compiled_with_vm));
-
   scm_c_register_extension ("libguile", "scm_init_vm",
                             (scm_t_extension_init_func)scm_init_vm, NULL);
 
-  strappage = 1;
-
 #ifdef VM_ENABLE_PRECISE_STACK_GC_SCAN
   vm_stack_gc_kind =
     GC_new_kind (GC_new_free_list (),
@@ -690,8 +673,6 @@ scm_bootstrap_vm (void)
 void
 scm_init_vm (void)
 {
-  scm_bootstrap_vm ();
-
 #ifndef SCM_MAGIC_SNARFER
 #include "libguile/vm.x"
 #endif
index f18826ef5c828f3c032fdd428eebed4fbb8a7e74..8ae09faaea07d8304929ead9a5c3b769bb39d894 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -104,6 +104,7 @@ SCM_API void scm_vm_reinstate_continuations (SCM conts);
 
 SCM_API SCM scm_load_compiled_with_vm (SCM file);
 
+SCM_INTERNAL void scm_bootstrap_vm (void);
 SCM_INTERNAL void scm_init_vm (void);
 
 #endif /* _SCM_VM_H_ */