Commit Graph

319 Commits (06fc9ecbb04801a63ecc87f254e1fb70de9f1c98)

Author SHA1 Message Date
Joe Groff 75f9904c40 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.
2011-11-08 08:42:48 -08:00
Joe Groff ceeb9f36d8 vm: write async signals to pipe for multiplexer
also factor out safepoint logic into its own file
2011-11-08 08:42:46 -08:00
Joe Groff 04a3c88227 vm: readable feps for more types 2011-11-06 20:26:52 -08:00
Joe Groff ac2fcd1ee0 vm: sample pc on windows 2011-11-02 21:18:31 -07:00
Joe Groff 6b2a34fdc6 vm: count samples during unoptimized compiler 2011-11-02 13:23:21 -07:00
Joe Groff 4f87ab1df7 vm: separate 'current_gc_p' from 'current_gc'
The 'current_gc' handle doesn't need to be volatile, just the state of GC-ness
2011-11-02 13:23:19 -07:00
Joe Groff 9fb10f60b5 vm: add atomic::load and atomic::store functions
Abstract out the fence-and-load and store-and-fence patterns
2011-11-02 13:23:19 -07:00
Joe Groff 2a64c3ed69 vm: sample code block owners instead of blocks 2011-11-02 13:23:17 -07:00
Joe Groff bb2df7da6b vm: die if we fault in a fault 2011-11-02 13:23:16 -07:00
Joe Groff fdeb6ddbaa vm: quell MSVC warnings 2011-11-02 13:23:16 -07:00
Joe Groff d7bc7ae4bf vm: parameterize sampling rate 2011-11-02 13:23:15 -07:00
Joe Groff 66356c1d24 vm: better organize atomics and sample counter 2011-11-02 13:23:15 -07:00
Joe Groff 52bcbe55cf vm: factor out sample counting code 2011-11-02 13:23:13 -07:00
Joe Groff b89335df71 vm: only show factorbug help the first time 2011-11-02 13:23:13 -07:00
Joe Groff c0e4458733 vm: fix build on windows 2011-11-02 13:23:12 -07:00
Joe Groff bec71e9ae2 vm: sampling profiler timer for windows
Spawn a thread and have it spin on the performance counter, triggering safepoints on the main thread every sample time
2011-11-02 13:23:11 -07:00
Joe Groff 1c68bbf8a6 vm: count samples from foreign threads
On OS X it appears the mach exception thread and libdispatch queue threads occasionally get the SIGALRM from the itimer. Count those as foreign_thread_samples instead of letting the signal kill the process.
2011-11-02 13:23:10 -07:00
Joe Groff 1ab4871fcc vm: add primitives to lift sample data to factor 2011-11-02 13:23:09 -07:00
Joe Groff cb2e87ecde vm: release memory used by sampler vectors 2011-11-02 13:23:08 -07:00
Joe Groff 1604c503ab vm: don't allocate callstack samples on data heap
Invoking a GC during a safepoint has some complications, so stuff the callstack samples in a vector instead.
2011-11-02 13:23:07 -07:00
Joe Groff 2ddfdda7b5 vm: groundwork for sampling profiler
Set up the state necessary to collect samples. We still need to add GC support for walking the sample set, and the compiler needs to register GC roots before safepoints as well. We also need primitives to expose the data to Factor for reporting.
2011-11-02 13:23:06 -07:00
Joe Groff 12a4c7a538 vm: change "profiler" names to "counting_profiler" 2011-11-02 13:23:05 -07:00
Joe Groff 83569d3793 vm: give factorbug a help command
Also change the prompt to "> _" instead of "READY\n_" since it's not 1970 anymore
2011-10-27 21:18:23 -07:00
Joe Groff 09088ec3ce cleanups from code review 2011-10-27 21:18:23 -07:00
Joe Groff b1094e0e5f vm: remove half-assed signal queueing scaffolding
Should implement it right later. See #297.
2011-10-27 21:18:22 -07:00
Joe Groff 7e3944509a vm: get CtrlHandler working on windows 2011-10-27 21:18:21 -07:00
Joe Groff ad9b90f23b vm: update windows for resumable signals 2011-10-27 21:18:21 -07:00
Joe Groff e431cef96b vm: move dispatch_signal_handler to cpu-x86.cpp
The new signal handler dispatch is logic is CISC-centric; defer fixing it until we find someone who cares
2011-10-27 21:18:20 -07:00
Joe Groff 1660bd5a19 vm: remove signal_from_leaf flag
Now that the resuming from the signal handler works within leaf procedures, the flag is no longer necessary.
2011-10-27 21:18:20 -07:00
Joe Groff a5da58bb97 vm: fix foreign segfaults and callstack overflows 2011-10-27 21:18:18 -07:00
Joe Groff 1eddaf34f1 vm: resumably handle signals from leaf procedures 2011-10-27 21:18:18 -07:00
Joe Groff f788bc954c vm: sketchy signal dispatch from leaf procs 2011-10-27 21:14:49 -07:00
Joe Groff f759575ddd vm: factor out dispatch_signal_handler logic 2011-10-27 21:14:49 -07:00
Joe Groff 91d8bcd4f8 vm: fep on SIGINT or SIGQUIT instead of exception
It's not robust currently to raise an exception because a lot of our code that isn't already written with exceptions in mind breaks. Also, a signal is likely to be received by an FFI callback installed on the IO multiplexer, which will cause Factor to die since the callback cannot handle the exception. We need a more robust solution to dealing with SIGINT.

