Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2018-04-23
10:00 • Ticket [552ed5eac5] Strange discrepancy regarding INST_START_CMD in body of cycl... artifact: 1d19de2206 user: sebres
2017-01-12
17:43 • Ticket [931e4956b9] Interpreter command count not always incremented status ... artifact: cc898ddfe5 user: apnadkarni
17:41 • New ticket [931e4956b9]. artifact: 453def0871 user: apnadkarni

Interpreter command count not always incremented

Open931e4956b91b4545bb294a76faf82d13e11e74dbCreated 10 years agoUpdated 10 years ago
Descriptionplain2017-01-12 17:41:38
What exactly does [info cmdcount] count? Based on below, it does not seem to count either [incr] or [set] though it does count itself. (ip is a slave interp)

% ip eval {info cmdcount}  
377                        
% ip eval {incr i}         
1                          
% ip eval {incr i}         
2                          
% ip eval {incr i}         
3                          
% ip eval {incr i}         
4                          
% ip eval {incr i}         
5                          
% ip eval {info cmdcount}  
378                        
% ip eval {set x 1}        
1                          
% ip eval {set x 1}        
1                          
% ip eval {set x 1}        
1                          
% ip eval {set x 1}        
1                          
% ip eval {info cmdcount}  
379
Referenced by1
  • 1d19de2206Ticket [552ed5eac5] Strange discrepancy regarding INST_START_CMD in body of cycles if compiled with or without invocation in condition/iterator... status still Open with 3 other changes ticket2018-04-23 10:00:19
apnadkarniplain2017-01-12 17:43:00
Speculation by dgp on the chat:

[23:59]	apn	the [incr i] within the slave interpreter should increment cmdCount for that slave, no?
[23:59]	dgp	One increment happens in the "Dispatch" of any objCmdProc.
[23:59]	dgp	That captures all the "direct eval" of any command.
[00:00]	apn	That's in tclBasic.c
[00:00]	dgp	The other increment is in bytecode execution.
[00:00]	dgp	and has been #ifdef'ed to within an inch of its life.
[00:01]	dgp	and peepholed etc etc.
[00:01]	dgp	Quick, likely faulty analysis.....
[00:01]	dgp	Bytecode execution has given command counting task to INST_START_CMD
[00:02]	dgp	Over time INST_START_CMD was perceived as too much performance drag for too little value, so it's been suppressed in many situations.
[00:03]	dgp	So don't expect bytecode to get correct answers.
[00:03]	dgp	If not for the [interp limit], I'd say just ignore it.
[00:04]	dgp	take a look at the bytecode disassembly for more explorations.
[00:04]	apn	hmm, also turns out that [ip eval {set x 1; set x 1; info cmdcount}] does increment cmdCount correctly
[00:05]	apn	So it's almost like for a single command, INST_START_CMD gets skipped. Or something like that
[00:05]	dgp	"optimized"
Log in (anonymous is fine) to add a comment.