Author: heimdall
Date: Sat Aug 13 19:55:38 2005
New Revision: 8951
Modified:
branches/gmc/lib/Parrot/Pmc2c.pm
branches/gmc/src/hash.c
branches/gmc/src/headers.c
branches/gmc/src/memory.c
Log:
Corrected two bugs about pmc_ext allocation
Modified: branches/gmc/lib/Parrot/Pmc2c.pm
==============================================================================
--- branches/gmc/lib/Parrot/Pmc2c.pm (original)
+++ branches/gmc/lib/Parrot/Pmc2c.pm Sat Aug 13 19:55:38 2005
@@ -845,7 +845,7 @@ Parrot_${classname}_class_init(Parrot_In
$enum_name, /* base_type */
NULL, /* whoami */
$vtbl_flag, /* flags */
- 8, /* size of pmc_body (sizeof(UnionVal) for now) */
+ 24, /* size of pmc_body */
NULL, /* does_str */
NULL, /* isa_str */
NULL, /* class */
Modified: branches/gmc/src/hash.c
==============================================================================
--- branches/gmc/src/hash.c (original)
+++ branches/gmc/src/hash.c Sat Aug 13 19:55:38 2005
@@ -374,8 +374,6 @@ expand_hash(Interp *interpreter, Hash *h
void *new_mem;
size_t offset, i, new_loc;
- fprintf(stderr, "Trying to expand hash at %p\n", hash);
-
/*
allocate some less buckets
e.g. 3 buckets, 4 pointers:
Modified: branches/gmc/src/headers.c
==============================================================================
--- branches/gmc/src/headers.c (original)
+++ branches/gmc/src/headers.c Sat Aug 13 19:55:38 2005
@@ -268,7 +268,10 @@ new_pmc_header(Interp *interpreter, UINT
#else
flags |= PObj_is_special_PMC_FLAG;
#endif
-#if ! PARROT_GC_GMC
+#if PARROT_GC_GMC
+ Gmc_PMC_flag_SET(has_ext,pmc);
+ PObj_is_PMC_EXT_SET(pmc);
+#else
pmc->pmc_ext = new_pmc_ext(interpreter);
#endif /* PARROT_GC_GMC */
if (flags & PObj_is_PMC_shared_FLAG) {
@@ -279,10 +282,17 @@ new_pmc_header(Interp *interpreter, UINT
}
else
#if PARROT_GC_GMC
- PMC_data(pmc) = NULL;
+ Gmc_PMC_flag_CLEAR(has_ext,pmc);
#else
pmc->pmc_ext = NULL;
#endif
+
+#if PARROT_GC_GMC
+ PMC_next_for_GC(pmc) = NULL;
+ PMC_metadata(pmc) = NULL;
+ PMC_sync(pmc) = NULL;
+ PMC_data(pmc) = NULL;
+#endif
PObj_get_FLAGS(pmc) |= PObj_is_PMC_FLAG|flags;
pmc->vtable = NULL;
#if ! PMC_DATA_IN_EXT
@@ -327,7 +337,10 @@ new_pmc_typed_header(Interp *interpreter
#else
flags |= PObj_is_special_PMC_FLAG;
#endif
-#if ! PARROT_GC_GMC
+#if PARROT_GC_GMC
+ Gmc_PMC_flag_SET(has_ext,pmc);
+ PObj_is_PMC_EXT_SET(pmc);
+#else
pmc->pmc_ext = new_pmc_ext(interpreter);
#endif
if (flags & PObj_is_PMC_shared_FLAG) {
@@ -338,10 +351,17 @@ new_pmc_typed_header(Interp *interpreter
}
else
#if PARROT_GC_GMC
- PMC_data(pmc) = NULL;
+ Gmc_PMC_flag_CLEAR(has_ext,pmc);
#else
pmc->pmc_ext = NULL;
#endif
+
+#if PARROT_GC_GMC
+ PMC_next_for_GC(pmc) = NULL;
+ PMC_metadata(pmc) = NULL;
+ PMC_sync(pmc) = NULL;
+ PMC_data(pmc) = NULL;
+#endif
PObj_get_FLAGS(pmc) |= PObj_is_PMC_FLAG|flags;
pmc->vtable = NULL;
#if ! PMC_DATA_IN_EXT
Modified: branches/gmc/src/memory.c
==============================================================================
--- branches/gmc/src/memory.c (original)
+++ branches/gmc/src/memory.c Sat Aug 13 19:55:38 2005
@@ -114,13 +114,6 @@ mem__sys_realloc(void *from, size_t size
#ifdef DETAIL_MEMORY_DEBUG
printf("Freed %p (realloc -- %i bytes)\n", from, size);
#endif
- /* XXX: DON'T LOOK !!! */
- if (from == 0x0832b8c8)
- {
- fprintf (stderr, "PROUT!\n");
- from = NULL;
- *(int*)from = 54;
- }
ptr = realloc(from, size);
if (!ptr)
PANIC("Out of mem");