[all-commits] [llvm/llvm-project] 831910: tsan: new MemoryAccess interface
Dmitry Vyukov via All-commits
all-commits at lists.llvm.org
Tue Aug 3 02:03:37 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 831910c5c4941b7c58d4d50d9e20808c8e2c1c0b
https://github.com/llvm/llvm-project/commit/831910c5c4941b7c58d4d50d9e20808c8e2c1c0b
Author: Dmitry Vyukov <dvyukov at google.com>
Date: 2021-08-03 (Tue, 03 Aug 2021)
Changed paths:
M compiler-rt/lib/tsan/go/tsan_go.cpp
M compiler-rt/lib/tsan/rtl/tsan_external.cpp
M compiler-rt/lib/tsan/rtl/tsan_fd.cpp
M compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
M compiler-rt/lib/tsan/rtl/tsan_interface.cpp
M compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp
M compiler-rt/lib/tsan/rtl/tsan_interface_inl.h
M compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
M compiler-rt/lib/tsan/rtl/tsan_rtl.h
M compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp
Log Message:
-----------
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
More information about the All-commits
mailing list