Tcl Source Code

Artifact [c94f8f5b63]
Login

Artifact c94f8f5b636205154279383f7e40012dd14b80a6:

Attachment "traceEnsembleOverhead3.patch" to ticket [3485833fff] added by sebres 2012-02-13 23:18:07.
Index: tclBasic.c
===================================================================
--- tclBasic.c	(revision 84)
+++ tclBasic.c	(working copy)
@@ -3020,8 +3020,11 @@
     if (!command) {
 	return Tcl_NewListObj(objc, objv);
     }
-    if (command == (char *) -1) {
+    if (command == (char *) -1 || command == (char *) -2) {
 	command = TclGetSrcInfoForCmd(iPtr, &numChars);
+	if (!command) {
+	    return Tcl_NewListObj(objc, objv);
+	}
     }
     return Tcl_NewStringObj(command, numChars);
 }
Index: tclExecute.c
===================================================================
--- tclExecute.c	(revision 84)
+++ tclExecute.c	(working copy)
@@ -7796,11 +7796,35 @@
     Interp *iPtr,
     int *lenPtr)
 {
+    int len;
+    ByteCode *codePtr;
+
     CmdFrame *cfPtr = iPtr->cmdFramePtr;
-    ByteCode *codePtr = (ByteCode *) cfPtr->data.tebc.codePtr;
+    const char * command;
 
-    return GetSrcInfoForPc((unsigned char *) cfPtr->data.tebc.pc,
-	    codePtr, lenPtr);
+    if (!cfPtr)
+	return NULL;
+    codePtr = (ByteCode *) cfPtr->data.tebc.codePtr;
+    if (!codePtr)
+	return NULL;
+    if (!cfPtr->data.tebc.pc)
+	return NULL;
+
+    command = GetSrcInfoForPc((unsigned char *) cfPtr->data.tebc.pc,
+	    codePtr, &len);
+
+    // [sebres] if ensemble call - shift string ptr to subcommand (string range -> range) :
+    if (command && len && (lenPtr && *lenPtr == -2) && codePtr->objArrayPtr) {
+	Tcl_Obj * objPtr = codePtr->objArrayPtr[0];
+	if (len > objPtr->length) {
+	    command += objPtr->length + 1;
+	    len -= objPtr->length + 1;
+	}
+    }
+
+    if (lenPtr != NULL)
+	*lenPtr = len;
+    return command;
 }
 
 void
Index: tclNamesp.c
===================================================================
--- tclNamesp.c	(revision 84)
+++ tclNamesp.c	(working copy)
@@ -25,6 +25,7 @@
  */
 
 #include "tclInt.h"
+#include "tclCompile.h"
 
 /*
  * Thread-local storage used to avoid having a global lock on data that is not
@@ -6253,9 +6254,10 @@
 
 	/*
 	 * Hand off to the target command.
+	 * [sebres] call from ensemble -- -2 (to retrive subcommand from main ensemble)
 	 */
 
-	result = Tcl_EvalObjv(interp, objc-2+prefixObjc, tempObjv,
+	result = TclEvalObjvInternal(interp, objc-2+prefixObjc, tempObjv, (char *)-2, -2,
 		TCL_EVAL_INVOKE);
 
 	/*
Index: tclTest.c
===================================================================
--- tclTest.c	(revision 84)
+++ tclTest.c	(working copy)
@@ -39,6 +39,10 @@
  * Declare external functions used in Windows tests.
  */
 
+#if (defined( _MSC_VER ))
+typedef void * intptr_t;
+#endif
+ 
 /*
  * Dynamic string shared by TestdcallCmd and DelCallbackProc; used to collect
  * the results of the various deletion callbacks.