Commit Graph

109 Commits (8675cb2c25429831470efef67a60989ee1785b32)

Author SHA1 Message Date
Björn Lindqvist d73666b9d0 VM: the unimplemented error isn't used anymore
Cause all the primitives are implemented so it can never ever be
thrown. Probably requires new boot images.
2016-11-23 10:24:52 +01: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
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
Björn Lindqvist 801c70e9da VM: removes the signal_handler_impl methods from factor_vm
Instead the code is in the functions with the same name. That way, they
don't need to exist both as functions and methods.
2016-06-29 18:27:26 +02:00
Björn Lindqvist 4f33f22b56 VM: on errors, only dump the heap if it has been initialized 2016-03-23 01:56:40 +01:00
Björn Lindqvist 579875821b VM: removes the OBJ-ERROR special object in favor of a constant
The special object contained the string "kernel-error" which were used
to tag VM errors. But it is simplier and removes a little complexity to
just tag them with a fixnum constant.
2016-03-22 17:52:19 +01: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
Björn Lindqvist cb55fcf20f VM: prettier and more detailed output when dumping generations 2015-10-08 16:25:35 +02:00
Björn Lindqvist cb0bf3b1ce VM: merge memory_protection_error() with memory_signal_handler_impl() 2015-08-24 07:23:40 -07:00
Björn Lindqvist a7757eed41 VM: new method context::address_to_error 2015-08-04 16:02:10 +02:00
Björn Lindqvist 504be0c7cb VM: signal_error and fp_trap_error not needed, call general_error directly 2015-08-04 16:02:10 +02:00
Björn Lindqvist 434e4ef4b7 VM: fix the debug printing so that instead of always printing to std::cout, you supply the stream to print to 2015-01-28 14:58:21 +00:00
John Benediktsson 70778b89ae Revert "VM: always clear the data and retainstack in general_error because they might contain uninitialized values ()"
This reverts commit 378f208025.
2014-12-04 11:46:28 -08:00
Björn Lindqvist 378f208025 VM: always clear the data and retainstack in general_error because they might contain uninitialized values () 2014-12-04 10:26:23 -08:00
Doug Coleman c675694619 vm: Annotate more places where we can gc.
Code formatting fix.
2014-11-29 19:25:46 -06: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 .
2014-11-11 06:26:55 +00:00
Björn Lindqvist 48bf3a9ab4 VM: moves the code that clears the roots to the same function that
corrupts the stack
2014-07-23 07:12:28 -07:00
Björn Lindqvist 810031b02c VM: data_roots must be empty before unwind_native_frames is called because it doesn't return 2014-07-16 14:54:35 -07:00
Björn Lindqvist 655dcee2d8 VM: clear the local roots before garbage collection in general_error()
If we got here from memory_protection_error(), then the stack pointer
has been fiddled with and the elements of these vectors, which address
stack-allocated objects, are bogus and needs to be resetted.
2014-07-16 14:54:29 -07:00
Erik Charlebois e9c0476f15 VM: Refactor errors to Factor style 2013-05-12 13:24:43 -04:00
Erik Charlebois ca2ea548be VM: Remove exec bit from VM source files 2013-05-11 17:04:23 -04:00
Doug Coleman aad70160f0 vm: Add more comments about functions that allocate. 2012-08-15 22:00:08 -07:00
Doug Coleman 000efd9bbb vm: Add messages about things that can allocate. Fix a gc bug in the primitive for quotation-code. 2012-08-15 21:30:55 -07:00
Doug Coleman 66de3a85dd errors.cpp: Previous fix was correct, except we shouldn't clear the data_roots before gc'ing. Laugh out loud. Fixes . 2012-08-15 19:49:04 -07:00
Doug Coleman 7e39d7ef30 errors.cpp: Patch looked like it would work. It either exposes more gc bugs or is incorrect.
Revert "errors.cpp: general_error() throws away its args when it calls compact_gc() when compiled with DEBUG=1. Save the args as data_roots instead. Fixes . See #620."

This reverts commit dc46297050.
2012-08-15 17:25:14 -07:00
Doug Coleman beb202b3de errors.cpp: general_error() throws away its args when it calls compact_gc() when compiled with DEBUG=1. Save the args as data_roots instead. Fixes . See . 2012-08-15 16:36:36 -07:00
Joe Groff b6f323450f vm: load mega cache object before popping frame
Fixes  harder
2011-12-20 14:38:01 -08:00
Joe Groff 6c0ecf631a vm: charge samples collected in prolog to parent
Fixes 
2011-11-23 11:11:26 -08:00
Joe Groff 3fc82282f7 vm: close_console before exiting anywhere
Add a factor_vm::exit function that does close_console() before ::exit-ing
2011-11-12 23:05:44 -08:00
Joe Groff e0dc236725 cpu.*.bootstrap: clear faulting flag directly
No reason to go through a safepoint in unwind-native-frames really.
2011-11-12 13:02:57 -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 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 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 4d39e59054 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 4037c981eb vm: die if we fault in a fault 2011-11-02 13:23:16 -07:00
Joe Groff 799053661e vm: better organize atomics and sample counter 2011-11-02 13:23:15 -07:00
Joe Groff 27ac4c60f4 vm: factor out sample counting code 2011-11-02 13:23:13 -07:00
Joe Groff 1351e30e52 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 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 27d7e4af53 vm: actually collect samples and add primitives... 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 6d57eb4f59 vm: update windows for resumable signals 2011-10-27 21:18:21 -07:00
Joe Groff 03ebb91170 vm: remove signal_from_leaf flag
Now that the resuming from the signal handler works within leaf procedures, the flag is no longer necessary.
2011-10-27 21:18:20 -07:00
Joe Groff 126bf22c16 vm: include quots and profile stubs in leaf search 2011-10-27 21:18:19 -07:00
Joe Groff f284ac2b48 vm: fix foreign segfaults and callstack overflows 2011-10-27 21:18:18 -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 b0b0905460 vm: add factorbug command to throw exception
Also rename "q" to "c" because it "c"ontinues, remove the useless "im" command, and rename the less useful "t" to "trim" so we can use "t" to mean "throw"
2011-10-27 21:14:49 -07:00