Commit Graph

108 Commits (master)

Author SHA1 Message Date
John Benediktsson 0d6096df0a vm: use FILE_READ_ATTRIBUTES to make exists? faster. 2020-02-25 11:05:17 -08:00
nomennescio c33a406066 Support for MinGW compiler. Need to instal MinGW compiler and runtime. 2019-12-10 08:53:32 -08:00
Doug Coleman 2a409c79e0 vm: Fix unused variable warnings on Windows. 2018-07-13 00:48:58 -05:00
Alexander Iljin 526a995d64 VM: implement a ctrl-break handler thread (#1573) 2016-11-01 16:53:00 -07:00
Björn Lindqvist a0df88f20b VM: renaming verify_memory_protection_error to set_memory_protection_error
and sets the signal_fault_addr and signal_fault_pc in the function.
2016-09-22 13:12:59 +02:00
Alexander Iljin 0d57734dab vm: replace block comments /**/ with line comments // 2016-09-09 05:47:52 +02:00
Alexander Iljin e0acf4f328 Revert "vm: replace line comments // with block comments /**/ for consintency"
This reverts commit 7ee4e5dea5.
2016-09-09 05:47:52 +02:00
Björn Lindqvist b5c6658ae5 VM: removing the safepoint_state class
The code reads better if the safepoint_state methods and
attributes (sample_counts and safepoint_fep_p) are moved to the vm
class.
2016-08-15 15:16:41 +02:00
Alexander Iljin 7ee4e5dea5 vm: replace line comments // with block comments /**/ for consintency
Fix #1651.
2016-08-03 09:19:48 -07:00
Alexander Iljin 56880fbacf vm: add a comment on possible issues with QueryPerformanceCounter 2016-07-30 09:25:30 -07:00
Björn Lindqvist f99c684cc5 VM: set_border_locked is the same on windows and unix 2016-06-27 16:27:56 +02:00
Alexander Iljin 7a94230899 VM: fix the sampler_thread handle leak 2016-06-22 11:27:26 -07:00
Alexander Iljin db9007a713 vm: give windows_stat fewer reasons to fail
More sharing flags mean that the file opening attempts will succeed even
if the file is already open by another process for writing or deleting.
2016-05-30 12:11:56 -07:00
Björn Lindqvist 575da3e478 VM: fix so that errno is set if MoveFileEx fails, should fix #1490 2015-10-12 12:19:21 +02:00
Björn Lindqvist 7dfb352a7e VM: replaced calls to out_of_memory() with fatal_error()
No need for a special out of memory function -- it's just a kind of
fatal  error. Also make fatal_error() call dump_memory_layout() for
easier debugging.
2015-10-08 20:46:17 +02:00
Doug Coleman 7eec8621aa vm: MoveFileEx returns BOOL which needs help converting to C++ bool. 2015-10-01 17:04:13 +00: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
Björn Lindqvist 5a39631b4b VM: refactoring, new function get_thread_pc() and simpler logic in exception_handler() 2015-08-26 20:23:20 +02:00
Björn Lindqvist 2a852915d2 VM: signal_fault_pc probably should be set here... 2015-08-26 20:23:17 +02:00
Björn Lindqvist 39c888230a VM: new function set_safepoint_guard to replace the functions (un)guard_safepoint 2015-08-24 07:23:40 -07:00
Björn Lindqvist 56ddb59b00 VM: new function set_memory_locked(true/false)
it wraps the mprotect/VirtualProtect platform differences and makes it
so you can unify some windows/unix code path forks
2015-08-24 07:23:40 -07:00
Björn Lindqvist 51daaf6be4 VM: the windows_image_path method is unused 2015-08-24 07:23:40 -07:00
Björn Lindqvist a53d5be683 VM: make allot_alien() and ffi_dlsym() use cell instead of void*
this way we get rid of a bunch of superfluous casts
2015-08-23 18:36:31 -07:00
Björn Lindqvist b8aef640f9 VM: new method set_border_locked() in segment, so that you can remove
the protection of the guard pages
2015-08-14 20:19:56 -07:00
Björn Lindqvist 73956db33a VM: a bunch of methods on factor_vm that can be converted into free
functions

I think that makes it easier to see whats going on than having
everything added to factor_vm
2015-08-04 16:02:09 +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 6244b925c7 vm: Simplify strerror code. 2014-07-05 18:58:24 -07:00
Doug Coleman ecbf48d1ef vm: Fix namespace brace. 2014-07-04 03:14:17 -07:00
Doug Coleman 69262be4d8 vm: Add threadsafe_sterror to the vm. 2014-07-04 03:00:08 -07:00
Doug Coleman c3210f9f4f Windows: Add two new targets, x86-32-vista and x86-64-vista for bjourne's
ctrl-c patch. We still support Windows XP by default for now. Closes
2014-05-10 18:13:20 -07:00
Björn Lindqvist 0226718a82 VM: attempt to cancel blocking system calls when ctrl-c is pressed
Windows runs ctrl-c in its own thread and doesn't by itself interrupt
blocking system calls when it is pressed. Therefore you have to manually
send an interrupt signal to the stuck thread.
2014-05-10 18:13:04 -07:00
Doug Coleman 268fa0225d os-windows: Remove FACTOR_DLL which is NULL and only used in one place. 2013-11-24 22:06:57 -06:00
Erik Charlebois ffe41b3d7f VM: Fixup cast formatting after clang-format
clang-format doesn't recognize casts to non-pointer/non-template types
so it winds up adding a space between the right paren and the expression
and then failing to recognize prefix operators in the process
(e.g. foo = (cell) & bar; should be foo = (cell)&bar;). This commit
manually fixes up the major cases (fixnum, cell, all types ending in _t).
2013-05-13 14:59:24 -04: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
Erik Charlebois ca2ea548be VM: Remove exec bit from VM source files 2013-05-11 17:04:23 -04:00
Joe Groff 0a1a252cdb 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 5e99a7bbbf vm: disable SIGINT handler while in factorbug
Fixes #410
2011-11-15 18:50:42 -08:00
Philipp Brüschweiler db19efe1b3 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 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 9e4a51c55f 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 c0094186a1 vm: fix build on windows 2011-11-08 23:17:51 -08:00
Joe Groff 90609cc5d8 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 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 04c6b2c393 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 18e01f7770 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 72d335f2b5 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 2d87b68a56 vm: sample pc on windows 2011-11-02 21:18:31 -07:00
Joe Groff 1833beea52 vm: fix MSVC warnings 2011-11-02 20:26:53 -07:00
Joe Groff e0c68d5a3f vm: fix scrub-league assert abuse 2011-11-02 13:23:21 -07:00