summaryrefslogtreecommitdiff
path: root/libguile/eval.i.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2008-10-30 15:50:48 +0100
committerAndy Wingo <wingo@pobox.com>2008-10-30 15:50:48 +0100
commit05b37c17ff8e7099d047ae8265766fbb084cb1c3 (patch)
tree889dc813ecaf6fb29bf25dda259214c2c0d270ae /libguile/eval.i.c
parent5487977b1bf4a120cc3604f649cc51ea39b533d9 (diff)
downloadguile-05b37c17ff8e7099d047ae8265766fbb084cb1c3.tar.gz
fix up some assumptions that cmethods were lists
* libguile/eval.i.c (type_dispatch, apply_vm_cmethod) (apply_memoized_cmethod): Tweak the nastiness a bit more so as to deal with the '(no-method) empty entries. I would like to stop the search if the cdr isn't a pair, but currently with the inlined memoized bits, the cdr is a pair. The fix would be to make the memoizer return a procedure and not the already-inlined bits -- slightly slower but the vm will be faster anyway. * libguile/objects.c (scm_mcache_lookup_cmethod): Same fixes here. * oop/goops/dispatch.scm (cache-hashval, cache-try-hash!): Allow non-list cmethod tails.
Diffstat (limited to 'libguile/eval.i.c')
-rw-r--r--libguile/eval.i.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/libguile/eval.i.c b/libguile/eval.i.c
index 407a64281..b208f01b0 100644
--- a/libguile/eval.i.c
+++ b/libguile/eval.i.c
@@ -856,8 +856,11 @@ dispatch:
z = SCM_CDR (z);
}
/* Fewer arguments than specifiers => CAR != CLASS */
- if (!SCM_CLASSP (SCM_CAR (z)))
- goto apply_cmethod;
+ if (!scm_is_pair (z))
+ goto apply_vm_cmethod;
+ else if (!SCM_CLASSP (SCM_CAR (z))
+ && !scm_is_symbol (SCM_CAR (z)))
+ goto apply_memoized_cmethod;
next_method:
hash_value = (hash_value + 1) & mask;
} while (hash_value != cache_end_pos);
@@ -865,19 +868,21 @@ dispatch:
/* No appropriate method was found in the cache. */
z = scm_memoize_method (x, arg1);
- apply_cmethod: /* inputs: z, arg1 */
- {
- 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;
- }
- }
+ if (scm_is_pair (z))
+ goto apply_memoized_cmethod;
+
+ apply_vm_cmethod:
+ proc = z;
+ PREP_APPLY (proc, arg1);
+ goto apply_proc;
+
+ apply_memoized_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;
+ }
}
}