libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libunwind-devel] [PATCH 05/57] Align `sos_memory' to MAX_ALIGN


From: Tommi Rantala
Subject: [Libunwind-devel] [PATCH 05/57] Align `sos_memory' to MAX_ALIGN
Date: Fri, 21 Sep 2012 14:11:06 +0300

We give aligned pointers from the `sos_memory' array, so any non-aligned
bytes are only wasted.
---
 include/compiler.h |    2 ++
 src/mi/mempool.c   |    3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/compiler.h b/include/compiler.h
index b46d5aa..f519877 100644
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -31,6 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 #define COMPILER_H
 
 #ifdef __GNUC__
+# define ALIGNED(x)    __attribute__((aligned(x)))
 # define UNUSED                __attribute__((unused))
 # define NORETURN      __attribute__((noreturn))
 # define ALIAS(name)   __attribute__((alias (#name)))
@@ -51,6 +52,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 #  define unlikely(x)  (x)
 # endif
 #else
+# define ALIGNED(x)
 # define ALWAYS_INLINE
 # define UNUSED
 # define NORETURN
diff --git a/src/mi/mempool.c b/src/mi/mempool.c
index 66cb099..b04aa63 100644
--- a/src/mi/mempool.c
+++ b/src/mi/mempool.c
@@ -1,6 +1,7 @@
 /* libunwind - a platform-independent unwind library
    Copyright (C) 2002-2003, 2005 Hewlett-Packard Co
        Contributed by David Mosberger-Tang <address@hidden>
+   Copyright (C) 2012 Tommi Rantala <address@hidden>
 
 This file is part of libunwind.
 
@@ -38,7 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 # define MAX_ALIGN     MAX_ALIGN_(sizeof (long double))
 #endif
 
-static char sos_memory[SOS_MEMORY_SIZE];
+static char sos_memory[SOS_MEMORY_SIZE] ALIGNED(MAX_ALIGN);
 static char *sos_memp;
 static size_t pg_size;
 
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]