[svn:parrot] r49640 - branches/generational_gc/src/ops
bacek at svn.parrot.org
bacek at svn.parrot.org
Sun Oct 24 04:11:15 UTC 2010
Author: bacek
Date: Sun Oct 24 04:11:13 2010
New Revision: 49640
URL: https://trac.parrot.org/parrot/changeset/49640
Log:
Fix "op copy" to avoid messing with PMC guts which breaks under
assumption that everything inside PMC is simple and memmovable.
Modified:
branches/generational_gc/src/ops/core_ops.c
branches/generational_gc/src/ops/set.ops
Modified: branches/generational_gc/src/ops/core_ops.c
==============================================================================
--- branches/generational_gc/src/ops/core_ops.c Sat Oct 23 23:33:46 2010 (r49639)
+++ branches/generational_gc/src/ops/core_ops.c Sun Oct 24 04:11:13 2010 (r49640)
@@ -22166,21 +22166,10 @@
EXCEPTION_NULL_REG_ACCESS, "Null PMC in copy");return (opcode_t *)handler;
}
else {
- PMC * const clone = VTABLE_clone(interp, PREG(2));
/* Preserve the metadata on the destination. */
PMC * const meta = VTABLE_getprops(interp, PREG(1));
- /* avoid leaks and unreachable memory by destroying the destination PMC */
- Parrot_pmc_destroy(interp, PREG(1));
-
- /* the source PMC knows how to clone itself, but we must reuse the
- * destination header */
- memmove(PREG(1), clone, sizeof (PMC));
-
- /* don't let the clone's destruction destroy the destination's data */
- PObj_custom_destroy_CLEAR(clone);
- PMC_data(clone) = NULL;
- PMC_metadata(clone) = NULL;
+ PREG(1) = VTABLE_clone(interp, PREG(2));
/* Restore metadata. */
if (!PMC_IS_NULL(meta)) {
Modified: branches/generational_gc/src/ops/set.ops
==============================================================================
--- branches/generational_gc/src/ops/set.ops Sat Oct 23 23:33:46 2010 (r49639)
+++ branches/generational_gc/src/ops/set.ops Sun Oct 24 04:11:13 2010 (r49640)
@@ -401,21 +401,10 @@
goto ADDRESS(handler);
}
else {
- PMC * const clone = VTABLE_clone(interp, $2);
/* Preserve the metadata on the destination. */
PMC * const meta = VTABLE_getprops(interp, $1);
- /* avoid leaks and unreachable memory by destroying the destination PMC */
- Parrot_pmc_destroy(interp, $1);
-
- /* the source PMC knows how to clone itself, but we must reuse the
- * destination header */
- memmove($1, clone, sizeof (PMC));
-
- /* don't let the clone's destruction destroy the destination's data */
- PObj_custom_destroy_CLEAR(clone);
- PMC_data(clone) = NULL;
- PMC_metadata(clone) = NULL;
+ $1 = VTABLE_clone(interp, $2);
/* Restore metadata. */
if (!PMC_IS_NULL(meta)) {
More information about the parrot-commits
mailing list