summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-08-29 10:00:23 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-08-29 10:00:23 (GMT)
commitdc471da4331df6c6ec520bf55f7b5ce7f6490bdf (patch)
treecbfed49668e3100f7d926a2f7701d4914d798633 /generic/tclCompile.c
parent4e9c7a9ae0adaee122394db9ebf41650340fe023 (diff)
parentf0a6c93a0e89c86140a0c5f3a19db9c38628d1d8 (diff)
downloadtcl-dc471da4331df6c6ec520bf55f7b5ce7f6490bdf.zip
tcl-dc471da4331df6c6ec520bf55f7b5ce7f6490bdf.tar.gz
tcl-dc471da4331df6c6ec520bf55f7b5ce7f6490bdf.tar.bz2
Merge 9.0
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r--generic/tclCompile.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 5bfad37..a57743c 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -2825,9 +2825,13 @@ TclInitByteCode(
/*
* Compute the total number of bytes needed for this bytecode.
+ *
+ * Note that code bytes need not be aligned but since later elements are we
+ * need to pad anyway, either directly after ByteCode or after codeBytes,
+ * and it's easier and more consistent to do the former.
*/
- structureSize = sizeof(ByteCode);
+ structureSize = TCL_ALIGN(sizeof(ByteCode)); /* align code bytes */
structureSize += TCL_ALIGN(codeBytes); /* align object array */
structureSize += TCL_ALIGN(objArrayBytes); /* align exc range arr */
structureSize += TCL_ALIGN(exceptArrayBytes); /* align AuxData array */
@@ -2866,7 +2870,7 @@ TclInitByteCode(
codePtr->maxExceptDepth = envPtr->maxExceptDepth;
codePtr->maxStackDepth = envPtr->maxStackDepth;
- p += sizeof(ByteCode);
+ p += TCL_ALIGN(sizeof(ByteCode)); /* align code bytes */
codePtr->codeStart = p;
memcpy(p, envPtr->codeStart, codeBytes);