[svn:parrot] r40346 - trunk/compilers/imcc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Thu Jul 30 18:57:46 UTC 2009


Author: NotFound
Date: Thu Jul 30 18:57:46 2009
New Revision: 40346
URL: https://trac.parrot.org/parrot/changeset/40346

Log:
[cage] getting rid of a imcc global, RT #39714

Modified:
   trunk/compilers/imcc/imc.h
   trunk/compilers/imcc/symreg.c

Modified: trunk/compilers/imcc/imc.h
==============================================================================
--- trunk/compilers/imcc/imc.h	Thu Jul 30 18:29:24 2009	(r40345)
+++ trunk/compilers/imcc/imc.h	Thu Jul 30 18:57:46 2009	(r40346)
@@ -595,6 +595,7 @@
     STRING                *error_message;   /* The Error message */
 
     /* some values that were global... */
+    Namespace            *namespace_stack;
     SymReg               *cur_call;
     SymReg               *cur_obj;
     SymReg               *adv_named_id;

Modified: trunk/compilers/imcc/symreg.c
==============================================================================
--- trunk/compilers/imcc/symreg.c	Thu Jul 30 18:29:24 2009	(r40345)
+++ trunk/compilers/imcc/symreg.c	Thu Jul 30 18:57:46 2009	(r40346)
@@ -29,10 +29,6 @@
 
 #include "imc.h"
 
-/* Globals: */
-
-static Namespace * pesky_global__namespace;
-
 /* Code: */
 
 /* HEADERIZER HFILE: compilers/imcc/symreg.h */
@@ -140,14 +136,14 @@
 */
 
 void
-push_namespace(SHIM_INTERP, ARGIN(const char *name))
+push_namespace(PARROT_INTERP, ARGIN(const char *name))
 {
     ASSERT_ARGS(push_namespace)
     Namespace * const ns = mem_allocate_zeroed_typed(Namespace);
 
-    ns->parent = pesky_global__namespace;
+    ns->parent = IMCC_INFO(interp)->namespace_stack;
     ns->name   = mem_sys_strdup(name);
-    pesky_global__namespace = ns;
+    IMCC_INFO(interp)->namespace_stack = ns;
 }
 
 
@@ -166,7 +162,7 @@
 pop_namespace(PARROT_INTERP, ARGIN(const char *name))
 {
     ASSERT_ARGS(pop_namespace)
-    Namespace * const ns = pesky_global__namespace;
+    Namespace * const ns = IMCC_INFO(interp)->namespace_stack;
 
     if (!ns)
         IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR, "pop() on empty namespace stack\n");
@@ -181,7 +177,7 @@
         mem_sys_free(ident);
     }
 
-    pesky_global__namespace = ns->parent;
+    IMCC_INFO(interp)->namespace_stack = ns->parent;
     mem_sys_free(ns);
 }
 
@@ -640,7 +636,7 @@
 mk_ident(PARROT_INTERP, ARGIN(const char *name), int t)
 {
     ASSERT_ARGS(mk_ident)
-    char   * const fullname = _mk_fullname(pesky_global__namespace, name);
+    char   * const fullname = _mk_fullname(IMCC_INFO(interp)->namespace_stack, name);
     SymReg *r = get_sym_by_name(&(IMCC_INFO(interp)->last_unit->hash), name);
     if (r && r->set != t)
         IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR,
@@ -650,12 +646,12 @@
     r->type = VTIDENTIFIER;
 
 
-    if (pesky_global__namespace) {
+    if (IMCC_INFO(interp)->namespace_stack) {
         Identifier * const ident = mem_allocate_zeroed_typed(Identifier);
 
         ident->name        = fullname;
-        ident->next        = pesky_global__namespace->idents;
-        pesky_global__namespace->idents = ident;
+        ident->next        = IMCC_INFO(interp)->namespace_stack->idents;
+        IMCC_INFO(interp)->namespace_stack->idents = ident;
     }
     else
         mem_sys_free(fullname);
@@ -1560,7 +1556,7 @@
 {
     ASSERT_ARGS(find_sym)
     if (IMCC_INFO(interp)->cur_unit)
-        return _find_sym(interp, pesky_global__namespace,
+        return _find_sym(interp, IMCC_INFO(interp)->namespace_stack,
             &IMCC_INFO(interp)->cur_unit->hash, name);
 
     return NULL;


More information about the parrot-commits mailing list