Overview
| Artifact ID: | dc1bc7c7d5460be327a3575cd3eab08a282b745c |
|---|---|
| Ticket: | 1290457fffffffffffffffffffffffffffffffff
TEOVI refactoring |
| User & Date: | tallniel on 2006-06-30 17:47:31 |
Changes
- icomment:
File Added - 183405: teovi-29Jun06.patch Logged In: YES user_id=102050 Uploading newer patch: The new patch refactors things again to create a new TclInvokeCommand function that can be used in place of the various places where the core directly calls a cmdPtr->objProc (e.g. 582506). The new function is not declared "static", but I've not put a declaration in any header file as I wasn't sure which would be appropriate (tclCompile.h?). For instance, to fix 582506 you can change InvokeImportedCmd (in tclNamesp.c) from: return (*realCmdPtr->objProc)(realCmdPtr->objClientData, interp, objc, objv); to: return TclInvokeCommand(interp, objc, objv, realCmdPtr, 0); (Actually, this only fixes the original problem of 582506 -- miguel's added comment is not fixed as that requires further changes to how execution traces are stored/invoked). I've also added a TODO comment in the source for TclEvalObjvInternalUnknownHandler. In the original code this calls Tcl_GetCommandFromObj to check if the handler exists and then calls TEOVI to invoke it (which then calls T_GCFO again). I think this can be replaced by a call to the new TclInvokeCommand, which would avoid the extra call to T_GCFO as we could just pass in the Command from the previous call. However, the call to TEOVI also passes in the *original* command+args string when calling the unknown handler. I'm not sure if this is ever actually used (it is passed to further execution trace handlers, but I haven't dug further), so I'm not sure if this replacement can be made safely. The new patch passes the test-suite, *EXCEPT* it causes a segfault in one test in stack.test on my system, but only when symbols are *disabled*. The segfault is from blowing the C stack, and is obviously caused by the extra function call added to the stack (TEOVI -> TEOVIInvokeCommand). Adding an "inline" keyword to TEOVIIC fixes this for me, but is C99/GCC-specific. Alternatives would be either to inline this function manually again (still leaves some refactoring, which may be worth it), or a further refactoring. The further refactoring would split into before/after functions for taking care of traces etc, but leave the actual calling of cmdPtr->objProc to the caller (TEOVI or TclInvokeCommand). I can produce a further patch for this if you want. - login: "tallniel"
- mimetype: "text/plain"
- username: "tallniel"