[compiler-rt] [scudo] Add static vector functionality. (PR #98986)
Christopher Ferris via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 17 01:05:15 PDT 2024
================
@@ -116,18 +118,19 @@ template <typename T> class VectorNoCtor {
uptr CapacityBytes = 0;
uptr Size = 0;
- T LocalData[256 / sizeof(T)] = {};
+ T LocalData[StaticCapacity] = {};
MemMapT ExternalBuffer;
};
-template <typename T> class Vector : public VectorNoCtor<T> {
+template <typename T, size_t StaticCapacity = 8>
----------------
cferris1000 wrote:
After thinking about this, I do think Chia-hung is right that we should use number of entries as the value to pass. Josh, sorry to keep having you make changes back and forth. I think it would be best to use number of entries everywhere though and ditch the Bytes version completely. However, I think we should remove the default and have everyone who use the vector be explicit about the sizes they use. This would require adding entry numbers where all vectors are used but I think that might be the best idea, rather than choosing some arbitrary default.
Also, instead of StaticCapacity as the name, maybe it would be better to use StaticNumEntries so it's clear what this value means.
https://github.com/llvm/llvm-project/pull/98986
More information about the llvm-commits
mailing list