|
2005-08-28
| ||
| 19:42 | • Ticket [1237040fff] dict compiler status still Closed with 2 other changes artifact: f4f3fa20c6 user: dkf | |
| 19:42 | • Ticket [1237040fff]: 6 changes artifact: 3ba352d13c user: dkf | |
| 19:42 | • Closed ticket [1237040fff]. artifact: 51805e1ec9 user: dkf | |
|
2005-07-15
| ||
| 17:46 | • Ticket [1237040fff]: 4 changes artifact: eb53c4a636 user: dkf | |
| 11:22 | • Ticket [1237040fff]: 4 changes artifact: f99e051cf7 user: dgp | |
| 00:54 | • Ticket [1237040fff]: 4 changes artifact: 926a8add95 user: dgp | |
|
2005-07-14
| ||
| 21:04 | • Ticket [1237040fff]: 4 changes artifact: 1e7955ca7d user: dkf | |
| 21:04 | • Add attachment bccDict_2.diff to ticket [1237040fff] artifact: b4b0cde237 user: dkf | |
| 21:00 | • Ticket [1237040fff] dict compiler status still Open with 4 other changes artifact: d4b7f0f410 user: dkf | |
| 04:47 | • Ticket [1237040fff]: 4 changes artifact: 6955e6be8a user: dgp | |
| 04:31 | • Ticket [1237040fff]: 4 changes artifact: 1d2e357aff user: dgp | |
| 04:26 | • Ticket [1237040fff]: 4 changes artifact: 173a141f04 user: dgp | |
| 04:24 | • Ticket [1237040fff]: 4 changes artifact: 919af75b50 user: dgp | |
| 04:15 | • Ticket [1237040fff]: 4 changes artifact: aaf568cb42 user: dgp | |
| 04:12 | • Ticket [1237040fff]: 4 changes artifact: 68bd518a60 user: dgp | |
|
2005-07-13
| ||
| 06:54 | • Ticket [1237040fff]: 4 changes artifact: c9edfd3496 user: dkf | |
|
2005-07-12
| ||
| 23:54 | • New ticket [1237040fff]. artifact: 3437de7041 user: dkf | |
dict compiler
Closed / Accepted1237040fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-07-12 23:54:53
This is a first hack at compiling the [dict] command. It passes the test suite cleanly for me (clock.test is a pretty good workout of many of the features that are compiled.)
dkfplain2005-07-13 06:54:53
File Added - 141861: bccDict.diff
dgpplain2005-07-14 04:12:56
Logged In: YES user_id=80530 On line 2774 of the patched tclCompCmds.c, shouldn't (wordTokenPtr[0].type == TCL_TOKEN_SIMPLE_WORD) be (wordTokenPtr[1].type == TCL_TOKEN_SIMPLE_WORD) ?
dgpplain2005-07-14 04:15:51
Logged In: YES user_id=80530 I'm a bit surprised to see TclCompileDictCmd use repeated strncmp() calls for subcommand parsing. Wouldn't it make more sense to copy TclCompileStringCmd()'s technique of using Tcl_GetIndexFromObj() ? If not, does it make sense to do the reverse, and have the [string] subcommands parsed as the [dict] ones are? I think it would be best not to use two different techniques in the same source code file without a really good reason.
dgpplain2005-07-14 04:24:27
Logged In: YES user_id=80530 On the subcommand parsing topic, I note that the [string] compiler accepts unique prefixes of subcommands for compiling ([string comp] for example). Will have to consider whether the [dict] compiler will copy that.
dgpplain2005-07-14 04:26:42
Logged In: YES user_id=80530 I note that the direct evaluation implementation of [dict] does accept unique prefixes, so it seems strange that the [dict] compiler refuses to compile them. That suggests to me that copying the [string] compiler routine is the way to go.
dgpplain2005-07-14 04:31:56
Logged In: YES user_id=80530 This is true about pre-existing code as well, but might as well mention it: The variable name "nameChars" is misleading as the value it holds is a number of bytes, not a number of characters. Would be a good idea to change them all.
dgpplain2005-07-14 04:47:18
Logged In: YES user_id=80530 I don't see the value of the TclLooksLikeInt() call in the compile of [dict incr]. It tells us approximately whether we have an int value, by at least rejecting string that do not "look" right. If it passes, we move on to an actual Tcl_GetIntFromObj() call which tells us for sure whether we have an int value. I don't see the point of a half-test right before the real test. I suppose it could help us fail faster, but is that really important? The check also makes us succeed slower, and success ought to be the normal mode.
dkfplain2005-07-14 21:00:07
Logged In: YES user_id=79902 1: wordTokenPtr[0].type is correct (but better written as wTP->type). I didn't write the way tokens operate... 2: I hadn't thought of doing that, but it's not a major issue. I do worry about having a table of subcommands in two locations though. 3: I'm trying to ensure that the compilation works, and extending coverage to all possible prefixes is a low-value issue, since it is Good Practice to not rely on prefixes at all. 4: I'm not going to do anything about this in this patch. 5: It's a cargo-cultist copying from the [incr] compiler. i.e. yet another thing to fix outside the context of this patch :-)
dkfplain2005-07-14 21:04:40
File Deleted - 141861: File Added - 142041: bccDict_2.diff Logged In: YES user_id=79902 Here's an updated patch that includes compilation of [dict append] and [dict lappend] as well.
dgpplain2005-07-15 00:54:16
Logged In: YES user_id=80530 line 5076 of tclExecute.c dynamically allocates a Tcl_DictSearch. Any reason not to use an automatic variable instead?
dgpplain2005-07-15 11:22:41
Logged In: YES user_id=80530 Um, ignore my last comment. Clearly nested [dict for] commands will compile to a stream of bytecode that would execute in many iterations through TEBC, but not nested TEBC calls. Dynamic allocation is correct.
dkfplain2005-07-15 17:46:26
Logged In: YES user_id=79902 By automatic variable, do you mean a local temporary Var or a C variable or what? Storing the Tcl_DictSearch in the bytecode structure won't work because of recursion. Putting the value in a (stack-allocated) C variable could work, but it'd be tricky to get right because you can nest iterations (and we really want to reduce the amount of stack space required for TEBC anyway) which means you'd have to keep an array (or list) of them; you could do it, but it'd be a lot of work to get right (not that we couldn't do this in the future, of course, but it would break the TDK compiler if we did it whereas my current solution remains compatible on this front at least). The easiest way is to store the iterator context in a Var, since they're handled right anway, which is what I do. :^)
dkf Closed ticket [1237040fff].
[History diff]2005-08-28 19:42:54
dkfplain2005-08-28 19:42:55
Logged In: YES user_id=79902 the dict compiler has been in the HEAD for a while now
dkf Ticket [1237040fff]: 2 changes
[History diff]2005-08-28 19:42:57
Log in (anonymous is fine) to add a comment.
Attachments:
- bccDict_2.diff [download] added by dkf on 2005-07-14 21:04:40. [details]