Make the svm1 interpreter's state thread-local.
authorMatt Birkholz <puck@birchwood-abbey.net>
Sun, 19 Jul 2015 01:20:31 +0000 (18:20 -0700)
committerMatt Birkholz <puck@birchwood-abbey.net>
Thu, 26 Nov 2015 08:09:45 +0000 (01:09 -0700)
src/microcode/svm1-interp.c

index 454c87c082e727d1af2bbc3901c8b173a4988d04..1d6b3d9133e675834e1a7d3840bb2d49e5ec8d7a 100644 (file)
@@ -65,8 +65,8 @@ typedef SCHEME_OBJECT word_t; /* convenience abbreviation */
 #  define FLOAT_REGISTER_P(b) true
 #endif
 
-static word_t word_registers [N_WORD_REGISTERS];
-static double float_registers [N_FLOAT_REGISTERS];
+static __thread word_t word_registers [N_WORD_REGISTERS];
+static __thread double float_registers [N_FLOAT_REGISTERS];
 
 #define SBYTE (sizeof (byte_t))
 #define SWORD (sizeof (word_t))
@@ -116,7 +116,7 @@ static inst_defn_t * inst_defns [256];
   return (addr);                                                       \
 } while (0)
 
-static long svm1_result;
+static __thread long svm1_result;
 
 #define EXIT_VM(code) do                                               \
 {                                                                      \
@@ -215,8 +215,8 @@ initialize_svm1 (void)
 /* Only true when the virtual machine is running, e.g. while Free is
    cached in word_registers[].  In a signal handler, the virtual
    instruction that trapped is at instruction_pointer. */
-static bool running_p = false;
-static insn_t * instruction_pointer;
+static __thread bool running_p = false;
+static __thread insn_t * instruction_pointer;
 
 long
 C_to_interface (void * address)