Commit Graph

33 Commits (3db0db801ecad68fc127fc8ec3e77ae7d9dc4fa1)

Author SHA1 Message Date
Joe Groff 00f00663ad vm: replace assert with FACTOR_ASSERT
Factor is finally a real C++ project and has a custom assert macro. Assertion failures were still getting caught as exceptions and causing failure loops. Write our own macro that calls factor::abort on failure.
2011-11-23 11:11:26 -08:00
Joe Groff ba88cbbe51 vm: charge samples collected in prolog to parent
Fixes #379
2011-11-23 11:11:26 -08:00
Joe Groff beb0f48da9 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().
2011-11-12 13:02:57 -08: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 f759575ddd vm: factor out dispatch_signal_handler logic 2011-10-27 21:14:49 -07:00
Joe Groff 01b782e6c4 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 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
Slava Pestov 55ac874eb2 vm: Remove signal_callstack_top nonsense 2010-09-02 22:57:17 -05:00
Slava Pestov 6617eca683 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
Slava Pestov 370718e9a4 vm: signal handling cleanup 2010-03-27 07:33:28 -04:00
Slava Pestov 960e911c31 vm: another fix 2010-03-23 04:17:39 -04:00
Slava Pestov cd4bd1bd96 vm/mach_signal.c: work around Mac OS X 10.6 API change (or bug?) 2010-03-23 04:04:08 -04:00
Slava Pestov b78202e816 Merge branch 'master' into new_gc 2009-10-22 05:40:57 -05:00
Slava Pestov 5a63edf278 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 5e12356a22 vm: new mark_bits data structure replaces hashtable when compacting code heap 2009-10-19 02:21:11 -05:00
Joe Groff 8edde0ffeb keep a map of thread ids to vm pointers. use this to look up the correct VM to handle mach exceptions on os x 2009-10-02 12:03:05 -05:00
Slava Pestov 0497ade10b vm: add assertions to tls_vm() 2009-10-02 09:37:04 -05:00
Phil Dawes 1c5329cc2e renamed factorvm to factor_vm 2009-09-24 08:16:52 +01:00
Phil Dawes 2cfb1b6f02 removed a bunch of superflous blank lines 2009-09-24 08:02:14 +01:00
Phil Dawes 8662e9e9e4 put mach call_fault_handler in the vm 2009-09-16 08:22:18 +01:00
Phil Dawes f955e36a56 removed vm ptr from mach_signal and some other places 2009-09-16 08:20:51 +01:00
Phil Dawes f60b1e1dd0 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 939426dcf5 fixed up linux64 bootstrap (single threaded) 2009-09-16 08:20:09 +01:00
Phil Dawes 41345583a5 added lookup_vm and removed last usage of vm from windows code 2009-09-16 08:20:09 +01:00
Phil Dawes 38eb7a23f1 removed some error vm-> functions 2009-09-16 08:17:27 +01:00
Phil Dawes bbdcabae9c removed some vm-> forwarding functions 2009-09-16 08:17:26 +01:00
Joe Groff 0284a4b6f8 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
Slava Pestov 4c0bd2e77d vm: fix fp_trap_error() so that it can work properly in signal handlers 2009-09-12 18:15:16 -05:00
Joe Groff 0b6f017840 Send FP trap signals to Factor as a different vm-error type 2009-09-06 08:44:25 -05:00
Slava Pestov ec943c2299 Change (void) to () 2009-05-05 11:33:35 -05:00
Slava Pestov 7c0a59f7a9 The great type renaming 2009-05-04 04:50:24 -05:00
Slava Pestov 7f48eb2b2c Use C++ namespaces 2009-05-04 01:46:13 -05:00
Slava Pestov 938d1a4270 Move vmpp to vm 2009-05-02 20:37:18 -05:00