summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2015-06-30 08:10:15 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2015-06-30 08:10:15 (GMT)
commit68de044c4e43f457cf298983fc8dc0936aed9923 (patch)
treee963a357aeb17226cede5a09a53f75b86b353eab /generic/tclCompile.c
parentcdbe969ea378527a9002c3a5ab21465c7a79fc4b (diff)
downloadtcl-68de044c4e43f457cf298983fc8dc0936aed9923.zip
tcl-68de044c4e43f457cf298983fc8dc0936aed9923.tar.gz
tcl-68de044c4e43f457cf298983fc8dc0936aed9923.tar.bz2
Use twoPtrValue in stead of ptrAndLongRep for implementation of some internal Obj types. On most platforms this doesn't make a difference,
as (void *) and (long) generially have the same size. The only exception where it makes a difference is win64, as we can now store 64 bits in this field in stead of only 32 bits, exactly what the processor is optimized for.
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r--generic/tclCompile.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 0f4dfaf..a552f39 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -978,8 +978,7 @@ FreeByteCodeInternalRep(
register ByteCode *codePtr = objPtr->internalRep.twoPtrValue.ptr1;
objPtr->typePtr = NULL;
- codePtr->refCount--;
- if (codePtr->refCount <= 0) {
+ if (codePtr->refCount-- < 2) {
TclCleanupByteCode(codePtr);
}
}
@@ -1295,8 +1294,8 @@ CompileSubstObj(
if (objPtr->typePtr == &substCodeType) {
Namespace *nsPtr = iPtr->varFramePtr->nsPtr;
- codePtr = objPtr->internalRep.ptrAndLongRep.ptr;
- if ((unsigned long)flags != objPtr->internalRep.ptrAndLongRep.value
+ codePtr = objPtr->internalRep.twoPtrValue.ptr1;
+ if (flags != PTR2INT(objPtr->internalRep.twoPtrValue.ptr2)
|| ((Interp *) *codePtr->interpHandle != iPtr)
|| (codePtr->compileEpoch != iPtr->compileEpoch)
|| (codePtr->nsPtr != nsPtr)
@@ -1322,8 +1321,8 @@ CompileSubstObj(
TclFreeCompileEnv(&compEnv);
codePtr = objPtr->internalRep.twoPtrValue.ptr1;
- objPtr->internalRep.ptrAndLongRep.ptr = codePtr;
- objPtr->internalRep.ptrAndLongRep.value = flags;
+ objPtr->internalRep.twoPtrValue.ptr1 = codePtr;
+ objPtr->internalRep.twoPtrValue.ptr2 = INT2PTR(flags);
if (iPtr->varFramePtr->localCachePtr) {
codePtr->localCachePtr = iPtr->varFramePtr->localCachePtr;
codePtr->localCachePtr->refCount++;
@@ -1362,11 +1361,10 @@ static void
FreeSubstCodeInternalRep(
register Tcl_Obj *objPtr) /* Object whose internal rep to free. */
{
- register ByteCode *codePtr = objPtr->internalRep.ptrAndLongRep.ptr;
+ register ByteCode *codePtr = objPtr->internalRep.twoPtrValue.ptr1;
objPtr->typePtr = NULL;
- codePtr->refCount--;
- if (codePtr->refCount <= 0) {
+ if (codePtr->refCount-- < 2) {
TclCleanupByteCode(codePtr);
}
}