diff options
author | andreas_kupries <akupries@shaw.ca> | 2001-12-05 18:22:24 (GMT) |
---|---|---|
committer | andreas_kupries <akupries@shaw.ca> | 2001-12-05 18:22:24 (GMT) |
commit | c2a8f646627f4cec5a76810a5b59d17229c5eec6 (patch) | |
tree | c99bcc14812bc67defd3e90e776b514766e0e574 | |
parent | 8c077c7737d8f145bda783f4f6ae7b66660d5c3d (diff) | |
download | tcl-c2a8f646627f4cec5a76810a5b59d17229c5eec6.zip tcl-c2a8f646627f4cec5a76810a5b59d17229c5eec6.tar.gz tcl-c2a8f646627f4cec5a76810a5b59d17229c5eec6.tar.bz2 |
* NOTES: Updated to explain the usage of the various macros
upfront. The original contents remain and are declared to be the
scratchpad.
* tclCmdMZ.c:
* tclCompCmds.c:
* tclCompile.c:
* tclEvent.c:
* tclExecute.c:
* tclNamesp.c:
* tclParse.c:
* tclProc.c:
* tclUtil.c: More places using TCL_STRUCT_ON_HEAP.
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | NOTES | 99 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 10 | ||||
-rw-r--r-- | generic/tclCompCmds.c | 11 | ||||
-rw-r--r-- | generic/tclCompile.c | 7 | ||||
-rw-r--r-- | generic/tclEvent.c | 10 | ||||
-rw-r--r-- | generic/tclExecute.c | 11 | ||||
-rw-r--r-- | generic/tclNamesp.c | 41 | ||||
-rw-r--r-- | generic/tclParse.c | 7 | ||||
-rw-r--r-- | generic/tclProc.c | 19 | ||||
-rw-r--r-- | generic/tclUtil.c | 10 |
11 files changed, 207 insertions, 38 deletions
@@ -1,3 +1,19 @@ +2001-12-05 Andreas Kupries <andreas_kupries@users.sourceforge.net> + + * NOTES: Updated to explain the usage of the various macros + upfront. The original contents remain and are declared to be the + scratchpad. + + * tclCmdMZ.c: + * tclCompCmds.c: + * tclCompile.c: + * tclEvent.c: + * tclExecute.c: + * tclNamesp.c: + * tclParse.c: + * tclProc.c: + * tclUtil.c: More places using TCL_STRUCT_ON_HEAP. + 2001-12-04 Andreas Kupries <andreas_kupries@users.sourceforge.net> * NOTES: @@ -17,8 +33,8 @@ * tclParseExpr.c: * tclScan.c: * tclUnixChan.c: Adapted to changed macro names, added some more - places their structures go on the heap instead of the stacke - stack. Fixed a problem with TCL_FMT_STATIC_FLOATBUFFER_SZ which + places there structures go on the heap instead of the stack. + Fixed a problem with TCL_FMT_STATIC_FLOATBUFFER_SZ which caused the interp to crash when actually used to reduce the usage of the stack. @@ -1,4 +1,81 @@ +------------------------------------------------------------------------ +Description of the new macros to control feature exclusion and +stack handling +------------------------------------------------------------------------ + +All the macros reside in "generic/tclInt.h" and can be set in the +build environment. Especially the macros controlling usage of stack +are setup in such a way that a value defined in the build environment +takes priority over the value defined in the header. + +Feature exclusion. Simply define any of the macros below to exclude +the associated feature of the core. + + TCL_NO_SOCKETS /* Disable "tcp" channel driver */ + TCL_NO_TTY /* Disable "tty" channel driver */ + TCL_NO_PIPES /* Disable "pipe" channel driver */ + TCL_NO_PIDCMD /* Disable "pid" command */ + TCL_NO_NONSTDCHAN /* Disable creation of channels beyond std* */ + TCL_NO_CHANNELCOPY /* Disable channel copying, C/Tcl [fcopy] */ + TCL_NO_CHANNEL_READ /* Disable Tcl_ReadChars, [read] */ + TCL_NO_CHANNEL_EOF /* Disable [eof] */ + TCL_NO_CHANNEL_CONFIG /* Disable [fconfigure] and Tcl_GetChannelOption */ + TCL_NO_CHANNEL_BLOCKED /* Disable [fblocked] */ + TCL_NO_FILEEVENTS /* Disable [fileevent] and underlying APIs */ + TCL_NO_FILESYSTEM /* Disable everything related to the filesystem */ + TCL_NO_LOADCMD /* Disable [load] and machinery below */ + TCL_NO_SLAVEINTERP /* No slave interp's */ + TCL_NO_CMDALIASES /* No command aliases */ + + MODULAR_TCL /* All of the above */ + +Controlling the stack. Define TCL_STRUCT_ON_HEAP to switch a number a +of structures to allocation off the heap. The other macros are numeric +and define how many variables of a kind are placed on the stack by the +functions using the macros. + + TCL_STRUCT_ON_HEAP /* Allocate temp. big structures off the heap */ + +* TCL_FMT_STATIC_FLOATBUFFER_SZ 320 /* size of various information placed */ + TCL_FMT_STATIC_VALIDATE_LIST 16 /* on the stack */ +* TCL_FOREACH_STATIC_ARGS 9 +* TCL_FOREACH_STATIC_LIST_SZ 4 + TCL_FOREACH_STATIC_VARLIST_SZ 5 +* TCL_RESULT_APPEND_STATIC_LIST_SZ 16 + TCL_MERGE_STATIC_LIST_SZ 20 +* TCL_PROC_STATIC_CLOCALS 20 + TCL_PROC_STATIC_ARGS 20 + TCL_INVOKE_STATIC_ARGS 20 + TCL_EVAL_STATIC_VARCHARS 30 + TCL_STATS_COUNTERS 10 + TCL_LSORT_STATIC_MERGE_BUCKETS 30 + +* TCL_DSTRING_STATIC_SIZE 200 /* Exception: Resides in "tcl.h" */ + +Only the macros marked by '*' have been tested so far (-Dxxx=1). This +means that usage of the other macros may result in a crash +(FLOATBUFFER... for example did for while). + +It is advisable to use "-O" when compiling the core so that the +compiler optimizes the allocation of local variables on the stack, +i.e. collapsing variables with non-overlapping lifetimes into one +memory location. + + + + +------------------------------------------------------------------------ +------------------------------------------------------------------------ +------------------------------------------------------------------------ + + Scratchpad + Everything below may change at will. + +------------------------------------------------------------------------ +------------------------------------------------------------------------ +------------------------------------------------------------------------ + Pre-notes The cutting of the channel system is not as clean as I would like @@ -257,3 +334,25 @@ TclObjInterpProc TclInvokeStringCommand TCL_INVOKE_STATIC_ARGS => 20 x char* = 80 + +TclExecuteByte + Uses 868 btes of stack. where ? .... + compiler places all local variables immediately on stack, + independent of where defined (i.e. even variables declared in sub + scopes are placed immediately.) + 868 -> /4 about 217 variables ... Yes, that it is on the order of + variables declared in this behemoth + + Why variables with non-intersecting lieftimes collapsed into + one memory location ? ... Ok, compilation was just -g, without + any optimizations ... + + Compile -g -O => 480 bytes stack + compile -g -O2 => 460 bytes stack + + ! Ok compiling the whole instrumented core with -g -O to + get standard stack usage numbers. + + => Have to comile baseline with that as well. + +Also look for variable decl. hidden in intenrl blocks. ... diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 3af4aad..799fd1a 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.26.2.5.2.1 2001/11/28 17:58:35 andreas_kupries Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.26.2.5.2.2 2001/12/05 18:22:25 andreas_kupries Exp $ */ #include "tclInt.h" @@ -2770,12 +2770,13 @@ TraceVarProc(clientData, interp, name1, name2, flags) int flags; /* OR-ed bits giving operation and other * information. */ { - Tcl_SavedResult state; + TEMP (Tcl_SavedResult) state; TraceVarInfo *tvarPtr = (TraceVarInfo *) clientData; char *result; int code; Tcl_DString cmd; + NEWTEMP (Tcl_SavedResult, state); result = NULL; if (tvarPtr->errMsg != NULL) { ckfree(tvarPtr->errMsg); @@ -2810,7 +2811,7 @@ TraceVarProc(clientData, interp, name1, name2, flags) * the command. We discard any object result the command returns. */ - Tcl_SaveResult(interp, &state); + Tcl_SaveResult(interp, REF (state)); code = Tcl_Eval(interp, Tcl_DStringValue(&cmd)); if (code != TCL_OK) { /* copy error msg to result */ @@ -2823,7 +2824,7 @@ TraceVarProc(clientData, interp, name1, name2, flags) result = tvarPtr->errMsg; } - Tcl_RestoreResult(interp, &state); + Tcl_RestoreResult(interp, REF (state)); Tcl_DStringFree(&cmd); } @@ -2834,6 +2835,7 @@ TraceVarProc(clientData, interp, name1, name2, flags) } ckfree((char *) tvarPtr); } + RELTEMP (state); return result; } diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index ec7f430..4b56240 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompCmds.c,v 1.5.6.2 2001/12/04 21:52:08 andreas_kupries Exp $ + * RCS: @(#) $Id: tclCompCmds.c,v 1.5.6.3 2001/12/05 18:22:25 andreas_kupries Exp $ */ #include "tclInt.h" @@ -1330,9 +1330,10 @@ TclCompileIncrCmd(interp, parsePtr, envPtr) char *name, *elName, *p; int nameChars, elNameChars, haveImmValue, immValue, localIndex, i, code; int maxDepth = 0; - char buffer[160]; + STRING (160, buffer); NEWTEMP (Tcl_Parse,elemParse); + NEWSTR (160, buffer); envPtr->maxStackDepth = 0; if ((parsePtr->numWords != 2) && (parsePtr->numWords != 3)) { @@ -1547,6 +1548,7 @@ TclCompileIncrCmd(interp, parsePtr, envPtr) Tcl_FreeParse(REF (elemParse)); } RELTEMP (elemParse); + RELTEMP (buffer); envPtr->maxStackDepth = maxDepth; return code; } @@ -1748,11 +1750,14 @@ TclCompileSetCmd(interp, parsePtr, envPtr) *(elName+elNameChars) = ')'; gotElemParse = 1; if ((code != TCL_OK) || (ITEM (elemParse,numWords) > 1)) { - char buffer[160]; + STRING (160, buffer); + NEWSTR (160, buffer); + sprintf(buffer, "\n (parsing index for array \"%.*s\")", TclMin(nameChars, 100), name); Tcl_AddObjErrorInfo(interp, buffer, -1); code = TCL_ERROR; + RELTEMP (buffer); goto done; } else if (ITEM (elemParse,numWords) == 1) { code = TclCompileTokens(interp, ITEM (elemParse,tokenPtr)+1, diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 88b1926..ba7a029 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.c,v 1.20.2.1.2.2 2001/12/04 21:52:08 andreas_kupries Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.20.2.1.2.3 2001/12/05 18:22:25 andreas_kupries Exp $ */ #include "tclInt.h" @@ -1628,17 +1628,19 @@ LogCompilationInfo(interp, script, command, length) int length; /* Number of bytes in command (-1 means * use all bytes up to first null byte). */ { - char buffer[200]; + STRING (200, buffer); register char *p; char *ellipsis = ""; Interp *iPtr = (Interp *) interp; + NEWSTR (200, buffer); if (iPtr->flags & ERR_ALREADY_LOGGED) { /* * Someone else has already logged error information for this * command; we shouldn't add anything more. */ + RELTEMP (buffer); return; } @@ -1668,6 +1670,7 @@ LogCompilationInfo(interp, script, command, length) sprintf(buffer, "\n while compiling\n\"%.*s%s\"", length, command, ellipsis); Tcl_AddObjErrorInfo(interp, buffer, -1); + RELTEMP (buffer); } /* diff --git a/generic/tclEvent.c b/generic/tclEvent.c index c72317d..0a18529 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclEvent.c,v 1.8.2.5.2.1 2001/11/28 17:58:35 andreas_kupries Exp $ + * RCS: @(#) $Id: tclEvent.c,v 1.8.2.5.2.2 2001/12/05 18:22:25 andreas_kupries Exp $ */ #include "tclInt.h" @@ -270,12 +270,14 @@ HandleBgErrors(clientData) */ if (Tcl_IsSafe(interp)) { - Tcl_SavedResult save; + TEMP (Tcl_SavedResult) save; + NEWTEMP (Tcl_SavedResult, save); - Tcl_SaveResult(interp, &save); + Tcl_SaveResult(interp, REF (save)); TclGlobalInvoke(interp, 2, argv, TCL_INVOKE_HIDDEN); - Tcl_RestoreResult(interp, &save); + Tcl_RestoreResult(interp, REF (save)); + RELTEMP (save); goto doneWithInterp; } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 1da7be2..fa84ad7 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.10.2.2.2.2 2001/12/04 21:52:08 andreas_kupries Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.10.2.2.2.3 2001/12/05 18:22:25 andreas_kupries Exp $ */ #include "tclInt.h" @@ -5564,10 +5564,12 @@ ProcessUnexpectedResult(interp, returnCode) Tcl_AppendToObj(Tcl_GetObjResult(interp), "invoked \"continue\" outside of a loop", -1); } else { - char buf[30 + TCL_INTEGER_SPACE]; + STRING (30 + TCL_INTEGER_SPACE, buf); + NEWSTR (30 + TCL_INTEGER_SPACE, buf); sprintf(buf, "command returned bad code: %d", returnCode); Tcl_SetResult(interp, buf, TCL_VOLATILE); + RELTEMP (buf); } } @@ -5598,10 +5600,12 @@ RecordTracebackInfo(interp, objPtr, numSrcBytes) int numSrcBytes; /* Number of bytes compiled in script. */ { Interp *iPtr = (Interp *) interp; - char buf[200]; + STRING (200, buf); char *ellipsis, *bytes; int length; + NEWSTR (200, buf); + /* * Decide how much of the command to print in the error message * (up to a certain number of bytes). @@ -5624,6 +5628,7 @@ RecordTracebackInfo(interp, objPtr, numSrcBytes) length, bytes, ellipsis); } Tcl_AddObjErrorInfo(interp, buf, -1); + RELTEMP (buf); } /* diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 9ab5879..876fbae 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -19,7 +19,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNamesp.c,v 1.17.2.1 2001/04/03 22:54:37 hobbs Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.17.2.1.2.1 2001/12/05 18:22:25 andreas_kupries Exp $ */ #include "tclInt.h" @@ -1775,15 +1775,16 @@ TclGetNamespaceForQualName(interp, qualName, cxtNsPtr, flags, if (entryPtr != NULL) { nsPtr = (Namespace *) Tcl_GetHashValue(entryPtr); } else if (flags & CREATE_NS_IF_UNKNOWN) { - Tcl_CallFrame frame; + TEMP(Tcl_CallFrame) frame; + NEWTEMP(Tcl_CallFrame, frame); - (void) Tcl_PushCallFrame(interp, &frame, + (void) Tcl_PushCallFrame(interp, REF (frame), (Tcl_Namespace *) nsPtr, /*isProcCallFrame*/ 0); nsPtr = (Namespace *) Tcl_CreateNamespace(interp, nsName, (ClientData) NULL, (Tcl_NamespaceDeleteProc *) NULL); Tcl_PopCallFrame(interp); - + RELTEMP(frame); if (nsPtr == NULL) { panic("Could not create namespace '%s'", nsName); } @@ -2879,13 +2880,16 @@ NamespaceEvalCmd(dummy, interp, objc, objv) Tcl_Obj *CONST objv[]; /* Argument objects. */ { Tcl_Namespace *namespacePtr; - Tcl_CallFrame frame; + TEMP (Tcl_CallFrame) frame; Tcl_Obj *objPtr; char *name; int length, result; + NEWTEMP (Tcl_CallFrame, frame); + if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "name arg ?arg...?"); + RELTEMP (frame); return TCL_ERROR; } @@ -2896,6 +2900,7 @@ NamespaceEvalCmd(dummy, interp, objc, objv) result = GetNamespaceFromObj(interp, objv[2], &namespacePtr); if (result != TCL_OK) { + RELTEMP (frame); return result; } @@ -2908,6 +2913,7 @@ NamespaceEvalCmd(dummy, interp, objc, objv) namespacePtr = Tcl_CreateNamespace(interp, name, (ClientData) NULL, (Tcl_NamespaceDeleteProc *) NULL); if (namespacePtr == NULL) { + RELTEMP (frame); return TCL_ERROR; } } @@ -2917,9 +2923,10 @@ NamespaceEvalCmd(dummy, interp, objc, objv) * the command(s). */ - result = Tcl_PushCallFrame(interp, &frame, namespacePtr, + result = Tcl_PushCallFrame(interp, REF (frame), namespacePtr, /*isProcCallFrame*/ 0); if (result != TCL_OK) { + RELTEMP (frame); return TCL_ERROR; } @@ -2935,11 +2942,13 @@ NamespaceEvalCmd(dummy, interp, objc, objv) result = Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_DIRECT); } if (result == TCL_ERROR) { - char msg[256 + TCL_INTEGER_SPACE]; + STRING (256 + TCL_INTEGER_SPACE, msg); + NEWSTR (256 + TCL_INTEGER_SPACE, msg); sprintf(msg, "\n (in namespace eval \"%.200s\" script line %d)", namespacePtr->fullName, interp->errorLine); Tcl_AddObjErrorInfo(interp, msg, -1); + RELTEMP (msg); } /* @@ -2947,6 +2956,7 @@ NamespaceEvalCmd(dummy, interp, objc, objv) */ Tcl_PopCallFrame(interp); + RELTEMP (frame); return result; } @@ -3237,11 +3247,15 @@ NamespaceInscopeCmd(dummy, interp, objc, objv) Tcl_Obj *CONST objv[]; /* Argument objects. */ { Tcl_Namespace *namespacePtr; - Tcl_CallFrame frame; int i, result; + TEMP(Tcl_CallFrame) frame; + + NEWTEMP (Tcl_CallFrame, frame); + if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "name arg ?arg...?"); + RELTEMP(frame); return TCL_ERROR; } @@ -3251,12 +3265,14 @@ NamespaceInscopeCmd(dummy, interp, objc, objv) result = GetNamespaceFromObj(interp, objv[2], &namespacePtr); if (result != TCL_OK) { + RELTEMP(frame); return result; } if (namespacePtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "unknown namespace \"", Tcl_GetString(objv[2]), "\" in inscope namespace command", (char *) NULL); + RELTEMP(frame); return TCL_ERROR; } @@ -3264,9 +3280,10 @@ NamespaceInscopeCmd(dummy, interp, objc, objv) * Make the specified namespace the current namespace. */ - result = Tcl_PushCallFrame(interp, &frame, namespacePtr, + result = Tcl_PushCallFrame(interp, REF (frame), namespacePtr, /*isProcCallFrame*/ 0); if (result != TCL_OK) { + RELTEMP(frame); return result; } @@ -3288,6 +3305,7 @@ NamespaceInscopeCmd(dummy, interp, objc, objv) result = Tcl_ListObjAppendElement(interp, listPtr, objv[i]); if (result != TCL_OK) { Tcl_DecrRefCount(listPtr); /* free unneeded obj */ + RELTEMP(frame); return result; } } @@ -3299,12 +3317,14 @@ NamespaceInscopeCmd(dummy, interp, objc, objv) Tcl_DecrRefCount(listPtr); /* we're done with the list object */ } if (result == TCL_ERROR) { - char msg[256 + TCL_INTEGER_SPACE]; + STRING (256 + TCL_INTEGER_SPACE, msg); + NEWSTR (256 + TCL_INTEGER_SPACE, msg); sprintf(msg, "\n (in namespace inscope \"%.200s\" script line %d)", namespacePtr->fullName, interp->errorLine); Tcl_AddObjErrorInfo(interp, msg, -1); + RELTEMP (msg); } /* @@ -3312,6 +3332,7 @@ NamespaceInscopeCmd(dummy, interp, objc, objv) */ Tcl_PopCallFrame(interp); + RELTEMP(frame); return result; } diff --git a/generic/tclParse.c b/generic/tclParse.c index 41037ae..84d1ba9 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclParse.c,v 1.13.2.1.2.2 2001/12/04 21:52:09 andreas_kupries Exp $ + * RCS: @(#) $Id: tclParse.c,v 1.13.2.1.2.3 2001/12/05 18:22:25 andreas_kupries Exp $ */ #include "tclInt.h" @@ -1074,17 +1074,19 @@ Tcl_LogCommandInfo(interp, script, command, length) int length; /* Number of bytes in command (-1 means * use all bytes up to first null byte). */ { - char buffer[200]; + STRING (200, buffer); register char *p; char *ellipsis = ""; Interp *iPtr = (Interp *) interp; + NEWSTR (200, buffer); if (iPtr->flags & ERR_ALREADY_LOGGED) { /* * Someone else has already logged error information for this * command; we shouldn't add anything more. */ + RELTEMP (buffer); return; } @@ -1120,6 +1122,7 @@ Tcl_LogCommandInfo(interp, script, command, length) } Tcl_AddObjErrorInfo(interp, buffer, -1); iPtr->flags &= ~ERR_ALREADY_LOGGED; + RELTEMP (buffer); } /* diff --git a/generic/tclProc.c b/generic/tclProc.c index 32768eb..273a55e 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclProc.c,v 1.23.6.1 2001/12/03 18:23:14 andreas_kupries Exp $ + * RCS: @(#) $Id: tclProc.c,v 1.23.6.2 2001/12/05 18:22:26 andreas_kupries Exp $ */ #include "tclInt.h" @@ -350,12 +350,14 @@ TclCreateProc(interp, nsPtr, procName, argsPtr, bodyPtr, procPtrPtr) && (fieldCount == 2)) || ((localPtr->defValuePtr != NULL) && (fieldCount != 2))) { - char buf[80 + TCL_INTEGER_SPACE]; + STRING (80 + TCL_INTEGER_SPACE, buf); + NEWSTR (80 + TCL_INTEGER_SPACE, buf); sprintf(buf, "\": formal parameter %d is inconsistent with precompiled body", i); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "procedure \"", procName, buf, (char *) NULL); + RELTEMP (buf); ckfree((char *) fieldValues); goto procError; } @@ -836,10 +838,12 @@ TclProcCompileProc(interp, procPtr, bodyPtr, nsPtr, description, procName) { Interp *iPtr = (Interp*)interp; int result; - Tcl_CallFrame frame; + TEMP (Tcl_CallFrame) frame; Proc *saveProcPtr; ByteCode *codePtr = (ByteCode *) bodyPtr->internalRep.otherValuePtr; + NEWTEMP (Tcl_CallFrame, frame); + /* * If necessary, compile the procedure's body. The compiler will * allocate frame slots for the procedure's non-argument local @@ -862,6 +866,7 @@ TclProcCompileProc(interp, procPtr, bodyPtr, nsPtr, description, procName) if ((Interp *) *codePtr->interpHandle != iPtr) { Tcl_AppendResult(interp, "a precompiled script jumped interps", NULL); + RELTEMP (frame); return TCL_ERROR; } codePtr->compileEpoch = iPtr->compileEpoch; @@ -906,7 +911,7 @@ TclProcCompileProc(interp, procPtr, bodyPtr, nsPtr, description, procName) saveProcPtr = iPtr->compiledProcPtr; iPtr->compiledProcPtr = procPtr; - result = Tcl_PushCallFrame(interp, &frame, + result = Tcl_PushCallFrame(interp, REF (frame), (Tcl_Namespace*)nsPtr, /* isProcCallFrame */ 0); if (result == TCL_OK) { @@ -918,7 +923,8 @@ TclProcCompileProc(interp, procPtr, bodyPtr, nsPtr, description, procName) if (result != TCL_OK) { if (result == TCL_ERROR) { - char buf[100 + TCL_INTEGER_SPACE]; + STRING (100 + TCL_INTEGER_SPACE, buf); + NEWSTR (100 + TCL_INTEGER_SPACE, buf); numChars = strlen(procName); ellipsis = ""; @@ -930,7 +936,9 @@ TclProcCompileProc(interp, procPtr, bodyPtr, nsPtr, description, procName) description, numChars, procName, ellipsis, interp->errorLine); Tcl_AddObjErrorInfo(interp, buf, -1); + RELTEMP (buf); } + RELTEMP (frame); return result; } } else if (codePtr->nsEpoch != nsPtr->resolverEpoch) { @@ -954,6 +962,7 @@ TclProcCompileProc(interp, procPtr, bodyPtr, nsPtr, description, procName) } } } + RELTEMP (frame); return TCL_OK; } diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 46fc51b..bcd20e6 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUtil.c,v 1.17.2.1.2.2 2001/12/03 18:23:14 andreas_kupries Exp $ + * RCS: @(#) $Id: tclUtil.c,v 1.17.2.1.2.3 2001/12/05 18:22:26 andreas_kupries Exp $ */ #include "tclInt.h" @@ -193,7 +193,8 @@ TclFindElement(interp, list, listLength, elementPtr, nextPtr, sizePtr, */ if (interp != NULL) { - char buf[100]; + STRING (100, buf); + NEWSTR (100, buf); p2 = p; while ((p2 < limit) @@ -205,6 +206,7 @@ TclFindElement(interp, list, listLength, elementPtr, nextPtr, sizePtr, "list element in braces followed by \"%.*s\" instead of space", (int) (p2-p), p); Tcl_SetResult(interp, buf, TCL_VOLATILE); + RELTEMP (buf); } return TCL_ERROR; } @@ -256,7 +258,8 @@ TclFindElement(interp, list, listLength, elementPtr, nextPtr, sizePtr, */ if (interp != NULL) { - char buf[100]; + STRING (100, buf); + NEWSTR (100, buf); p2 = p; while ((p2 < limit) @@ -268,6 +271,7 @@ TclFindElement(interp, list, listLength, elementPtr, nextPtr, sizePtr, "list element in quotes followed by \"%.*s\" %s", (int) (p2-p), p, "instead of space"); Tcl_SetResult(interp, buf, TCL_VOLATILE); + RELTEMP (buf); } return TCL_ERROR; } |