morganstanley / hobbes

A language and an embedded JIT compiler
http://hobbes.readthedocs.io/
Apache License 2.0
1.16k stars 105 forks source link

fix a race condition in StringMap[] for new element #432

Closed mo-xiaoming closed 2 years ago

mo-xiaoming commented 2 years ago

In createUniqueName, llvm::StringMap m is not thread safe if it gets written at the same time.

Since this function is only used in jitcc::module, then there is no reason to put it in hobbes.H