diff options
author | Andy Wingo <wingo@pobox.com> | 2009-01-17 16:42:53 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-01-17 16:42:53 +0100 |
commit | 2fda0242214e1b650b8fd3eb084e1c930a8399a5 (patch) | |
tree | cb0e118575713554b98b11e4d15c91a0605f6941 /libguile/vm-i-loader.c | |
parent | a72317988fa29377928d30c7e52b5acf63b6943a (diff) | |
download | guile-2fda0242214e1b650b8fd3eb084e1c930a8399a5.tar.gz |
move module and meta inside programs' object tables
* libguile/programs.h (struct scm_program): Remove the module and meta
fields.
* libguile/programs.c (scm_c_make_program): Add a new argument, `objs'.
If it's a vector, we'll look for the module and the metadata in there,
instead of having them in the scm_program structure.
(scm_c_make_closure, program_mark, scm_program_meta)
(scm_c_program_source, scm_program_module): Adapt to the new program
representation.
* libguile/objcodes.c (scm_objcode_to_program): Pass #f as the object
table when making the program.
* libguile/vm-engine.h (CACHE_PROGRAM):
* libguile/vm-engine.c (vm_run): Rework to use the simple vector API for
getting the current object table. Call the helper,
vm_make_boot_program, to make the boot program.
* libguile/vm-i-loader.c (load-program): Set the current module and the
meta in the object vector, which we pass to scm_c_make_program.
* libguile/vm-i-system.c (toplevel-ref, toplevel-set): Adapt to the new
program representation.
* module/language/glil/compile-objcode.scm (codegen): Clarify.
Diffstat (limited to 'libguile/vm-i-loader.c')
-rw-r--r-- | libguile/vm-i-loader.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/libguile/vm-i-loader.c b/libguile/vm-i-loader.c index 71f53abf5..45aced1de 100644 --- a/libguile/vm-i-loader.c +++ b/libguile/vm-i-loader.c @@ -106,37 +106,33 @@ VM_DEFINE_LOADER (load_keyword, "load-keyword") VM_DEFINE_LOADER (load_program, "load-program") { size_t len; - SCM prog, x; + SCM prog, x, objs = SCM_BOOL_F, meta = SCM_BOOL_F; struct scm_program *p; - FETCH_LENGTH (len); - SYNC_REGISTER (); - prog = scm_c_make_program (ip, len, program); - p = SCM_PROGRAM_DATA (prog); - ip += len; - POP (x); /* init meta data */ if (SCM_PROGRAM_P (x)) { - p->meta = x; + meta = x; POP (x); } /* init object table */ if (scm_is_vector (x)) { -#if 0 - if (scm_is_simple_vector (x)) - printf ("is_simple_vector!\n"); - else - printf ("NOT is_simple_vector\n"); -#endif - p->objs = x; + objs = x; + scm_c_vector_set_x (objs, 0, scm_current_module ()); + scm_c_vector_set_x (objs, 1, meta); POP (x); } + FETCH_LENGTH (len); + SYNC_REGISTER (); + prog = scm_c_make_program (ip, len, objs, program); + p = SCM_PROGRAM_DATA (prog); + ip += len; + /* init parameters */ /* NOTE: format defined in system/vm/assemble.scm */ if (SCM_I_INUMP (x)) |