mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-09-19 11:09:05 +01:00
89b230395f
Summary: tbv2: remove unnecessary copy in Element `IntrospectionResult::const_iterator` iterates through the `Element`s in an `IntrospectionResult`. `Element` currently copies the `type_path` which is a `std::vector<string_view>` every time the iterator is incremented. This is unnecessary as the data in the vector only changes slightly between iterations. This change changes the `type_path` field in `Element` to a `std::span<const std::string_view>`. Doing this previously caused SEGVs because of the iterator's potential to be copied. To make it possible we do two things: 1. Make all copies explicit using a clone interface as in `ContainerInfo`. This prevents accidental copies of an expensive structure. 2. After calling the copy constructor in `clone()` update the `span` in `next_` to point at the newly copied structure. Moves are fine because the `span` points at the allocation of the `vector`, not the vector itself. Test Plan: - CI - `FILTER='OilIntegration.*' make test` - Ran `OilgenIntegration.std_vector_vector_int_some` which SEGVd with the `span` change before and now doesn't. This now passes cleanly with ASAN enabled on the target, though isn't available in `main` (only works on my machine). Differential Revision: D53472595 Pulled By: JakeHillion |
||
---|---|---|
.. | ||
exporters | ||
support | ||
type_graph | ||
types/test | ||
CMakeLists.txt | ||
CodeGen.cpp | ||
CodeGen.h | ||
Config.cpp | ||
Config.h | ||
ContainerInfo.cpp | ||
ContainerInfo.h | ||
ContainerTypeEnum.h | ||
Descs.cpp | ||
Descs.h | ||
DrgnUtils.cpp | ||
DrgnUtils.h | ||
EnumBitset.h | ||
Features.cpp | ||
Features.h | ||
FuncGen.cpp | ||
FuncGen.h | ||
Headers.h | ||
IntrospectionResult.cpp | ||
Metrics.cpp | ||
Metrics.h | ||
OICache.cpp | ||
OICache.h | ||
OICodeGen.cpp | ||
OICodeGen.h | ||
OICompiler.cpp | ||
OICompiler.h | ||
OID.cpp | ||
OIDebugger.cpp | ||
OIDebugger.h | ||
OIGenerator.cpp | ||
OIGenerator.h | ||
OILexer.h | ||
OILexer.l | ||
OILibrary.cpp | ||
OILibraryImpl.cpp | ||
OILibraryImpl.h | ||
OIOpts.h | ||
OIParser.h | ||
OIParser.yy | ||
OITraceCode.cpp | ||
PaddingHunter.cpp | ||
PaddingHunter.h | ||
Portability.h | ||
Serialize.cpp | ||
Serialize.h | ||
SymbolService.cpp | ||
SymbolService.h | ||
Syscall.h | ||
TimeUtils.h | ||
TrapInfo.h | ||
TreeBuilder.cpp | ||
TreeBuilder.h | ||
TypeHierarchy.h | ||
X86InstDefs.h |