Attachment "compList.patch" to
ticket [1661637fff]
added by
dgp
2007-02-16 23:09:00.
Index: generic/tclCompile.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCompile.c,v
retrieving revision 1.106
diff -u -r1.106 tclCompile.c
--- generic/tclCompile.c 19 Jan 2007 14:06:09 -0000 1.106
+++ generic/tclCompile.c 16 Feb 2007 15:23:38 -0000
@@ -475,12 +475,38 @@
TclInitCompileEnv(interp, &compEnv, stringPtr, length,
iPtr->invokeCmdFramePtr, iPtr->invokeWord);
+
+ if (objPtr->typePtr == &tclListType) {
+ List *listRepPtr = (List *) objPtr->internalRep.twoPtrValue.ptr1;
+
+ if (listRepPtr->canonicalFlag) {
+ int objc;
+ Tcl_Obj **objv;
+
+ Tcl_ListObjGetElements(NULL, objPtr, &objc, &objv);
+ if (objc > 0) {
+ int i = 0;
+ while (i++ < objc) {
+ TclEmitPush( TclAddLiteralObj(&compEnv, *objv++, NULL),
+ &compEnv);
+ }
+ if (objc <= 255) {
+ TclEmitInstInt1(INST_INVOKE_STK1, objc, &compEnv);
+ } else {
+ TclEmitInstInt4(INST_INVOKE_STK4, objc, &compEnv);
+ }
+ goto compileDone;
+ }
+ }
+ }
+
TclCompileScript(interp, stringPtr, length, &compEnv);
/*
* Successful compilation. Add a "done" instruction at the end.
*/
+ compileDone:
TclEmitOpcode(INST_DONE, &compEnv);
/*