From 26fe6af140fd7e3042bfc628e5fb60b382d6a126 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sun, 1 Nov 2009 21:09:42 +0100 Subject: [PATCH] remove redundant, unnecessary instance size from struct vtables * libguile/struct.h (scm_struct_i_size): Remove this shared field -- I mean, the slot is still there, but it's only used for flags. * libguile/goops.h (SCM_SET_CLASS_INSTANCE_SIZE): * libguile/goops.c (scm_sys_inherit_magic_x, scm_make_class): Remove uses and definition of SCM_SET_CLASS_INSTANCE_SIZE. Light structs used it, but you have that info in the layout; and foreign classes used it, but that is going away soon anyway :) --- libguile/goops.c | 7 +------ libguile/goops.h | 3 --- libguile/struct.h | 1 - 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/libguile/goops.c b/libguile/goops.c index c6188ba3a..12d0e4b7c 100644 --- a/libguile/goops.c +++ b/libguile/goops.c @@ -775,8 +775,7 @@ SCM_DEFINE (scm_sys_inherit_magic_x, "%inherit-magic!", 2, 0, 0, #endif if (n > 0 && !(flags & SCM_CLASSF_METACLASS)) { - /* NOTE: The following depends on scm_struct_i_size. */ - flags |= SCM_STRUCTF_LIGHT + n * sizeof (SCM); /* use light representation */ + flags |= SCM_STRUCTF_LIGHT; /* use light representation */ } } SCM_SET_CLASS_FLAGS (class, flags); @@ -3044,10 +3043,6 @@ scm_make_class (SCM meta, char *s_name, SCM supers, size_t size, SCM_SET_SLOT (class, scm_si_destructor, (SCM) destructor); SCM_SET_CLASS_DESTRUCTOR (class, scm_free_foreign_object); } - else if (size > 0) - { - SCM_SET_CLASS_INSTANCE_SIZE (class, size); - } SCM_SET_SLOT (class, scm_si_layout, scm_from_locale_symbol ("")); SCM_SET_SLOT (class, scm_si_constructor, (SCM) constructor); diff --git a/libguile/goops.h b/libguile/goops.h index 01cf23c53..153aace1a 100644 --- a/libguile/goops.h +++ b/libguile/goops.h @@ -141,9 +141,6 @@ typedef struct scm_t_method { #define SCM_VALIDATE_METHOD(pos, x) SCM_MAKE_VALIDATE_MSG (pos, x, METHODP, "method") #define SCM_SET_CLASS_DESTRUCTOR(c, d) SCM_SET_VTABLE_DESTRUCTOR (c, d) -#define SCM_SET_CLASS_INSTANCE_SIZE(c, s) \ - (SCM_STRUCT_DATA (c)[scm_struct_i_size] \ - = (SCM_STRUCT_DATA (c) [scm_struct_i_size] & SCM_STRUCTF_MASK) | s) #define SCM_GENERIC_METHOD_CACHE(G) (SCM_PACK (SCM_STRUCT_DATA (G) [scm_struct_i_procedure])) #define SCM_SET_GENERIC_METHOD_CACHE(G,C) (SCM_STRUCT_DATA (G) [scm_struct_i_procedure] = SCM_UNPACK (C)) diff --git a/libguile/struct.h b/libguile/struct.h index fb655aa5e..8634659f8 100644 --- a/libguile/struct.h +++ b/libguile/struct.h @@ -38,7 +38,6 @@ #define scm_struct_i_free -4 /* Destructor */ #define scm_struct_i_ptr -3 /* Start of block (see alloc_struct) */ #define scm_struct_i_n_words -2 /* How many words allocated to this struct? */ -#define scm_struct_i_size -1 /* Instance size */ #define scm_struct_i_flags -1 /* Upper 12 bits used as flags */ /* These indices must correspond to required_vtable_fields in