From 77d75ab2fc29b4b5ee0d3c1919a9882e4d1b7734 Mon Sep 17 00:00:00 2001 From: stanton Date: Wed, 18 Nov 1998 03:34:27 +0000 Subject: * tclAlloc.c: changed so allocated memory is always 8-byte aligned to improve memory performance and to ensure that it will work on systems that don't like accessing 4-byte aligned values (e.g. Solaris and HP-UX). [Bug: 834] --- generic/tclAlloc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c index 070302f..d309319 100644 --- a/generic/tclAlloc.c +++ b/generic/tclAlloc.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclAlloc.c,v 1.1.2.2 1998/09/24 23:58:40 stanton Exp $ + * RCS: @(#) $Id: tclAlloc.c,v 1.1.2.3 1998/11/18 03:34:27 stanton Exp $ */ #include "tclInt.h" @@ -31,7 +31,7 @@ typedef unsigned long caddr_t; /* - * The overhead on a block is at least 4 bytes. When free, this space + * The overhead on a block is at least 8 bytes. When free, this space * contains a pointer to the next free block, and the bottom two bits must * be zero. When in use, the first byte is set to MAGIC, and the second * byte is the size index. The remaining bytes are for alignment. @@ -43,6 +43,7 @@ typedef unsigned long caddr_t; union overhead { union overhead *ov_next; /* when free */ + unsigned char ov_padding[8]; /* Ensure the structure is 8-byte aligned. */ struct { unsigned char ovu_magic0; /* magic number */ unsigned char ovu_index; /* bucket # */ @@ -51,6 +52,7 @@ union overhead { #ifdef RCHECK unsigned short ovu_rmagic; /* range magic number */ unsigned long ovu_size; /* actual block size */ + unsigned short ovu_unused2; /* padding to 8-byte align */ #endif } ovu; #define ov_magic0 ovu.ovu_magic0 @@ -105,7 +107,10 @@ static struct block bigBlocks = { /* Big blocks aren't suballocated. */ * used before anything else in Tcl, we make this module self-initializing * after all with the allocInit variable. */ + +#ifdef TCL_THREADS static TclpMutex allocMutex; +#endif static int allocInit = 0; -- cgit v0.12