Changeset: faadee04a873 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=faadee04a873
Modified Files:
        gdk/gdk_utils.mx
Branch: Aug2011
Log Message:

Fix alignment issue.

On 64 bit Windows mserver5 wouldn't start in the default branch.  The
reason for that was that setjmp needs a 16-byte-aligned pointer for
the setjmp buffer.  Malloc knows that and always returns
16-byte-aligned pointers, but GDKmalloc added 8 to that, so the
pointer setjmp got was only 8-byte-aligned.

We now add two times sizeof(void) to the pointer that malloc returns
which will keep the alignment on a 16 byte boundary on 64 bit
Windows).

Note that on 32 bit Windows malloc returns 8 byte aligned pointers,
and on 64 bit Linux malloc returns 16 byte aligned pointers.  This
means this change will keep those alignments in tact on those
platforms.

Since this could potentially also be an issue in the Aug2011 branch,
the bug is fixed here.


diffs (12 lines):

diff --git a/gdk/gdk_utils.mx b/gdk/gdk_utils.mx
--- a/gdk/gdk_utils.mx
+++ b/gdk/gdk_utils.mx
@@ -1144,7 +1144,7 @@ GDKmemfail(str s, size_t len, size_t mem
 #endif
 
 /* we allocate extra space and return a pointer offset by this amount */
-#define MALLOC_EXTRA_SPACE     8
+#define MALLOC_EXTRA_SPACE     (2 * SIZEOF_VOID_P)
 
 #ifndef GDK_MEM_MISALIGN
 
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to