tsan: new MemoryAccess interface
Currently we have MemoryAccess function that accepts "bool kAccessIsWrite, bool kIsAtomic" and 4 wrappers: MemoryRead/MemoryWrite/MemoryReadAtomic/MemoryWriteAtomic. Such scheme with bool flags is not particularly scalable/extendable. Because of that we did not have Read/Write wrappers for UnalignedMemoryAccess, and "true, false" or "false, true" at call sites is not very readable. Moreover, the new tsan runtime will introduce more flags (e.g. move "freed" and "vptr access" to memory acccess flags). We can't have 16 wrappers and each flag also takes whole 64-bit register for non-inlined calls. Introduce AccessType enum that contains bit mask of read/write, atomic/non-atomic, and later free/non-free, vptr/non-vptr. Such scheme is more scalable, more readble, more efficient (don't consume multiple registers for these flags during calls) and allows to cover unaligned and range variations of memory access functions as well. Also switch from size log to just size. The new tsan runtime won't have the limitation of supporting only 1/2/4/8 access sizes, so we don't need the logarithms. Also add an inline thunk that converts the new interface to the old one. For inlined calls it should not add any overhead because all flags/size can be computed as compile time. Reviewed By: vitalybuka, melver Differential Revision: https://reviews.llvm.org/D107276
Loading
Please sign in to comment