summaryrefslogtreecommitdiffstats
path: root/generic/tclProc.c
diff options
context:
space:
mode:
authorescoffon <escoffon>1998-06-10 12:34:22 (GMT)
committerescoffon <escoffon>1998-06-10 12:34:22 (GMT)
commitfa6729be12fe55ffb70a5614fa32733085a7c539 (patch)
treebffca9f7688773bd1442b5289790d31d20369b78 /generic/tclProc.c
parent0c5942c4533ba53f9a91fc95bf9309ea2e1b2603 (diff)
downloadtcl-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/tclProc.c')
-rw-r--r--generic/tclProc.c17
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