|
2009-03-20
| ||
| 06:34 | • Closed ticket [2649975fff]: bizarre interaction of uplevel and tailcall plus... artifact: 6cf443492a user: msofer | |
|
2009-03-17
| ||
| 16:17 | • Ticket [2649975fff]: 4 changes artifact: d8cec8e608 user: dkf | |
| 06:25 | • Ticket [2649975fff]: 1 change artifact: bf20a81ce9 user: dkf | |
| 06:24 | • Ticket [2649975fff]: 4 changes artifact: d873df3eeb user: dkf | |
| 06:21 | • Ticket [2649975fff]: 4 changes artifact: 12ce3863b7 user: dkf | |
| 06:21 | • Add attachment bug2.tcl to ticket [2649975fff] artifact: 6af8ba167f user: dkf | |
| 05:50 | • Ticket [2649975fff] bizarre interaction of uplevel, tailcall, method invocation<... artifact: a49518d207 user: dkf | |
| 05:38 | • Ticket [2649975fff]: 4 changes artifact: 4b7bf659ee user: dkf | |
|
2009-03-16
| ||
| 20:42 | • Ticket [2649975fff]: 6 changes artifact: f538416ee2 user: dkf | |
|
2009-03-01
| ||
| 06:20 | • Ticket [2649975fff]: 4 changes artifact: 19953ae864 user: kennykb | |
| 06:20 | • Add attachment bugg.tcl to ticket [2649975fff] artifact: b5b8f898a1 user: kennykb | |
|
2009-02-28
| ||
| 23:20 | • New ticket [2649975fff] bizarre interaction of uplevel, tailcall, method invocat... artifact: 97fa3f30c2 user: kennykb | |
bizarre interaction of uplevel and tailcall
Closed / Fixed2649975fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2009-02-28 23:20:34
I'm struggling to come up with a smaller example of this
problem; it's quite nasty.
When the attached 'bugg.tcl' script is run, it
produces the output,
v should have been found at global level but was found in bar's method bravo
Removing the line:
proc dump args {}
from the script makes it print a play-by-play analysis of what happened.
It appears that everything is working fine right up to the very end, when the last [tailcall] invokes
::grill create betty
That constructor runs at level 2, despite having been tailcalled from level 1, and causing [upvar 1 v w] to resolve in the wrong callframe.
kennykbplain2009-03-01 06:20:35
File Added - 315619: bugg.tcl
dkfplain2009-03-16 20:42:59
Confirmed with HEAD. At the offending point (just before doing 'set resolution $w' in grill's constructor) doing an 'uplevel 1 dump' produces this output: 1: ::barney bravo That would seem to indicate that we're somehow managing to not stick within the constraints of the [uplevel]ed stack! I have no idea at all how that could possibly happen! Help!
dkfplain2009-03-17 05:38:01
File Added - 318108: bug2.tcl Here's a simplified version that exhibits the same problem, but with less gunk in the way. Note that it does not include the puzzling code from the original that wasn't hitting the problem... File Added: bug2.tcl
dkfplain2009-03-17 05:50:08
Evidence! In my script, in procedure 'bravo', changing
uplevel 1 [list delta ::betty]
to
uplevel 1 delta ::betty
makes the problem go away.
dkfplain2009-03-17 06:21:29
File Deleted - 318108: File Added - 318114: bug2.tcl This version also exhibits the bug and doesn't use TclOO... File Added: bug2.tcl
dkfplain2009-03-17 06:24:05
problem seems to be that tailcall doesn't work right from within a procedure called by a pure-list uplevel body
dkf Ticket [2649975fff]: 1 change
[History diff]2009-03-17 06:25:04
dkfplain2009-03-17 16:17:35
Having slept on it, I think the issue is related to the fact that TclNREvalObjEx-list doesn't push the same callbacks as TclNREvalObjEx-string. Respectively:
TclNREvalObjEx-list:
TEOEx_ListCallback
NRCommand
NRRunObjProc
TclNREvalObjEx-string:
TEOEx_ByteCodeCallback
NRCallTEBC
According to what I can (and can't) see in the code, the issue might be that NRCommand doesn't do tailcall processing; that's only done in TEBC (which doesn't get called at this level on the canonical-list route).
msoferplain2009-03-20 06:34:40
allow_comments - 1 These two examples were added to tests/tailcall.test
Log in (anonymous is fine) to add a comment.
Attachments:
- bug2.tcl [download] added by dkf on 2009-03-17 06:21:29. [details]
- bugg.tcl [download] added by kennykb on 2009-03-01 06:20:35. [details]