[svn:parrot] r43079 - in branches/pmc_freeze_cleanup: include/parrot src

plobsing at svn.parrot.org plobsing at svn.parrot.org
Wed Dec 16 03:10:23 UTC 2009


Author: plobsing
Date: Wed Dec 16 03:10:19 2009
New Revision: 43079
URL: https://trac.parrot.org/parrot/changeset/43079

Log:
Revert of r43056 and r43057. Apparently the Packfile is used for something after all.

Modified:
   branches/pmc_freeze_cleanup/include/parrot/pmc_freeze.h
   branches/pmc_freeze_cleanup/src/pmc_freeze.c

Modified: branches/pmc_freeze_cleanup/include/parrot/pmc_freeze.h
==============================================================================
--- branches/pmc_freeze_cleanup/include/parrot/pmc_freeze.h	Tue Dec 15 21:08:16 2009	(r43078)
+++ branches/pmc_freeze_cleanup/include/parrot/pmc_freeze.h	Wed Dec 16 03:10:19 2009	(r43079)
@@ -68,6 +68,7 @@
     void               *extra;          /* PMC specific */
     INTVAL              extra_flags;    /* concerning to extra */
     PMC                *thaw_result;    /* 1st thawed */
+    struct PackFile *pf;
     const image_funcs *vtable;
     struct _visit_info *image_io;       /* dummy backwards-compat pointer. */
 } visit_info;

Modified: branches/pmc_freeze_cleanup/src/pmc_freeze.c
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc_freeze.c	Tue Dec 15 21:08:16 2009	(r43078)
+++ branches/pmc_freeze_cleanup/src/pmc_freeze.c	Wed Dec 16 03:10:19 2009	(r43079)
@@ -399,7 +399,7 @@
 shift_opcode_integer(SHIM_INTERP, ARGIN(visit_info *io))
 {
     ASSERT_ARGS(shift_opcode_integer)
-    const INTVAL i = PF_fetch_integer(NULL, (const opcode_t **)&io->pos);
+    const INTVAL i = PF_fetch_integer(io->pf, (const opcode_t **)&io->pos);
     BYTECODE_SHIFT_OK(io);
     return i;
 }
@@ -419,7 +419,7 @@
 shift_opcode_number(SHIM_INTERP, ARGIN(visit_info *io))
 {
     ASSERT_ARGS(shift_opcode_number)
-    const FLOATVAL f  = PF_fetch_number(NULL, (const opcode_t **)&io->pos);
+    const FLOATVAL f  = PF_fetch_number(io->pf, (const opcode_t **)&io->pos);
     BYTECODE_SHIFT_OK(io);
     return f;
 }
@@ -442,7 +442,7 @@
 shift_opcode_string(PARROT_INTERP, ARGIN(visit_info *io))
 {
     ASSERT_ARGS(shift_opcode_string)
-    STRING * const s = PF_fetch_string(interp, NULL, (const opcode_t **)&io->pos);
+    STRING * const s = PF_fetch_string(interp, io->pf, (const opcode_t **)&io->pos);
     BYTECODE_SHIFT_OK(io);
     return s;
 }
@@ -496,7 +496,7 @@
         (PACKFILE_HEADER_BYTES % 16 ?
          16 - PACKFILE_HEADER_BYTES % 16 : 0);
 
-    PackFile *pf = PackFile_new(interp, 0);
+    PackFile *pf = info->pf = PackFile_new(interp, 0);
     info->visit_pmc_now   = visit_todo_list;
 
     /* we must use PMCs here so that they get marked properly */
@@ -516,7 +516,6 @@
     }
     else {
         if (Parrot_str_byte_length(interp, input) < header_length) {
-            PackFile_destroy(interp, pf);
             Parrot_ex_throw_from_c_args(interp, NULL,
                 EXCEPTION_INVALID_STRING_REPRESENTATION,
                 "bad string to thaw");
@@ -524,13 +523,11 @@
 
         /* TT #749: use the validation logic from Packfile_unpack */
         if (pf->header->bc_major != PARROT_PBC_MAJOR
-        ||  pf->header->bc_minor != PARROT_PBC_MINOR) {
-            PackFile_destroy(interp, pf);
+        ||  pf->header->bc_minor != PARROT_PBC_MINOR)
             Parrot_ex_throw_from_c_args(interp, NULL,
                     EXCEPTION_INVALID_STRING_REPRESENTATION,
                     "can't thaw a PMC from Parrot %d.%d", pf->header->bc_major,
                     pf->header->bc_minor);
-        }
 
         info->buffer = (Buffer *)input;
         PARROT_ASSERT(input->_bufstart == input->strstart);
@@ -543,8 +540,6 @@
         info->pos += header_length;
     }
 
-    PackFile_destroy(interp, pf);
-
     info->last_type   = -1;
     info->id_list     = pmc_new(interp, enum_class_Array);
     info->id          = 0;
@@ -1096,6 +1091,7 @@
         Parrot_unblock_GC_sweep(interp);
     }
 
+    PackFile_destroy(interp, info.pf);
     return info.thaw_result;
 }
 
@@ -1140,6 +1136,7 @@
     result = Parrot_str_new_init(interp, (char *)Buffer_bufstart(info.buffer), OUTPUT_LENGTH(&info),
       Parrot_fixed_8_encoding_ptr, Parrot_binary_charset_ptr, 0);
 
+    PackFile_destroy(interp, info.pf);
     return result;
 }
 


More information about the parrot-commits mailing list