cvsuser 05/03/28 01:54:33
Modified: classes hash.pmc
dynclasses pydict.pmc
Log:
fix Hash creation GC bug reported by Cory Spencer
Revision Changes Path
1.6 +16 -15 parrot/classes/hash.pmc
Index: hash.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/hash.pmc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- hash.pmc 12 Jan 2005 11:42:06 -0000 1.5
+++ hash.pmc 28 Mar 2005 09:54:32 -0000 1.6
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2004 The Perl Foundation. All Rights Reserved.
-$Id: hash.pmc,v 1.5 2005/01/12 11:42:06 leo Exp $
+$Id: hash.pmc,v 1.6 2005/03/28 09:54:32 leo Exp $
=head1 NAME
@@ -31,7 +31,7 @@
TODO: PMCs extending Hash should probably register themselves.
=cut
-
+
*/
static PMC* get_integer_pmc(Interp* interpreter, INTVAL base_type ) {
@@ -54,7 +54,7 @@
TODO: PMCs extending Hash should probably register themselves.
=cut
-
+
*/
static PMC * get_none_pmc(Interp* interpreter, INTVAL base_type ) {
@@ -76,7 +76,7 @@
TODO: PMCs extending Hash should probably register themselves.
=cut
-
+
*/
static PMC * get_number_pmc(Interp* interpreter, INTVAL base_type ) {
@@ -98,7 +98,7 @@
TODO: PMCs extending Hash should probably register themselves.
=cut
-
+
*/
static PMC * get_string_pmc(Interp* interpreter, INTVAL base_type ) {
@@ -198,6 +198,7 @@
*/
void init () {
+ PMC_struct_val(SELF) = NULL;
PObj_custom_mark_SET(SELF);
new_pmc_hash(INTERP, SELF);
}
@@ -231,7 +232,7 @@
HashBucket* b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF),
key);
if (b == NULL) {
- PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
+ PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
return VTABLE_type(INTERP, none);
}
@@ -255,7 +256,7 @@
HashBucket* b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF),
keystr);
if (b == NULL) {
- PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
+ PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
return VTABLE_type(INTERP, none);
}
@@ -314,7 +315,7 @@
key);
if (b == NULL) {
/* XXX Warning: use of uninitialized value */
- PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
+ PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
return VTABLE_get_integer(INTERP, none);
}
@@ -360,7 +361,7 @@
b = hash_get_bucket(INTERP, hash, keystr);
if (b == NULL) {
/* XXX Warning: use of uninitialized value */
- PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
+ PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
return VTABLE_get_integer(INTERP, none);
}
@@ -386,7 +387,7 @@
key);
if (b == NULL) {
/* XXX Warning: Use of uninitialized value */
- PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
+ PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
return VTABLE_get_number(INTERP, none);
}
@@ -415,7 +416,7 @@
PMC* nextkey;
if (b == NULL) {
/* XXX Warning: Use of uninitialized value */
- PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
+ PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
return VTABLE_get_number(INTERP, none);
}
@@ -501,7 +502,7 @@
key);
if (b == NULL) {
/* XXX Warning: use of uninitialized value */
- PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
+ PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
return VTABLE_get_string(INTERP, none);
}
@@ -544,7 +545,7 @@
b = hash_get_bucket(INTERP, hash, keystr);
if (b == NULL) {
/* XXX Warning: use of uninitialized value */
- PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
+ PMC * none = get_none_pmc(INTERP, SELF->vtable->base_type);
return VTABLE_get_string(INTERP, none);
}
@@ -598,7 +599,7 @@
key);
if (b == NULL) {
/* XXX should store the undef for consistency */
- return get_none_pmc(INTERP, SELF->vtable->base_type);
+ return get_none_pmc(INTERP, SELF->vtable->base_type);
}
return b->value;
}
@@ -666,7 +667,7 @@
keystr);
if (b == NULL) {
/* XXX should store the undef for consistency */
- return get_none_pmc(INTERP, SELF->vtable->base_type);
+ return get_none_pmc(INTERP, SELF->vtable->base_type);
}
nextkey = key_next(INTERP, key);
if (!nextkey)
1.21 +2 -1 parrot/dynclasses/pydict.pmc
Index: pydict.pmc
===================================================================
RCS file: /cvs/public/parrot/dynclasses/pydict.pmc,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- pydict.pmc 29 Jan 2005 14:14:20 -0000 1.20
+++ pydict.pmc 28 Mar 2005 09:54:33 -0000 1.21
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: pydict.pmc,v 1.20 2005/01/29 14:14:20 leo Exp $
+$Id: pydict.pmc,v 1.21 2005/03/28 09:54:33 leo Exp $
=head1 NAME
@@ -94,6 +94,7 @@
*/
void init () {
+ PMC_struct_val(SELF) = NULL;
PObj_custom_mark_SET(SELF);
new_pmc_hash_x(INTERP, SELF,
enum_type_PMC,