<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 15, 2015 at 10:48 PM, Sanjoy Das <span dir="ltr"><<a href="mailto:sanjoy@playingwithpointers.com" target="_blank">sanjoy@playingwithpointers.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi chandlerc, dexonsmith, rnk, zturner,<br>
<br>
This is a re-do of D7931 with the following changes:<br>
<br>
 * the `EpochTracker` class is now conditional on<br>
   `LLVM_ENABLE_FAIL_FAST_ITERATORS` and not `NDEBUG`.<br></blockquote><div><br>It'd be nice to have a more general conditional name so we can add other ABI-breaking debug checks under the same flag. (strawman: LLVM_ABI_BREAKING_DEBUG ?)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
 * **The most significant change**: `LLVM_ENABLE_FAIL_FAST_ITERATORS`<br>
   can be forced to be set or unset independent of `NDEBUG`.  By<br>
   default, cmake and autoconf set it (thus enabling fail-fast<br>
   iterators) for with-asserts builds and unset it for without-asserts<br>
   builds.<br></blockquote><div><br></div><div>*fingers crossed that this is sufficient for other users* (that they're willing to manually unset this value for their debug builds if they need ABI compatibility)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
With these changes, projects that require ABI compatibility between<br>
`defined(NDEBUG)` builds and `!defined(NDEBUG)` builds can get that by<br>
clamping `LLVM_ENABLE_FAIL_FAST_ITERATORS` to on or off.<br>
<br>
== Minor changes from D7931 ==<br>
<br>
 * `HandleBase::getEpochAddress` returns a `void *` to emphasise that<br>
   the result is for comparison, not derefernecing.<br>
<br>
 * `HandleBase::getEpochAddress` was missing in the fail-fast-disabled<br>
   version of `HandleBase`.  This was not a problem earlier since the<br>
   function is only called from `assert`s and when `assert`s were<br>
   enabled, we'd always choose the fail-fast-enabled version of<br>
   `HandleBase`.  Since this is no longer the case (a with-asserts<br>
   build may be using the fail-fast-disabled version of `HandleBase`),<br>
   the missing method shows up as an obvious compiler error.<br>
<br>
Original summary for D7931:<br>
This patch is an attempt at making `DenseMapIterator`s "fail-fast".<br>
Fail-fast iterators that have been invalidated due to insertion into<br>
the host `DenseMap` deterministically trip an assert (in debug mode)<br>
on access, instead of non-deterministically hitting memory corruption<br>
issues.<br>
<br>
<a href="http://reviews.llvm.org/D8351" target="_blank">http://reviews.llvm.org/D8351</a><br>
<br>
Files:<br>
  CMakeLists.txt<br>
  <a href="http://Makefile.config.in" target="_blank">Makefile.config.in</a><br>
  Makefile.rules<br>
  autoconf/<a href="http://configure.ac" target="_blank">configure.ac</a><br>
  cmake/modules/HandleLLVMOptions.cmake<br>
  configure<br>
  docs/CMake.rst<br>
  include/llvm/ADT/DenseMap.h<br>
  include/llvm/ADT/EpochTracker.h<br>
<br>
EMAIL PREFERENCES<br>
  <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div>