[svn:parrot] r40697 - branches/pcc_arg_unify/src/pmc

tene at svn.parrot.org tene at svn.parrot.org
Sat Aug 22 02:19:09 UTC 2009


Author: tene
Date: Sat Aug 22 02:19:08 2009
New Revision: 40697
URL: https://trac.parrot.org/parrot/changeset/40697

Log:
[pcc] Create a new String PMC when returning a constant string into an empty PMC register.

Modified:
   branches/pcc_arg_unify/src/pmc/cpointer.pmc

Modified: branches/pcc_arg_unify/src/pmc/cpointer.pmc
==============================================================================
--- branches/pcc_arg_unify/src/pmc/cpointer.pmc	Sat Aug 22 01:49:59 2009	(r40696)
+++ branches/pcc_arg_unify/src/pmc/cpointer.pmc	Sat Aug 22 02:19:08 2009	(r40697)
@@ -344,7 +344,11 @@
             *str_pointer = value;
         }
         else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
-            PMC ** const pmc_pointer = (PMC **) data->pointer;
+            PMC ** pmc_pointer = (PMC **) data->pointer;
+            if (*pmc_pointer == PMCNULL) {
+                PMC * const new_str = pmc_new(interp, enum_class_String);
+                *pmc_pointer = (PMC *) new_str;
+            }
             VTABLE_set_string_native(interp, *pmc_pointer, value);
         }
         else {


More information about the parrot-commits mailing list