[svn:parrot] r40485 - branches/auto_attrs/src/pmc
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Tue Aug 11 07:38:34 UTC 2009
Author: NotFound
Date: Tue Aug 11 07:38:33 2009
New Revision: 40485
URL: https://trac.parrot.org/parrot/changeset/40485
Log:
set auto_attrs on Float, Role and iterators PMCs
Modified:
branches/auto_attrs/src/pmc/arrayiterator.pmc
branches/auto_attrs/src/pmc/float.pmc
branches/auto_attrs/src/pmc/hashiterator.pmc
branches/auto_attrs/src/pmc/hashiteratorkey.pmc
branches/auto_attrs/src/pmc/orderedhashiterator.pmc
branches/auto_attrs/src/pmc/role.pmc
Modified: branches/auto_attrs/src/pmc/arrayiterator.pmc
==============================================================================
--- branches/auto_attrs/src/pmc/arrayiterator.pmc Tue Aug 11 07:31:31 2009 (r40484)
+++ branches/auto_attrs/src/pmc/arrayiterator.pmc Tue Aug 11 07:38:33 2009 (r40485)
@@ -51,7 +51,7 @@
*/
-pmclass ArrayIterator extends Iterator no_ro {
+pmclass ArrayIterator extends Iterator no_ro auto_attrs {
ATTR PMC *array; /* the array which this Iterator iterates */
ATTR INTVAL pos; /* Current position of iterator for forward iterator */
/* Previous position of iterator for reverse iterator */
@@ -86,12 +86,11 @@
VTABLE void init_pmc(PMC *array) {
Parrot_ArrayIterator_attributes * const attrs =
- mem_allocate_zeroed_typed(Parrot_ArrayIterator_attributes);
+ (Parrot_ArrayIterator_attributes *) PMC_data(SELF);
attrs->array = array;
- PMC_data(SELF) = attrs;
- PObj_custom_mark_destroy_SETALL(SELF);
+ PObj_custom_mark_SET(SELF);
/* by default, iterate from start */
SELF.set_integer_native(ITERATE_FROM_START);
@@ -99,21 +98,6 @@
/*
-=item C<void destroy()>
-
-destroys this PMC
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
-/*
-
=item C<void mark()>
Marks the current idx/key and the aggregate as live.
Modified: branches/auto_attrs/src/pmc/float.pmc
==============================================================================
--- branches/auto_attrs/src/pmc/float.pmc Tue Aug 11 07:31:31 2009 (r40484)
+++ branches/auto_attrs/src/pmc/float.pmc Tue Aug 11 07:38:33 2009 (r40485)
@@ -18,7 +18,7 @@
*/
-pmclass Float extends scalar provides float provides scalar {
+pmclass Float extends scalar provides float provides scalar auto_attrs {
ATTR FLOATVAL fv;
/*
@@ -32,27 +32,9 @@
*/
VTABLE void init() {
- Parrot_Float_attributes * const fattr = mem_allocate_zeroed_typed(Parrot_Float_attributes);
-
- PMC_data(SELF) = fattr;
SET_ATTR_fv(INTERP, SELF, 0.0);
-
- PObj_active_destroy_SET(SELF);
}
-/*
-
-=item C<void destroy()>
-
-Destroy this PMC.
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
/*
=item C<PMC *clone()>
Modified: branches/auto_attrs/src/pmc/hashiterator.pmc
==============================================================================
--- branches/auto_attrs/src/pmc/hashiterator.pmc Tue Aug 11 07:31:31 2009 (r40484)
+++ branches/auto_attrs/src/pmc/hashiterator.pmc Tue Aug 11 07:38:33 2009 (r40485)
@@ -75,7 +75,7 @@
return bucket;
}
-pmclass HashIterator extends Iterator no_ro {
+pmclass HashIterator extends Iterator no_ro auto_attrs {
ATTR PMC *pmc_hash; /* the Hash which this Iterator iterates */
ATTR Hash *parrot_hash; /* Underlying implementation of hash */
ATTR HashBucket *bucket; /* Current bucket */
@@ -96,7 +96,7 @@
VTABLE void init_pmc(PMC *hash) {
Parrot_HashIterator_attributes * const attrs =
- mem_allocate_zeroed_typed(Parrot_HashIterator_attributes);
+ (Parrot_HashIterator_attributes *) PMC_data(SELF);
attrs->pmc_hash = hash;
attrs->parrot_hash = (Hash*)VTABLE_get_pointer(INTERP, hash);
@@ -106,9 +106,8 @@
/* Will be decreased on initial advance_to_next */
/* XXX Do we really need to support this use-case ? */
attrs->elements = attrs->parrot_hash->entries + 1;
- PMC_data(SELF) = attrs;
- PObj_custom_mark_destroy_SETALL(SELF);
+ PObj_custom_mark_SET(SELF);
/* Initial state of iterator is "before start" */
/* So, advance to first element */
@@ -117,21 +116,6 @@
/*
-=item C<void destroy()>
-
-destroys this PMC
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
-/*
-
=item C<void mark()>
Marks the hash as live.
Modified: branches/auto_attrs/src/pmc/hashiteratorkey.pmc
==============================================================================
--- branches/auto_attrs/src/pmc/hashiteratorkey.pmc Tue Aug 11 07:31:31 2009 (r40484)
+++ branches/auto_attrs/src/pmc/hashiteratorkey.pmc Tue Aug 11 07:38:33 2009 (r40485)
@@ -19,48 +19,12 @@
*/
-pmclass HashIteratorKey no_ro {
+pmclass HashIteratorKey no_ro auto_attrs {
ATTR Hash *parrot_hash; /* Underlying parrot's hash */
ATTR HashBucket *bucket; /* Current bucket from HashItertor */
/*
-=item C<void init()>
-
-Initializes the PMC.
-
-Not really part of public API.
-
-=cut
-
-*/
-
- VTABLE void init() {
- Parrot_HashIteratorKey_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_HashIteratorKey_attributes);
-
- PMC_data(SELF) = attrs;
-
- PObj_active_destroy_SET(SELF);
- }
-
-/*
-
-=item C<void destroy()>
-
-Destroys this PMC
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
-/*
-
=item C<get_pmc()>
Get "key".
Modified: branches/auto_attrs/src/pmc/orderedhashiterator.pmc
==============================================================================
--- branches/auto_attrs/src/pmc/orderedhashiterator.pmc Tue Aug 11 07:31:31 2009 (r40484)
+++ branches/auto_attrs/src/pmc/orderedhashiterator.pmc Tue Aug 11 07:38:33 2009 (r40485)
@@ -21,7 +21,7 @@
#include "pmc_hash.h"
#include "pmc_hashiteratorkey.h"
-pmclass OrderedHashIterator extends Iterator no_ro {
+pmclass OrderedHashIterator extends Iterator no_ro auto_attrs {
ATTR PMC *pmc_hash; /* the Hash which this Iterator iterates */
ATTR Hash *parrot_hash; /* Underlying implementation of hash */
ATTR INTVAL pos; /* */
@@ -41,7 +41,7 @@
VTABLE void init_pmc(PMC *hash) {
Parrot_OrderedHashIterator_attributes * const attrs =
- mem_allocate_zeroed_typed(Parrot_OrderedHashIterator_attributes);
+ (Parrot_OrderedHashIterator_attributes *) PMC_data(SELF);
attrs->pmc_hash = hash;
attrs->parrot_hash = (Hash*)VTABLE_get_pointer(INTERP, hash);
@@ -49,24 +49,8 @@
/* Will be decreased on initial advance_to_next */
/* XXX Do we really need to support this use-case ? */
attrs->elements = attrs->parrot_hash->entries;
- PMC_data(SELF) = attrs;
- PObj_custom_mark_destroy_SETALL(SELF);
- }
-
-/*
-
-=item C<void destroy()>
-
-destroys this PMC
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
+ PObj_custom_mark_SET(SELF);
}
/*
Modified: branches/auto_attrs/src/pmc/role.pmc
==============================================================================
--- branches/auto_attrs/src/pmc/role.pmc Tue Aug 11 07:31:31 2009 (r40484)
+++ branches/auto_attrs/src/pmc/role.pmc Tue Aug 11 07:38:33 2009 (r40485)
@@ -198,7 +198,7 @@
*/
-pmclass Role need_ext {
+pmclass Role need_ext auto_attrs {
ATTR STRING *name; /* The name of the role. */
ATTR PMC *_namespace; /* The namespace it's linked to, if any. */
ATTR PMC *roles; /* Roles from which this role is composed. */
@@ -221,12 +221,11 @@
*/
VTABLE void init() {
- Parrot_Role_attributes * const role = mem_allocate_zeroed_typed(Parrot_Role_attributes);
- PMC_data(SELF) = role;
+ Parrot_Role_attributes * const role =
+ (Parrot_Role_attributes *) PMC_data(SELF);
- /* Set flags for custom GC mark and destroy. */
+ /* Set flags for custom GC mark. */
PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
/* Set up the object. */
role->name = CONST_STRING(interp, "");
@@ -246,21 +245,6 @@
/*
-=item C<void destroy()>
-
-Free the memory associated with the object's underlying struct.
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
-/*
-
=item C<void mark()>
Mark referenced strings and PMCs in the structure as live.
More information about the parrot-commits
mailing list