Reduce cache size for generic functions.

Instead of occupying two vector elements (one for the actual value and
one for a bit indicating whether it's an eql-specializer) store cons
cells containing eql specializer values from
CLOS::GENERIC-FUNCTION-SPEC-LIST.
This commit is contained in:
Stas Boukarev 2015-11-01 21:52:57 +03:00
parent 5532d4b996
commit dfe68fe96a
2 changed files with 8 additions and 9 deletions

View file

@ -127,21 +127,22 @@ fill_spec_vector(cl_object vector, cl_object frame, cl_object gf)
cl_object spec_how = ECL_CONS_CAR(spec_how_list);
cl_object spec_type = ECL_CONS_CAR(spec_how);
int spec_position = ecl_fixnum(ECL_CONS_CDR(spec_how));
cl_object eql_spec;
unlikely_if (spec_position >= narg)
FEwrong_num_arguments(gf);
unlikely_if (spec_no >= vector->vector.dim)
ecl_internal_error("Too many arguments to fill_spec_vector()");
/* Need to differentiate between EQL specializers and
class specializers, because the EQL value can be a
class, and may classh with a class specializer. */
if (ECL_LISTP(spec_type) && ecl_memql(args[spec_position], spec_type)) {
argtype[spec_no++] = args[spec_position];
argtype[spec_no++] = 1;
class, and may clash with a class specializer.
Store the cons cell containing the EQL value. */
if (ECL_LISTP(spec_type) &&
!Null(eql_spec = ecl_memql(args[spec_position], spec_type))) {
argtype[spec_no++] = eql_spec;
} else {
argtype[spec_no++] = cl_class_of(args[spec_position]);
argtype[spec_no++] = 0;
}
} end_loop_for_on_unsafe(spec_how_list);
vector->vector.fillp = spec_no;
return vector;

View file

@ -169,9 +169,7 @@ ecl_init_env(cl_env_ptr env)
((struct ecl_fficall*)env->fficall)->registers = 0;
#endif
/* Needs 128 elements for 64 entries to differentiate between
EQL specializers and class specializers */
env->method_cache = ecl_make_cache(128, 4096);
env->method_cache = ecl_make_cache(64, 4096);
env->slot_cache = ecl_make_cache(3, 4096);
env->pending_interrupt = ECL_NIL;
{