Artifacts Associated With Ticket fa6bf38d07
Ticket change [3e1359e670] (rid 174332) by sebres on 2019-08-26 14:02:29:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
Execution of byte-code disregards "return" command if some command or proc before would bump compiler epoch (cause recompile of a code in-between). PoC: <code><pre style="padding-left:10pt"> set i [interp create] $i eval {proc _recompile_ {} {rename set __set; rename __set set}} $i eval {puts A; puts B; return; puts C} $i eval {puts A; _recompile_; puts B; return; puts C} </pre></code> The last eval does not return before puts C. - foundin initialized to: ">= 8.6"
- is_private initialized to: "0"
- login: "sebres"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Critical"
- status initialized to: "Open"
- submitter initialized to: "sebres"
- subsystem initialized to: "47. Bytecode Compiler"
- title initialized to:
Execution of byte-code with recompile in-between disregards "return" command.
- type initialized to: "Bug"
Ticket change [1dc600aad5] (rid 174335) by sebres on 2019-08-26 14:03:31:
- login: "sebres"
- mimetype: "text/plain"
- priority changed to: "9 Immediate"
Ticket change [8978ea9d2b] (rid 174342) by sebres on 2019-08-26 14:44:10:
- icomment:
This is also not slave (interp-command) related issue, same with in main-interp within tclsh (compiled Tcl_RecordAndEval): <code><pre style="padding-left:10pt"> proc _recompile_ {} {rename set __set; rename __set set} puts A; _recompile_; puts B; return; puts C if 1 {puts A; _recompile_; puts B; return; puts C} set i 0; while {[incr i] < 10} {puts A; _recompile_; puts B; return; puts C} </pre></code> Just strange, the issue is not reproducible at all with <code>eval</code>, <code>namespace eval/inscope ::</code>, or if invoked like a proc. - login: "sebres"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [59edf89f80] (rid 174343) by sebres on 2019-08-26 15:41:18:
- icomment:
It looks like the issue is not restricted to "returnImm" instruction.<br/> Trying to check command "break" issued with: <code><pre style="padding-left:10pt"> % set i 0; while {[incr i] < 10} { puts A; _recompile_; puts B; break; puts C } A B invoked "break" outside of a loop" </pre></code> As assumed it seems to be NRE (because 8.5 was not affected), so possibly [c718302fcab3892c] causes that (so ISC peephole, e. g. NRE-related switch to direct invocation, is implemented not correct, or it got broken later with some further commits). - login: "sebres"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [674036341f] (rid 174376) by sebres on 2019-08-26 17:01:25:
- comment changed to:
Execution of byte-code after TEBC recompilation initiated from peephole breaks normal execution flow (e. g. disregards "return" or "break" commands) if some command or proc before would bump compiler epoch (cause recompile of a code in-between). PoC: <code><pre style="padding-left:10pt"> set i [interp create] $i eval {proc _recompile_ {} {rename set __set; rename __set set}} $i eval {puts A; puts B; return; puts C} $i eval {puts A; _recompile_; puts B; return; puts C} </pre></code> The last eval does not return before puts C. - login: "sebres"
- mimetype: "text/plain"
- title changed to:
Execution of byte-code with recompile in-between breaks normal execution flow (e. g. disregards "return" or "break" commands).
- comment changed to:
Ticket change [1607a466bb] (rid 174406) by dgp on 2019-08-26 19:58:16:
- icomment:
A piece of the puzzle is the special handling of exceptional return codes when (interp->numLevels == 0). The restarted evaluation of a recompile is probably not recreating the same value of that field as the first pass.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [0c823c9bfd] (rid 174407) by sebres on 2019-08-27 11:11:20:
- icomment:
Sure, just I think it is rather an after effect (looks like a continuation with direct execution, resp. <code>GetSrcInfoForPc()</code> starts retriving from wrong current command)...<br/> So for some reason in case of a while-loop (without a break), bumping of epoch causes "direct" execution starting from <code>incr i</code>, not by puts B. So it is called firstly after whole single iteration (while-body) is processed. Also debugging of other cases shows strange continuation points in instStartCmdFailed.
- login: "sebres"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [70779b90fa] (rid 174426) by sebres on 2019-08-27 12:12:29:
- icomment: "There is possibly a related issue [723a2f4ac3]"
- login: "sebres"
- mimetype: "text/x-fossil-wiki"
Ticket change [d1ce072aee] (rid 174432) by sebres on 2019-08-27 15:03:40:
- icomment:
Should be fixed now in branch [/timeline?r=bug-fa6bf38d07|bug-fa6bf38d07].
- login: "sebres"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Pending"
- icomment:
Ticket change [e8d99ff297] (rid 174436) by sebres on 2019-08-27 15:42:26:
- icomment:
After small review I provided another variant as [/timeline?r=bug-fa6bf38d07-v2|bug-fa6bf38d07-v2], with a simplification (used the same "fixed" (and faster) code for INST_EVAL_STK).
- login: "sebres"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [48154af919] (rid 174527) by sebres on 2019-08-28 14:42:08:
- closedate changed to: "2458724.11259354"
- closer changed to: "sebres"
- login: "sebres"
- mimetype: "text/plain"
- status changed to: "Closed"