diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2008-04-08 15:11:27 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2008-04-08 15:11:27 (GMT) |
commit | cd778f7c442ce23fe562d67ffeb097fbc286365a (patch) | |
tree | c23278c77b98ea0e4156b7e5570806a343199c34 /generic | |
parent | a56109238f30be1857ca8cd42e6b8cc2595bdf34 (diff) | |
download | tcl-cd778f7c442ce23fe562d67ffeb097fbc286365a.zip tcl-cd778f7c442ce23fe562d67ffeb097fbc286365a.tar.gz tcl-cd778f7c442ce23fe562d67ffeb097fbc286365a.tar.bz2 |
* generic/tclExecute.c: added comments to the alignment macros
used in GrowEvaluationStack() and friends.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclExecute.c | 23 |
1 files changed, 18 insertions, 5 deletions
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)) |