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
ab9088e7ba
vm: disable SIGINT handler while in factorbug
...
Fixes #410
2011-11-15 18:50:42 -08:00
Philipp Brüschweiler
4dd1f3297e
vm: close the console when exiting
...
This prevents an endless loop caused by the nvidia drivers on linux.
See http://www.nvnews.net/vbulletin/showthread.php?t=164619
2011-11-12 23:05:43 -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
7e7607306c
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.
2011-11-10 16:01:07 -08:00
Joe Groff
feb9221c5b
vm: fix build on windows
2011-11-08 23:17:51 -08:00
Joe Groff
fca09f21ed
vm: don't pass this to safepoint constructor
...
It's bad juju and MSVC calls us out on it.
2011-11-08 11:06:00 -08:00
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
0c132cf861
vm: write signals to pipe immediately
...
The whole point is to wake up the mx without waiting for the next safepoint derp
2011-11-08 08:42:47 -08:00
Joe Groff
06bb122b6e
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.
2011-11-08 08:42:47 -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
ac2fcd1ee0
vm: sample pc on windows
2011-11-02 21:18:31 -07:00
Joe Groff
8d2e4fbda2
vm: fix MSVC warnings
2011-11-02 20:26:53 -07:00
Joe Groff
7f1088ef4e
vm: fix scrub-league assert abuse
2011-11-02 13:23:21 -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
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
8218e82ccc
vm: more accurate sample timing on windows
2011-11-02 13:23:12 -07:00
Joe Groff
6d922c70a9
get sampler working under windows
2011-11-02 13:23:12 -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
a02816f075
vm: stub out windows sampling timer implementation
...
AFAIK Windows has no equivalent to setitimer. We'll probably need to use a thread that periodically pauses and samples the main VM thread.
2011-11-02 13:23:10 -07:00
Joe Groff
09088ec3ce
cleanups from code review
2011-10-27 21:18:23 -07:00
Joe Groff
bdf28ce3df
vm: remove some debugging crumbs
2011-10-27 21:18:22 -07:00
Joe Groff
5c8c63d7c3
vm: clean up windows ctrl-handler
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
011ce33068
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
ed72d57c1a
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
29dad5c168
vm: fix windows compile errors
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
e6f65d81e4
vm: code_heap::(un)guard_safepoint methods
2011-10-27 21:14:44 -07:00
Erik Charlebois
1ed2bc6231
32 and 64 bit Linux PPC support
2011-05-23 23:36:14 -04:00
Doug Coleman
43624e037c
Squashed commit of the following:
...
commit 197dbe9a6733775ac0ea19b3da4bd4dc3c85418c
Author: Doug Coleman <doug.coleman@gmail.com>
Date: Sat Sep 18 19:01:38 2010 -0500
Fix bootstrap, move privileges to windows.privileges
commit 521c622f8afb15bf42d263c738cb990560dc29cb
Author: Doug Coleman <doug.coleman@gmail.com>
Date: Sat Sep 18 18:26:30 2010 -0500
Hopefully fix bootstrap
commit eb3f22928b59758b9505430034044b5b94705da2
Author: Doug Coleman <doug.coleman@gmail.com>
Date: Sat Sep 18 18:19:05 2010 -0500
Remove wince from factor codebase
commit 619d6c99415f46208a7ede6a04b0ccda46b15360
Author: Doug Coleman <doug.coleman@gmail.com>
Date: Sat Sep 18 16:07:46 2010 -0500
Remove Windows CE from vm/
2010-09-19 19:13:25 -05:00
Slava Pestov
88102c3ed5
vm: hard tabs, indent width 8
2010-08-02 20:50:34 -04:00
Joe Groff
92fd0bd8e3
vm/os-windows.cpp: fix compiler warnings/errors
2010-08-01 17:50:35 -07:00
Joe Groff
56702b868c
vm: remove some mixed use of stdio/iostream. when monotonic timer decreases, log old and new values
2010-08-01 16:14:20 -07:00
Slava Pestov
0fa2277bc3
vm: use sigaltstack to handle callstack overflow properly
2010-03-28 11:37:28 -04:00
Slava Pestov
370718e9a4
vm: signal handling cleanup
2010-03-27 07:33:28 -04:00
Slava Pestov
e481d5e71c
vm: disable silly nano-count workaround on Win64, fix some indentation issues
2010-02-06 00:45:29 -06:00
Doug Coleman
eb468d89aa
fix typo in os-windows.cpp
2010-02-03 16:03:22 -06:00
Doug Coleman
f6002e6c78
Change the MOVE_FILE macro to a function named move_file
2010-02-03 15:12:13 -06:00
Slava Pestov
0c8dc1f00b
Use ParseCommandLineArgvw() on Windows again, instead of hand-rolled parser. Update Nmakefile to link in shell32.dll, where this function is defined
2010-01-18 06:12:04 -06:00
Slava Pestov
a3c7f1001d
vm: fix command line parsing on Windows
2010-01-17 00:05:52 -06:00
Slava Pestov
edb1346239
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
a942e2c34d
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
26a9852b8c
fix windows compile error
2009-11-20 04:21:21 -06:00
Doug Coleman
a896eef7b4
remove sleep_micros, add sleeo_nanos to vm
2009-11-19 04:49:29 -06:00
Doug Coleman
1861dd2705
initial commit to nanos branch to replace micros
2009-11-18 04:20:05 -06:00