Tcl Source Code

View Ticket
Login
Ticket UUID: 451858
Title: broken compilation trace
Type: Bug Version: None
Submitter: msofer Created on: 2001-08-16 23:37:05
Subsystem: 47. Bytecode Compiler Assigned To: msofer
Priority: 2 Severity:
Status: Closed Last Modified: 2001-09-17 18:55:08
Resolution: Fixed Closed By: msofer
    Closed on: 2001-09-17 11:55:08
Description:
Trace compilation is broken since at least tcl8.3.3 -
it doesn't print the bytecodes details.

Witness the following

[mig@mini tcl_NOP]$ tclsh
% info patch
8.3.3
% set tcl_traceCompile 2
2
% 
  Compiling: "history add {\n}"
%

versus

[mig@mini tcl_NOP]$ tclsh8.0
% info patch
8.0.5
%  set tcl_traceCompile 2
2
% 
Compiling: history add { ...

ByteCode 0x8059dc8, ref ct 1, epoch 0, interp
0x8049a10(epoch 0)
  Source "history add {\n}"
  Cmds 1, chars 15, inst 9, objs 3, aux 0, stk depth 3,
code/src 14.87
  Code 223 =
104(header)+9(inst)+83(objs)+0(exc)+0(aux)+4(cmd map)
  Commands 1:
      1: pc 0-7, source 0-14
  Command 1: "history add {\n}"
    (0) push1 0         # "history"
    (2) push1 1         # "add"
    (4) push1 2         # "\n"
    (6) invokeStk1 3 
    (8) done 

ByteCode 0x805d2d0, ref ct 1, epoch 0, interp
0x8049a10(epoch 0)
  Source "\n"
  Cmds 0, chars 1, inst 3, objs 1, aux 0, stk depth 1,
code/src 144.00
  Code 144 =
104(header)+3(inst)+24(objs)+0(exc)+0(aux)+0(cmd map)
    (0) push1 0         # ""
    (2) done 
%
User Comments: msofer added on 2001-09-17 18:55:08:

File Added - 10875: 451858.patch

Logged In: YES 
user_id=148712

The patch disables all compile and execution tracing
functionality in standard builds; TCL_COMPILE_DEBUG is now
necessary to enable it.

hobbs added on 2001-08-21 06:38:10:
Logged In: YES 
user_id=72656

the traces should be left out - eliminated as much as 
possible for the standard compile.  A #define should 
reenable them, but that should only be considered a 
debugging mode.  We shouldn't slow the core down one iota 
for more users who won't care about compilation tracing.

msofer added on 2001-08-19 09:10:21:
Logged In: YES 
user_id=148712

Apparently misassigned by mistake; reassigning the ticket to
myself.

stanton added on 2001-08-17 23:37:04:
Logged In: YES 
user_id=90875

If I recall correctly, the reason we disabled the feature 
in a default compile was to improve performance.  Compile 
tracing does add some overhead even when the trace level is 
turned down.  It was never intended to go out enabled by 
default, but we forgot to turn it off in the 8.0 release.

One possible rationale for leaving the level 1 feature on 
is that it is a relatively inexpensive way of verifying 
whether parts of a script are being compiled.  Not sure if 
it's all that useful in practice, but I can see someone 
making that argument.  Now, I don't remember if that was 
our reason for leaving it on, or if it was simply an 
oversight.  I'd be content to leave it alone or disable 
it.  I don't think it's a big deal either way.  Obviously 
the docs should be updated to reflect whatever decision is 
made.

msofer added on 2001-08-17 23:18:47:
Logged In: YES 
user_id=148712

The functionality has been disabled in the standard build
since tcl8.1 (CVS version 1.14 of tclCompile.c) - it is only
available if TCL_COMPILE_DEBUG is defined at compile time.

The basic compile tracing functionality [set
tcl_traceCompile 1] is available in the standard build. Both
are documented in the man pages (tclvars).

So, this may be the intended behaviour, it would just be a
docs bug ... 

Scott: you committed the change way back then. Do you
remember the rationale for this behaviour? Especially, why
keep only part of the functionality. 

You can reassign this ticket to me - assigning it to you as
RFC.

Attachments: