summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2010-01-05 18:50:17 +0100
committerAndy Wingo <wingo@pobox.com>2010-01-07 23:42:41 +0100
commita6029b97ea84d9e9a13d71b21213b6fd0be41e87 (patch)
tree5a60c3aebe8cdb826e24633a2712ea008171a609
parentf3056b42cf2ddb52cdd7de013ada33e4aa953ada (diff)
downloadguile-a6029b97ea84d9e9a13d71b21213b6fd0be41e87.tar.gz
properly integrate vm bootstrapping into init.c
* 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.
-rw-r--r--libguile/Makefile.am1
-rw-r--r--libguile/frames.c3
-rw-r--r--libguile/init.c12
-rw-r--r--libguile/instructions.c5
-rw-r--r--libguile/load.c4
-rw-r--r--libguile/objcodes.c3
-rw-r--r--libguile/programs.c3
-rw-r--r--libguile/vm-bootstrap.h30
-rw-r--r--libguile/vm.c21
-rw-r--r--libguile/vm.h3
10 files changed, 19 insertions, 66 deletions
diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index 838946769..856c87a9f 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -569,7 +569,6 @@ modinclude_HEADERS = \
values.h \
variable.h \
vectors.h \
- vm-bootstrap.h \
vm-engine.h \
vm-expand.h \
vm.h \
diff --git a/libguile/frames.c b/libguile/frames.c
index 5077d8e4f..29c14c8f1 100644
--- a/libguile/frames.c
+++ b/libguile/frames.c
@@ -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"
diff --git a/libguile/init.c b/libguile/init.c
index 21fefb43f..e2e90a1d7 100644
--- a/libguile/init.c
+++ b/libguile/init.c
@@ -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"
@@ -122,7 +126,7 @@
#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 */
diff --git a/libguile/instructions.c b/libguile/instructions.c
index c8d95cc9b..4c1f9f16f 100644
--- a/libguile/instructions.c
+++ b/libguile/instructions.c
@@ -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
diff --git a/libguile/load.c b/libguile/load.c
index 7c2dcfbe1..abd5b1ca3 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -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"
diff --git a/libguile/objcodes.c b/libguile/objcodes.c
index f73265727..cd5506f53 100644
--- a/libguile/objcodes.c
+++ b/libguile/objcodes.c
@@ -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
diff --git a/libguile/programs.c b/libguile/programs.c
index fdc0c32a9..d5b3b1aa4 100644
--- a/libguile/programs.c
+++ b/libguile/programs.c
@@ -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
index 7ba1a93ba..000000000
--- a/libguile/vm-bootstrap.h
+++ /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:
-*/
diff --git a/libguile/vm.c b/libguile/vm.c
index a5b5a558e..5d0c4c9bc 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -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
diff --git a/libguile/vm.h b/libguile/vm.h
index f18826ef5..8ae09faae 100644
--- a/libguile/vm.h
+++ b/libguile/vm.h
@@ -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_ */