summaryrefslogtreecommitdiff
path: root/libguile/goops.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2017-09-26 21:56:31 +0200
committerAndy Wingo <wingo@pobox.com>2017-09-26 21:56:31 +0200
commit214e887dbdece2e7608b02dd1ce5b31e710266cc (patch)
tree57aa16c3c15dfc2a39cfc858127504771e6ec5aa /libguile/goops.c
parentf32500acca82f13824e0d6d06836411f9d0c9c01 (diff)
downloadguile-214e887dbdece2e7608b02dd1ce5b31e710266cc.tar.gz
Struct vtables store bitmask of unboxed fields
* libguile/struct.h (scm_vtable_index_unboxed_fields): Allocate slot for bitmask of which fields are unboxed. (SCM_VTABLE_FLAG_SIMPLE, SCM_VTABLE_FLAG_SIMPLE_RW): Remove flags. Renumber other flags. (SCM_VTABLE_SIZE, SCM_STRUCT_SIZE): New helpers; long overdue. (SCM_VTABLE_UNBOXED_FIELDS, SCM_VTABLE_FIELD_IS_UNBOXED): (SCM_STRUCT_FIELD_IS_UNBOXED): New macros. * libguile/struct.c (set_vtable_access_fields): Rename from set_vtable_layout_flags, and initialize the unboxed flags bitmask instead of computing vtable flags. (scm_struct_init, scm_c_make_structv, scm_allocate_struct): Simplify. (scm_i_make_vtable_vtable): Adapt. (scm_i_struct_equalp, scm_struct_ref, scm_struct_set_x) (scm_struct_ref_unboxed, scm_struct_set_x_unboxed): Simplify. * libguile/vm-engine.c (VM_VALIDATE_BOXED_STRUCT_FIELD): (VM_VALIDATE_UNBOXED_STRUCT_FIELD): Adapt definitions. (struct-ref, struct-set!, struct-ref/immediate) (struct-set!/immediate): Simplify definitions. * libguile/hash.c (scm_i_struct_hash): Simplify. * libguile/goops.c (scm_sys_clear_fields_x): Simplify. * libguile/foreign-object.c (scm_make_foreign_object_n): (scm_foreign_object_unsigned_ref, scm_foreign_object_unsigned_set_x): Simplify.
Diffstat (limited to 'libguile/goops.c')
-rw-r--r--libguile/goops.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/libguile/goops.c b/libguile/goops.c
index e8ae001ed..40a93b1a4 100644
--- a/libguile/goops.c
+++ b/libguile/goops.c
@@ -475,17 +475,13 @@ SCM_DEFINE (scm_sys_clear_fields_x, "%clear-fields!", 2, 0, 0,
#define FUNC_NAME s_scm_sys_clear_fields_x
{
scm_t_signed_bits n, i;
- SCM vtable, layout;
SCM_VALIDATE_STRUCT (1, obj);
- vtable = SCM_STRUCT_VTABLE (obj);
-
- n = SCM_STRUCT_DATA_REF (vtable, scm_vtable_index_size);
- layout = SCM_VTABLE_LAYOUT (vtable);
+ n = SCM_STRUCT_SIZE (obj);
/* Set all SCM-holding slots to the GOOPS unbound value. */
for (i = 0; i < n; i++)
- if (scm_i_symbol_ref (layout, i*2) == 'p')
+ if (!SCM_STRUCT_FIELD_IS_UNBOXED (obj, i))
SCM_STRUCT_SLOT_SET (obj, i, unbound);
return SCM_UNSPECIFIED;