summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-04-22 18:13:17 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-04-22 18:13:17 (GMT)
commitb46c53fec03b48c96092ef01990c03a00891fb8c (patch)
tree8618cf39a9aa59709a21be76dd8b16b6d1c5752a /generic/tclExecute.c
parent5f08f4b52618056de417f6d543d5bd596d9197eb (diff)
downloadtcl-b46c53fec03b48c96092ef01990c03a00891fb8c.zip
tcl-b46c53fec03b48c96092ef01990c03a00891fb8c.tar.gz
tcl-b46c53fec03b48c96092ef01990c03a00891fb8c.tar.bz2
Refactor bytecode cleanup.
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 823f619..2a2b951 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -1499,11 +1499,9 @@ ExprObjCallback(
*
* Results:
* A (ByteCode *) is returned pointing to the resulting ByteCode.
- * The caller must manage its refCount and arrange for a call to
- * TclCleanupByteCode() when the last reference disappears.
*
* Side effects:
- * The Tcl_ObjType of objPtr is changed to the "bytecode" type,
+ * The Tcl_ObjType of objPtr is changed to the "exprcode" type,
* and the ByteCode is kept in the internal rep (along with context
* data for checking validity) for faster operations the next time
* CompileExprObj is called on the same value.
@@ -1536,7 +1534,7 @@ CompileExprObj(
|| (codePtr->nsPtr != namespacePtr)
|| (codePtr->nsEpoch != namespacePtr->resolverEpoch)
|| (codePtr->localCachePtr != iPtr->varFramePtr->localCachePtr)) {
- FreeExprCodeInternalRep(objPtr);
+ TclFreeIntRep(objPtr);
}
}
if (objPtr->typePtr != &exprCodeType) {
@@ -1644,10 +1642,7 @@ FreeExprCodeInternalRep(
{
ByteCode *codePtr = objPtr->internalRep.twoPtrValue.ptr1;
- objPtr->typePtr = NULL;
- if (codePtr->refCount-- <= 1) {
- TclCleanupByteCode(codePtr);
- }
+ TclReleaseByteCode(codePtr);
}
/*
@@ -2033,7 +2028,7 @@ TclNRExecuteByteCode(
* sizeof(void *);
int numWords = (size + sizeof(Tcl_Obj *) - 1) / sizeof(Tcl_Obj *);
- codePtr->refCount++;
+ TclPreserveByteCode(codePtr);
/*
* Reserve the stack, setup the TEBCdataPtr (TD) and CallFrame
@@ -8189,9 +8184,7 @@ TEBCresume(
}
iPtr->cmdFramePtr = bcFramePtr->nextPtr;
- if (codePtr->refCount-- <= 1) {
- TclCleanupByteCode(codePtr);
- }
+ TclReleaseByteCode(codePtr);
TclStackFree(interp, TD); /* free my stack */
return result;