Evaluator uses two-dimensional environment
authorAndy Wingo <wingo@pobox.com>
Fri, 25 Oct 2013 10:25:53 +0000 (12:25 +0200)
committerAndy Wingo <wingo@pobox.com>
Fri, 25 Oct 2013 15:15:23 +0000 (17:15 +0200)
commitcfc28c808e44582e9751b54713c58fd91ab53f16
tree8e0c8959c8774fc9322abe90f458207d7d9253fb
parent33e9a90d7b66d174c41b2cf0c8c89d4a3fa88443
Evaluator uses two-dimensional environment

* libguile/memoize.c (MAKMEMO_LEX_REF, MAKMEMO_LEX_SET): Change to
  address lexicals by depth and width.
  (try_lookup_rib, lookup_rib, make_pos): New helpers.
  (lookup): Adapt to return a pair.
  (memoize, unmemoize_bindings, unmemoize_lexical): Adapt.

* libguile/eval.c (eval, prepare_boot_closure_env_for_eval):
  (prepare_boot_closure_env_for_apply):
* module/ice-9/eval.scm (make-fixed-closure, make-general-closure)
  (eval): Adapt to new environment.

This is currently a slight win for C, and a slight lose for Scheme --
because the lookup loop is so poorly compiled by the stack VM.  I expect
that the RTL-compiled eval will fix this.
libguile/eval.c
libguile/memoize.c
module/ice-9/eval.scm