Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2024-03-13
00:13 • Closed ticket [1acd172c42]: Ensemble compilation leads to change in "unknow... artifact: ba2f723e35 user: sebres
2024-03-12
22:41 • Open ticket [1acd172c42]. artifact: cbd7774730 user: sebres
21:50 • Closed ticket [1acd172c42]. artifact: db44fe5beb user: sebres
21:44
fixes [1acd172c424b57c9]: restored ensemble compilation, fixed TCL_ENSEMBLE_PREFIX (restores default... check-in: f665afd65e user: sebres tags: sebres-9-0-clock-speedup-cr2
19:30 • Ticket [1acd172c42] Ensemble compilation leads to change in "unknown" ... artifact: 367dfe0b97 user: sebres
19:20
fixes [1acd172c424b57c9]: there is only one case where a subcommand may be ambiguous (as a prefix), ... closed check-in: 5984cb59e7 user: sebres tags: bug-1acd172c424b57c9-p1
14:18 • Ticket [1acd172c42] Ensemble compilation leads to change in "unknown" ... artifact: 6ddc922fb1 user: sebres
2024-03-11
11:02
Fix [1acd172c424b57c9] (by just reverting the change causing this). Not crucial for TIP #688. Also, ... check-in: 3a21968956 user: jan.nijtmans tags: sebres-9-0-clock-speedup-cr2
10:31 • Ticket [1acd172c42] Ensemble compilation leads to change in "unknown" ... artifact: 4fc51f1c16 user: jan.nijtmans
10:21
Demonstrate [1acd172c42]: Ensemble compilation leads to change in "unknown" behavior closed check-in: fbfeae2379 user: jan.nijtmans tags: bug-1acd172c42
10:19 • New ticket [1acd172c42] Ensemble compilation leads to change in "unknown&qu... artifact: 6f84a9e048 user: jan.nijtmans

Ensemble compilation leads to change in "unknown" behavior

Closed / Fixed1acd172c424b57c947df0024c5de16fd59207499Created 3 years agoUpdated 3 years ago
Descriptionwiki2024-03-11 10:19:43
Testcases in TIP #688 implementation show a different error-message for http::idna unknown command handling compared to trunk. This shows something unexpected is happening:
==== http-idna-1.2.0 IDNA package: basics FAILED
==== Contents of test case:

::tcl::idna ?

---- Result was: unknown subcommand "?": must be decode, encode, puny, or version ---- Result should have been (exact matching): unknown or ambiguous subcommand "?": must be decode, encode, puny, or version ==== http-idna-1.2.0 FAILED

Referenced by1
  • fbfeae2379Demonstrate [1acd172c42]: Ensemble compilation leads to change in "unknown" behavior check-in2024-03-11 10:21:08
jan.nijtmans Ticket [1acd172c42]: 3 changes [History diff]2024-03-11 10:31:03
sebresmarkdown2024-03-12 14:18:51

I don't know whether it is the same issue (however all versions 8.6+ seem to affected), but since it's pretty reproducible in sebres-8-6-clock-speedup-cr2 (where the compilation of mapped ensemble still there), we can combine both things in the same ticket.

The issue:

interp alias {} dis {} ::tcl::unsupported::disassemble
proc test {} { clock format 0 -too-few-options-4-test }; 
time {
  puts [list [catch test msg] $msg]; # puts [dis proc test]
} 2
produce:
1 {wrong # args: should be "clock format clockval|-now ?-format string? ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"}
1 {wrong # args: should be "::tcl::clock::format clockval|-now ?-format string? ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"}
So rewrite ensemble stops to work after epoch change (here caused by auto load of ::tcl::clock stubs), see 2nd output.

The compilation of ensemble (either compile of INST_INVOKE_REPLACE or recompilation TEBC after epoch switch) seems to have a bug, which causes that TclInitRewriteEnsemble would be not executed at some point anymore. Uncommenting of dissassemble shows that the epoch changes and proc-code indeed losses INST_INVOKE_REPLACE instruction hereafter.

Non-compiled ensemble does it correct, because in that case TclInitRewriteEnsemble is invoked from NRE by invocation of main ensemble command.

sebreswiki2024-03-12 19:30:15

[5984cb59e7] doesn't fix initial issue, but makes the error message proper (there is only one case where subcommand can be ambiguous), so it'd then behave equal to non-compiled ensemble.

For the second part (with INST_INVOKE_REPLACE) I have also a solution - previously, INST_INVOKE_REPLACE was never emitted for compiled ensembles (probably because one doesn't expects they will fail). I found the way to emit it instead of simple invocation.

sebreswiki2024-03-12 21:50:49

You were right with side effect: setting of flags for namespace compilation removed TCL_ENSEMBLE_PREFIX flag (so such ensembles, inclusive clock, didn't allow prefixes completely).

Fixed in [f665afd65e] together with correct compilation of INST_INVOKE_REPLACE for ensemble commands.
There is also as expected no speed regression anymore.

Shall we add regression test for prefixes, like [clock f 0]?

sebreswiki2024-03-12 22:41:05

Hmm... somehow the performance regression is back...
Searching for the issue.

sebreswiki2024-03-13 00:13:41

The regression was only for not fully compiled commands, probably by an overhead similar to [3485833fffffffffffff], therefore the compilation with INST_INVOKE_REPLACE was a bad idea.

Ultimately fixed now in [e535d3edc6305d23], that partially reverts [f665afd65ee7a5f9] and now do ensemble compilation for clock only.

The "wrong # args" syntax adjusted for subcommands to provide proper "clock ..." usage by failures during compiled invocation.

The ensemble still supports prefixes, test-cases pass too.

Log in (anonymous is fine) to add a comment.