[svn:parrot] r40755 - trunk/src/pmc
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Mon Aug 24 10:50:06 UTC 2009
Author: NotFound
Date: Mon Aug 24 10:50:01 2009
New Revision: 40755
URL: https://trac.parrot.org/parrot/changeset/40755
Log:
[pmc] set auto_attrs on Hash and derived PMCs
Modified:
trunk/src/pmc/addrregistry.pmc
trunk/src/pmc/hash.pmc
trunk/src/pmc/lexinfo.pmc
trunk/src/pmc/namespace.pmc
Modified: trunk/src/pmc/addrregistry.pmc
==============================================================================
--- trunk/src/pmc/addrregistry.pmc Mon Aug 24 09:31:14 2009 (r40754)
+++ trunk/src/pmc/addrregistry.pmc Mon Aug 24 10:50:01 2009 (r40755)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2005-2008, Parrot Foundation.
+Copyright (C) 2005-2009, Parrot Foundation.
$Id$
=head1 NAME
@@ -29,7 +29,7 @@
#include "parrot/hash.h"
#include "pmc_hash.h"
-pmclass AddrRegistry extends Hash provides hash {
+pmclass AddrRegistry extends Hash provides hash auto_attrs {
/*
=item C<void init()>
@@ -48,8 +48,8 @@
key_hash_int);
Parrot_AddrRegistry_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_AddrRegistry_attributes);
- PMC_data(SELF) = attrs;
+ (Parrot_AddrRegistry_attributes *) PMC_data(SELF);
+
SELF.set_pointer(registry);
PObj_custom_mark_destroy_SETALL(SELF);
Modified: trunk/src/pmc/hash.pmc
==============================================================================
--- trunk/src/pmc/hash.pmc Mon Aug 24 09:31:14 2009 (r40754)
+++ trunk/src/pmc/hash.pmc Mon Aug 24 10:50:01 2009 (r40755)
@@ -376,7 +376,7 @@
/* Needs ext struct for the next_for_GC pointer
* We would get recursive marking of a deeply nested HoHoH...
*/
-pmclass Hash provides hash {
+pmclass Hash provides hash auto_attrs {
ATTR Hash *hash;
/*
@@ -395,9 +395,8 @@
VTABLE void init() {
Parrot_Hash_attributes * const attr =
- mem_allocate_typed(Parrot_Hash_attributes);
+ (Parrot_Hash_attributes *) PMC_data(SELF);
- PMC_data(SELF) = attr;
attr->hash = parrot_new_hash(INTERP);
attr->hash->container = SELF;
PObj_custom_mark_destroy_SETALL(SELF);
@@ -407,9 +406,6 @@
Hash * const hash = (Hash *)SELF.get_pointer();
if (hash)
parrot_hash_destroy(INTERP, hash);
-
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
Modified: trunk/src/pmc/lexinfo.pmc
==============================================================================
--- trunk/src/pmc/lexinfo.pmc Mon Aug 24 09:31:14 2009 (r40754)
+++ trunk/src/pmc/lexinfo.pmc Mon Aug 24 10:50:01 2009 (r40755)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2008, Parrot Foundation.
+Copyright (C) 2008-2009, Parrot Foundation.
$Id$
=head1 NAME
@@ -26,7 +26,7 @@
* keys and integer indices
*/
-pmclass LexInfo extends Hash provides hash no_ro {
+pmclass LexInfo extends Hash provides hash no_ro auto_attrs {
/*
@@ -60,7 +60,8 @@
VTABLE void init_pmc(PMC *sub) {
Hash *hash;
Parrot_LexInfo_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_LexInfo_attributes);
+ (Parrot_LexInfo_attributes *) PMC_data(SELF);
+
PARROT_ASSERT(PObj_constant_TEST(SELF));
hash = parrot_create_hash(INTERP,
@@ -69,7 +70,6 @@
(hash_comp_fn)Parrot_str_not_equal, /* STRING compare */
(hash_hash_key_fn)Parrot_str_to_hashval); /* hash */
- PMC_data(SELF) = attrs;
SELF.set_pointer(hash);
PObj_active_destroy_SET(SELF);
}
Modified: trunk/src/pmc/namespace.pmc
==============================================================================
--- trunk/src/pmc/namespace.pmc Mon Aug 24 09:31:14 2009 (r40754)
+++ trunk/src/pmc/namespace.pmc Mon Aug 24 10:50:01 2009 (r40755)
@@ -123,7 +123,7 @@
#define FPA_is_ns_ext PObj_private0_FLAG
-pmclass NameSpace extends Hash provides hash no_ro {
+pmclass NameSpace extends Hash provides hash no_ro auto_attrs {
ATTR STRING *name; /* Name of this namespace part. */
ATTR PMC *_class; /* The class or role attached to this namespace. */
@@ -144,8 +144,6 @@
*/
VTABLE void init() {
- PMC_data(SELF) =
- mem_allocate_zeroed_typed(Parrot_NameSpace_attributes);
PARROT_NAMESPACE(SELF)->vtable = PMCNULL;
PARROT_NAMESPACE(SELF)->_class = PMCNULL;
SELF.set_pointer(parrot_new_hash(INTERP));
@@ -178,20 +176,6 @@
/*
-=item C<void destroy()>
-
-Frees the namespace info struct.
-
-=cut
-
-*/
- VTABLE void destroy() {
- /* Call Hash.destroy. It will free all memory. */
- SUPER();
- }
-
-/*
-
=item C<PMC *get_class()>
Returns the class or role PMC that is associated with this namespace.
More information about the parrot-commits
mailing list