From: <no...@so...> - 2002-07-24 21:19:45
|
Patches item #585105, was opened at 2002-07-22 13:02 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=310894&aid=585105&group_id=10894 Category: 43. Parsing and Eval Group: CONSTify Status: Open Resolution: None Priority: 5 Submitted By: Don Porter (dgp) >Assigned to: Don Porter (dgp) Summary: CONST-ified parser Initial Comment: I've put together a patch that constifies the Tcl parser routines, and things that call them, like Tcl_Eval(). First here is a patch for the existing files... ---------------------------------------------------------------------- >Comment By: Joe English (jenglish) Date: 2002-07-24 14:19 Message: Logged In: YES user_id=68433 Reviewed 'complete.patch': this looks very good. The parser changes should definitely be committed; Tcl_Eval() and friends finally have the right signature, the patch fixes at least one known bug and probably several as-yet-undiscovered ones, and the code is now simpler and better-factored. With the patch, I was finally able to fully-CONSTify an extension that used to require -DUSE_NON_CONST. Just a few minor notes: In generic/tclInt.h, TclCmdProcType should be changed to match Tcl_CmdProc: typedef Tcl_CmdProc *TclCmdProcType; With the current definition (int (*TclCmdProcType)(...CONST char **argv)), there may be a type mismatch in extensions that #include tclInt.h with -DUSE_NON_CONST . Also, there's some stray debugging code (commented-out fprintfs) that made its way into the patch, and a comment in tclParseExpr.c/ParsePrimaryExpr() (~line 1390) that is no longer accurate. Other than that, I didn't see any problems. ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2002-07-23 20:52 Message: Logged In: YES user_id=80530 Here is a companion patch for Tk. ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2002-07-23 20:51 Message: Logged In: YES user_id=80530 Here is an updated patch that completes CONST-ification of Tcl. It has a substantial parser re-write that operates on counted strings, and doesn't have the thread-safety issues of the last attempt. Also merged in are the features of Patch 582429 which CONST-ifies the Tcl_*Var* interfaces, and the patch attached to Bug 580433 that enhances the USE_NON_CONST macro to allows users of the C API to completely avoid all source incompatibilities with 8.3 headers if they need to. It's been said that CONST-ification needs to be an "all or nothing" affair. This patch lets us explore the "all" option. It's also been said that CONST-ification of the parser would kill performance. I don't see a significant problem with it. Simple testing with tclbench indicates the patched Tcl is overall faster than even the HEAD, and a still a significant improvement over 8.4b1 (thanks, MIguel!). There are some things that are slower, notably evaluation of unbraced [expr]'s, but haven't we advised against those for awhile now? Anyhow the main point was to get something working so that we can decide whether or not to adopt it based on measurements rather than speculation, so please measure away! Try it. ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2002-07-22 13:04 Message: Logged In: YES user_id=80530 ...and here is a new file tclParse.h to place in the generic directory. Apply and `make genstubs', then try it. Note that the patched code will not be thread-safe. Further revisions required for that. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=310894&aid=585105&group_id=10894 |