vm: change where we set safepoints_fep to false to allow old Ctrl-C behavior.

char-rename
John Benediktsson 2016-11-01 19:21:47 -07:00
parent 72b43a57a1
commit 4fee8bd2cb
3 changed files with 7 additions and 4 deletions

View File

@ -35,7 +35,6 @@ void factor_vm::handle_safepoint(cell pc) {
faulting_p = false;
if (atomic::load(&safepoint_fep_p)) {
atomic::store(&safepoint_fep_p, false);
if (atomic::load(&sampling_profiler_p))
end_sampling_profiler();
std::cout << "Interrupted\n";
@ -43,10 +42,12 @@ void factor_vm::handle_safepoint(cell pc) {
/* Ctrl-Break throws an exception, interrupting the main thread, same
as the "t" command in the factorbug debugger. But for Ctrl-Break to
work we don't require the debugger to be activated, or even enabled. */
atomic::store(&safepoint_fep_p, false);
general_error(ERROR_INTERRUPT, false_object, false_object);
FACTOR_ASSERT(false);
}
factorbug();
atomic::store(&safepoint_fep_p, false);
} else if (atomic::load(&sampling_profiler_p)) {
FACTOR_ASSERT(code->seg->in_segment_p(pc));
code_block* block = code->code_block_for_address(pc);

View File

@ -10,7 +10,6 @@ factor_vm::factor_vm(THREADHANDLE thread)
#if defined(WINDOWS)
thread_id(GetCurrentThreadId()),
ctrl_break_thread(NULL),
stop_on_ctrl_break(false),
#endif
callback_id(0),
c_to_factor_func(NULL),
@ -30,7 +29,8 @@ factor_vm::factor_vm(THREADHANDLE thread)
full_output(false),
last_nano_count(0),
signal_callstack_seg(NULL),
safepoint_fep_p(false) {
safepoint_fep_p(false),
stop_on_ctrl_break(false) {
primitive_reset_dispatch_stats();
}

View File

@ -149,6 +149,9 @@ struct factor_vm {
// Two fep_p variants, one might be redundant.
volatile cell safepoint_fep_p;
// Allow Ctrl-Break a busy loop in the Listener, only used on Windows
volatile bool stop_on_ctrl_break;
// contexts
context* new_context();
void init_context(context* ctx);
@ -395,7 +398,6 @@ struct factor_vm {
void primitive_die();
void primitive_enable_ctrl_break();
void primitive_disable_ctrl_break();
volatile bool stop_on_ctrl_break;
// arrays
inline void set_array_nth(array* array, cell slot, cell value);