diff options
| author | dgp <dgp@users.sourceforge.net> | 2016-04-22 18:13:17 (GMT) |
|---|---|---|
| committer | dgp <dgp@users.sourceforge.net> | 2016-04-22 18:13:17 (GMT) |
| commit | a52a0147b7b9491e17b69cda754de7fe2476540f (patch) | |
| tree | 8618cf39a9aa59709a21be76dd8b16b6d1c5752a /generic/tclExecute.c | |
| parent | 3f2f704c28a23ff932110f2eab0daeb1536b7bdd (diff) | |
| download | tcl-a52a0147b7b9491e17b69cda754de7fe2476540f.zip tcl-a52a0147b7b9491e17b69cda754de7fe2476540f.tar.gz tcl-a52a0147b7b9491e17b69cda754de7fe2476540f.tar.bz2 | |
Refactor bytecode cleanup.
Diffstat (limited to 'generic/tclExecute.c')
| -rw-r--r-- | generic/tclExecute.c | 17 |
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; |
