1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 06:20:23 +02:00

The struct vtable data is now an array of scm_bits_t variables.

This commit is contained in:
Dirk Herrmann 2000-04-11 22:36:55 +00:00
parent bc66755eef
commit 1c3e63f06d
4 changed files with 21 additions and 7 deletions

View file

@ -1,3 +1,14 @@
2000-04-11 Dirk Herrmann <D.Herrmann@tu-bs.de>
* objects.h (SCM_OBJ_CLASS_FLAGS, SCM_OBJ_CLASS_REDEF), struct.h
(SCM_STRUCT_VTABLE_DATA, SCM_STRUCT_LAYOUT, SCM_STRUCT_VTABLE,
SCM_STRUCT_PRINTER): The struct vtable data is now an array of
scm_bits_t variables.
* struct.h (SCM_SET_STRUCT_LAYOUT): New macro.
* struct.c (scm_make_vtable_vtable): Use it.
2000-04-11 Dirk Herrmann <D.Herrmann@tu-bs.de>
* symbols.c (scm_sym2vcell, scm_sym2ovcell_soft, scm_sym2ovcell,

View file

@ -70,7 +70,7 @@
#define SCM_CLASS_FLAGS(class)\
SCM_UNPACK (SCM_STRUCT_DATA (class)[scm_struct_i_flags])
#define SCM_OBJ_CLASS_FLAGS(obj)\
SCM_UNPACK (SCM_STRUCT_VTABLE_DATA (obj)[scm_struct_i_flags])
(SCM_STRUCT_VTABLE_DATA (obj) [scm_struct_i_flags])
#define SCM_SET_CLASS_FLAGS(c, f) (SCM_CLASS_FLAGS (c) |= (f))
#define SCM_CLEAR_CLASS_FLAGS(c, f) (SCM_CLASS_FLAGS (c) &= ~(f))
#define SCM_CLASSF_MASK SCM_STRUCTF_MASK
@ -176,7 +176,7 @@ struct scm_metaclass_operator {
#define scm_si_redefined 6
#define scm_si_hashsets 7
#define SCM_CLASS_OF(x) SCM_STRUCT_VTABLE (x)
#define SCM_OBJ_CLASS_REDEF(x) (SCM_STRUCT_VTABLE_DATA(x)[scm_si_redefined])
#define SCM_OBJ_CLASS_REDEF(x) (SCM_PACK (SCM_STRUCT_VTABLE_DATA (x) [scm_si_redefined]))
typedef struct scm_effective_slot_definition {
SCM name;

View file

@ -500,7 +500,7 @@ SCM_DEFINE (scm_make_vtable_vtable, "make-vtable-vtable", 2, 0, 1,
"make-vtable-vtable");
SCM_SET_CELL_WORD_1 (handle, data);
SCM_SETCAR (handle, ((SCM)data) + scm_tc3_cons_gloc);
SCM_STRUCT_LAYOUT (handle) = layout;
SCM_SET_STRUCT_LAYOUT (handle, layout);
scm_struct_init (handle, tail_elts, scm_cons (layout, init));
SCM_ALLOW_INTS;
return handle;

View file

@ -79,10 +79,13 @@ typedef scm_sizet (*scm_struct_free_t) (SCM *vtable, SCM *data);
#define SCM_STRUCTP(X) (SCM_NIMP(X) && (SCM_TYP3(X) == scm_tc3_cons_gloc))
#define SCM_STRUCT_DATA(X) ((SCM *) SCM_UNPACK (SCM_CDR (X)))
#define SCM_STRUCT_VTABLE_DATA(X) ((SCM *) (SCM_UNPACK (SCM_CAR (X)) - 1))
#define SCM_STRUCT_LAYOUT(X) (SCM_STRUCT_VTABLE_DATA(X)[scm_vtable_index_layout])
#define SCM_STRUCT_VTABLE(X) (SCM_STRUCT_VTABLE_DATA(X)[scm_vtable_index_vtable])
#define SCM_STRUCT_PRINTER(X) (SCM_STRUCT_VTABLE_DATA(X)[scm_vtable_index_printer])
#define SCM_STRUCT_VTABLE_DATA(X) ((scm_bits_t *) (SCM_CELL_WORD_0 (X) - 1))
#define SCM_STRUCT_LAYOUT(X) (SCM_PACK (SCM_STRUCT_VTABLE_DATA (X) [scm_vtable_index_layout]))
#define SCM_SET_STRUCT_LAYOUT(X, v) (SCM_STRUCT_VTABLE_DATA (X) [scm_vtable_index_layout] = SCM_UNPACK (v))
#define SCM_STRUCT_VTABLE(X) (SCM_PACK (SCM_STRUCT_VTABLE_DATA (X) [scm_vtable_index_vtable]))
#define SCM_STRUCT_PRINTER(X) (SCM_PACK (SCM_STRUCT_VTABLE_DATA (X) [scm_vtable_index_printer]))
#define SCM_SET_VTABLE_DESTRUCTOR(X, D) (SCM_STRUCT_DATA(X)[scm_struct_i_free] = (SCM) D)
/* Efficiency is important in the following macro, since it's used in GC */
#define SCM_LAYOUT_TAILP(X) (((X) & 32) == 0) /* R, W or O */