Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 May 2013 20:44:28 +0000 (UTC)
From:      Jeff Roberson <jeff@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r250578 - head/sys/sys
Message-ID:  <201305122044.r4CKiSeR069114@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)					\
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305122044.r4CKiSeR069114>