Tcl Source Code

Check-in [0fe6ceff5c]
Login

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

Overview
Comment:Decrement framePtr->tailcallNsPtr in Tcl_PopCallFrame.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-e593adf103-core-8
Files: files | file ages | folders
SHA3-256: 0fe6ceff5cdbea2e5613b0c24d60c5e8352f090253627f46f6bc2ccc4065016e
User & Date: pooryorick 2018-05-27 16:58:13
Context
2018-05-27
17:10
Be a little more concise in TclNRTailcallObjCmd. check-in: 2b12ca7eed user: pooryorick tags: bug-e593adf103-core-8
16:58
Decrement framePtr->tailcallNsPtr in Tcl_PopCallFrame. check-in: 0fe6ceff5c user: pooryorick tags: bug-e593adf103-core-8
2018-05-26
16:42
merge 8.7 check-in: 74f9541fc2 user: dgp tags: bug-e593adf103-core-8
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclBasic.c.

745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
    TclInitLimitSupport(interp);

    /*
     * Initialise the thread-specific data ekeko. Note that the thread's alloc
     * cache was already initialised by the call to alloc the interp struct.
     */

#if TCL_THREADS && defined(USE_THREAD_ALLOC)
    iPtr->allocCache = TclpGetAllocCache();
#else
    iPtr->allocCache = NULL;
#endif
    iPtr->pendingObjDataPtr = NULL;
    iPtr->asyncReadyPtr = TclGetAsyncReadyPtr();
    iPtr->deferredCallbacks = NULL;







|







745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
    TclInitLimitSupport(interp);

    /*
     * Initialise the thread-specific data ekeko. Note that the thread's alloc
     * cache was already initialised by the call to alloc the interp struct.
     */

#if (!defined(TCL_THREADS) || TCL_THREADS) && defined(USE_THREAD_ALLOC)
    iPtr->allocCache = TclpGetAllocCache();
#else
    iPtr->allocCache = NULL;
#endif
    iPtr->pendingObjDataPtr = NULL;
    iPtr->asyncReadyPtr = TclGetAsyncReadyPtr();
    iPtr->deferredCallbacks = NULL;
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
    Tcl_TraceVar2(interp, "tcl_precision", NULL,
	    TCL_GLOBAL_ONLY|TCL_TRACE_READS|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
	    TclPrecTraceProc, NULL);
#endif /* !TCL_NO_DEPRECATED */
    TclpSetVariables(interp);

#if TCL_THREADS
    /*
     * The existence of the "threaded" element of the tcl_platform array
     * indicates that this particular Tcl shell has been compiled with threads
     * turned on. Using "info exists tcl_platform(threaded)" a Tcl script can
     * introspect on the interpreter level of thread safety.
     */








|







961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
    Tcl_TraceVar2(interp, "tcl_precision", NULL,
	    TCL_GLOBAL_ONLY|TCL_TRACE_READS|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
	    TclPrecTraceProc, NULL);
#endif /* !TCL_NO_DEPRECATED */
    TclpSetVariables(interp);

#if !defined(TCL_THREADS) || TCL_THREADS
    /*
     * The existence of the "threaded" element of the tcl_platform array
     * indicates that this particular Tcl shell has been compiled with threads
     * turned on. Using "info exists tcl_platform(threaded)" a Tcl script can
     * introspect on the interpreter level of thread safety.
     */

8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
     * at the proper time.
     */

    if (objc > 1) {
        Tcl_Obj *listPtr;
        Namespace *nsPtr = iPtr->varFramePtr->nsPtr;

        /* The tailcall data is in a Tcl list: the first element is the
         * namespace, the rest the command to be tailcalled. */

        listPtr = Tcl_NewListObj(objc-1, objv+1);
        iPtr->varFramePtr->tailcallNsPtr = nsPtr;
	nsPtr->refCount++;
        iPtr->varFramePtr->tailcallCmdPtr = listPtr;
    }
    return TCL_RETURN;
}







<
<
<







8519
8520
8521
8522
8523
8524
8525



8526
8527
8528
8529
8530
8531
8532
     * at the proper time.
     */

    if (objc > 1) {
        Tcl_Obj *listPtr;
        Namespace *nsPtr = iPtr->varFramePtr->nsPtr;




        listPtr = Tcl_NewListObj(objc-1, objv+1);
        iPtr->varFramePtr->tailcallNsPtr = nsPtr;
	nsPtr->refCount++;
        iPtr->varFramePtr->tailcallCmdPtr = listPtr;
    }
    return TCL_RETURN;
}
8560
8561
8562
8563
8564
8565
8566


8567

8568
8569
8570
8571
8572
8573
8574

    /*
     * Perform the tailcall
     */

    TclMarkTailcall(interp);
    TclNRAddCallback(interp, TclNRReleaseValues, listPtr, NULL, NULL,NULL);


    iPtr->lookupNsPtr = (Namespace *) nsPtr;

    return TclNREvalObjv(interp, objc, objv, 0, NULL);
}

int
TclNRReleaseValues(
    ClientData data[],
    Tcl_Interp *interp,







>
>

>







8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574

    /*
     * Perform the tailcall
     */

    TclMarkTailcall(interp);
    TclNRAddCallback(interp, TclNRReleaseValues, listPtr, NULL, NULL,NULL);

    /* Reference count already incremented in TclSetTailcall. */
    iPtr->lookupNsPtr = (Namespace *) nsPtr;

    return TclNREvalObjv(interp, objc, objv, 0, NULL);
}

int
TclNRReleaseValues(
    ClientData data[],
    Tcl_Interp *interp,

Changes to generic/tclNamesp.c.

405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423


424
425
426
427
428
429
430
	if (framePtr->localCachePtr->refCount-- <= 1) {
	    TclFreeLocalCache(interp, framePtr->localCachePtr);
	}
	framePtr->localCachePtr = NULL;
    }

    /*
     * Decrement the namespace's count of active call frames. If the namespace
     * is "dying" and there are no more active call frames, call
     * Tcl_DeleteNamespace to destroy it.
     */

    /* Corresponds to refCount++ in Tcl_PushCallFrame */
    TclNsDecrRefCount(framePtr->nsPtr);
    framePtr->nsPtr = NULL;

    if (framePtr->tailcallNsPtr) {
	TclSetTailcall(interp, framePtr->tailcallNsPtr,
	    framePtr->tailcallCmdPtr);


    }
}

/*
 *----------------------------------------------------------------------
 *
 * TclPushStackFrame --







|
<
<









>
>







405
406
407
408
409
410
411
412


413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
	if (framePtr->localCachePtr->refCount-- <= 1) {
	    TclFreeLocalCache(interp, framePtr->localCachePtr);
	}
	framePtr->localCachePtr = NULL;
    }

    /*
     * Decrement the namespace's count of active call frames.


     */

    /* Corresponds to refCount++ in Tcl_PushCallFrame */
    TclNsDecrRefCount(framePtr->nsPtr);
    framePtr->nsPtr = NULL;

    if (framePtr->tailcallNsPtr) {
	TclSetTailcall(interp, framePtr->tailcallNsPtr,
	    framePtr->tailcallCmdPtr);
	TclNsDecrRefCount(framePtr->tailcallNsPtr);
	framePtr->tailcallNsPtr = NULL;
    }
}

/*
 *----------------------------------------------------------------------
 *
 * TclPushStackFrame --