Overview
| Artifact ID: | 0c5ea8f85899035dab09a6616611353cc1928a96 |
|---|---|
| Ticket: | 4955f5d8a4dce006e063f924bc9709f7850ecb6a
tailcall splicing spot vs. raw TclInvokeObjectCommand |
| User & Date: | ferrieux on 2014-05-19 17:48:03 |
Changes
- icomment:
As requested, a patch to tclTest that demonstrates the panic in script. The trick is, as Miguel predicted, to kickstart a slave with the T_GCI and proc pointer call. interp create foo interp eval foo { proc f {} {tailcall g} proc g {} {puts ggg} } testcmdinfo getandcall foo f You might say "ad hoc". It is :} If however you consider it a non-joking test, I'll make it so. Index: generic/tclTest.c ================================================================== --- generic/tclTest.c +++ generic/tclTest.c @@ -1030,11 +1030,11 @@ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { Tcl_CmdInfo info; - if (argc != 3) { + if (argc < 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " option cmdName\"", NULL); return TCL_ERROR; } if (strcmp(argv[1], "create") == 0) { @@ -1071,10 +1071,32 @@ if (info.isNativeObjectProc) { Tcl_AppendResult(interp, " nativeObjectProc", NULL); } else { Tcl_AppendResult(interp, " stringProc", NULL); } + } else if (strcmp(argv[1], "getandcall") == 0) { + Tcl_Interp *slave; + + if (argc<4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], argv[1], + " interp cmd [args]\"", NULL); + return TCL_ERROR; + } + slave = Tcl_GetSlave(interp, argv[2]); + if (slave == NULL) { + return TCL_ERROR; + } + if (Tcl_GetCommandInfo(slave, argv[3], &info) ==0) { + Tcl_SetResult(interp, "??", TCL_STATIC); + return TCL_OK; + } + if (info.proc == NULL) { + Tcl_SetResult(interp, "NULLPROC", TCL_STATIC); + return TCL_OK; + } + (*info.proc)(info.clientData,slave,argc-3,argv+3); + return TCL_OK; } else if (strcmp(argv[1], "modify") == 0) { info.proc = CmdProc2; info.clientData = (ClientData) "new_command_data"; info.objProc = NULL; info.objClientData = NULL; - login: "ferrieux"
- mimetype: "text/plain"