svn commit: r250578 - head/sys/sys
Jeff Roberson
jeff at FreeBSD.org
Sun May 12 20:44:29 UTC 2013
Author: jeff
Date: Sun May 12 20:44:28 2013
New Revision: 250578
URL: http://svnweb.freebsd.org/changeset/base/250578
Log:
- pctrie really only requires two byte alignment so that there is a single
bit available for a flag in the pointer. However, it felt more correct
to enforce natural alignment of the key pointer. Unfortunately on
32bit architectures 64bit integers are not always naturally aligned.
Change the assert to enforce only 32bit alignment of the 64bit key for
now to fix the build. A more correct fix would be to properly sort
the struct buf fields which definitely suffer from bloat due to padding.
Modified:
head/sys/sys/pctrie.h
Modified: head/sys/sys/pctrie.h
==============================================================================
--- head/sys/sys/pctrie.h Sun May 12 16:50:18 2013 (r250577)
+++ head/sys/sys/pctrie.h Sun May 12 20:44:28 2013 (r250578)
@@ -38,7 +38,11 @@
#define PCTRIE_DEFINE(name, type, field, allocfn, freefn) \
\
CTASSERT(sizeof(((struct type *)0)->field) == sizeof(uint64_t)); \
-CTASSERT((__offsetof(struct type, field) & (sizeof(uint64_t) - 1)) == 0); \
+/* \
+ * XXX This assert protects flag bits, it does not enforce natural \
+ * alignment. 32bit architectures do not naturally align 64bit fields. \
+ */ \
+CTASSERT((__offsetof(struct type, field) & (sizeof(uint32_t) - 1)) == 0); \
\
static __inline struct type * \
name##_PCTRIE_VAL2PTR(uint64_t *val) \
More information about the svn-src-all
mailing list