Joe Groff [Mon, 14 Nov 2011 00:09:30 +0000 (16:09 -0800)]
math.vectors.simd: don't try distance on int types
"v- norm" doesn't work right for uint-4s because of underflow, but who's going to call "distance" on a uint vector?
Joe Groff [Sun, 13 Nov 2011 08:02:40 +0000 (00:02 -0800)]
math.vectors.simd: add vcount to the tests
Also add a base case to (approx=) for integer returns. vcount returns an integer even for float vector inputs, but the test machinery isn't smart enough to figure that out and uses (approx=) on the outputs anyway.
Joe Groff [Fri, 11 Nov 2011 21:29:46 +0000 (13:29 -0800)]
vm: more defense against multi-faulting
* Clear faulting_p from a safepoint rather than inside general_error, because jumping into unwind-native-frames could blow up.
* Handle multiple faults from fatal_error by breakpointing. Is there anything else we can safely do at that point?
* Verify memory protection faults in the top half of the signal handlers because signal dispatch could fault. Treat memory faults during gc or fep as fatal errors.
* Add a function factor_vm::abort() that restores the default SIGABRT handler and ::abort()s. Use it from fatal_error() so we get useful context from gdb and so the user gets feedback from the system crash reporter that Factor blew up and didn't just disappear.
* In factorbug(), don't proceed with .s .r .c if it would be unsafe to do so.
* Don't pile on signals if we've already called fatal_error().
Joe Groff [Fri, 11 Nov 2011 03:34:36 +0000 (19:34 -0800)]
tools.deploy: label small-enough? tests
Put a no-op "vocab name" drop in the small-enough? tests so that it's immediately apparent from build farm errors which vocabs are deploying over the limit.
Joe Groff [Fri, 11 Nov 2011 00:00:47 +0000 (16:00 -0800)]
vm: strip out call-counting profiler
This makes the separate "code" and "entry_point" fields in word and quotation redundant, so also remove them to reclaim an additional cell per word and quotation object, which should help with #318.
Joe Groff [Thu, 10 Nov 2011 23:14:03 +0000 (15:14 -0800)]
init signals or console after stage2 init
A signal during early bootstrap is certainly an error, and the environment isn't there yet for Factor's signal handlers to work, so it makes no sense to install Factor's signal handlers beforehand. They'll just crash.
Joe Groff [Thu, 10 Nov 2011 21:46:44 +0000 (13:46 -0800)]
vm: don't SIGQUIT on unix or Ctrl-Break on windows
This gives us an escape hatch for when things go way south and ^C can't be handled. Also unmask SIGQUIT and SIGTERM from the stdin_loop thread so the thread doesn't keep the process alive after those signals.
Joe Groff [Thu, 10 Nov 2011 01:21:44 +0000 (17:21 -0800)]
io: more hot-rodding for #376
* Change the interface of read-into to return a slice and an eof boolean separately so the compiler can optimize the slice.
* Add an each-stream-block-slice combinator that behaves like each-block but reuses a preallocated buffer for every iteration.
* Pull some strings in the stream-read-into implementation to further improve type propagation and bounds check elimination.
Joe Groff [Wed, 9 Nov 2011 22:43:39 +0000 (14:43 -0800)]
io.files: add file-reader, file-writer mixins
This lets us do some trickery so that the stream-element-type propagates from <file-reader>/<file-writer>. For #376.
Joe Groff [Wed, 9 Nov 2011 22:29:12 +0000 (14:29 -0800)]
io:read: don't resize output buffer if unnecessary
Even with a short-circuit test in the VM primitives, resize still has an overly high runtime cost in tight loops. For #376.
Joe Groff [Wed, 9 Nov 2011 06:07:22 +0000 (22:07 -0800)]
vm: make signal pipe nonblocking
On the off chance the Factor end of the signal handler mechanism isn't listening, we don't want to tie up the VM because the pipe's buffer got full.
Joe Groff [Tue, 8 Nov 2011 22:11:53 +0000 (14:11 -0800)]
tools.profiler.sampling: change some names around
Rename the versions of top-down etc. that take sample data to "top-down*" (from "(top-down)") so they don't look so scary to use. Change "get-raw-profile-data" to "most-recent-profile-data".
Joe Groff [Tue, 8 Nov 2011 05:12:11 +0000 (21:12 -0800)]
vm: interrupt stdin_loop when entering fep
The stdin_loop thread will keep trying to consume input unless we stop it by sending it a signal. Use SIGUSR2 to stop the read syscall and a mutex to hold up the loop while the fep is active.
Joe Groff [Mon, 7 Nov 2011 22:05:31 +0000 (14:05 -0800)]
vm: enqueue signals for FEP signals too
Although SIGINT still can't interrupt the current Factor thread in a sane way, this will at least wake up the run loop when waiting for input and fix #348 when implemented at the application level.
Joe Groff [Tue, 8 Nov 2011 01:58:53 +0000 (17:58 -0800)]
vm: switch atomic::add to atomic::fetch_add
Win32 only provides fetch-and-add, not add-and-fetch, and we don't really care. Rename the functions so the order of operations is clear.