Author: chromatic
Date: Mon Nov 10 19:06:57 2008
New Revision: 32504

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

Log:
[IMCC] Moved yet another static variable into the IMCC_INFO structure.  Sadly,
still more re-entrancy problems remain (see RT #60170).

Modified: trunk/compilers/imcc/imc.h
==============================================================================
--- trunk/compilers/imcc/imc.h  (original)
+++ trunk/compilers/imcc/imc.h  Mon Nov 10 19:06:57 2008
@@ -510,6 +510,7 @@
     int                   cur_pmc_type;
     int                   debug;
     int                   dont_optimize;
+    int                   emitter;
     int                   error_code;      /* The Error code. */
     int                   expect_pasm;
     int                   gc_off;

Modified: trunk/compilers/imcc/instructions.c
==============================================================================
--- trunk/compilers/imcc/instructions.c (original)
+++ trunk/compilers/imcc/instructions.c Mon Nov 10 19:06:57 2008
@@ -80,8 +80,6 @@
      e_pbc_close},
 };
 
-static int emitter;     /* XXX */
-
 /*
 
 =item C<Instruction * _mk_instruction>
@@ -847,11 +845,11 @@
 int
 emit_open(PARROT_INTERP, int type, ARGIN_NULLOK(void *param))
 {
-    emitter                          = type;
+    IMCC_INFO(interp)->emitter       = type;
     IMCC_INFO(interp)->has_compile   = 0;
     IMCC_INFO(interp)->dont_optimize = 0;
 
-    return (emitters[emitter]).open(interp, param);
+    return (emitters[IMCC_INFO(interp)->emitter]).open(interp, param);
 }
 
 /*
@@ -869,7 +867,8 @@
 int
 emit_flush(PARROT_INTERP, ARGIN_NULLOK(void *param), ARGIN(IMC_Unit *unit))
 {
-    Instruction * ins;
+    Instruction *ins;
+    int          emitter = IMCC_INFO(interp)->emitter;
 
     if (emitters[emitter].new_sub)
         (emitters[emitter]).new_sub(interp, param, unit);
@@ -899,7 +898,7 @@
 int
 emit_close(PARROT_INTERP, ARGIN_NULLOK(void *param))
 {
-    return (emitters[emitter]).close(interp, param);
+    return (emitters[IMCC_INFO(interp)->emitter]).close(interp, param);
 }
 
 /*

Reply via email to