* 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().
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.
* 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.
It's a bit strange for disparate vocabs to reference words that get created out of thin air during bootstrap, so this lets there be some trace in the seeded vocab source that there was a word created there.
We also need to save C ABI volatile registers before calling the signal handler in order to be able to reliably resume. Add signal-handler and leaf-signal-handler subprimitives to preserve volatile registers before invoking the signal handler C function.
Add error checking for append-vocab-dir and (child-vocabs) in case someone tries to pass them the wrong parameters.
Rename: vocab-dir+ to append-vocab-dir
Document load-from-root and load-root
* with-error-stream(*)
* with-output+error-stream(*) -- sets output and error stream to same stream
* with-output>error -- sets output stream to error stream for scope
* with-input-output+error-streams(*) -- like with-streams, but sets output and error to same stream
Implement M: utf16[bl]e encode-string to use a fast implementation if a string is ASCII only, and do some inlining so the slow path optimizes a bit better.
stream-contents is extremely slow on decoder streams when implemented with each-block, and it can be implemented very quickly for streams of known length using stream-read-unsafe. Make it generic and provide some off-the-shelf implementations using each-block, a read1 loop, or length + read-unsafe. Provide new stream-seekable? and stream-length generics that can be implemented by stream implementations that know their size.
Now that "io" provides a method on object for stream-read-partial-unsafe that forwards to stream-read-unsafe, individual stream class that don't implement partial reads don't need to provide such a method themselves.
Provide default implementations of all the input-stream methods in terms of stream-read1 and of all the output-stream methods in terms of stream-write1.
Now that all streams have been updated to implement the stream-read-unsafe protocol, take out the noncopying-reader shim. Turn stream-read and stream-read-partial into plain functions over the -unsafe generics.
Add guess-encoded-length and guess-decoded-length generics that encodings can implement to provide hints as to how large the translation product will be, for sizing vectors and things like that.
each-(stream-)block* is like each-block but takes a buffer object and reads into it repeatedly. (stream-)contents* determines the stream length then does a single stream-read-unsafe into a preallocated buffers. Both functions currently only work for byte-arrays (and contents* only for seekable streams), so they can't replace the non-starred versions completely just yet.
Change the fread primitive to fread-unsafe, matching the new primitive in the VM, and update the implementation of c-reader to implement stream-read-unsafe and stream-read in terms of fread-unsafe
Add generics stream-read-unsafe and stream-read-partial-unsafe, which take a buffer pointer and return a count of bytes read instead of returning a freshly allocated byte array.