diff options
author | escoffon <escoffon> | 1998-06-10 12:34:22 (GMT) |
---|---|---|
committer | escoffon <escoffon> | 1998-06-10 12:34:22 (GMT) |
commit | fa6729be12fe55ffb70a5614fa32733085a7c539 (patch) | |
tree | bffca9f7688773bd1442b5289790d31d20369b78 /generic | |
parent | 0c5942c4533ba53f9a91fc95bf9309ea2e1b2603 (diff) | |
download | tcl-fa6729be12fe55ffb70a5614fa32733085a7c539.zip tcl-fa6729be12fe55ffb70a5614fa32733085a7c539.tar.gz tcl-fa6729be12fe55ffb70a5614fa32733085a7c539.tar.bz2 |
turn off check for shared source string in Tcl_ProcObjCmd if the body
is a PRECOMPILED ByteCode object.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclProc.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c index c9039df..273f12f 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -112,13 +112,26 @@ Tcl_ProcObjCmd(dummy, interp, objc, objv) * procedures that have a different number of arguments, even if their * bodies are identical. Note that we don't use Tcl_DuplicateObj since * we would not want any bytecode internal representation. + * + * But if this is a precompiled bytecode object, then do not duplicate it; + * precompiled bytecodes are immutable, and there is no source to + * recompile anyway. */ bodyPtr = objv[3]; if (Tcl_IsShared(bodyPtr)) { - bytes = Tcl_GetStringFromObj(bodyPtr, &length); - bodyPtr = Tcl_NewStringObj(bytes, length); + if (bodyPtr->typePtr == &tclByteCodeType) { + ByteCode *codePtr + = (ByteCode *) bodyPtr->internalRep.otherValuePtr; + if (codePtr->flags & TCL_BYTECODE_PRECOMPILED) { + goto skip_unshare; + } + } + + bytes = Tcl_GetStringFromObj(bodyPtr, &length); + bodyPtr = Tcl_NewStringObj(bytes, length); } + skip_unshare: /* * Create and initialize a Proc structure for the procedure. Note that |