[PATCH] D70600: [Error] Add stack traces for llvm::Error invariant violations.

Lang Hames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 2 17:09:55 PST 2020


lhames added a comment.

In D70600#1801726 <https://reviews.llvm.org/D70600#1801726>, @sammccall wrote:

> FWIW working on a codebase that heavily uses both Error and threads, the side-table seems fairly a bit terrifying. Even if the thread safety issues are fixed, do we really want to pay for mutex lock/unlock to create errors, to save a pointer?
>
> thread_local might be an option, though as I understand llvm/Support may have to be portable to environments where that doesn't work well.


An atomic pointer would work too. This cost is only paid on failure values and these are already heap allocated, so I'm I wouldn't expect the overhead to be prohibitive either way. I like the idea that the side table can be entirely compiled out in release mode (if we decide to go that way) without changing the shape of any error types or leaving any dead fields.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70600/new/

https://reviews.llvm.org/D70600





More information about the llvm-commits mailing list