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)
|
||||
{
|
||||
if(code->safepoint_p(addr))
|
||||
safepoint.handle_safepoint();
|
||||
safepoint.handle_safepoint(this);
|
||||
else if(faulting_p)
|
||||
fatal_error("Double fault", 0);
|
||||
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();
|
||||
if (vm)
|
||||
{
|
||||
vm->safepoint.enqueue_fep();
|
||||
vm->safepoint.enqueue_fep(vm);
|
||||
enqueue_signal(vm, signal);
|
||||
}
|
||||
else
|
||||
|
@ -213,10 +213,10 @@ void sample_signal_handler(int signal, siginfo_t *siginfo, void *uap)
|
|||
{
|
||||
factor_vm *vm = current_vm_p();
|
||||
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) {
|
||||
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. */
|
||||
assert(thread_vms.size() == 1);
|
||||
factor_vm *vm = thread_vms.begin()->second;
|
||||
vm->safepoint.enqueue_fep();
|
||||
vm->safepoint.enqueue_fep(this);
|
||||
return TRUE;
|
||||
}
|
||||
default:
|
||||
|
@ -348,7 +348,7 @@ void factor_vm::sampler_thread_loop()
|
|||
suscount = ResumeThread(thread);
|
||||
assert(suscount == 1);
|
||||
|
||||
safepoint.enqueue_samples(samples, context.EIP, false);
|
||||
safepoint.enqueue_samples(this, samples, context.EIP, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,20 +3,20 @@
|
|||
namespace factor
|
||||
{
|
||||
|
||||
void safepoint_state::enqueue_safepoint() volatile
|
||||
void safepoint_state::enqueue_safepoint(factor_vm *parent) volatile
|
||||
{
|
||||
parent->code->guard_safepoint();
|
||||
}
|
||||
|
||||
void safepoint_state::enqueue_fep() volatile
|
||||
void safepoint_state::enqueue_fep(factor_vm *parent) volatile
|
||||
{
|
||||
if (parent->fep_p)
|
||||
fatal_error("Low-level debugger interrupted", 0);
|
||||
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))
|
||||
{
|
||||
|
@ -31,11 +31,11 @@ void safepoint_state::enqueue_samples(cell samples, cell pc, bool foreign_thread
|
|||
if (!parent->code->seg->in_segment_p(pc))
|
||||
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();
|
||||
|
||||
|
|
|
@ -3,23 +3,20 @@ namespace factor
|
|||
|
||||
struct safepoint_state
|
||||
{
|
||||
factor_vm *parent;
|
||||
|
||||
cell fep_p;
|
||||
profiling_sample_count sample_counts;
|
||||
|
||||
safepoint_state(factor_vm *parent) :
|
||||
parent(parent),
|
||||
safepoint_state() :
|
||||
fep_p(false),
|
||||
sample_counts()
|
||||
{
|
||||
}
|
||||
|
||||
void handle_safepoint() volatile;
|
||||
void handle_safepoint(factor_vm *parent) volatile;
|
||||
|
||||
void enqueue_safepoint() volatile;
|
||||
void enqueue_samples(cell samples, cell pc, bool foreign_thread_p) volatile;
|
||||
void enqueue_fep() volatile;
|
||||
void enqueue_safepoint(factor_vm *parent) volatile;
|
||||
void enqueue_samples(factor_vm *parent, cell samples, cell pc, bool foreign_thread_p) volatile;
|
||||
void enqueue_fep(factor_vm *parent) volatile;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue