vppinfra: vector allocator rework 18/35718/50
authorDamjan Marion <damarion@cisco.com>
Fri, 18 Mar 2022 23:07:52 +0000 (00:07 +0100)
committerFlorin Coras <florin.coras@gmail.com>
Wed, 30 Mar 2022 18:27:13 +0000 (18:27 +0000)
commit299571aca34d36e637e43cfbba6275662d0d7795
treea48be21950d082afb7dd93562f76f0ba554e8919
parent9539647b895c456ca53892a9259e3127c6b92d35
vppinfra: vector allocator rework

- support of in-place growth of vectors (if there is available space next to
  existing alloc)
- drops the need for alloc_aligned_at_offset from memory allocator,
  which allows easier swap to different memory allocator and reduces
  malloc overhead
- rework of pool and vec macros to inline functions to improve debuggability
- fix alignment - in many cases macros were not using native alignment
  of the particular datatype. Explicitly setting alignment with XXX_aligned()
  versions of the macro is not needed anymore in > 99% of cases
- fix ASAN usage
- avoid use of vector of voids, this was root cause of several bugs
  found in vec_* and pool_* function where sizeof() was used on voids
  instead of real vector data type
- introduce minimal alignment which is currently 8 bytes, vectors will
  be always aligned at least to that value (underlay allocator actually always
  provide 16-byte aligned allocs)

Type: improvement
Change-Id: I20f4b081bb13bbf7bc0ace85cc4e301787f12fdf
Signed-off-by: Damjan Marion <damarion@cisco.com>
25 files changed:
src/plugins/unittest/counter_test.c
src/svm/svm.h
src/vlib/node.h
src/vlib/node_funcs.h
src/vpp/mem/mem.c
src/vppinfra/dlmalloc.c
src/vppinfra/dlmalloc.h
src/vppinfra/elf.h
src/vppinfra/hash.c
src/vppinfra/heap.c
src/vppinfra/heap.h
src/vppinfra/mem.h
src/vppinfra/mem_dlmalloc.c
src/vppinfra/pool.c
src/vppinfra/pool.h
src/vppinfra/ring.h
src/vppinfra/serialize.c
src/vppinfra/sparse_vec.h
src/vppinfra/string.h
src/vppinfra/test_heap.c
src/vppinfra/test_vec.c
src/vppinfra/types.h
src/vppinfra/vec.c
src/vppinfra/vec.h
src/vppinfra/vec_bootstrap.h