summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2008-04-08 15:11:27 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2008-04-08 15:11:27 (GMT)
commitcd778f7c442ce23fe562d67ffeb097fbc286365a (patch)
treec23278c77b98ea0e4156b7e5570806a343199c34
parenta56109238f30be1857ca8cd42e6b8cc2595bdf34 (diff)
downloadtcl-cd778f7c442ce23fe562d67ffeb097fbc286365a.zip
tcl-cd778f7c442ce23fe562d67ffeb097fbc286365a.tar.gz
tcl-cd778f7c442ce23fe562d67ffeb097fbc286365a.tar.bz2
* generic/tclExecute.c: added comments to the alignment macros
used in GrowEvaluationStack() and friends.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclExecute.c23
2 files changed, 23 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 0adcdde..6c30da3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-08 Miguel Sofer <msofer@users.sf.net>
+
+ * generic/tclExecute.c: added comments to the alignment macros
+ used in GrowEvaluationStack() and friends.
+
2008-04-08 Daniel Steffen <das@users.sourceforge.net>
* tools/genStubs.tcl: revert erroneous 2008-04-02 change marking
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 1677a78..c7e3e08 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclExecute.c,v 1.369 2008/03/18 18:52:07 msofer Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.370 2008/04/08 15:11:30 msofer Exp $
*/
#include "tclInt.h"
@@ -851,23 +851,36 @@ TclFinalizeExecution(void)
/*
* Auxiliary code to insure that GrowEvaluationStack always returns correctly
- * aligned memory. This assumes that TCL_ALLOCALIGN is a multiple of the
- * wordsize 'sizeof(Tcl_Obj *)'.
+ * aligned memory.
+ *
+ * WALLOCALIGN represents the alignment reqs in words, just as TCL_ALLOCALIGN
+ * represents the reqs in bytes. This assumes that TCL_ALLOCALIGN is a
+ * multiple of the wordsize 'sizeof(Tcl_Obj *)'.
*/
#define WALLOCALIGN \
(TCL_ALLOCALIGN/sizeof(Tcl_Obj *))
+/*
+ * OFFSET computes how many words have to be skipped until the next aligned
+ * word. Note that we are only interested in the low order bits of ptr, so
+ * that any possible information loss in PTR2INT is of no consequence.
+ */
+
static inline int
OFFSET(
void *ptr)
{
int mask = TCL_ALLOCALIGN-1;
int base = PTR2INT(ptr) & mask;
- return (TCL_ALLOCALIGN - base)/sizeof(Tcl_Obj**);
+ return (TCL_ALLOCALIGN - base)/sizeof(Tcl_Obj *);
}
-#define MEMSTART(markerPtr) \
+/*
+ * Given a marker, compute where the following aligned memory starts.
+ */
+
+#define MEMSTART(markerPtr) \
((markerPtr) + OFFSET(markerPtr))