[uim-commit] r2984 - branches/r5rs/sigscheme/src

ekato at freedesktop.org ekato at freedesktop.org
Sun Jan 22 21:17:50 PST 2006


Author: ekato
Date: 2006-01-22 21:17:46 -0800 (Sun, 22 Jan 2006)
New Revision: 2984

Modified:
   branches/r5rs/sigscheme/src/alloc.c
Log:
* sigscheme/src/alloc.c (scm_malloc_aligned) : Use malloc()
  for Mac OS X since it is guaranteed to be 16 bytes aligned.


Modified: branches/r5rs/sigscheme/src/alloc.c
===================================================================
--- branches/r5rs/sigscheme/src/alloc.c	2006-01-22 23:49:56 UTC (rev 2983)
+++ branches/r5rs/sigscheme/src/alloc.c	2006-01-23 05:17:46 UTC (rev 2984)
@@ -98,6 +98,20 @@
         p = scm_malloc(size);
     else
         ERR("cannot ensure memory alignment");
+#elif defined(__APPLE__)
+    /*
+     * malloc in Mac OS X guarantees 16 byte alignment.  And large
+     * memory allocations are guaranteed to be page-aligned.  See
+     * http://developer.apple.com/documentation/Performance/Conceptual/
+     * ManagingMemory/Articles/MemoryAlloc.html
+     * -- 
+     * ekato Jan 23 2006
+     */
+    if ((ALIGN_CELL % 16 == 0) || (ALIGN_CELL % 8 == 0)
+        || (ALIGN_CELL % 4 == 0) || (ALIGN_CELL % 2 == 0))
+        p = malloc(size);
+    else
+        ERR("cannot ensure memory alignment");
 #else
 #error "This platform is not supported yet"
 #endif



More information about the uim-commit mailing list