[svn:parrot] r40784 - in trunk/src: . pmc
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Tue Aug 25 13:54:03 UTC 2009
Author: NotFound
Date: Tue Aug 25 13:54:01 2009
New Revision: 40784
URL: https://trac.parrot.org/parrot/changeset/40784
Log:
[oo] set auto_attrs in Object PMC
Modified:
trunk/src/oo.c
trunk/src/pmc/class.pmc
trunk/src/pmc/object.pmc
Modified: trunk/src/oo.c
==============================================================================
--- trunk/src/oo.c Tue Aug 25 11:58:01 2009 (r40783)
+++ trunk/src/oo.c Tue Aug 25 13:54:01 2009 (r40784)
@@ -272,8 +272,7 @@
if (!PMC_IS_NULL(dest)) {
PARROT_ASSERT(!PMC_IS_NULL(class_));
PARROT_ASSERT(class_->vtable->base_type == enum_class_Class);
- obj = (Parrot_Object_attributes *)
- Parrot_oo_new_object_attrs(interp, class_);
+ obj = PARROT_OBJECT(pmc);
cloned = dest;
}
else {
@@ -323,10 +322,6 @@
}
}
- /* free object attributes if created directly */
- if (!PMC_IS_NULL(dest))
- mem_sys_free(obj);
-
/* And we have ourselves a clone. */
return cloned;
}
Modified: trunk/src/pmc/class.pmc
==============================================================================
--- trunk/src/pmc/class.pmc Tue Aug 25 11:58:01 2009 (r40783)
+++ trunk/src/pmc/class.pmc Tue Aug 25 13:54:01 2009 (r40784)
@@ -1229,9 +1229,14 @@
/* Initialize the object's underlying structure, pointing it to this
* class. */
- PMC_data(object) =
- (Parrot_Object_attributes *)Parrot_oo_new_object_attrs(interp, SELF);
-
+ /* TODO: this has been changed in order to use auto_attrs in the
+ * Object PMC. Needs to be redone in a cleaner way. */
+ {
+ Parrot_Object_attributes * const objattr =
+ (Parrot_Object_attributes *)PMC_data(object);
+ objattr->_class = SELF;
+ objattr->attrib_store = pmc_new(interp, enum_class_ResizablePMCArray);
+ }
if (!PMC_IS_NULL(init)) {
/* Initialize attributes with the supplied values. */
PMC * const iter = VTABLE_get_iter(interp, init);
Modified: trunk/src/pmc/object.pmc
==============================================================================
--- trunk/src/pmc/object.pmc Tue Aug 25 11:58:01 2009 (r40783)
+++ trunk/src/pmc/object.pmc Tue Aug 25 13:54:01 2009 (r40784)
@@ -107,7 +107,7 @@
return -1;
}
-pmclass Object {
+pmclass Object auto_attrs {
ATTR PMC *_class; /* The class this is an instance of. */
ATTR PMC *attrib_store; /* The attributes store - a resizable PMC array. */
@@ -146,14 +146,12 @@
=item C<void destroy()>
-Free the object's underlying struct.
+Just to avoid the automatic generation of one.
=cut
*/
VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
More information about the parrot-commits
mailing list