Make global mutable state thread safe

Addresses issues of thread safety within the compiler.