summaryrefslogtreecommitdiff
path: root/libguile/objects.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2008-10-30 13:42:40 +0100
committerAndy Wingo <wingo@pobox.com>2008-10-30 13:42:40 +0100
commit5487977b1bf4a120cc3604f649cc51ea39b533d9 (patch)
tree818b6f8f4cf50fd5e4e340eac003a9b37fa49041 /libguile/objects.c
parent3de80ed52f7482faee2ce883d3df21eb8a38ee7a (diff)
downloadguile-5487977b1bf4a120cc3604f649cc51ea39b533d9.tar.gz
runtime byte compilation of goops methods, whooooo
* ice-9/boot-9.scm (make-modules-in): Change to make sure that we are making modules in modules; that is, that a global binding of `compile' doesn't prevent a module from importing a submodule named `compile'. (resolve-module): Clean up a bit, and serialize the logic. * libguile/objects.c (scm_mcache_lookup_cmethod, scm_apply_generic): * libguile/eval.i.c (CEVAL): Now that cmethod entries can have a program as their tail instead of a memoized proc, we have to change the halting condition on the method cache search, in both places: the one that's inlined into eval.i.c and the one in objects.c. If the cmethod isn't a pair, apply it. * libguile/goops.c (make): In the `make' procedure that's used before GOOPS is booted, bind #:formals, #:body, and #:compile-env on methods. * oop/goops/compile.scm (compute-entry-with-cmethod): There was a terrible trick here that involved putting a dummy pair in the cache, then modifying it in place with the result of memoization. The note claimed that this was to cut recursion short, or something. I can't see how it could recurse, given that `methods' is changing each time. Also, the pair trick doesn't work with byte-compiled methods. So, remove it. (compile-method): Dispatch to the appropriate method compiler, based on whether the method was defined with the interpreter or with the compiler. (make-next-method): New function, generically computes a `next-method' procedure, though the caller has to supply the arguments. (compile-method/vm): Exciting method byte compiler! (make-make-next-method/memoizer, compile-method/memoizer): Add the /memoizer suffix, and move all this code to the bottom of the file.
Diffstat (limited to 'libguile/objects.c')
-rw-r--r--libguile/objects.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libguile/objects.c b/libguile/objects.c
index 995d2e4c9..f3c9731a4 100644
--- a/libguile/objects.c
+++ b/libguile/objects.c
@@ -138,8 +138,8 @@ scm_mcache_lookup_cmethod (SCM cache, SCM args)
z = SCM_CDR (z);
}
while (j-- && !scm_is_null (ls));
- /* Fewer arguments than specifiers => CAR != ENV */
- if (scm_is_null (SCM_CAR (z)) || scm_is_pair (SCM_CAR (z)))
+ /* Fewer arguments than specifiers => CAR != CLASS */
+ if (!SCM_CLASSP (SCM_CAR (z)))
return z;
next_method:
i = (i + 1) & mask;
@@ -161,10 +161,13 @@ SCM
scm_apply_generic (SCM gf, SCM args)
{
SCM cmethod = scm_mcache_compute_cmethod (SCM_ENTITY_PROCEDURE (gf), args);
- return scm_eval_body (SCM_CDR (SCM_CMETHOD_CODE (cmethod)),
- SCM_EXTEND_ENV (SCM_CAR (SCM_CMETHOD_CODE (cmethod)),
- args,
- SCM_CMETHOD_ENV (cmethod)));
+ if (scm_is_pair (cmethod))
+ return scm_eval_body (SCM_CDR (SCM_CMETHOD_CODE (cmethod)),
+ SCM_EXTEND_ENV (SCM_CAR (SCM_CMETHOD_CODE (cmethod)),
+ args,
+ SCM_CMETHOD_ENV (cmethod)));
+ else
+ return scm_apply (cmethod, args, SCM_EOL);
}
SCM