Artifacts Associated With Ticket 827119ffffffffff
Ticket change [f654eb0bc1] (rid 130286) by dgp on 2003-10-20 20:31:54:
- assignee initialized to: "msofer"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Here's a first draft implementation of TIP 157 as a patch to the HEAD. Note changes to the public interface. Besides the script level {expand} expansion, a new Tcl_Token type #define TCL_TOKEN_EXPAND_WORD 256 is in tcl.h and a new bytecode opcode #define INST_LCONCAT1 100 is in tclCompile.h Patch does not yet include documentation or test updates. Contributions for both are welcome, as well as mucho banging on it in search of bugs. There are alternative implementation ideas out there too, I'm sure, particularly on better ways to handle bytecode compiling of the {expand} operation. Feel free to treat this as the straw man. - foundin initialized to: "TIP Implementation"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "dgp"
- subsystem initialized to: "45. Parsing and Eval"
- title initialized to: "TIP 157 implementation"
- type initialized to: "Patch"
Ticket change [b7a2826c65] (rid 125637) by dgp on 2003-10-21 03:31:54:
- icomment:
File Added - 64913: tip157.patch
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [fea69900d8] (rid 108626) by dgp on 2003-10-21 03:45:52:
- icomment:
Logged In: YES user_id=80530 Probably worthwhile to note that the controversial syntax choice between TIPs 157 and 144 are completely determined by line 337 of the patched tclParse.c. Change static char expPfx[] = "expand"; to static char expPfx[] = ""; and this patch becomes an implementation of TIP 144. - login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [07a4435f01] (rid 89439) by msofer on 2003-10-21 05:05:24:
- icomment:
File Deleted - 64913: File Added - 64922: tip157.patch Logged In: YES user_id=148712 The new INST was missing in the tclInstructionTable (tclCompile.c); patch updated.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [0163c660de] (rid 119476) by dgp on 2003-10-21 12:25:17:
- icomment:
Logged In: YES user_id=80530 Crash: % set l1 [list a {b c} d] a {b c} d % list {expand}$l1 a {b c} d % !! list {expand}$l1 a {b c} d % !! list {expand}$l1 Segmentation fault Note that the use of "!!" apparently matters. - login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [b879541108] (rid 128971) by dgp on 2003-10-21 13:28:33:
- icomment:
Logged In: YES user_id=80530 Looks like an "off-by-one" in the in-place objv array expansion shift. Will look again tomorrow.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [89fd0a94c7] (rid 127315) by dgp on 2003-10-21 21:56:42:
- icomment:
File Deleted - 64922: File Added - 64974: tip157.patch Logged In: YES user_id=80530 Updated patch corrects all known flaws. Includes several tests from Peter Spjuth.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [0981fc4902] (rid 113669) by dgp on 2003-10-22 03:58:28:
- icomment:
File Deleted - 64974: File Added - 65008: tip157.patch Logged In: YES user_id=80530 Updated patch adds several tests to parse.test (and updates it to tcltest 2)
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [0bb6978626] (rid 114041) by dgp on 2003-10-23 21:52:10:
- icomment:
File Deleted - 65008: File Added - 65203: tip157.patch Logged In: YES user_id=80530 Updated patch adds more tests, moves those from cmdAH.test into basic.test, fixes a few bugs, and add docs for the parser changes. Three tests fail, revealing not exactly bugs, but inconsistencies between compiled operation and direct string evaluation.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [4136ae9158] (rid 116149) by dgp on 2003-10-24 00:52:44:
- icomment:
File Deleted - 65203: File Added - 65227: tip157.patch Logged In: YES user_id=80530 latest patch adds more tests in compile.test, simplifies the code in tclCompile.c a bit. Note the knownBug tests that highlight a potential ability to overflow objc .
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [b4a5726551] (rid 125076) by dgp on 2003-10-24 21:57:20:
- icomment:
File Deleted - 65227: File Added - 65324: tip157.patch Logged In: YES user_id=80530 New patch updates the [eval]'s found in the script library and test suite that were only for word expansion to use the {expand} syntax, and those [eval]'s that were used only to force direct string evaluation to [testevalex]. No updates done to the bundled pacakges, which may want to consider the timing of when they [package require Tcl 8.5]. Upon further reflection, it seems that the failing test basic-48.17.0 really is a bug, as performance/object safety was one of the motivators for TIP 157. Fixing it will require another bytecode, and perhaps opens an opportunity for the more ambitious bytecoders to look for the best solutions. - login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [2fe10d8f36] (rid 93146) by dkf on 2003-10-25 05:27:13:
- icomment:
Logged In: YES user_id=79902 I suspect that we could use a better compilation strategy than purely list concatenation, as that does a lot of object-churn. My idea goes something like this: Two new opcodes (though one might be simulatable using existing opcodes - I don't know for sure): INST_VERIFY_LIST and INST_EXPAND_STK (might want it in 1/4 forms). INST_VERIFY_LIST checks that the object on the top of the stack is a list; it *doesn't* pop anything off the stack, but it throws an error if it isn't a list at the stack top. INST_EXPAND_STK has one immediate value which is the number of words to evaluate (much as in INST_INVOKE_STK) but it also reads an additional object off the top of the stack (not counted?) which is a *sorted* list of integer indices to expand. Compilation proceeds as follows: Generate words for command execution as normal. If any of the words are expanded, add a trailing INST_VERIFY_LIST (required for correct functioning of basic-48.19.*) and append the index of the word within the whole command invokation to a list you are building. If at the end of the command you've got a non-empty list, push the list (which is guaranteed to be sorted ints) and use INST_EXPAND_STK instead of INST_INVOKE_STK. This simplifies the compiler *and* allows for a more efficient strategy for use of temporary space when building the actual list of argument objects. I proposed such a strategy for expansion compilation back in the discussions for TIP#144 on tcl-core
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [e75f0a6e89] (rid 104446) by msofer on 2003-10-26 04:18:46:
- icomment:
Logged In: YES user_id=148712 Having trouble with the endekalogue: all my attempts to document {expand} seem to require to incoporate the concept of 'list' to Tcl.n, a concept which was not necessary up to now. Does anybody have a simple proposal? I guess I deserve this ... - login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [9e9366a9f7] (rid 96497) by msofer on 2003-10-26 06:21:00:
- icomment:
File Added - 65434: Tcl.n.patch Logged In: YES user_id=148712 Attached my first attempt at Tcl.n revision for this Tip; RFC
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Add attachment "Tcl.n.patch" [821e29ee46] (rid 117176) by msofer on 2003-10-26 06:21:00.
Ticket change [0c74a7d494] (rid 114175) by msofer on 2003-10-26 19:32:47:
- icomment:
Logged In: YES user_id=148712 Doc proposal exposed in the wiki: http://mini.net/tcl/Dodekalogue
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [a99d0cd858] (rid 99178) by dgp on 2003-10-27 20:46:29:
- icomment:
Logged In: YES user_id=80530 dkf's outline has many similarities to what is done in the patch to support argument expansion during direct string evaluation.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [e6886dbae1] (rid 104307) by dgp on 2003-10-28 04:59:57:
- icomment:
File Deleted - 65324: File Added - 65603: tip157.patch Logged In: YES user_id=80530 New patch removes some objv shifting in Tcl_EvalEx.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [749c452f0d] (rid 105233) by dgp on 2003-10-29 04:45:36:
- icomment:
File Deleted - 65603: File Added - 65724: tip157.patch Logged In: YES user_id=80530 Latest patch defines and uses a new opcode INST_LIST_VERIFY to verify list validity before expansion with less cost than before.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Add attachment "tip157.patch" [919d1f4958] (rid 120646) by dgp on 2003-10-29 04:45:36.
Ticket change [65666cca0c] (rid 102540) by dgp on 2003-11-07 04:44:04:
- icomment:
Logged In: YES user_id=80530 Here's an alternative patch that emits lists of word indices to be expanded directly into the codestream (as new operand types OPERAND_ULIST1 or OPERANCE_ULIST4). New instructions INST_INVOKE_EXP1 and INST_INVOKE_EXP4 read the immediate index lists and perform expansion before going to a modified doInvocation to take care of the command evaluation. This patch corrects test basic-48.17.0, indicating proper object safety of expansion. I'm keeping the former patch registered this time, for sake of comparison by interested reviewers.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Add attachment "tip157-imm.patch" [dcc81599c9] (rid 114544) by dgp on 2003-11-07 04:44:04.
Ticket change [71fa930d05] (rid 100785) by dgp on 2003-11-07 04:44:05:
- icomment:
File Added - 66711: tip157-imm.patch
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Add attachment "tip157.patch.1" [af1d62e2ee] (rid 97750) by msofer on 2003-11-07 20:34:51.
Ticket change [3d5b12d0e7] (rid 121070) by msofer on 2003-11-07 20:34:51:
- icomment:
File Added - 66775: tip157.patch.1 Logged In: YES user_id=148712 Enclosing a new patch tip157.patch.1 This is a modification of dgp's tip157.patch, keeping the original logic of building the command to invoke as a list object at stacktop. The differences to the original are: - new INST_INVOKE_LIST that replaces the call to INST_EVAL_STK and fixes the object-safety bug - modification of INST_LCONCAT1 to improve efficiency. The list handling in the bcc code can (and will) be improved further; the hope is that the runtime penalty vs the approach in tip157-imm.patch will be small enough to justify using this simpler approach.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [420bd5ded3] (rid 116298) by msofer on 2003-11-07 20:35:18:
- title changed to: "TIP 157 implementation - {expand}"
Ticket change [1eeec5c661] (rid 91063) by dgp on 2003-11-08 05:46:57:
- icomment:
File Added - 66826: tip157-imm-2.patch Logged In: YES user_id=80530 Here's the next revision on the index list as immediates in the codestream approach. The execution of the INST_INVOKE_EXP* instructions are now simplified to not attempt complex "in-place" expansion. Instead expansion is done into the stack expansion space above the tosPtr. Refcount management is also left to the bytecode execution engine macros. This code should be considerably simpler to understand.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Add attachment "tip157-imm-2.patch" [6a2d0db075] (rid 128097) by dgp on 2003-11-08 05:46:57.
Ticket change [78473ffabd] (rid 89934) by msofer on 2003-11-10 09:00:47:
- icomment:
File Added - 66970: tip157.patch.2 Logged In: YES user_id=148712 Here's the 2nd revision of the "invoke list at stacktop" approach. Improved efficiency in building the list, reducing the memory churn.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [693ed3cba2] (rid 103218) by msofer on 2003-11-10 17:25:33:
- icomment:
Logged In: YES user_id=148712 Updated patch.2 (fix copy-paste error)
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [040bc0e3e1] (rid 119925) by msofer on 2003-11-10 17:25:34:
- icomment:
File Deleted - 66970: File Added - 66997: tip157.patch.2
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [f511e3157e] (rid 130046) by msofer on 2003-11-11 05:01:16:
- icomment:
Logged In: YES user_id=148712 Updated patch.2 - slight change, added comments.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [6b60243301] (rid 128323) by msofer on 2003-11-11 05:01:17:
- icomment:
File Deleted - 66997: File Added - 67065: tip157.patch.3
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [be50b12155] (rid 102053) by msofer on 2003-11-11 05:59:58:
- icomment:
Logged In: YES user_id=148712 oops - removing latest patch.3 (wrong), back to revised patch.2
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [d0f4b85f7e] (rid 113272) by msofer on 2003-11-11 05:59:59:
- icomment:
File Deleted - 67065: File Added - 67067: tip157.patch.2
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Add attachment "tip157-imm-3.patch" [62da16f601] (rid 92477) by dgp on 2003-11-14 05:13:54.
Ticket change [b5dd3432eb] (rid 125322) by dgp on 2003-11-14 05:13:54:
- icomment:
File Added - 67441: tip157-imm-3.patch Logged In: YES user_id=80530 here's another alternative patch, tip157-imm-3.patch It stores deltas between words need expansion as immediate bytes in the code stream. Also, it builds up the delta list in a Tcl_DString instead of a Tcl_ListObj for less memory allocation overhead. Also, unnecessary INST_LIST_VERIFY opcodes are left out. Could probably use more whitebox tests tuned to its particular branch points.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [6d9af056c8] (rid 128735) by dkf on 2003-11-14 06:22:09:
- icomment:
Logged In: YES user_id=79902 If the patch works, apply it. If there are optimizations to be done, they can be done later on.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [1718008a97] (rid 124823) by msofer on 2003-11-14 07:22:19:
- assignee changed to: "dgp"
- icomment:
Logged In: YES user_id=148712 I agree with donal: patch approved, apply to HEAD. I'll let you do it, as you mentioned a possible last round of changes. We can still think of alternative implementations afterwards.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
Ticket change [6f02a04091] (rid 100236) by vincentdarley on 2003-11-14 19:39:04:
- icomment:
Logged In: YES user_id=32170 NB. In the TIP archive, tip144 needs to be withdrawn, and tip157 needs to specify Tcl version 8.5 (not 9.0).
- login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"
- icomment:
Ticket change [e9ce22a21d] (rid 104870) by msofer on 2003-11-14 19:57:23:
- icomment:
File Deleted - 67067: File Added - 67480: tip157.patch.2
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Add attachment "tip157.patch.2" [1655acdd88] (rid 124702) by msofer on 2003-11-14 19:57:23.
Ticket change [3e7d6ea845] (rid 121279) by dkf on 2003-11-14 22:37:03:
- icomment:
Logged In: YES user_id=79902 TIPs updated
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Add attachment "827119.patch" [47e6117a1a] (rid 99787) by dgp on 2003-11-15 03:44:12.
Ticket change [68c74c818f] (rid 103124) by dgp on 2003-11-15 03:44:12:
- closedate changed to: "2003-11-14T20:44:12"
- closer changed to: "dgp"
- icomment:
Logged In: YES user_id=80530 File 827119.patch is the combined patch that is now being applied to the HEAD. Further optimization, additional tests, etc. can take place as ongoing development.
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Accepted"
- status changed to: "Closed"
- username: "dgp"
Ticket change [10c673362d] (rid 95021) by dgp on 2003-11-15 03:44:13:
- icomment:
File Added - 67522: 827119.patch
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [8fafe2be79] (rid 120316) by msofer on 2003-11-15 05:26:37:
- icomment:
Logged In: YES user_id=148712 Moved the discussion of the list-based alternative (tip157.patch.2) to [Patch 842446]
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment: