Commit Graph

43 Commits (elevate-erg)

Author SHA1 Message Date
Björn Lindqvist b20084317a VM: removing the annotations to please musl (#1836) 2017-06-26 17:43:14 +02:00
Björn Lindqvist 4cc5e90605 VM: SNPRINTF macro is not used 2016-05-02 15:01:49 +02:00
Björn Lindqvist 2536b6cd93 VM: fix move_file called from save_image
save_image() shouldn't throw exceptions because if the 'then_die'
argument is t it would leave factor in an inconsistent state. So
therefore move_file() should be fixed and raw_fclose() called instead of
safe_fclose().
2015-09-29 23:13:10 +02:00
Doug Coleman 53eac53626 vm: Fail with out_of_memory() if mprotect returns ENOMEM.
Add a message to out_of_memory(msg) calls so we know which call caused the OOM.
Fixes #664.
2014-11-11 06:26:55 +00:00
Doug Coleman fe548d9ed7 os-unix.hpp: Use the old strerror_r insetad of the newfangled one. 2014-07-16 17:08:02 -07:00
Doug Coleman 6244b925c7 vm: Simplify strerror code. 2014-07-05 18:58:24 -07:00
Doug Coleman 69262be4d8 vm: Add threadsafe_sterror to the vm. 2014-07-04 03:00:08 -07:00
Erik Charlebois 88d7c10d03 VM: Replace u8-64, s8-64, cell, fixnum with stdint.h equivalents 2013-05-13 00:28:25 -04:00
Erik Charlebois 37b15012e6 VM: Refactor os-* to Factor style 2013-05-12 13:24:46 -04:00
Joe Groff e24400679f 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 f9aa0419c4 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 799053661e vm: better organize atomics and sample counter 2011-11-02 13:23:15 -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
Joe Groff 14de58b73c 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
Doug Coleman e8d528ad93 Remove system_micros from vm, implement gmt hook on windows 2010-06-16 23:39:16 -05: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
Slava Pestov 9ffe0a69d1 vm: use sigaltstack to handle callstack overflow properly 2010-03-28 11:37: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
Doug Coleman bb2f455747 Save images to a temporary file first, then call MOVE_FILE to avoid writing incomplete and truncated images. 2010-01-22 12:59:20 -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 0fd3c78157 vm: remove some unused #defines 2010-01-07 21:33:19 +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
Doug Coleman 00efd780c9 Merge branch 'master' of git://factorcode.org/git/factor 2009-10-03 18:27:38 -05:00
Doug Coleman 11d55131de add ftell primitive 2009-10-03 18:20:35 -05:00
Slava Pestov c4ef640f4d Big VM cleanup
- Move forward declarations of 'struct factor_vm' to one place
- Rename template parameters from T and TYPE to descriptive names. New convention: CamelCase for template parameters
- Change some higher-order functions taking function pointers into templates, and define classes overriding operator(). There's a bit of new boilerplate here but its more consistent than the old mish-mash approaches
- Put GC state into a gc_state struct
- Use exceptions instead of longjmp for non-local control transfer in GC
- In code GC, instead of interleaving code block tracing with copying, add code blocks which need to be revisited to an std::set stored in the gc_state
2009-10-03 08:47:05 -05:00
Joe Groff 435cd02200 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
Phil Dawes 83b0769eef renamed factorvm to factor_vm 2009-09-24 08:16:52 +01:00
Phil Dawes f4af39b60e thread_id is a pthread_t on unix 2009-09-16 08:20:51 +01:00
Phil Dawes ca16daa4b2 cleaned up code a bit, added multithreaded mode flags 2009-09-16 08:20:50 +01:00
Phil Dawes 3c139593c5 moved the thread stuff around a bit 2009-09-16 08:20:49 +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 e98f168a11 print_native_string doesn't need singleton ptr 2009-09-16 08:17:27 +01:00
Phil Dawes 2f3cd4d23d removed some vm-> pointers 2009-09-16 08:17:26 +01: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 9ef162e2ef More VM cleanups 2009-05-13 01:08:16 -05: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 b923d548cf Move vmpp to vm 2009-05-02 20:37:18 -05:00