region: use aligned allocations where necessary
Region is used for temporary allocations, usually bound to a transaction, but not always. Keyword - temporary. It is usually much faster to allocate something on the region than on the heap, and much much faster to free the region, since it frees data in whole slabs. Lots of objects at once. Region is used both for byte arrays (MessagePack, strings, blobs), and for objects like standard types, structs. Almost always for allocations was used region_alloc() function, which returns a not aligned address. It can be anything, even not multiple of 2. That led to alignment violation for standard types and structs. Usually it is harmless in terms of errors, but can be slower than aligned access, and on some platforms may even crash. Also the crash can be forced using clang undefined behaviour sanitizer, which revealed all the not aligned accesses fixed in this patch. Part of #4609
Showing
- src/box/alter.cc 24 additions, 15 deletionssrc/box/alter.cc
- src/box/applier.cc 11 additions, 11 deletionssrc/box/applier.cc
- src/box/bind.c 4 additions, 3 deletionssrc/box/bind.c
- src/box/ck_constraint.c 6 additions, 5 deletionssrc/box/ck_constraint.c
- src/box/field_map.c 10 additions, 7 deletionssrc/box/field_map.c
- src/box/fk_constraint.h 9 additions, 5 deletionssrc/box/fk_constraint.h
- src/box/index_def.c 5 additions, 4 deletionssrc/box/index_def.c
- src/box/key_def.c 5 additions, 4 deletionssrc/box/key_def.c
- src/box/lua/execute.c 4 additions, 3 deletionssrc/box/lua/execute.c
- src/box/lua/key_def.c 4 additions, 3 deletionssrc/box/lua/key_def.c
- src/box/lua/misc.cc 4 additions, 4 deletionssrc/box/lua/misc.cc
- src/box/memtx_tree.c 4 additions, 3 deletionssrc/box/memtx_tree.c
- src/box/space_def.c 4 additions, 3 deletionssrc/box/space_def.c
- src/box/sql.c 13 additions, 7 deletionssrc/box/sql.c
- src/box/sql/build.c 36 additions, 24 deletionssrc/box/sql/build.c
- src/box/sql/func.c 4 additions, 3 deletionssrc/box/sql/func.c
- src/box/sql/select.c 8 additions, 6 deletionssrc/box/sql/select.c
- src/box/sql/update.c 3 additions, 3 deletionssrc/box/sql/update.c
- src/box/sql/vdbe.c 4 additions, 4 deletionssrc/box/sql/vdbe.c
- src/box/sql/wherecode.c 6 additions, 3 deletionssrc/box/sql/wherecode.c
Loading
Please register or sign in to comment