[Lldb-commits] [PATCH] D40470: DWZ 03/07: Protect DWARFCompileUnit::m_die_array by a new mutex
Jan Kratochvil via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 30 14:31:51 PDT 2018
jankratochvil marked an inline comment as done.
jankratochvil added inline comments.
================
Comment at: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:335
m_die_array.swap(tmp_array);
- if (keep_compile_unit_die)
+ m_die_array_size_atomic = 0;
+ if (keep_compile_unit_die) {
----------------
clayborg wrote:
> You can't really play with the m_die_array_size_atomic without locking the mutex, which really means m_die_array_size_atomic is not very useful. Seems like there is still a race condition:
> - thread 1 calls this function and executes "m_die_array.swap(tmp_array);" but not " m_die_array_size_atomic = 0;"
> - thread 2 calls DWARFUnit::ExtractDIEsIfNeeded() and calls "already_parsed()" which returns true because m_die_array_size_atomic is still some valid value
> - thread 1 clears the DIE array and sets m_die_array_size_atomic to zero
> - thread 2 has no DIEs when it tries to use them
>
>
I see I did screw up even that, sorry for that. I believe there still could be an atomic_t speedup but given you are fine with the performance of a mutex I have implemented it that way.
https://reviews.llvm.org/D40470
More information about the lldb-commits
mailing list