This is a PR for discussion. It allows us to run multithreaded
programs, and reduces the use of global singletons.
The goal of removing the globals is to allow us to unit test more of
the code, which is hard when there are lots of implicit + nested
dependencies on global state.
The basic idea is that global functions + flags (like the inRollback
and initialized flags now live under the doubletake:: namespace,
and the state for syscalls, memory, threads, watchpoints + leakcheck
are now all embedded into the xrun object. Global functions don't
invoke thread or memory methods directly on a singleton, they invoke
it on the xrun() singleton, which delegates to its private
thread/memory instance.
Comments and suggestions welcome - I know this is a hard one to
review, and is also not complete (watchpoint isn't yet converted, for
example) -- as removing getInstance() invocations requires a ton of
changes across the codebase.
This is a PR for discussion. It allows us to run multithreaded programs, and reduces the use of global singletons.
The goal of removing the globals is to allow us to unit test more of the code, which is hard when there are lots of implicit + nested dependencies on global state.
The basic idea is that global functions + flags (like the
inRollback
andinitialized
flags now live under thedoubletake::
namespace, and the state for syscalls, memory, threads, watchpoints + leakcheck are now all embedded into thexrun
object. Global functions don't invoke thread or memory methods directly on a singleton, they invoke it on the xrun() singleton, which delegates to its private thread/memory instance.Comments and suggestions welcome - I know this is a hard one to review, and is also not complete (watchpoint isn't yet converted, for example) -- as removing
getInstance()
invocations requires a ton of changes across the codebase.