Commit b9d54d6b authored by Daniel Kochmański's avatar Daniel Kochmański Committed by Marius Gerbershagen
Browse files

internals: rename instance.sig to instance.slotds

Slot definitions are no longer a signature, but they are still needed
to update obsolete instances. Reader function name is also changed to
SI:INSTANCE-SLOTDS. SI:INSTANCE-SIG-SET name does not change, because
it sets both SLOTDS and the STAMP.
parent f1bc883e
......@@ -443,7 +443,7 @@ cl_object_mark_proc(void *addr, struct GC_ms_entry *msp, struct GC_ms_entry *msl
break;
case t_instance:
MAYBE_MARK(o->instance.slots);
MAYBE_MARK(o->instance.sig);
MAYBE_MARK(o->instance.slotds);
MAYBE_MARK(o->instance.clas);
break;
# ifdef ECL_THREADS
......@@ -682,7 +682,7 @@ ecl_alloc_instance(cl_index slots)
i->instance.slots = (cl_object *)ecl_alloc(sizeof(cl_object) * slots);
i->instance.length = slots;
i->instance.entry = FEnot_funcallable_vararg;
i->instance.sig = ECL_UNBOUND;
i->instance.slotds = ECL_UNBOUND;
return i;
}
......@@ -1012,7 +1012,7 @@ init_alloc(void)
to_bitmap(&o, &(o.cclosure.file_position));
type_info[t_instance].descriptor =
to_bitmap(&o, &(o.instance.clas)) |
to_bitmap(&o, &(o.instance.sig)) |
to_bitmap(&o, &(o.instance.slotds)) |
to_bitmap(&o, &(o.instance.slots));
# ifdef ECL_THREADS
type_info[t_process].descriptor =
......
......@@ -59,7 +59,7 @@ reshape_instance(cl_object x, int delta)
cl_fixnum size = x->instance.length + delta;
cl_object aux = ecl_allocate_instance(ECL_CLASS_OF(x), size);
/* Except for the different size, this must match si_copy_instance */
aux->instance.sig = x->instance.sig;
aux->instance.slotds = x->instance.slotds;
aux->instance.stamp = x->instance.stamp;
aux->instance.class_stamp = x->instance.class_stamp;
memcpy(aux->instance.slots, x->instance.slots,
......
......@@ -68,16 +68,16 @@ si_instance_get_stamp(cl_object x)
}
cl_object
si_instance_sig(cl_object x)
si_instance_slotds(cl_object x)
{
@(return x->instance.sig);
@(return x->instance.slotds);
}
cl_object
si_instance_sig_set(cl_object x)
{
x->instance.stamp = ECL_CLASS_OF(x)->instance.class_stamp;
@(return (x->instance.sig = ECL_CLASS_SLOTS(ECL_CLASS_OF(x))));
@(return (x->instance.slotds = ECL_CLASS_SLOTS(ECL_CLASS_OF(x))));
}
cl_object
......@@ -296,7 +296,7 @@ si_copy_instance(cl_object x)
FEwrong_type_nth_arg(@[si::copy-instance], 1, x, @[ext::instance]);
}
y = ecl_allocate_instance(x->instance.clas, x->instance.length);
y->instance.sig = x->instance.sig;
y->instance.slotds = x->instance.slotds;
y->instance.stamp = x->instance.stamp;
y->instance.class_stamp = x->instance.class_stamp;
memcpy(y->instance.slots, x->instance.slots,
......
......@@ -49,7 +49,7 @@ si_structure_subtype_p(cl_object x, cl_object y)
ECL_STRUCT_SLOTS(x) = NULL; /* for GC sake */
ECL_STRUCT_LENGTH(x) = --narg;
ECL_STRUCT_SLOTS(x) = (cl_object *)ecl_alloc_align(sizeof(cl_object)*narg, sizeof(cl_object));
x->instance.sig = ECL_UNBOUND;
x->instance.slotds = ECL_UNBOUND;
if (narg >= ECL_SLOTS_LIMIT)
FEerror("Limit on structure size exceeded: ~S slots requested.",
1, ecl_make_fixnum(narg));
......
......@@ -1297,7 +1297,7 @@ cl_symbols[] = {
{SYS_ "INSTANCE-OBSOLETE-P", SI_ORDINARY, si_instance_obsolete_p, 1, OBJNULL},
{SYS_ "INSTANCE-NEW-STAMP", SI_ORDINARY, si_instance_new_stamp, 1, OBJNULL},
{SYS_ "INSTANCE-GET-STAMP", SI_ORDINARY, si_instance_get_stamp, 1, OBJNULL},
{SYS_ "INSTANCE-SIG", SI_ORDINARY, si_instance_sig, 1, OBJNULL},
{SYS_ "INSTANCE-SLOTDS", SI_ORDINARY, si_instance_slotds, 1, OBJNULL},
{SYS_ "INSTANCE-SIG-SET", SI_ORDINARY, si_instance_sig_set, 1, OBJNULL},
{SYS_ "INSTANCE-CLASS", SI_ORDINARY, si_instance_class, 1, OBJNULL},
{SYS_ "INSTANCE-CLASS-SET", SI_ORDINARY, si_instance_class_set, 2, OBJNULL},
......
......@@ -1297,7 +1297,7 @@ cl_symbols[] = {
{SYS_ "INSTANCE-OBSOLETE-P","si_instance_obsolete_p",1},
{SYS_ "INSTANCE-NEW-STAMP","si_instance_new_stamp",1},
{SYS_ "INSTANCE-GET-STAMP","si_instance_get_stamp",1},
{SYS_ "INSTANCE-SIG","si_instance_sig",1},
{SYS_ "INSTANCE-SLOTDS","si_instance_slotds",1},
{SYS_ "INSTANCE-SIG-SET","si_instance_sig_set",1},
{SYS_ "INSTANCE-CLASS","si_instance_class",1},
{SYS_ "INSTANCE-CLASS-SET","si_instance_class_set",2},
......
......@@ -35,8 +35,8 @@
(defmethod update-instance-for-different-class
((old-data standard-object) (new-data standard-object) &rest initargs)
(let ((old-local-slotds (si::instance-sig old-data))
(new-local-slotds (remove :instance (si::instance-sig new-data)
(let ((old-local-slotds (si::instance-slotds old-data))
(new-local-slotds (remove :instance (si::instance-slotds new-data)
:test-not #'eq :key #'slot-definition-allocation))
added-slots)
(setf added-slots (set-difference (mapcar #'slot-definition-name new-local-slotds)
......@@ -83,9 +83,9 @@
;;;
;;; PART 2: UPDATING AN INSTANCE THAT BECAME OBSOLETE
;;;
;;; Each instance has a hidden field (readable with SI::INSTANCE-SIG),
;;; which contains the list of slots of its class which are needed to
;;; update it when it is obsolete. Generally
;;; Each instance has a field (readable with SI::INSTANCE-SLOTDS),
;;; which contains the list of slot definitions from its class which
;;; are needed to update it when it is obsolete. Generally
;;;
;;; (SI::INSTANCE-OBSOLETE-P x)
;;;
......@@ -147,7 +147,7 @@
(defun update-instance (instance)
(let* ((class (class-of instance))
(old-slotds (si::instance-sig instance))
(old-slotds (si::instance-slotds instance))
(new-slotds (class-slots class))
(old-instance (si::copy-instance instance))
(discarded-slots '())
......
......@@ -87,9 +87,7 @@
(t
old-class))))
(si::instance-sig-set gfun)
(register-method-with-specializers method)
)
))
(register-method-with-specializers method))))
;;; ---------------------------------------------------------------------
......
......@@ -1428,7 +1428,7 @@
#+clos
(proclamation si:instance-ref (t fixnum) t :reader)
#+clos
(proclamation si::instance-sig (standard-object) list :reader)
(proclamation si::instance-slotds (standard-object) list :reader)
#+clos
(proclamation si:instance-set (t fixnum t) t)
#+clos
......
......@@ -827,8 +827,8 @@
"(#0)->instance.slots[#1]")
#+clos
(def-inline si::instance-sig :unsafe (standard-object) list
"(#0)->instance.sig")
(def-inline si::instance-slotds :unsafe (standard-object) list
"(#0)->instance.slotds")
#+clos
(def-inline si:instance-set :unsafe (t fixnum t) t
......
......@@ -843,7 +843,7 @@ extern ECL_API cl_object si_sl_makunbound(cl_object x, cl_object index);
extern ECL_API cl_object si_instance_obsolete_p(cl_object x);
extern ECL_API cl_object si_instance_new_stamp(cl_object x);
extern ECL_API cl_object si_instance_get_stamp(cl_object x);
extern ECL_API cl_object si_instance_sig(cl_object x);
extern ECL_API cl_object si_instance_slotds(cl_object x);
extern ECL_API cl_object si_instance_sig_set(cl_object x);
extern ECL_API cl_object ecl_allocate_instance(cl_object clas, cl_index size);
......
......@@ -1044,7 +1044,7 @@ struct ecl_instance { /* -- instance header -- */
cl_index length; /* instance length */
cl_object clas; /* instance class */
cl_objectfn entry; /* entry address */
cl_object sig; /* instance class slots */
cl_object slotds; /* slot definitions */
cl_object *slots; /* instance slots */
cl_index stamp; /* instance stamp */
cl_index class_stamp; /* class stamp */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment