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

darbelo at svn.parrot.org darbelo at svn.parrot.org
Mon Dec 14 22:45:54 UTC 2009


Author: darbelo
Date: Mon Dec 14 22:45:53 2009
New Revision: 43056
URL: https://trac.parrot.org/parrot/changeset/43056

Log:
Reduce packfile scope to the one place we need to use it.
The PF_store_*() functions can explicitly handle a NULL argument for freeze/thaw.

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	Mon Dec 14 22:41:18 2009	(r43055)
+++ branches/pmc_freeze_cleanup/include/parrot/pmc_freeze.h	Mon Dec 14 22:45:53 2009	(r43056)
@@ -68,7 +68,6 @@
     void               *extra;          /* PMC specific */
     INTVAL              extra_flags;    /* concerning to extra */
     PMC                *thaw_result;    /* 1st thawed */
-    struct PackFile *pf;
     const image_funcs *vtable;
 } visit_info;
 

Modified: branches/pmc_freeze_cleanup/src/pmc_freeze.c
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc_freeze.c	Mon Dec 14 22:41:18 2009	(r43055)
+++ branches/pmc_freeze_cleanup/src/pmc_freeze.c	Mon Dec 14 22:45:53 2009	(r43056)
@@ -399,7 +399,7 @@
 shift_opcode_integer(SHIM_INTERP, ARGIN(visit_info *io))
 {
     ASSERT_ARGS(shift_opcode_integer)
-    const INTVAL i = PF_fetch_integer(io->pf, (const opcode_t **)&io->pos);
+    const INTVAL i = PF_fetch_integer(NULL, (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(io->pf, (const opcode_t **)&io->pos);
+    const FLOATVAL f  = PF_fetch_number(NULL, (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, io->pf, (const opcode_t **)&io->pos);
+    STRING * const s = PF_fetch_string(interp, NULL, (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 = info->pf = PackFile_new(interp, 0);
+    PackFile *pf = PackFile_new(interp, 0);
     info->visit_pmc_now   = visit_todo_list;
 
     /* we must use PMCs here so that they get marked properly */
@@ -538,6 +538,8 @@
         info->pos += header_length;
     }
 
+    PackFile_destroy(interp, pf);
+
     info->last_type   = -1;
     info->id_list     = pmc_new(interp, enum_class_Array);
     info->id          = 0;
@@ -1089,7 +1091,6 @@
         Parrot_unblock_GC_sweep(interp);
     }
 
-    PackFile_destroy(interp, info.pf);
     return info.thaw_result;
 }
 
@@ -1134,7 +1135,6 @@
     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