John Benediktsson
629677b772
vm: adding bignum_gcd primitive.
2012-04-05 09:17:35 -07:00
Joe Groff
cd9b3f26ee
vm: load mega cache object before popping frame
...
Fixes #457 harder
2011-12-20 14:38:01 -08:00
Joe Groff
530db5fa95
vm: get rid of now-trivial innermost_stack_frame
2011-12-14 09:56:49 -08:00
Joe Groff
e56f2b5753
vm: replace remaining stack_frame-based logic
2011-12-14 09:56:49 -08:00
Joe Groff
9df2c107dc
vm: remove _reversed from callstack iterator names
...
Now that they're the only game in town we can give them the short names
2011-12-14 09:56:49 -08:00
Joe Groff
e5f591c772
vm: remove iterate_callstack_object
2011-12-14 09:56:48 -08:00
Joe Groff
1ef3454e1a
vm: callstack_reversed for callstack_to_array
2011-12-14 09:56:48 -08:00
Joe Groff
099559c191
remove iterate_callstack now that it's unused
2011-12-14 09:56:48 -08:00
Joe Groff
faa9b4ea3f
vm: callstack_reversed in code_block_visitor
2011-12-14 09:56:48 -08:00
Joe Groff
00967b4931
vm: iterate_callstack_reversed in slot_visitor
2011-12-14 09:56:47 -08:00
Joe Groff
41f3190349
vm: reversed callstack iteration
2011-12-14 09:56:47 -08:00
Joe Groff
5926257d1e
WIP verify_callstack function
...
dumps callstack in reverse order so i can visually inspect that it matches the old forward walking logic
2011-12-14 09:56:47 -08:00
Joe Groff
9186a1bdf3
vm: store stack frame size in code blocks
...
Change modify-code-heap primitive so it takes a sixth element in each array for the frame size.
2011-12-14 09:56:45 -08:00
Joe Groff
04d030ec25
vm: factor out embedded image detection code
2011-11-27 14:39:21 -08:00
Joe Groff
8b75193a57
vm: support self-executing image file
2011-11-27 12:37:54 -08:00
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
ab9088e7ba
vm: disable SIGINT handler while in factorbug
...
Fixes #410
2011-11-15 18:50:42 -08:00
Joe Groff
05da199174
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
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
4984bde393
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
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
c5d7ce0282
vm: "edges" command for factorbug
2011-11-11 10:12:36 -08:00
Joe Groff
5b43301eb6
vm: strip out call-counting profiler
...
This makes the separate "code" and "entry_point" fields in word and quotation redundant, so also remove them to reclaim an additional cell per word and quotation object, which should help with #318 .
2011-11-10 16:01:07 -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
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
04a3c88227
vm: readable feps for more types
2011-11-06 20:26:52 -08:00
Joe Groff
ac2fcd1ee0
vm: sample pc on windows
2011-11-02 21:18:31 -07:00
Joe Groff
6b2a34fdc6
vm: count samples during unoptimized compiler
2011-11-02 13:23:21 -07:00
Joe Groff
4f87ab1df7
vm: separate 'current_gc_p' from 'current_gc'
...
The 'current_gc' handle doesn't need to be volatile, just the state of GC-ness
2011-11-02 13:23:19 -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
2a64c3ed69
vm: sample code block owners instead of blocks
2011-11-02 13:23:17 -07:00
Joe Groff
bb2df7da6b
vm: die if we fault in a fault
2011-11-02 13:23:16 -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
52bcbe55cf
vm: factor out sample counting code
2011-11-02 13:23:13 -07:00
Joe Groff
b89335df71
vm: only show factorbug help the first time
2011-11-02 13:23:13 -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
1c68bbf8a6
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
1ab4871fcc
vm: add primitives to lift sample data to factor
2011-11-02 13:23:09 -07:00
Joe Groff
cb2e87ecde
vm: release memory used by sampler vectors
2011-11-02 13:23:08 -07:00
Joe Groff
1604c503ab
vm: don't allocate callstack samples on data heap
...
Invoking a GC during a safepoint has some complications, so stuff the callstack samples in a vector instead.
2011-11-02 13:23:07 -07:00
Joe Groff
2ddfdda7b5
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
12a4c7a538
vm: change "profiler" names to "counting_profiler"
2011-11-02 13:23:05 -07:00
Joe Groff
83569d3793
vm: give factorbug a help command
...
Also change the prompt to "> _" instead of "READY\n_" since it's not 1970 anymore
2011-10-27 21:18:23 -07:00
Joe Groff
09088ec3ce
cleanups from code review
2011-10-27 21:18:23 -07:00
Joe Groff
b1094e0e5f
vm: remove half-assed signal queueing scaffolding
...
Should implement it right later. See #297 .
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