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.
char-rename
Björn Lindqvist 2016-06-29 02:31:52 +02:00
parent 880d43d638
commit 801c70e9da
2 changed files with 23 additions and 31 deletions

View File

@ -121,45 +121,40 @@ void factor_vm::divide_by_zero_error() {
void factor_vm::primitive_unimplemented() { not_implemented_error(); }
/* Allocates memory */
void factor_vm::memory_signal_handler_impl() {
if (code->safepoint_p(signal_fault_addr)) {
safepoint.handle_safepoint(this, signal_fault_pc);
void memory_signal_handler_impl() {
factor_vm* vm = current_vm();
if (vm->code->safepoint_p(vm->signal_fault_addr)) {
vm->safepoint.handle_safepoint(vm, vm->signal_fault_pc);
}
else {
vm_error_type type = ctx->address_to_error(signal_fault_addr);
cell number = from_unsigned_cell(signal_fault_addr);
general_error(type, number, false_object);
vm_error_type type = vm->ctx->address_to_error(vm->signal_fault_addr);
cell number = vm->from_unsigned_cell(vm->signal_fault_addr);
vm->general_error(type, number, false_object);
}
if (!signal_resumable) {
if (!vm->signal_resumable) {
/* In theory we should only get here if the callstack overflowed during a
safepoint */
general_error(ERROR_CALLSTACK_OVERFLOW, false_object, false_object);
vm->general_error(ERROR_CALLSTACK_OVERFLOW, false_object, false_object);
}
}
/* Allocates memory */
void memory_signal_handler_impl() {
current_vm()->memory_signal_handler_impl();
}
/* Allocates memory */
void factor_vm::synchronous_signal_handler_impl() {
general_error(ERROR_SIGNAL, from_unsigned_cell(signal_number), false_object);
}
/* Allocates memory */
void synchronous_signal_handler_impl() {
current_vm()->synchronous_signal_handler_impl();
}
/* Allocates memory (fp_trap_error())*/
void factor_vm::fp_signal_handler_impl() {
/* Clear pending exceptions to avoid getting stuck in a loop */
set_fpu_state(get_fpu_state());
general_error(ERROR_FP_TRAP, tag_fixnum(signal_fpu_status), false_object);
factor_vm* vm = current_vm();
vm->general_error(ERROR_SIGNAL,
vm->from_unsigned_cell(vm->signal_number),
false_object);
}
/* Allocates memory */
void fp_signal_handler_impl() { current_vm()->fp_signal_handler_impl(); }
void fp_signal_handler_impl() {
factor_vm* vm = current_vm();
/* Clear pending exceptions to avoid getting stuck in a loop */
vm->set_fpu_state(vm->get_fpu_state());
vm->general_error(ERROR_FP_TRAP,
tag_fixnum(vm->signal_fpu_status),
false_object);
}
}

View File

@ -202,9 +202,6 @@ struct factor_vm {
void verify_memory_protection_error(cell addr);
void divide_by_zero_error();
void primitive_unimplemented();
void memory_signal_handler_impl();
void synchronous_signal_handler_impl();
void fp_signal_handler_impl();
// bignum
int bignum_equal_p(bignum* x, bignum* y);