Tcl Source Code

Check-in [cc975c8c54]
Login

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

Overview
Comment:Add an assertion that checks the stack depth under TCL_COMPILE_DEBUG *before* stack cleanup. It currently triggers at several spots in the testsuite!
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cc975c8c54ef0e04e60464097cf09e768f2b10a5
User & Date: mig 2013-01-05 00:15:19
Context
2013-01-05
00:36
fix the new assertion, it should not trigger when an expansion is in progress check-in: 56be4365e0 user: mig tags: trunk
00:36
adjust stub library version number check-in: 5f32d735d7 user: jan.nijtmans tags: trunk
00:15
Add an assertion that checks the stack depth under TCL_COMPILE_DEBUG *before* stack cleanup. It curr... check-in: cc975c8c54 user: mig tags: trunk
2013-01-04
15:01
Fix memory leak in [format] compiler. check-in: 113b75cd58 user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclExecute.c.

251
252
253
254
255
256
257






258
259
260

261
262
263
264
265
266
267
 *	otherwise, push objResultPtr. If (result < 0), objResultPtr already
 *	has the correct reference count.
 *
 * We use the new compile-time assertions to cheack that nCleanup is constant
 * and within range.
 */







#define NEXT_INST_F(pcAdjustment, nCleanup, resultHandling) \
    do {							\
	TCL_CT_ASSERT((nCleanup >= 0) && (nCleanup <= 2));	\

	if (nCleanup == 0) {					\
	    if (resultHandling != 0) {				\
		if ((resultHandling) > 0) {			\
		    PUSH_OBJECT(objResultPtr);			\
		} else {					\
		    *(++tosPtr) = objResultPtr;			\
		}						\







>
>
>
>
>
>
|


>







251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
 *	otherwise, push objResultPtr. If (result < 0), objResultPtr already
 *	has the correct reference count.
 *
 * We use the new compile-time assertions to cheack that nCleanup is constant
 * and within range.
 */

#if TCL_COMPILE_DEBUG
#define CHECK_STACK() assert(CURR_DEPTH <= codePtr->maxStackDepth)
#else
#define CHECK_STACK()
#endif

#define NEXT_INST_F(pcAdjustment, nCleanup, resultHandling)	\
    do {							\
	TCL_CT_ASSERT((nCleanup >= 0) && (nCleanup <= 2));	\
	CHECK_STACK();						\
	if (nCleanup == 0) {					\
	    if (resultHandling != 0) {				\
		if ((resultHandling) > 0) {			\
		    PUSH_OBJECT(objResultPtr);			\
		} else {					\
		    *(++tosPtr) = objResultPtr;			\
		}						\
282
283
284
285
286
287
288
289

290
291
292
293
294
295
296
	    switch (nCleanup) {					\
	    case 1: goto cleanup1;				\
	    case 2: goto cleanup2;				\
	    }							\
	}							\
    } while (0)

#define NEXT_INST_V(pcAdjustment, nCleanup, resultHandling) \

    do {							\
	pc += (pcAdjustment);					\
	cleanup = (nCleanup);					\
	if (resultHandling) {					\
	    if ((resultHandling) > 0) {				\
		Tcl_IncrRefCount(objResultPtr);			\
	    }							\







|
>







289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
	    switch (nCleanup) {					\
	    case 1: goto cleanup1;				\
	    case 2: goto cleanup2;				\
	    }							\
	}							\
    } while (0)

#define NEXT_INST_V(pcAdjustment, nCleanup, resultHandling)	\
    CHECK_STACK();						\
    do {							\
	pc += (pcAdjustment);					\
	cleanup = (nCleanup);					\
	if (resultHandling) {					\
	    if ((resultHandling) > 0) {				\
		Tcl_IncrRefCount(objResultPtr);			\
	    }							\