From ed688aceee660abed27f84b18fa64e5d4af56fd9 Mon Sep 17 00:00:00 2001 From: florian <florian@freepascal.org> Date: Wed, 4 Sep 2019 20:45:23 +0000 Subject: [PATCH] * remove packed from tdynarray, it is not needed and especially 64 bit CPUs which require proper aligment, suffer from it git-svn-id: trunk@42920 - --- rtl/inc/dynarr.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rtl/inc/dynarr.inc b/rtl/inc/dynarr.inc index 72a6d7c451..0fbb020f54 100644 --- a/rtl/inc/dynarr.inc +++ b/rtl/inc/dynarr.inc @@ -19,7 +19,14 @@ type { don't add new fields, the size is used } { to calculate memory requirements } pdynarray = ^tdynarray; - tdynarray = packed record + { removed packed here as + 1) both fields have typically the same size (2, 4 or 8 bytes), if this is not the case, packed + should be used only for this architecture + 2) the memory blocks are sufficiently well aligned + 3) in particular 64 bit CPUs which require natural alignment suffer from + the packed as it causes each field access being split in 8 single loads and appropriate shift operations + } + tdynarray = { packed } record refcount : ptrint; high : tdynarrayindex; end;