- /* (SCM_IM_DISPATCH N-SPECIALIZED
- * #((TYPE1 ... ENV FORMALS FORM ...) ...))
- *
- * Need FORMALS in order to support varying arity. This
- * also avoids the need for renaming of bindings.
- *
- * We should probably not complicate this mechanism by
- * introducing "optimizations" for getters and setters or
- * primitive methods. Getters and setter will normally be
- * compiled into @slot-[ref|set!] or a procedure call.
- * They rely on the dispatch performed before executing
- * the code which contains them.
- *
- * We might want to use a more efficient representation of
- * this form in the future, perhaps after we have introduced
- * low-level support for syntax-case macros.
+ proc = SCM_CADR (x); /* unevaluated operands */
+ PREP_APPLY (SCM_UNDEFINED, SCM_EOL);
+ if (SCM_IMP (proc))
+ arg2 = *scm_ilookup (proc, env);
+ else if (SCM_NCONSP (proc))
+ {
+ if (SCM_NCELLP (proc))
+ arg2 = SCM_GLOC_VAL (proc);
+ else
+ arg2 = *scm_lookupcar (SCM_CDR (x), env, 1);
+ }
+ else
+ {
+ arg2 = scm_cons (EVALCAR (proc, env), SCM_EOL);
+ t.lloc = SCM_CDRLOC (arg2);
+ while (SCM_NIMP (proc = SCM_CDR (proc)))
+ {
+ *t.lloc = scm_cons (EVALCAR (proc, env), SCM_EOL);
+ t.lloc = SCM_CDRLOC (*t.lloc);
+ }
+ }
+
+ type_dispatch:
+ /* The type dispatch code is duplicated here
+ * (c.f. objects.c:scm_mcache_compute_cmethod) since that
+ * cuts down execution time for type dispatch to 50%.