Commit Graph

22855 Commits (a09a278981da98e5a243a8e223bd05f4a6da608f)

Author SHA1 Message Date
Joe Groff 23208e5697 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 2d5360778f cleanups from code review 2011-10-27 21:18:23 -07:00
Joe Groff 9eee44ce4a vm: remove half-assed signal queueing scaffolding
Should implement it right later. See #297.
2011-10-27 21:18:22 -07:00
Joe Groff fb2d105e83 vm: remove some debugging crumbs 2011-10-27 21:18:22 -07:00
Joe Groff 27c43ea6a3 vm: add "gc" command to factorbug 2011-10-27 21:18:22 -07:00
Joe Groff 8e66c7abee vm: clean up windows ctrl-handler 2011-10-27 21:18:22 -07:00
Joe Groff c70a1004f8 cpu.x86.64: also must save ctx-reg 2011-10-27 21:18:21 -07:00
Joe Groff 331e4264b3 vm: some typos in debug.cpp 2011-10-27 21:18:21 -07:00
Joe Groff ca0dfc5730 vm: get CtrlHandler working on windows 2011-10-27 21:18:21 -07:00
Joe Groff 6d57eb4f59 vm: update windows for resumable signals 2011-10-27 21:18:21 -07:00
Joe Groff 9541bf14f5 vm: win32 GetCurrentThread is a fake thread handle
Open a real thread handle with the necessary permissions to dispatch a handler from the the Ctrl-C handler thread.
2011-10-27 21:18:21 -07:00
Joe Groff af0f021a94 vm: change factorbug "q" to quit process
Also change the docs around so the useful commands are all listed under "Basic commands", and rename the more arcane "s" and "r" dumps to "ds" and "dr".
2011-10-27 21:18:20 -07:00
Joe Groff 5d59faa7d1 vm: move dispatch_signal_handler to cpu-x86.cpp
The new signal handler dispatch is logic is CISC-centric; defer fixing it until we find someone who cares
2011-10-27 21:18:20 -07:00
Joe Groff a6b80f3efa vm: code_block_for_address method -> code_heap 2011-10-27 21:18:20 -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 11ffea55fc vm: sniff leaf words walking code heap, not data 2011-10-27 21:18:19 -07:00
Joe Groff 126bf22c16 vm: include quots and profile stubs in leaf search 2011-10-27 21:18:19 -07:00
Joe Groff ff2d480d98 cpu.x86.32: update for resumable signal handlers 2011-10-27 21:18:19 -07:00
Joe Groff d6eae2f42d vm: suppress signal-handler stack frame generation
This is a hack; see #295
2011-10-27 21:18:19 -07:00
Joe Groff 7bd7d0234d vm: turns out adding and subtracting are different 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 402e1155a5 vm: resumably handle signals from leaf procedures 2011-10-27 21:18:18 -07:00
Joe Groff 1386212d23 vm: dispatch signal handlers through subprimitive
We also need to save C ABI volatile registers before calling the signal handler in order to be able to reliably resume. Add signal-handler and leaf-signal-handler subprimitives to preserve volatile registers before invoking the signal handler C function.
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 68518e741e cpu.x86.(32,64).bootstrap: get rid of PUSH malarky
In the function prologue, move the stack pointer once after the stack frame is set up instead of PUSHing the stack frame piece by piece.
2011-10-27 21:14:50 -07:00
Joe Groff 1a673e30f5 vm: comments should be in English 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
Joe Groff a374c2da05 vm: sketchy signal dispatch from leaf procs 2011-10-27 21:14:49 -07:00
Joe Groff 6e4117035e vm: factor out dispatch_signal_handler logic 2011-10-27 21:14:49 -07:00
Joe Groff dc42365007 vm: fep on SIGINT or SIGQUIT instead of exception
It's not robust currently to raise an exception because a lot of our code that isn't already written with exceptions in mind breaks. Also, a signal is likely to be received by an FFI callback installed on the IO multiplexer, which will cause Factor to die since the callback cannot handle the exception. We need a more robust solution to dealing with SIGINT.

Also lay some groundwork for counting profile samples and reporting non-interrupting asynchronous signals.
2011-10-27 21:14:49 -07:00
Joe Groff 1dc31d133b vm: clean up signal handler dispatch
Remove the weird and broken functions fix_callstack_top and scrub_return_address. Instead, simply decrement the SP and store the PC from the front end of the signal handler so that the back end can return back into the original context normally. Currently aborts for leaf procedure frames pending a more robust solution.
2011-10-27 21:14:48 -07:00
Joe Groff 92a5b7c300 vm: don't mix iostream and stdio 2011-10-27 21:14:48 -07:00
Joe Groff c06be95816 compiler: no spurious safepoint at start of loops 2011-10-27 21:14:48 -07:00
Joe Groff 3726f61c70 vm: fatal_error if VM-less thread gets a signal 2011-10-27 21:14:48 -07:00
Joe Groff 41c36752fc compiler.cfg.tco: clean up commented-out old code 2011-10-27 21:14:47 -07:00
Joe Groff 7f3d70f97f vm: fix windows compile errors 2011-10-27 21:14:47 -07:00
Joe Groff d6a06cf5dc vm: remove unguard-safepoint primitive 2011-10-27 21:14:47 -07:00
Joe Groff 552711e903 vm: block all signals from unix stdin_loop thread 2011-10-27 21:14:47 -07:00
Joe Groff 9865417149 vm: SetConsoleCtrlHandler on windows 2011-10-27 21:14:47 -07:00
Joe Groff b3e5f75c9e vm: handle async signals at safepoints on unix
Factor now supports the new 4.0BSD feature of "signals".
2011-10-27 21:14:46 -07:00
Joe Groff 6f75e84d93 compiler.cfg.tco: teach TCO about safepoints 2011-10-27 21:14:46 -07:00
Joe Groff e449fef4e3 compiler.cfg.builder: safepoint loops and epilogs 2011-10-27 21:14:46 -07:00
Joe Groff 0c022f2454 compiler: add ##safepoint IR insn 2011-10-27 21:14:46 -07:00
Joe Groff ae1a903c4e cpu.x86.assembler: add MOVABS instruction
MOVABS generates the one-byte opcode version of MOV eAX, [absolute] or MOV [absolute], eAX, which saves a byte per safepoint on x86-32.
2011-10-27 21:14:45 -07:00
Joe Groff 9b575730bb vm: add RT_SAFEPOINT to number_of_parameters() 2011-10-27 21:14:45 -07:00
Joe Groff 4be5eadb34 cpu.x86.bootstrap: add safepoint to jit-epilog 2011-10-27 21:14:45 -07:00
Joe Groff 98fa51f0e0 compiler: rt-safepoint and rel-safepoint words 2011-10-27 21:14:45 -07:00
Joe Groff e1465308cd vm: add RT_SAFEPOINT relocation type 2011-10-27 21:14:44 -07:00
Joe Groff 99804d5e3f vm: code_heap::(un)guard_safepoint methods 2011-10-27 21:14:44 -07:00