From: Matt Birkholz Date: Sat, 20 Dec 2014 18:55:34 +0000 (-0700) Subject: smp: share: fasload.o X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=f88991759716cb39a9eeb635ca503209d4694b2f;p=mit-scheme.git smp: share: fasload.o --- diff --git a/README.txt b/README.txt index 9078f8f7b..f1f0dbc5a 100644 --- a/README.txt +++ b/README.txt @@ -290,6 +290,12 @@ command line. The remaining 12 belong to the 7 microcode modules and 000000a0 b table.6366 000001e0 b table.6400 + OK. Prim_binary_fasload only hacks the local heap, but it + uses gcloop, which uses non-pthread-local state. Use of this + primitive is now locked up. Prim_band_load uses smp_gc_start + to get exclusive access to the heap, gcloop, etc. for the + duration of a gc-wait. + fixnum.o: floenv.o: diff --git a/src/microcode/fasload.c b/src/microcode/fasload.c index d9ede4e9c..58aea6cd1 100644 --- a/src/microcode/fasload.c +++ b/src/microcode/fasload.c @@ -40,6 +40,19 @@ USA. #include "option.h" #include "fasl.h" +#ifdef ENABLE_SMP +static pthread_mutex_t mutex = MUTEX_INITIALIZER; +# ifdef ENABLE_DEBUGGING_TOOLS +static bool locked_p = false; +# endif +#endif + +static void +unlock (void *null) +{ + UNLOCK(); +} + static fasl_header_t fasl_header; static fasl_header_t * fh; static SCHEME_OBJECT * new_heap_start; @@ -108,6 +121,8 @@ that was dumped.") canonicalize_primitive_context (); transaction_begin (); + transaction_record_action (tat_always, &unlock, NULL); + LOCK(); init_fasl_file ((STRING_ARG (1)), false, (&handle)); if ((FASLHDR_CONSTANT_SIZE (fh)) > 0)