1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +02:00

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.
This commit is contained in:
Andy Wingo 2010-01-05 18:50:17 +01:00
parent f3056b42cf
commit a6029b97ea
10 changed files with 19 additions and 66 deletions

View file

@ -569,7 +569,6 @@ modinclude_HEADERS = \
values.h \ values.h \
variable.h \ variable.h \
vectors.h \ vectors.h \
vm-bootstrap.h \
vm-engine.h \ vm-engine.h \
vm-expand.h \ vm-expand.h \
vm.h \ vm.h \

View 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -23,7 +23,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "_scm.h" #include "_scm.h"
#include "vm-bootstrap.h"
#include "frames.h" #include "frames.h"

View file

@ -57,6 +57,7 @@
#include "libguile/filesys.h" #include "libguile/filesys.h"
#include "libguile/fluids.h" #include "libguile/fluids.h"
#include "libguile/fports.h" #include "libguile/fports.h"
#include "libguile/frames.h"
#include "libguile/gc.h" #include "libguile/gc.h"
#include "libguile/gdbint.h" #include "libguile/gdbint.h"
#include "libguile/generalized-arrays.h" #include "libguile/generalized-arrays.h"
@ -68,6 +69,7 @@
#include "libguile/hooks.h" #include "libguile/hooks.h"
#include "libguile/gettext.h" #include "libguile/gettext.h"
#include "libguile/i18n.h" #include "libguile/i18n.h"
#include "libguile/instructions.h"
#include "libguile/iselect.h" #include "libguile/iselect.h"
#include "libguile/ioext.h" #include "libguile/ioext.h"
#include "libguile/keywords.h" #include "libguile/keywords.h"
@ -80,6 +82,7 @@
#include "libguile/modules.h" #include "libguile/modules.h"
#include "libguile/net_db.h" #include "libguile/net_db.h"
#include "libguile/numbers.h" #include "libguile/numbers.h"
#include "libguile/objcodes.h"
#include "libguile/objprop.h" #include "libguile/objprop.h"
#include "libguile/options.h" #include "libguile/options.h"
#include "libguile/pairs.h" #include "libguile/pairs.h"
@ -91,6 +94,7 @@
#include "libguile/print.h" #include "libguile/print.h"
#include "libguile/procprop.h" #include "libguile/procprop.h"
#include "libguile/procs.h" #include "libguile/procs.h"
#include "libguile/programs.h"
#include "libguile/promises.h" #include "libguile/promises.h"
#include "libguile/properties.h" #include "libguile/properties.h"
#include "libguile/array-map.h" #include "libguile/array-map.h"
@ -122,7 +126,7 @@
#include "libguile/variable.h" #include "libguile/variable.h"
#include "libguile/vectors.h" #include "libguile/vectors.h"
#include "libguile/version.h" #include "libguile/version.h"
#include "libguile/vm-bootstrap.h" #include "libguile/vm.h"
#include "libguile/vports.h" #include "libguile/vports.h"
#include "libguile/weaks.h" #include "libguile/weaks.h"
#include "libguile/guardians.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_arrays (); /* Requires smob_prehistory, array-handle */
scm_init_array_map (); 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_frames (); /* Requires smob_prehistory */
scm_init_stacks (); /* Requires strings, struct, frames */ scm_init_stacks (); /* Requires strings, struct, frames */

View 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -23,7 +23,6 @@
#include <string.h> #include <string.h>
#include "_scm.h" #include "_scm.h"
#include "vm-bootstrap.h"
#include "instructions.h" #include "instructions.h"
struct scm_instruction { struct scm_instruction {
@ -205,8 +204,6 @@ scm_bootstrap_instructions (void)
void void
scm_init_instructions (void) scm_init_instructions (void)
{ {
scm_bootstrap_vm ();
#ifndef SCM_MAGIC_SNARFER #ifndef SCM_MAGIC_SNARFER
#include "libguile/instructions.x" #include "libguile/instructions.x"
#endif #endif

View file

@ -908,6 +908,10 @@ scm_init_load ()
scm_fluid_set_x (the_reader, SCM_BOOL_F); scm_fluid_set_x (the_reader, SCM_BOOL_F);
scm_c_define("current-reader", the_reader); 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 (); init_build_info ();
#include "libguile/load.x" #include "libguile/load.x"

View file

@ -30,7 +30,6 @@
#include <alignof.h> #include <alignof.h>
#include "_scm.h" #include "_scm.h"
#include "vm-bootstrap.h"
#include "programs.h" #include "programs.h"
#include "objcodes.h" #include "objcodes.h"
@ -274,8 +273,6 @@ scm_bootstrap_objcodes (void)
void void
scm_init_objcodes (void) scm_init_objcodes (void)
{ {
scm_bootstrap_vm ();
#ifndef SCM_MAGIC_SNARFER #ifndef SCM_MAGIC_SNARFER
#include "libguile/objcodes.x" #include "libguile/objcodes.x"
#endif #endif

View file

@ -22,7 +22,6 @@
#include <string.h> #include <string.h>
#include "_scm.h" #include "_scm.h"
#include "vm-bootstrap.h"
#include "instructions.h" #include "instructions.h"
#include "modules.h" #include "modules.h"
#include "programs.h" #include "programs.h"
@ -338,8 +337,6 @@ scm_bootstrap_programs (void)
void void
scm_init_programs (void) scm_init_programs (void)
{ {
scm_bootstrap_vm ();
#ifndef SCM_MAGIC_SNARFER #ifndef SCM_MAGIC_SNARFER
#include "libguile/programs.x" #include "libguile/programs.x"
#endif #endif

View file

@ -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:
*/

View 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -28,7 +28,6 @@
#include <gc/gc_mark.h> #include <gc/gc_mark.h>
#include "_scm.h" #include "_scm.h"
#include "vm-bootstrap.h"
#include "frames.h" #include "frames.h"
#include "instructions.h" #include "instructions.h"
#include "objcodes.h" #include "objcodes.h"
@ -654,30 +653,14 @@ SCM scm_load_compiled_with_vm (SCM file)
void void
scm_bootstrap_vm (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_cont = scm_make_smob_type ("vm-cont", 0);
scm_tc16_vm = scm_make_smob_type ("vm", 0); scm_tc16_vm = scm_make_smob_type ("vm", 0);
scm_set_smob_apply (scm_tc16_vm, scm_vm_apply, 1, 0, 1); 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_c_register_extension ("libguile", "scm_init_vm",
(scm_t_extension_init_func)scm_init_vm, NULL); (scm_t_extension_init_func)scm_init_vm, NULL);
strappage = 1;
#ifdef VM_ENABLE_PRECISE_STACK_GC_SCAN #ifdef VM_ENABLE_PRECISE_STACK_GC_SCAN
vm_stack_gc_kind = vm_stack_gc_kind =
GC_new_kind (GC_new_free_list (), GC_new_kind (GC_new_free_list (),
@ -690,8 +673,6 @@ scm_bootstrap_vm (void)
void void
scm_init_vm (void) scm_init_vm (void)
{ {
scm_bootstrap_vm ();
#ifndef SCM_MAGIC_SNARFER #ifndef SCM_MAGIC_SNARFER
#include "libguile/vm.x" #include "libguile/vm.x"
#endif #endif

View 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * 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_API SCM scm_load_compiled_with_vm (SCM file);
SCM_INTERNAL void scm_bootstrap_vm (void);
SCM_INTERNAL void scm_init_vm (void); SCM_INTERNAL void scm_init_vm (void);
#endif /* _SCM_VM_H_ */ #endif /* _SCM_VM_H_ */