plasma-umass / DoubleTake

Evidence-based dynamic analysis: a fast checker for memory errors.
MIT License
21 stars 12 forks source link

WIP: multithreading + global removal #35

Open bpowers opened 8 years ago

bpowers commented 8 years ago

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.