summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorstanton <stanton>1998-11-18 03:34:27 (GMT)
committerstanton <stanton>1998-11-18 03:34:27 (GMT)
commit77d75ab2fc29b4b5ee0d3c1919a9882e4d1b7734 (patch)
tree94a6cc46e75e48d1db3ac2e75755fd97ffa0bbed /generic
parent1b2722f2f6959c899e46b8c8e9a5f93ffb362444 (diff)
downloadtcl-77d75ab2fc29b4b5ee0d3c1919a9882e4d1b7734.zip
tcl-77d75ab2fc29b4b5ee0d3c1919a9882e4d1b7734.tar.gz
tcl-77d75ab2fc29b4b5ee0d3c1919a9882e4d1b7734.tar.bz2
* 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]
Diffstat (limited to 'generic')
-rw-r--r--generic/tclAlloc.c9
1 files 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;