Tcl Source Code

Check-in [51f9d8af10]
Login

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

Overview
Comment:Fix a bug where global precompiled code (A) called from a precompiled procedure causes the core to recompile (A), triggering the trap laid inside, i.e. 'error "called a copy of compiled code"'.
Example
----------------------ex1.tcl
proc init {} {
    source ex2.tcl
}
init
----------------------ex2.tcl
puts a
----------------------

When run as precompiled code the 'puts a' is not executed, only the trap.

Fixed by enclosing the offending code into a guard which prevents its execution for precompiled code. The change passes the entire testsuite.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 51f9d8af1041fead7e5e896e16f2704c7d257a06
User & Date: andreask 2011-11-21 18:23:16
Original Comment: Fix a bug where global precompiled code (A) called from a precompiled procedure causes the core to recompile (A), triggering the trap laid inside, i.e. 'error "called a copy of compiled code"'.

Example ----------------------ex1.tcl proc init {} { source ex2.tcl } init ----------------------ex2.tcl puts a ----------------------

When run as precompiled code the 'puts a' is not executed, only the trap.

Fixed by enclosing the offending code into a guard which prevents its execution for precompiled code. The change passes the entire testsuite.

Context
2011-11-22
08:30
[Bug 2935503] Windows: file mtime sets wrong time (VS2005+ only) check-in: bc67d4f61a user: jan.nijtmans tags: trunk
2011-11-21
18:23
Fix a bug where global precompiled code (A) called from a precompiled procedure causes the core to ... check-in: 51f9d8af10 user: andreask tags: trunk
18:12
Fixed typo in a comment. check-in: 0a6cf58d8f user: andreask tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclExecute.c.

1648
1649
1650
1651
1652
1653
1654

1655
1656
1657
1658
1659
1660
1661
1662

1663
1664
1665
1666
1667
1668
1669
		}
		codePtr->compileEpoch = iPtr->compileEpoch;
	    } else {
		goto recompileObj;
	    }
	}


	if (codePtr->procPtr == NULL) {
	    /*
	     * Check that any compiled locals do refer to the current proc
	     * environment! If not, recompile.
	     */

	    if (codePtr->localCachePtr != iPtr->varFramePtr->localCachePtr) {
		goto recompileObj;

	    }
	}

	/*
	 * #280.
	 * Literal sharing fix. This part of the fix is not required by 8.4
	 * nor 8.5, because they eval-direct any literals, so just saving the







>
|
|
|
|
|

|
|
>







1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
		}
		codePtr->compileEpoch = iPtr->compileEpoch;
	    } else {
		goto recompileObj;
	    }
	}

	if (!(codePtr->flags & TCL_BYTECODE_PRECOMPILED)) {
	    if (codePtr->procPtr == NULL) {
		/*
		 * Check that any compiled locals do refer to the current proc
		 * environment! If not, recompile.
		 */

		if (codePtr->localCachePtr != iPtr->varFramePtr->localCachePtr) {
		    goto recompileObj;
		}
	    }
	}

	/*
	 * #280.
	 * Literal sharing fix. This part of the fix is not required by 8.4
	 * nor 8.5, because they eval-direct any literals, so just saving the