mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
remove used-by slot from generics
* libguile/goops.c (clear_method_cache) (scm_sys_invalidate_method_cache_x, scm_make) (create_standard_classes): Remove the used-by method from generics, as it is not used at all. * libguile/goops.h: Renumber generic slots. * module/oop/goops/dispatch.scm (memoize-method!): No more used-by slot.
This commit is contained in:
parent
0f84ac3fe6
commit
6d33e90f0c
3 changed files with 18 additions and 33 deletions
|
@ -1904,7 +1904,6 @@ clear_method_cache (SCM gf)
|
|||
{
|
||||
SCM cache = scm_make_method_cache (gf);
|
||||
SCM_SET_GENERIC_METHOD_CACHE (gf, cache);
|
||||
SCM_SET_SLOT (gf, scm_si_used_by, SCM_BOOL_F);
|
||||
}
|
||||
|
||||
SCM_DEFINE (scm_sys_invalidate_method_cache_x, "%invalidate-method-cache!", 1, 0, 0,
|
||||
|
@ -1912,23 +1911,16 @@ SCM_DEFINE (scm_sys_invalidate_method_cache_x, "%invalidate-method-cache!", 1, 0
|
|||
"")
|
||||
#define FUNC_NAME s_scm_sys_invalidate_method_cache_x
|
||||
{
|
||||
SCM used_by;
|
||||
SCM methods, n;
|
||||
|
||||
SCM_ASSERT (SCM_PUREGENERICP (gf), gf, SCM_ARG1, FUNC_NAME);
|
||||
used_by = SCM_SLOT (gf, scm_si_used_by);
|
||||
if (scm_is_true (used_by))
|
||||
{
|
||||
SCM methods = SCM_SLOT (gf, scm_si_methods);
|
||||
for (; scm_is_pair (used_by); used_by = SCM_CDR (used_by))
|
||||
scm_sys_invalidate_method_cache_x (SCM_CAR (used_by));
|
||||
clear_method_cache (gf);
|
||||
for (; scm_is_pair (methods); methods = SCM_CDR (methods))
|
||||
SCM_SET_SLOT (SCM_CAR (methods), scm_si_code_table, SCM_EOL);
|
||||
}
|
||||
{
|
||||
SCM n = SCM_SLOT (gf, scm_si_n_specialized);
|
||||
/* The sign of n is a flag indicating rest args. */
|
||||
SCM_SET_MCACHE_N_SPECIALIZED (SCM_GENERIC_METHOD_CACHE (gf), n);
|
||||
}
|
||||
methods = SCM_SLOT (gf, scm_si_methods);
|
||||
clear_method_cache (gf);
|
||||
for (; scm_is_pair (methods); methods = SCM_CDR (methods))
|
||||
SCM_SET_SLOT (SCM_CAR (methods), scm_si_code_table, SCM_EOL);
|
||||
n = SCM_SLOT (gf, scm_si_n_specialized);
|
||||
/* The sign of n is a flag indicating rest args. */
|
||||
SCM_SET_MCACHE_N_SPECIALIZED (SCM_GENERIC_METHOD_CACHE (gf), n);
|
||||
return SCM_UNSPECIFIED;
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
@ -2363,9 +2355,8 @@ SCM_DEFINE (scm_make, "make", 0, 0, 1,
|
|||
if (class == scm_class_generic || class == scm_class_accessor)
|
||||
{
|
||||
z = scm_make_struct (class, SCM_INUM0,
|
||||
scm_list_5 (SCM_EOL,
|
||||
scm_list_4 (SCM_EOL,
|
||||
SCM_INUM0,
|
||||
SCM_BOOL_F,
|
||||
scm_make_mutex (),
|
||||
SCM_EOL));
|
||||
scm_set_procedure_property_x (z, scm_sym_name,
|
||||
|
@ -2584,9 +2575,6 @@ create_standard_classes (void)
|
|||
scm_list_3 (scm_from_locale_symbol ("n-specialized"),
|
||||
k_init_value,
|
||||
SCM_INUM0),
|
||||
scm_list_3 (scm_from_locale_symbol ("used-by"),
|
||||
k_init_value,
|
||||
SCM_BOOL_F),
|
||||
scm_list_3 (scm_from_locale_symbol ("cache-mutex"),
|
||||
k_init_thunk,
|
||||
mutex_closure),
|
||||
|
|
|
@ -174,15 +174,14 @@ typedef struct scm_t_method {
|
|||
|
||||
#define scm_si_methods 0 /* offset of methods slot in a <generic> */
|
||||
#define scm_si_n_specialized 1
|
||||
#define scm_si_used_by 2
|
||||
#define scm_si_cache_mutex 3
|
||||
#define scm_si_extended_by 4
|
||||
#define scm_si_generic_cache 5
|
||||
#define scm_si_applicable_methods 6
|
||||
#define scm_si_effective_method 7
|
||||
#define scm_si_generic_setter_cache 8
|
||||
#define scm_si_applicable_setter_methods 9
|
||||
#define scm_si_effective_setter_method 10
|
||||
#define scm_si_cache_mutex 2
|
||||
#define scm_si_extended_by 3
|
||||
#define scm_si_generic_cache 4
|
||||
#define scm_si_applicable_methods 5
|
||||
#define scm_si_effective_method 6
|
||||
#define scm_si_generic_setter_cache 7
|
||||
#define scm_si_applicable_setter_methods 8
|
||||
#define scm_si_effective_setter_method 9
|
||||
|
||||
#define scm_si_generic_function 0 /* offset of gf slot in a <method> */
|
||||
#define scm_si_specializers 1 /* offset of spec. slot in a <method> */
|
||||
|
|
|
@ -212,8 +212,6 @@
|
|||
(no-applicable-method (car args) (cadr args)))
|
||||
|
||||
(define (memoize-method! gf args exp)
|
||||
(if (not (slot-ref gf 'used-by))
|
||||
(slot-set! gf 'used-by '()))
|
||||
(let ((applicable ((if (eq? gf compute-applicable-methods)
|
||||
%compute-applicable-methods
|
||||
compute-applicable-methods)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue