[svn:parrot] r46090 - branches/pbc_frozen_strings1/compilers/imcc

plobsing at svn.parrot.org plobsing at svn.parrot.org
Wed Apr 28 01:38:46 UTC 2010


Author: plobsing
Date: Wed Apr 28 01:38:45 2010
New Revision: 46090
URL: https://trac.parrot.org/parrot/changeset/46090

Log:
move storing subs in PBC until *after* it is fully created

Modified:
   branches/pbc_frozen_strings1/compilers/imcc/pbc.c

Modified: branches/pbc_frozen_strings1/compilers/imcc/pbc.c
==============================================================================
--- branches/pbc_frozen_strings1/compilers/imcc/pbc.c	Wed Apr 28 01:34:17 2010	(r46089)
+++ branches/pbc_frozen_strings1/compilers/imcc/pbc.c	Wed Apr 28 01:38:45 2010	(r46090)
@@ -1265,9 +1265,7 @@
     PMC                   *sub_pmc;
     Parrot_Sub_attributes *sub, *outer_sub;
 
-    const int            k            = add_const_table(interp);
     PackFile_ConstTable * const ct    = interp->code->const_table;
-    PackFile_Constant   * const pfc   = ct->constants[k];
     IMC_Unit            * const unit  =
         IMCC_INFO(interp)->globals->cs->subs->unit;
 
@@ -1278,8 +1276,6 @@
     int                  i;
     int                  ns_const = -1;
 
-    IMCC_INFO(interp)->globals->cs->subs->pmc_const = k;
-
     if (unit->_namespace) {
         /* strip namespace off from front */
         const char *real_name = strrchr(r->name, '@');
@@ -1445,29 +1441,36 @@
 
     Parrot_store_sub_in_namespace(interp, sub_pmc);
 
-    pfc->type     = PFC_PMC;
-    pfc->u.key    = sub_pmc;
-    unit->sub_pmc = sub_pmc;
-
     if (sub->outer_sub)
         PMC_get_sub(interp, sub->outer_sub, outer_sub);
 
-    IMCC_debug(interp, DEBUG_PBC_CONST,
-            "add_const_pmc_sub '%s' flags %x color %d (%Ss) "
-            "lex_info %s :outer(%Ss)\n",
-            r->name, r->pcc_sub->pragma, k,
-            sub_pmc->vtable->whoami,
-            sub->lex_info ? "yes" : "no",
-            sub->outer_sub? outer_sub->name :
-            Parrot_str_new(interp, "*none*", 0));
+    {
+        const int            k            = add_const_table(interp);
+        PackFile_Constant   * const pfc   = ct->constants[k];
+
+        pfc->type     = PFC_PMC;
+        pfc->u.key    = sub_pmc;
+        unit->sub_pmc = sub_pmc;
 
-    /*
-     * create entry in our fixup (=symbol) table
-     * the offset is the index in the constant table of this Sub
-     */
-    PackFile_FixupTable_new_entry(interp, r->name, enum_fixup_sub, k);
+        IMCC_INFO(interp)->globals->cs->subs->pmc_const = k;
 
-    return k;
+        IMCC_debug(interp, DEBUG_PBC_CONST,
+                "add_const_pmc_sub '%s' flags %x color %d (%Ss) "
+                "lex_info %s :outer(%Ss)\n",
+                r->name, r->pcc_sub->pragma, k,
+                sub_pmc->vtable->whoami,
+                sub->lex_info ? "yes" : "no",
+                sub->outer_sub? outer_sub->name :
+                Parrot_str_new(interp, "*none*", 0));
+
+        /*
+         * create entry in our fixup (=symbol) table
+         * the offset is the index in the constant table of this Sub
+         */
+        PackFile_FixupTable_new_entry(interp, r->name, enum_fixup_sub, k);
+
+        return k;
+    }
 }
 
 


More information about the parrot-commits mailing list