Use intrinsics in base/numerics |
|||
Issue descriptionClang has a nice set of intrinsics for efficiently detecting overflow in math operations (e.g. __builtin_add_overflow). Implementing this may require reconsidering how the state is currently handled, because the intrinsics don't expose the direction of overflow. However, the CheckedNumeric public API doesn't expose that information either, so there's a lot of latitude in changing our implementation.
,
Nov 4 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/428cf9473ad24fc6e026ebe8fe12f0181c9c35d4 commit 428cf9473ad24fc6e026ebe8fe12f0181c9c35d4 Author: jschuh <jschuh@chromium.org> Date: Fri Nov 04 21:16:21 2016 Remove usage time.cc of CheckedNumeric::validity() Fix the API abuse while preserving existing dubious behavior. BUG=613003 TBR=brettw@chromium.org Review-Url: https://codereview.chromium.org/2472983003 Cr-Commit-Position: refs/heads/master@{#430018} [modify] https://crrev.com/428cf9473ad24fc6e026ebe8fe12f0181c9c35d4/base/time/time.cc [modify] https://crrev.com/428cf9473ad24fc6e026ebe8fe12f0181c9c35d4/base/time/time.h
,
Nov 5 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/12d6cf3734f7f1cd64cf52812644a6a49b4da1fe commit 12d6cf3734f7f1cd64cf52812644a6a49b4da1fe Author: jschuh <jschuh@chromium.org> Date: Sat Nov 05 04:23:16 2016 Simplify Checked arithmetic functions in base/numerics Starting the process of restructuring to match the GCC and Clang intrinsics. This step is mostly just replacing RangeConstraint with bool. BUG=613003 Review-Url: https://codereview.chromium.org/2472933003 Cr-Commit-Position: refs/heads/master@{#430150} [modify] https://crrev.com/12d6cf3734f7f1cd64cf52812644a6a49b4da1fe/base/numerics/safe_math.h [modify] https://crrev.com/12d6cf3734f7f1cd64cf52812644a6a49b4da1fe/base/numerics/safe_math_impl.h
,
Nov 8 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/216b62a9bb39c9b6e5936d90b8085c300843bd9c commit 216b62a9bb39c9b6e5936d90b8085c300843bd9c Author: jschuh <jschuh@chromium.org> Date: Tue Nov 08 03:53:08 2016 Make Checked* functions better align with GCC/Clang intrinsics This switches around the return types and out params. BUG=613003 Review-Url: https://codereview.chromium.org/2480953002 Cr-Commit-Position: refs/heads/master@{#430511} [modify] https://crrev.com/216b62a9bb39c9b6e5936d90b8085c300843bd9c/base/numerics/safe_math.h [modify] https://crrev.com/216b62a9bb39c9b6e5936d90b8085c300843bd9c/base/numerics/safe_math_impl.h [modify] https://crrev.com/216b62a9bb39c9b6e5936d90b8085c300843bd9c/base/numerics/safe_numerics_unittest.cc
,
Nov 15 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/657a3d6a6cfeaf22ce948ad22f98ab19f7f54a80 commit 657a3d6a6cfeaf22ce948ad22f98ab19f7f54a80 Author: jschuh <jschuh@chromium.org> Date: Tue Nov 15 18:23:45 2016 Simplify CheckedNumeric macros BUG=613003 Review-Url: https://codereview.chromium.org/2496143003 Cr-Commit-Position: refs/heads/master@{#432217} [modify] https://crrev.com/657a3d6a6cfeaf22ce948ad22f98ab19f7f54a80/base/numerics/safe_math.h [modify] https://crrev.com/657a3d6a6cfeaf22ce948ad22f98ab19f7f54a80/base/numerics/safe_math_impl.h [modify] https://crrev.com/657a3d6a6cfeaf22ce948ad22f98ab19f7f54a80/base/numerics/safe_numerics_unittest.cc
,
Nov 18 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/990079ab09e7785132dfdd3021c748c878c9a551 commit 990079ab09e7785132dfdd3021c748c878c9a551 Author: jschuh <jschuh@chromium.org> Date: Fri Nov 18 12:58:21 2016 Use GCC/Clang builtins for Checked(Add|Sub|Mul) BUG=613003 Review-Url: https://codereview.chromium.org/2509233003 Cr-Commit-Position: refs/heads/master@{#433184} [modify] https://crrev.com/990079ab09e7785132dfdd3021c748c878c9a551/base/numerics/safe_math_impl.h
,
Dec 10 2016
Still need to fix the runtime dependency to get this working on clang. They have a bug open for it here: https://llvm.org/bugs/show_bug.cgi?id=16404 In the interim, it looks like we can explicitly link against: libclang_rt.builtins-${ARCH}
,
Dec 11 2016
The other approach is explicitly passing this switch to clang: -rtlib=compiler-rt
,
Jan 3 2017
Comment #7 and #8 have the details I uncovered.
,
Jul 26 2017
|
|||
►
Sign in to add a comment |
|||
Comment 1 by bugdroid1@chromium.org
, May 21 2016