Matt Birkholz [Sat, 20 Dec 2014 21:00:43 +0000 (14:00 -0700)]
smp: Wake io-waiter when necessary. Add io-waiter-registry...
...a copy of io-registry for io-waiter to block on while other threads
modify io-registry. Test io-registry in thread-timer-interrupt-
handler only when there is no io-waiter.
Matt Birkholz [Sat, 20 Dec 2014 16:15:03 +0000 (09:15 -0700)]
smp: Check for SIGCHLD in thread timer interrupt handler.
An idle thread might get a SIGCHLD, wake and run the thread timer
interrupt handler (since there is no subprocess-status-change
interrupt) and return to idle. If it is not the io-waiter, it does
not call test-select-registry nor otherwise notice the subprocess
status change.
Funnel all status change notifications through handle-subprocess-
status-change. It uses the last-global-tick variable to remember the
tick when threads blocking on status changes were last woken.
Matt Birkholz [Tue, 25 Nov 2014 15:46:15 +0000 (08:46 -0700)]
smp: unshare: UX trap_state and current_interruptable_extent.
Split the thread-local parts out of UX_initialize_trap_recovery into
UX_initialize_trap_state, and those of OS_initialize into
OS_initialize_processor.
Matt Birkholz [Sat, 20 Dec 2014 15:50:09 +0000 (08:50 -0700)]
smp: Initialize thread-local compiler_utilities.
Split the thread-local parts of compiler_initialize into
compiler_initialize_processor, those of compiler_reset into
compiler_reset_processor. Split the non-thread-local parts of
ASM_RESET_HOOK into ASM_INIT_HOOK, i.e. i386_reset_hook into
i386_init_hook. Call the _processor versions in co-processor startup
and SMP-GC-WAITs.
Add compiler_reset_p flag to processor_t so that load-band
(compiler_reset) can notify the other processors to load the new
compiler_utilities into their Registers slots.
Matt Birkholz [Sat, 20 Dec 2014 15:37:56 +0000 (08:37 -0700)]
smp: Synchronize initialized processors.
The main pthread must wait for the other processors to be initialized,
else the first GC waits forever for processors that cleared the
global-gc interrupt while initializing.
Matt Birkholz [Fri, 19 Dec 2014 23:53:42 +0000 (16:53 -0700)]
smp: Add configure option --enable-smp.
Arrange for multiple Scheme machines, "processors" (pthreads), to
share the heap. Each gets its own stack and "local" heap areas.
Gc-flips trace the stacks and evacuate the local heaps into the shared
heap. The dump-band primitive now works like half a gc-flip,
evacuating the local heaps and saving the shared heap to disk before
the primitive gc daemons can start consing in a local heap again.
Matt Birkholz [Fri, 19 Dec 2014 21:50:27 +0000 (14:50 -0700)]
smp: Punt "permanent" i/o thread events.
A "permanent" input channel in the system select registry will cause
the io-waiter to spin until a thread reads the available input.
Always removing an entry after its event is delivered allows the
io-waiter to block until the thread processes the event, reads the
available input, and blocks again.
Matt Birkholz [Fri, 19 Dec 2014 19:29:29 +0000 (12:29 -0700)]
smp: Accommodate multiple processors.
Keep the threads running on each processor in the current-threads
vector. Change the running list into a runnable list: the threads
that are runnable but not currently running on a processor.
Matt Birkholz [Wed, 5 Nov 2014 20:27:11 +0000 (13:27 -0700)]
smp: Clobber fluid-let and the (runtime state-space) package.
UNimplement fluid-let using dynamic-wind as a backward compatibility
kludge. Subsystems still using fluid-let, e.g. LIAR, must not be run
in multiple threads simultaneously. Fluid-let no longer provides
thread-local storage.
Replace the previously fluid-assigned bindings state-space:local and
(runtime dynamic)bindings with thread slots dynamic-point and
dynamic-environment. Split the initialization of (runtime thread)
into "low" and "high" procedures. The "low" procedure is applied
early in the bootstrap to create the initial thread, whose dynamic
state is needed later. Lose the error handling in wait-for-io; it
runs when there is no current thread, thus no way to bind-condition-
handler.
Replace the uniprocessor-only Hanson/Lamping state-spaces with
Scheme48's multiprocessing-friendly dynamic-points in a new package
(runtime wind).
Replace the fluid-let with its expansion into a dynamic-wind, which
works only if the bootstrap proceeds in one thread and thus
thread-local values for boot-inits are not needed.
Matt Birkholz [Wed, 22 Oct 2014 23:01:30 +0000 (16:01 -0700)]
Add bindings to edwin/debug.scm; punt browser-evaluator.
Add ansi.scm to (edwin screen console-screen) for unix as well as
dos and nt. This quiets cref's complaint about termcap.scm's
reference to make-ansi-terminal-description.
The browser-evaluator command was never implemented(?).
Matt Birkholz [Fri, 10 Oct 2014 23:57:02 +0000 (16:57 -0700)]
svm: Fix continue_from_trap.
Signal handlers always find an unknown pc when the svm interpreter is
running. This patch extracts the virtual machine's instruction
pointer for classify_pc in the hope that the compiled code block can
be located.
Matt Birkholz [Fri, 10 Oct 2014 23:39:22 +0000 (16:39 -0700)]
i386 flonums: Fix substitution of FLDZ,FUCOMP for FTST in 521ffb3.
The branch instructions needed to be swapped.
This caused compiled generic arithmetic to get e.g. (> x 0.) wrong,
causing an overflow in float->integers when compiling
runtime/arith.scm for the SVM.
Matt Birkholz [Fri, 10 Oct 2014 23:32:01 +0000 (16:32 -0700)]
make check: To avoid long run times, export FAST=y.
A nip and a tuck and the SVM can get through `make check' in 10-15
minutes, instead of MORE THAN 5 HOURS on a Dell Inspiron 1420 (2.2GHz
Core2Duo Centrino with 2GB RAM).
Matt Birkholz [Wed, 27 Aug 2014 05:27:38 +0000 (22:27 -0700)]
microcode/unix: fix continue_from_trap to freak out (force GC) less
The classify_pc function returns pcl_unknown for traps in shared
libraries, e.g. in feraiseexcept (in the raise-float-exceptions
primitive) or any callout (in the c-call primitive). This new
continue_from_trap function is less conservative, ignoring the
pcl_unknown result from classify_pc when the stack_pointer, Free and
PRIMITIVE registers all look good. This eliminated all complaints
during `make check' about "resetting bogus Free" (not the actual
problem), representing 14 unnecessarily forced GCs.
Also, fix the murmur about "resetting bogus Free". Correct it for
accuracy and so that it must be turned on with the
((make-primitive-procedure 'SET-DEBUG-FLAGS! 2) 9 #t)