Make the debugging flags and buffers pthread-local.
Serialize use of the MAKE-EPHEMERON primitive with a pthread mutex.
fixed_objects and heap_reserved are modified by primitives that the
runtime system already uses in serial fashion.
extern bool verify_heap (void);
extern void Pop_Return_Break_Point (void);
- extern unsigned int debug_slotno;
- extern unsigned int debug_nslots;
- extern unsigned int local_slotno;
- extern unsigned int local_nslots;
- extern unsigned int debug_circle [];
- extern unsigned int local_circle [];
+ extern __thread unsigned int debug_slotno;
+ extern __thread unsigned int debug_nslots;
+ extern __thread unsigned int local_slotno;
+ extern __thread unsigned int local_nslots;
+ extern __thread unsigned int debug_circle [];
+ extern __thread unsigned int local_circle [];
#else
# define Eval_Debug 0
# define Hex_Input_Debug 0
#ifdef ENABLE_SMP
int saved_processor_count;
unsigned long saved_processor_heap_size;
+static pthread_mutex_t mutex = MUTEX_INITIALIZER;
+# ifdef ENABLE_DEBUGGING_TOOLS
+static bool locked_p = false;
+# endif
#endif
static gc_tospace_allocator_t allocate_tospace;
void
guarantee_extra_ephemeron_space (unsigned long n)
{
+ LOCK();
ephemeron_count = n;
if (!ephemeron_array_big_enough_p (n))
{
assert (SHARED_HEAP_AVAILABLE_P (VECTOR_DATA + length));
ephemeron_array = make_ephemeron_vector (length);
}
+ UNLOCK();
}
\f
static void
{
n_ephemerons_requested = 1;
ephemeron_request_hard_p = true;
+ UNLOCK();
Primitive_GC (EPHEMERON_SIZE);
}
#endif
DEFINE_PRIMITIVE ("MAKE-EPHEMERON", Prim_make_ephemeron, 2, 2, 0)
{
PRIMITIVE_HEADER (2);
+ LOCK();
ephemeron_count += 1;
if (ephemeron_array_big_enough_p (ephemeron_count))
gc_if_needed_for_ephemeron (0);
(*Free++) = SHARP_F; /* list */
(*Free++) = SHARP_F; /* queue */
assert ((Free - addr) == EPHEMERON_SIZE);
+ UNLOCK();
PRIMITIVE_RETURN (MAKE_POINTER_OBJECT (TC_EPHEMERON, addr));
}
}
bool Trace_On_Error = false;
bool Bignum_Debug = false;
bool Per_File = false;
- unsigned int debug_slotno = 0;
- unsigned int debug_nslots = 0;
- unsigned int local_slotno = 0;
- unsigned int local_nslots = 0;
- unsigned int debug_circle [100];
- unsigned int local_circle [100];
+ __thread unsigned int debug_slotno = 0;
+ __thread unsigned int debug_nslots = 0;
+ __thread unsigned int local_slotno = 0;
+ __thread unsigned int local_nslots = 0;
+ __thread unsigned int debug_circle [100];
+ __thread unsigned int local_circle [100];
#endif
const char * CONT_PRINT_RETURN_MESSAGE = "SAVE_CONT, return code";