diff options
author | Andy Wingo <wingo@pobox.com> | 2008-05-19 19:37:39 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2008-05-19 19:37:39 +0200 |
commit | 6297d22907ef28d6dc059db3bbcd711d9b7c50a1 (patch) | |
tree | 3d23c3f8155b0fce6de1febf2d4dae13e6b589a3 /src/vm_loader.c | |
parent | 9cc649b880fe81ff4b2dd1929beb45ea313dee42 (diff) | |
download | guile-6297d22907ef28d6dc059db3bbcd711d9b7c50a1.tar.gz |
bind all module-level variables lazily
comments in ghil-lookup are pertinent.
* module/system/il/compile.scm (make-glil-var): Require that ghil vars
have environments. Remove the 'unresolved case -- we'll treat all
module-level variables as late bound.
* module/system/il/ghil.scm (ghil-lookup): Treat all module level vars as
late bound.
* module/system/vm/assemble.scm: Instead of vlink and vlate-bound, have
vlink-now and vlink-later.
(codegen): Add a bunch of crap to get the various cases right.
(object-assoc, dump-object!): Handle the new cases, remove the old
cases.
* src/vm_loader.c (link-now, link-later): Change from link and lazy-bind.
Include the module in which the link is to be done, so that callers
from other modules get the right behavior.
* src/vm_system.c (late-variable-ref, late-variable-set): Instead of a
sym, the unbound representation is a module name / symbol pair.
* testsuite/run-vm-tests.scm (run-vm-tests): Remove some debugging.
Diffstat (limited to 'src/vm_loader.c')
-rw-r--r-- | src/vm_loader.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/vm_loader.c b/src/vm_loader.c index d8bf554a8..aa9cd356c 100644 --- a/src/vm_loader.c +++ b/src/vm_loader.c @@ -176,29 +176,21 @@ VM_DEFINE_LOADER (load_program, "load-program") NEXT; } -/* this seems to be a bit too much processing for one instruction.. */ -VM_DEFINE_INSTRUCTION (link, "link", 0, 2, 1) +VM_DEFINE_INSTRUCTION (link_now, "link-now", 0, 2, 1) { - SCM modname, mod, sym; + SCM modname, sym; POP (sym); POP (modname); - if (SCM_NFALSEP (modname)) - { - mod = scm_resolve_module (modname); - - if (mod != scm_current_module ()) - { - mod = scm_c_module_lookup (mod, "%module-public-interface"); - if (SCM_FALSEP (mod)) - SCM_MISC_ERROR ("Could not load module", SCM_LIST1 (modname)); - mod = SCM_VARIABLE_REF (mod); - } - - PUSH (scm_module_lookup (mod, sym)); - } - else - PUSH (scm_lookup (sym)); - + PUSH (scm_module_lookup (scm_resolve_module (modname), sym)); /* might longjmp */ + NEXT; +} + +VM_DEFINE_INSTRUCTION (link_later, "link-later", 0, 2, 1) +{ + SCM modname, sym; + POP (sym); + POP (modname); + PUSH (scm_cons (modname, sym)); NEXT; } |