Also lay some groundwork for counting profile samples and reporting non-interrupting asynchronous signals.
2011-10-27 21:14:49 -07:00
Joe Groff 675cd246ad vm: fatal_error if VM-less thread gets a signal 2011-10-27 21:14:48 -07:00
Joe Groff d103e6b57d vm: remove unguard-safepoint primitive 2011-10-27 21:14:47 -07:00
Joe Groff 5b4a95a6a0 vm: SetConsoleCtrlHandler on windows 2011-10-27 21:14:47 -07:00
Joe Groff e9309a425a vm: handle async signals at safepoints on unix
Factor now supports the new 4.0BSD feature of "signals".
2011-10-27 21:14:46 -07:00
John Benediktsson 58765c31d5 vm: remove math::bignum_producer. 2011-10-11 21:24:38 -07:00
John Benediktsson da21f5ca61 io.binary: make le> and be> faster (20% and 75%, respectively).
Removed primitive byte-array>bignum and digit_stream_to_bignum from vm/.
2011-10-11 21:13:30 -07:00
Slava Pestov 20c6aaddec Tease out symbol name and library in undefined_symbol() handler, for friendlier errors when calling an unresolved C function name. Fixes #93 2011-09-12 00:56:24 -07:00
Slava Pestov 22ad7c4fcd vm: fix high_fragmentation_p assertion 2011-09-05 23:30:28 -07:00
Erik Charlebois 1ed2bc6231 32 and 64 bit Linux PPC support 2011-05-23 23:36:14 -04:00
Slava Pestov b0b5f3ac97 Remove bignum>float VM primitive, and use bignum/f to implement >float on bignums instead, for a slight accuracy gain. Also, bignum/f now has a more efficient post-scaling algorithm to break the circular dependency on bignum>float 2010-11-24 22:41:15 -08:00
Slava Pestov 4877d32cb3 compiler: preliminary implementation of tracking derived pointers in GC maps 2010-09-27 20:12:44 -07:00
Slava Pestov 18e8c0af9c vm: don't keep more than 10 unused contexts around to prevent address space wastage on low-budget operating systems like OpenBSD 2010-09-17 20:52:27 -07:00
Slava Pestov 05fc6ddad6 vm: a stack underflow inside a primitive could leave a data root in an uninitialized state; if allocating the thrown underflow error triggered a GC, the GC would visit a garbage pointer 2010-09-17 19:46:57 -07:00
Slava Pestov 09c74bda0b vm: don't call nano_count() from the GC at all, unless GC event recording is on 2010-09-04 13:21:45 -07:00
Slava Pestov 0797875ef5 vm: fix crash when doing GC with profiling enabled 2010-09-03 21:54:40 -05:00
Slava Pestov 55ac874eb2 vm: Remove signal_callstack_top nonsense 2010-09-02 22:57:17 -05:00