[svn:parrot] r48273 - in trunk/src: . pmc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Tue Aug 3 04:38:53 UTC 2010
Author: chromatic
Date: Tue Aug 3 04:38:52 2010
New Revision: 48273
URL: https://trac.parrot.org/parrot/changeset/48273
Log:
[PMC] Added set_pointer to ImageIO PMC.
This allows PMC freezing to avoid creating an UnManagedStruct initializer to
store a PackFile_ConstTable pointer in the ImageIO PMC.
Modified:
trunk/src/pmc/imageio.pmc
trunk/src/pmc_freeze.c
Modified: trunk/src/pmc/imageio.pmc
==============================================================================
--- trunk/src/pmc/imageio.pmc Tue Aug 3 04:38:49 2010 (r48272)
+++ trunk/src/pmc/imageio.pmc Tue Aug 3 04:38:52 2010 (r48273)
@@ -363,10 +363,8 @@
*/
VTABLE void init() {
- PARROT_IMAGEIO(SELF)->buffer = NULL;
PARROT_IMAGEIO(SELF)->todo = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
PARROT_IMAGEIO(SELF)->seen = PMCNULL;
- PARROT_IMAGEIO(SELF)->id = 0;
PARROT_IMAGEIO(SELF)->pf = PackFile_new(INTERP, 0);
PObj_flag_CLEAR(private1, SELF);
@@ -576,6 +574,23 @@
visit_todo_list_freeze(INTERP, v, SELF);
}
+
+/*
+
+=item C<void set_pointer(void *value)>
+
+Sets the constant table of this ImageIO PMC.
+
+=cut
+
+*/
+
+ VTABLE void set_pointer(void *value) {
+ PObj_flag_SET(private1, SELF);
+ PARROT_IMAGEIO(SELF)->pf_ct = (PackFile_ConstTable *)value;
+ }
+
+
/*
=item C<VTABLE INTVAL shift_integer()>
Modified: trunk/src/pmc_freeze.c
==============================================================================
--- trunk/src/pmc_freeze.c Tue Aug 3 04:38:49 2010 (r48272)
+++ trunk/src/pmc_freeze.c Tue Aug 3 04:38:52 2010 (r48273)
@@ -246,12 +246,9 @@
Parrot_thaw_pbc(PARROT_INTERP, ARGIN(STRING *image), ARGIN(PackFile_ConstTable *pf))
{
ASSERT_ARGS(Parrot_thaw_pbc)
- PMC *pf_pmc = Parrot_pmc_new(interp, enum_class_UnManagedStruct);
- PMC *info;
+ PMC *info = Parrot_pmc_new(interp, enum_class_ImageIO);
- VTABLE_set_pointer(interp, pf_pmc, pf);
-
- info = Parrot_pmc_new_init(interp, enum_class_ImageIO, pf_pmc);
+ VTABLE_set_pointer(interp, info, pf);
VTABLE_set_string_native(interp, info, image);
return VTABLE_get_pmc(interp, info);
More information about the parrot-commits
mailing list