Tcl Source Code

Check-in [4b0a6f7864]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:3484621 Invalidate bytecode when exec traces are added/removed from compiled cmd.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-4-branch
Files: files | file ages | folders
SHA1: 4b0a6f78649b52d5be4498a35e4a79a1c5ca6181
User & Date: dgp 2012-02-06 17:21:56
Context
2012-02-09
14:57
3484402 Correct Off-By-One error appending unicode. Thanks to Poor Yorick. Also corrected test for w... check-in: f57b5ba48d user: dgp tags: core-8-4-branch
2012-02-07
20:28
3484402 Correct Off-By-One error appending unicode. Thanks to Poor Yorick. Also converted some memc... Closed-Leaf check-in: ba9a1d9ddb user: dgp tags: bug-3484402
2012-02-06
17:34
3485022 TclCompileEnsemble() avoid compile when exec traces set. check-in: 37f719ad40 user: dgp tags: core-8-5-branch
17:21
3484621 Invalidate bytecode when exec traces are added/removed from compiled cmd. check-in: 4b0a6f7864 user: dgp tags: core-8-4-branch
2012-02-03
22:56
mingw doesn't have LABEL_SECURITY_INFORMATION definition check-in: 0a780ecc03 user: jan.nijtmans tags: core-8-4-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.






1
2
3
4
5
6
7




2012-02-02  Jan Nijtmans  <[email protected]>

	* generic/tclUniData.c: [Frq 3464401] Support Unicode 6.1
	* generic/regc_locale.c:

2012-02-02  Don Porter  <[email protected]>

>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
2012-02-06  Don Porter  <[email protected]>

	* generic/tclCmdMZ.c:	[Bug 3484621] Invalidate bytecode when exec
	* tests/trace.test:	traces are added/removed from compiled cmd.

2012-02-02  Jan Nijtmans  <[email protected]>

	* generic/tclUniData.c: [Frq 3464401] Support Unicode 6.1
	* generic/regc_locale.c:

2012-02-02  Don Porter  <[email protected]>

Changes to generic/tclCmdMZ.c.

4015
4016
4017
4018
4019
4020
4021
4022

4023









4024
4025
4026
4027
4028
4029
4030
....
4119
4120
4121
4122
4123
4124
4125









4126
4127
4128
4129
4130
4131
4132
    tracePtr->traceProc = proc;
    tracePtr->clientData = clientData;
    tracePtr->flags = flags & (TCL_TRACE_RENAME | TCL_TRACE_DELETE
			       | TCL_TRACE_ANY_EXEC);
    tracePtr->nextPtr = cmdPtr->tracePtr;
    tracePtr->refCount = 1;
    cmdPtr->tracePtr = tracePtr;
    if (tracePtr->flags & TCL_TRACE_ANY_EXEC) {

        cmdPtr->flags |= CMD_HAS_EXEC_TRACES;









    }
    return TCL_OK;
}
 
/*
 *----------------------------------------------------------------------
 *
................................................................................
	    }
	}
	/* 
	 * None of the remaining traces on this command are execution
	 * traces.  We therefore remove this flag:
	 */
	cmdPtr->flags &= ~CMD_HAS_EXEC_TRACES;









    }
}
 
/*
 *----------------------------------------------------------------------
 *
 * TraceCommandProc --






|
>

>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>







4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
....
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
    tracePtr->traceProc = proc;
    tracePtr->clientData = clientData;
    tracePtr->flags = flags & (TCL_TRACE_RENAME | TCL_TRACE_DELETE
			       | TCL_TRACE_ANY_EXEC);
    tracePtr->nextPtr = cmdPtr->tracePtr;
    tracePtr->refCount = 1;
    cmdPtr->tracePtr = tracePtr;
    if ((tracePtr->flags & TCL_TRACE_ANY_EXEC) 
	    && !(cmdPtr->flags & CMD_HAS_EXEC_TRACES)) {
        cmdPtr->flags |= CMD_HAS_EXEC_TRACES;

	/*
	 * Bug 3484621: New execution trace means we no longer compile
	 * this command if we normally would.  Invalidate bytecode.
	 */

	if (cmdPtr->compileProc != NULL) {
	    ((Interp *)interp)->compileEpoch++;
	}
    }
    return TCL_OK;
}
 
/*
 *----------------------------------------------------------------------
 *
................................................................................
	    }
	}
	/* 
	 * None of the remaining traces on this command are execution
	 * traces.  We therefore remove this flag:
	 */
	cmdPtr->flags &= ~CMD_HAS_EXEC_TRACES;

	/*
	 * Bug 3484621: No more execution trace means we can compile
	 * the command again.  If we will, invalidate bytecode.
	 */

	if (cmdPtr->compileProc != NULL) {
	    ((Interp *)interp)->compileEpoch++;
	}
    }
}
 
/*
 *----------------------------------------------------------------------
 *
 * TraceCommandProc --

Changes to tests/trace.test.

2399
2400
2401
2402
2403
2404
2405

































2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
    unset -nocomplain log first second
    rename dummy {}
    rename stepTraceHandler {}
    rename cmdTraceHandler {}
    rename isTracedInside_1 {}
    rename isTracedInside_2 {}
} -result ok


































# Delete procedures when done, so we don't clash with other tests
# (e.g. foobar will clash with 'unknown' tests).
catch {rename foobar {}}
catch {rename foo {}}
catch {rename bar {}}

# Unset the varaible when done
catch {unset info}

# cleanup
::tcltest::cleanupTests
return






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>













2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
    unset -nocomplain log first second
    rename dummy {}
    rename stepTraceHandler {}
    rename cmdTraceHandler {}
    rename isTracedInside_1 {}
    rename isTracedInside_2 {}
} -result ok

test trace-39 {bug #3484621: tracing Bc'ed commands} -setup {
    set ::traceLog 0
    set ::traceCalls 0
    set ::bar [list 0 1 2 3]
    set res {}
    proc dotrace args {
        incr ::traceLog
    }
    proc foo {} {
        incr ::traceCalls
        # choose a BC'ed command that is 'unlikely' to interfere with tcltest's
        # internals
        lset ::bar 1 2
    }
} -body {
    foo
    lappend res $::traceLog

    trace add execution lset enter dotrace
    foo
    lappend res $::traceLog

    trace remove execution lset enter dotrace
    foo
    lappend res $::traceLog

    linsert $res 0 $::traceCalls |
} -cleanup {
    unset ::traceLog ::traceCalls ::bar res
    rename dotrace {}
    rename foo {}
} -result {3 | 0 1 1}

# Delete procedures when done, so we don't clash with other tests
# (e.g. foobar will clash with 'unknown' tests).
catch {rename foobar {}}
catch {rename foo {}}
catch {rename bar {}}

# Unset the varaible when done
catch {unset info}

# cleanup
::tcltest::cleanupTests
return