Introduces a non-owning SymbolStringPool entry pointer. Instances of the new
type can be compared with SymbolStringPtr instances, but do not participate in
ref-counting and are therefore cheaper to copy. This makes it efficient to use
in algorithms that use symbol-strings as ids, e.g. ORC's waiting-on graph. A
future commit will rewrite ORC's waiting-on graph.
Details
- Reviewers
dblaikie - Commits
- rGeded5d381565: [ORC] Add a NonOwningSymbolStringPtr utility.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h | ||
---|---|---|
51–55 | Could this be private and friended to the test class, rather than only in +Asserts? (that way it'd be tested in non-Asserts, and not callable from code/accidentally used in +Asserts builds in the rest of the code) | |
90–91 | If these things are only sizeof(void*) then maybe pass by value, rather than const ref? |
llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h | ||
---|---|---|
51–55 | Ahh -- I was thinking of using this in assertions (and the tests), but wanted to discourage use outside that. To get the best of both worlds I could take your suggestion and make getRefCount private, then introduce a new method: #ifndef NDEBUG bool isPoolEntryValid() const { return getRefCount(); } #endif | |
90–91 | They could be pass by value. Is there likely to be any benefit on a trivially inline-able method like this? Or is it mostly a style issue? |
llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h | ||
---|---|---|
51–55 | Ah, fair enough - sounds good :) Hmm, could the debugging/testing use cases be covered by the private member anyway? | |
248 | Hmm, wouldn't this be non-NDEBUG conditional? (since it's declared unconditionally and called unconditionally from the test code now?) | |
llvm/unittests/ExecutionEngine/Orc/SymbolStringPoolTest.cpp | ||
25–31 | Do you need these locals anymore, now that you have an SP member? |
Sure, looks good
llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h | ||
---|---|---|
90–91 | general guideline - maybe makes -O0 builds slightly less bad | |
llvm/unittests/ExecutionEngine/Orc/SymbolStringPoolTest.cpp | ||
20–22 | Awkward to have to wrap the API like this - but I guess the inconvenience of having to touch the class definition for every test to do this http://google.github.io/googletest/reference/testing.html#FRIEND_TEST is annoying too. |
Could this be private and friended to the test class, rather than only in +Asserts? (that way it'd be tested in non-Asserts, and not callable from code/accidentally used in +Asserts builds in the rest of the code)