[svn:parrot] r48195 - in trunk: src t/tools
cotto at svn.parrot.org
cotto at svn.parrot.org
Wed Jul 28 05:56:13 UTC 2010
Author: cotto
Date: Wed Jul 28 05:56:13 2010
New Revision: 48195
URL: https://trac.parrot.org/parrot/changeset/48195
Log:
keep packfile segment names from being GC'd until the segment has been destroyed
Modified:
trunk/src/packfile.c
trunk/t/tools/pbc_dump.t
Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c Wed Jul 28 03:49:32 2010 (r48194)
+++ trunk/src/packfile.c Wed Jul 28 05:56:13 2010 (r48195)
@@ -1719,6 +1719,7 @@
PackFile_Segment * const seg = (f)(interp, pf, name, add);
segment_init(interp, seg, pf, name);
+ Parrot_pmc_gc_register(interp, (PMC*) name);
seg->type = type;
if (add)
@@ -1815,6 +1816,7 @@
const PackFile_Segment_destroy_func_t f =
self->pf->PackFuncs[self->type].destroy;
+ Parrot_pmc_gc_unregister(interp, (PMC*) self->name);
if (f)
(f)(interp, self);
Modified: trunk/t/tools/pbc_dump.t
==============================================================================
--- trunk/t/tools/pbc_dump.t Wed Jul 28 03:49:32 2010 (r48194)
+++ trunk/t/tools/pbc_dump.t Wed Jul 28 05:56:13 2010 (r48195)
@@ -45,7 +45,7 @@
plan skip_all => "pbc_dump hasn't been built. Run make parrot_utils";
exit(0);
}
- plan tests => 6;
+ plan tests => 7;
}
dump_output_like( <<PIR, "pir", [qr/FIXUP_t/, qr/CONSTANT_t/, qr/BYTECODE_t/], 'pbc_dump basic sanity');
@@ -72,6 +72,13 @@
.end
PIR
+my $longcode = ".sub main :main\n";
+for (0 ... 10000) {
+ $longcode .= "\$I0 = \$I0 + 1234\n";
+}
+$longcode .= ".end";
+dump_output_like( $longcode, "pir", qr/BYTECODE.*_DB.*=>/, "large pir program doesn't mess up pbc_dump");
+
=head1 HELPER SUBROUTINES
=head2 dump_output_like
More information about the parrot-commits
mailing list