Commit Graph

129 Commits (elevate-erg)

Author SHA1 Message Date
Joe Groff f5cdfaeb2a 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 80fb7788d9 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 2d5360778f cleanups from code review 2011-10-27 21:18:23 -07:00
Joe Groff 9eee44ce4a vm: remove half-assed signal queueing scaffolding
Should implement it right later. See #297.
2011-10-27 21:18:22 -07:00
Joe Groff 6d57eb4f59 vm: update windows for resumable signals 2011-10-27 21:18:21 -07:00
Joe Groff 5d59faa7d1 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 dca0fd3487 vm: Revert extra canary page before callstack
This reverts commit 7d5c8d6990385b94569116a23163d7e75ae21f49. We pretty much can't avoid unwinding frames without some more drastic redesign.
2011-10-27 21:14:50 -07:00
Joe Groff c3f007ce0a vm: allocate an extra canary page before callstack
This will let us safely unguard the callstack overflow guard page as a grace page so the callstack overflow handler can do its business without discarding frames.
2011-10-27 21:14:49 -07:00
Joe Groff 6e4117035e vm: factor out dispatch_signal_handler logic 2011-10-27 21:14:49 -07:00
Joe Groff dc42365007 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 1dc31d133b vm: clean up signal handler dispatch
Remove the weird and broken functions fix_callstack_top and scrub_return_address. Instead, simply decrement the SP and store the PC from the front end of the signal handler so that the back end can return back into the original context normally. Currently aborts for leaf procedure frames pending a more robust solution.
2011-10-27 21:14:48 -07:00
Joe Groff 3726f61c70 vm: fatal_error if VM-less thread gets a signal 2011-10-27 21:14:48 -07:00
Joe Groff 552711e903 vm: block all signals from unix stdin_loop thread 2011-10-27 21:14:47 -07:00
Joe Groff b3e5f75c9e 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
Joe Groff 99804d5e3f vm: code_heap::(un)guard_safepoint methods 2011-10-27 21:14:44 -07:00
Erik Charlebois 64252dbdbc 32 and 64 bit Linux PPC support 2011-05-23 23:36:14 -04:00
Slava Pestov 8ccaa417ab vm/os-unix.cpp: remove dead code 2010-09-20 21:36:19 -07:00
Slava Pestov 5378f2a0c7 vm/os-unix.cpp: set pipe file descriptors to close on exec 2010-09-15 22:20:24 -07:00
Slava Pestov 7374d868e7 Change how SIGPIPE is ignored, and add a unit test to io.launcher.unix to ensure that this ignoredness is not inherited by child processes 2010-09-02 22:11:45 -07:00
Slava Pestov d74817cedf vm: Remove signal_callstack_top nonsense 2010-09-02 22:57:17 -05:00
Slava Pestov 1818bcb780 Fix three problems discovered by running math.floats.env tests in a loop:
- Crash if allocating error triggers a GC from a signal/SEH handler
- Crash if GC runs with floating point traps enabled on Windows
- Floating point traps didn't prettyprint properly
2010-09-02 22:57:14 -05:00
Doug Coleman e8d528ad93 Remove system_micros from vm, implement gmt hook on windows 2010-06-16 23:39:16 -05:00
Slava Pestov d9d12ab8fb vm: don't try loading Factor VM DLL anymore 2010-04-02 00:03:26 -04:00
Joe Groff 6d8c30ad98 statically link factor executable to VM so dylib is only needed for embedding 2010-04-01 14:25:02 -07:00
Slava Pestov 43b2e02534 vm: split up TLS code and add a dummy implementation for a dummy OS known as NetBSD 2010-03-29 02:23:21 -04:00
Doug Coleman b40382f412 vm: don't use sigaltstack() on OpenBSD because OpenBSD sucks 2010-03-28 18:26:39 -05:00
Slava Pestov 84c01e1ab3 vm: fix compilation on FreeBSD 2010-03-28 12:52:16 -04:00
Slava Pestov 9ffe0a69d1 vm: use sigaltstack to handle callstack overflow properly 2010-03-28 11:37:28 -04:00
Slava Pestov 031ea6c39c vm: fix factor_vm::dispatch_signal() 2010-03-28 08:29:10 -04:00
Slava Pestov 19aef06741 vm: fix compilation on various Unices 2010-03-27 09:44:20 -04:00
Slava Pestov 11ddbc03a4 vm: signal handling cleanup 2010-03-27 07:33:28 -04:00
Slava Pestov 69bb81dab8 vm: clean up TLS usage 2010-03-27 03:44:40 -04:00
Doug Coleman 950eaed73a Change the MOVE_FILE macro to a function named move_file 2010-02-03 15:12:13 -06:00
Slava Pestov e4da687413 vm: Tweak Factor VM to compile with Microsoft Visual Studio on Windows, in addition to Mingw. Add an Nmakefile which can be used for this purpose. Rename Makefile to GNUmakefile. 2010-01-17 03:43:22 +13:00
Slava Pestov 63edd20a55 vm: eliminating register variables work in progress. Works on x86-32 with non-optimizing compiler 2009-12-19 10:59:56 +13:00
Doug Coleman 987602235e remove sleep_micros, add sleeo_nanos to vm 2009-11-19 04:49:29 -06:00
Doug Coleman 6f7ec206a1 rename millis to system-millis, micros to system-micros, add nano-count 2009-11-18 15:58:48 -06:00
Doug Coleman b4206f5252 initial commit to nanos branch to replace micros 2009-11-18 04:20:05 -06:00
Slava Pestov 3d5c3935ad vm: fix compilation 2009-10-22 06:38:02 -04:00
Slava Pestov f24942e063 vm: clean up signal handling and add EXC_BAD_INSTRUCTION Mach exception handler for OS X, since signal handlers cannot change the stack pointer 2009-10-22 05:22:59 -05:00
Slava Pestov 236588208b vm: rename F to false_object, and rename T to true_object 2009-10-18 20:26:21 -05:00
Slava Pestov c04412219b vm: allocate stacks and data heap segments without execute permissions 2009-10-16 05:16:12 -05:00
Slava Pestov 349cb41a29 Merge branch 'reentrantvm' of git://github.com/phildawes/factor 2009-10-16 03:52:35 -05:00
Phil Dawes 7fef05fd76 Removed VM_PTR macros. All builds reentrant by default 2009-10-14 19:14:57 +01:00
Slava Pestov 0bf31e42e6 vm: refactoring card logic a bit 2009-10-09 11:16:18 -05:00
Slava Pestov 5c774d8c84 vm: more code cleanups 2009-10-07 08:33:54 -05:00
Slava Pestov 96df486753 vm: add assertions to tls_vm() 2009-10-02 09:37:04 -05:00
Phil Dawes ded33eda87 removed some superflous newlines 2009-10-01 07:33:16 +01:00
Phil Dawes 9b7412b8f8 Moved PRIMITIVE and PRIMITIVE_FORWARDs to primitives.[ch]pp 2009-09-27 19:42:18 +01:00
Slava Pestov f81c8549f4 Make segment, context, data_heap, zone more object-oriented, and fix crash when calling undefined symbols 2009-09-25 21:17:20 -05:00
Slava Pestov d017a53227 Merge branch 'vm_cleanup' of git://github.com/phildawes/factor 2009-09-25 19:04:19 -05:00
Slava Pestov 602776c885 vm: clean up os-unix.cpp 2009-09-25 18:08:00 -05:00
Phil Dawes 6b7717bf37 forwarding functions replaced with PRIMITIVE_FORWARD() macro 2009-09-25 20:43:01 +01:00
Phil Dawes 83b0769eef renamed factorvm to factor_vm 2009-09-24 08:16:52 +01:00
Phil Dawes e566656e46 removed a bunch of superflous blank lines 2009-09-24 08:02:14 +01:00
Phil Dawes e3ac531fdb renamed vmprim_ to primitive_ 2009-09-24 08:02:13 +01:00
Phil Dawes 2cf2dab48e fpe signals working on unix again 2009-09-16 08:22:18 +01:00
Phil Dawes b02944c6d5 moved signal handlers into vm object 2009-09-16 08:22:16 +01:00
Phil Dawes f4af39b60e thread_id is a pthread_t on unix 2009-09-16 08:20:51 +01:00
Phil Dawes 3345922330 quick test vocab for mt stuff 2009-09-16 08:20:50 +01:00
Phil Dawes fa6d8d239b removed vm singleton usage from unix stuff 2009-09-16 08:20:49 +01:00
Phil Dawes 3c139593c5 moved the thread stuff around a bit 2009-09-16 08:20:49 +01:00
Phil Dawes 1456fb3c97 removed vm ptrs from unix code (still in signal handlers tho) 2009-09-16 08:20:10 +01:00
Phil Dawes 784b8d16ae moved utility functions and fatal_error out of vm struct since doesn't need state 2009-09-16 08:20:10 +01:00
Phil Dawes 6ddd3c654e fixed up linux64 bootstrap (single threaded) 2009-09-16 08:20:09 +01:00
Phil Dawes 9cac5e8aa9 added lookup_vm and removed last usage of vm from windows code 2009-09-16 08:20:09 +01:00
Phil Dawes 20ef4200fb removed some error vm-> functions 2009-09-16 08:17:27 +01:00
Phil Dawes 700e03a6a6 removed some vm-> forwarding functions 2009-09-16 08:17:26 +01:00
Phil Dawes 2f3cd4d23d removed some vm-> pointers 2009-09-16 08:17:26 +01:00
Phil Dawes fa2dccd6d3 vm passed in box_alien and alien_offset (win32) 2009-09-16 08:16:33 +01:00
Joe Groff fb43ae2daf save the FP status out of the signal context and use it as part of the fp trap factor exception. clear the FP status before continuing after an exception 2009-09-13 23:39:12 -05:00
Joe Groff 7ba71a524e Send FP trap signals to Factor as a different vm-error type 2009-09-06 08:44:25 -05:00
Philipp Brüschweiler 230061783a misc small documentation fixes, some fixes for factor.vim, changed permissions of vm/* to 644 2009-08-10 21:33:07 +02:00
Slava Pestov 53db9d737a Change (void) to () 2009-05-05 11:33:35 -05:00
Slava Pestov 8872c40b1e The great type renaming 2009-05-04 04:50:24 -05:00
Slava Pestov edecac508e Use C++ namespaces 2009-05-04 01:46:13 -05:00
Slava Pestov 8e17e0a01e VM: use better abstractions for tagged pointers, eliminate get()/set() stuff, clean up array, string, and byte-array element access 2009-05-04 01:00:30 -05:00
Slava Pestov e3592ca8f6 Clean up untag_* and tag_* inline functions in favor of more idiomatic C++ 2009-05-02 20:47:29 -05:00
Slava Pestov b923d548cf Move vmpp to vm 2009-05-02 20:37:18 -05:00