summaryrefslogtreecommitdiff
path: root/libguile/eval.i.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/eval.i.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/eval.i.c')
-rw-r--r--libguile/eval.i.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libguile/eval.i.c b/libguile/eval.i.c
index 3d686700b..407a64281 100644
--- a/libguile/eval.i.c
+++ b/libguile/eval.i.c
@@ -855,8 +855,8 @@ dispatch:
args = SCM_CDR (args);
z = SCM_CDR (z);
}
- /* 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)))
goto apply_cmethod;
next_method:
hash_value = (hash_value + 1) & mask;
@@ -867,10 +867,16 @@ dispatch:
apply_cmethod: /* inputs: z, arg1 */
{
- SCM formals = SCM_CMETHOD_FORMALS (z);
- env = SCM_EXTEND_ENV (formals, arg1, SCM_CMETHOD_ENV (z));
- x = SCM_CMETHOD_BODY (z);
- goto nontoplevel_begin;
+ if (scm_is_pair (z)) {
+ SCM formals = SCM_CMETHOD_FORMALS (z);
+ env = SCM_EXTEND_ENV (formals, arg1, SCM_CMETHOD_ENV (z));
+ x = SCM_CMETHOD_BODY (z);
+ goto nontoplevel_begin;
+ } else {
+ proc = z;
+ PREP_APPLY (proc, arg1);
+ goto apply_proc;
+ }
}
}
}