vm: don't pass this to safepoint constructor
It's bad juju and MSVC calls us out on it.db4
parent
8b9c9a5c63
commit
90609cc5d8
|
@ -89,7 +89,7 @@ void factor_vm::not_implemented_error()
|
||||||
void factor_vm::memory_protection_error(cell addr)
|
void factor_vm::memory_protection_error(cell addr)
|
||||||
{
|
{
|
||||||
if(code->safepoint_p(addr))
|
if(code->safepoint_p(addr))
|
||||||
safepoint.handle_safepoint();
|
safepoint.handle_safepoint(this);
|
||||||
else if(faulting_p)
|
else if(faulting_p)
|
||||||
fatal_error("Double fault", 0);
|
fatal_error("Double fault", 0);
|
||||||
else if(ctx->datastack_seg->underflow_p(addr))
|
else if(ctx->datastack_seg->underflow_p(addr))
|
||||||
|
|
|
@ -202,7 +202,7 @@ void fep_signal_handler(int signal, siginfo_t *siginfo, void *uap)
|
||||||
factor_vm *vm = current_vm_p();
|
factor_vm *vm = current_vm_p();
|
||||||
if (vm)
|
if (vm)
|
||||||
{
|
{
|
||||||
vm->safepoint.enqueue_fep();
|
vm->safepoint.enqueue_fep(vm);
|
||||||
enqueue_signal(vm, signal);
|
enqueue_signal(vm, signal);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -213,10 +213,10 @@ void sample_signal_handler(int signal, siginfo_t *siginfo, void *uap)
|
||||||
{
|
{
|
||||||
factor_vm *vm = current_vm_p();
|
factor_vm *vm = current_vm_p();
|
||||||
if (vm)
|
if (vm)
|
||||||
vm->safepoint.enqueue_samples(1, (cell)UAP_PROGRAM_COUNTER(uap), false);
|
vm->safepoint.enqueue_samples(vm, 1, (cell)UAP_PROGRAM_COUNTER(uap), false);
|
||||||
else if (thread_vms.size() == 1) {
|
else if (thread_vms.size() == 1) {
|
||||||
factor_vm *the_only_vm = thread_vms.begin()->second;
|
factor_vm *the_only_vm = thread_vms.begin()->second;
|
||||||
the_only_vm->safepoint.enqueue_samples(1, (cell)UAP_PROGRAM_COUNTER(uap), true);
|
the_only_vm->safepoint.enqueue_samples(vm, 1, (cell)UAP_PROGRAM_COUNTER(uap), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -288,7 +288,7 @@ static BOOL WINAPI ctrl_handler(DWORD dwCtrlType)
|
||||||
threads. */
|
threads. */
|
||||||
assert(thread_vms.size() == 1);
|
assert(thread_vms.size() == 1);
|
||||||
factor_vm *vm = thread_vms.begin()->second;
|
factor_vm *vm = thread_vms.begin()->second;
|
||||||
vm->safepoint.enqueue_fep();
|
vm->safepoint.enqueue_fep(this);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -348,7 +348,7 @@ void factor_vm::sampler_thread_loop()
|
||||||
suscount = ResumeThread(thread);
|
suscount = ResumeThread(thread);
|
||||||
assert(suscount == 1);
|
assert(suscount == 1);
|
||||||
|
|
||||||
safepoint.enqueue_samples(samples, context.EIP, false);
|
safepoint.enqueue_samples(this, samples, context.EIP, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,20 +3,20 @@
|
||||||
namespace factor
|
namespace factor
|
||||||
{
|
{
|
||||||
|
|
||||||
void safepoint_state::enqueue_safepoint() volatile
|
void safepoint_state::enqueue_safepoint(factor_vm *parent) volatile
|
||||||
{
|
{
|
||||||
parent->code->guard_safepoint();
|
parent->code->guard_safepoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void safepoint_state::enqueue_fep() volatile
|
void safepoint_state::enqueue_fep(factor_vm *parent) volatile
|
||||||
{
|
{
|
||||||
if (parent->fep_p)
|
if (parent->fep_p)
|
||||||
fatal_error("Low-level debugger interrupted", 0);
|
fatal_error("Low-level debugger interrupted", 0);
|
||||||
atomic::store(&fep_p, true);
|
atomic::store(&fep_p, true);
|
||||||
enqueue_safepoint();
|
enqueue_safepoint(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void safepoint_state::enqueue_samples(cell samples, cell pc, bool foreign_thread_p) volatile
|
void safepoint_state::enqueue_samples(factor_vm *parent, cell samples, cell pc, bool foreign_thread_p) volatile
|
||||||
{
|
{
|
||||||
if (atomic::load(&parent->sampling_profiler_p))
|
if (atomic::load(&parent->sampling_profiler_p))
|
||||||
{
|
{
|
||||||
|
@ -31,11 +31,11 @@ void safepoint_state::enqueue_samples(cell samples, cell pc, bool foreign_thread
|
||||||
if (!parent->code->seg->in_segment_p(pc))
|
if (!parent->code->seg->in_segment_p(pc))
|
||||||
atomic::fetch_add(&sample_counts.foreign_sample_count, samples);
|
atomic::fetch_add(&sample_counts.foreign_sample_count, samples);
|
||||||
}
|
}
|
||||||
enqueue_safepoint();
|
enqueue_safepoint(parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void safepoint_state::handle_safepoint() volatile
|
void safepoint_state::handle_safepoint(factor_vm *parent) volatile
|
||||||
{
|
{
|
||||||
parent->code->unguard_safepoint();
|
parent->code->unguard_safepoint();
|
||||||
|
|
||||||
|
|
|
@ -3,23 +3,20 @@ namespace factor
|
||||||
|
|
||||||
struct safepoint_state
|
struct safepoint_state
|
||||||
{
|
{
|
||||||
factor_vm *parent;
|
|
||||||
|
|
||||||
cell fep_p;
|
cell fep_p;
|
||||||
profiling_sample_count sample_counts;
|
profiling_sample_count sample_counts;
|
||||||
|
|
||||||
safepoint_state(factor_vm *parent) :
|
safepoint_state() :
|
||||||
parent(parent),
|
|
||||||
fep_p(false),
|
fep_p(false),
|
||||||
sample_counts()
|
sample_counts()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_safepoint() volatile;
|
void handle_safepoint(factor_vm *parent) volatile;
|
||||||
|
|
||||||
void enqueue_safepoint() volatile;
|
void enqueue_safepoint(factor_vm *parent) volatile;
|
||||||
void enqueue_samples(cell samples, cell pc, bool foreign_thread_p) volatile;
|
void enqueue_samples(factor_vm *parent, cell samples, cell pc, bool foreign_thread_p) volatile;
|
||||||
void enqueue_fep() volatile;
|
void enqueue_fep(factor_vm *parent) volatile;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ factor_vm::factor_vm(THREADHANDLE thread) :
|
||||||
last_nano_count(0),
|
last_nano_count(0),
|
||||||
signal_callstack_seg(NULL),
|
signal_callstack_seg(NULL),
|
||||||
faulting_p(false),
|
faulting_p(false),
|
||||||
safepoint(this)
|
safepoint()
|
||||||
{
|
{
|
||||||
primitive_reset_dispatch_stats();
|
primitive_reset_dispatch_stats();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue