[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
alignment (was Re: lynx-dev lynx2.8.5dev.13)
From: |
Leonid Pauzner |
Subject: |
alignment (was Re: lynx-dev lynx2.8.5dev.13) |
Date: |
Wed, 5 Feb 2003 17:04:11 +0300 (MSK) |
22-Jan-2003 19:06 Thomas Dickey wrote:
>> > 2003-01-22 (2.8.5dev.13)
>> > * change new memory-allocation in HTString.c and GridText.c to provide
>> > pointers
>> > to data aligned to the host's pointer-size, to work on Tru64 where this
>> > happens to be 8 -TD
> I didn't think of that at first either, but the runtime messages are very
> noticable.
sizeof(double) will be more portable, from alloca.c:
/* alloca.c -- allocate automatically reclaimed memory
(Mostly) portable public-domain implementation -- D A Gwyn
This implementation of the PWB library alloca function,
which is used to allocate space off the run-time stack so
that it is automatically reclaimed upon procedure exit,
was inspired by discussions with J. Q. Johnson of Cornell.
J.Otto Tennant <address@hidden> contributed the Cray support.
[...]
It is very important that sizeof(header) agree with malloc
alignment chunk size. The following default should work okay. */
#ifndef ALIGN_SIZE
#define ALIGN_SIZE sizeof(double)
#endif
--- 2_8_5dev.12n 2003-01-21 12:52:34.000000000 +0000
+++ 2_8_5dev.13 2003-01-22 23:42:00.000000000 +0000
@@ -116,7 +117,10 @@
Changes since Lynx 2.8 release
===============================================================================
-+2003-01-20 (2.8.5dev.13)
++2003-01-22 (2.8.5dev.13)
++* change new memory-allocation in HTString.c and GridText.c to provide
pointers
++ to data aligned to the host's pointer-size, to work on Tru64 where this
++ happens to be 8 -TD
++/*
++ * The HTPool.data[] array has to align the same as malloc() would, to make
the
++ * ALLOC_POOL scheme portable. For many platforms, that is the same as the
++ * number of bytes in a pointer. It may be larger, e.g., on machines which
++ * have more stringent requirements for floating point. 32-bits are plenty
for
++ * representing styles, but we may need 64-bit or 128-bit alignment.
++ *
++ * The real issue is that performance is degraded if the alignment is not met,
++ * and some platforms such as Tru64 generate lots of warning messages.
++ */
++#define ALIGN_SIZE 8
@@ -1665,12 +1670,13 @@
-+#define EXTRA_LEN size_t /* type we use for length */
++#define EXTRA_TYPE size_t /* type we use for length */
++#define EXTRA_SIZE sizeof(void *) /* alignment >= sizeof(EXTRA_TYPE) */
+
+PUBLIC void HTSAFree_extra ARGS1(
+ char *, s)
+{
-+ free((char *)s - sizeof(EXTRA_LEN));
++ free(s - EXTRA_SIZE);
+}
+
; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden
- alignment (was Re: lynx-dev lynx2.8.5dev.13),
Leonid Pauzner <=