diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2011-03-05 15:09:01 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2011-03-05 15:09:01 (GMT) |
commit | bc47f3260fa46a560c1a2e7e1a0891e5493cda50 (patch) | |
tree | cd7fbf0fbe27d0ed2e274f519ee07fed9331de9c | |
parent | 368e4fad6fab0c934ca09516ed3fc28519ec5578 (diff) | |
download | tcl-bc47f3260fa46a560c1a2e7e1a0891e5493cda50.zip tcl-bc47f3260fa46a560c1a2e7e1a0891e5493cda50.tar.gz tcl-bc47f3260fa46a560c1a2e7e1a0891e5493cda50.tar.bz2 |
* generic/tclExecute.c: cleaner mem management for TEBCdata
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | generic/tclExecute.c | 12 |
2 files changed, 10 insertions, 4 deletions
@@ -1,5 +1,7 @@ 2011-03-05 Miguel Sofer <msofer@users.sf.net> + * generic/tclExecute.c: cleaner mem management for TEBCdata + * generic/tclExecute.c: * tests/nre.test: Renamed BottomData to TEBCdata, so that the name refers to what it is rather than to its storage location. diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 6703d43..5cffc90 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -178,6 +178,10 @@ typedef struct TEBCdata { int cleanup; /* new codePtr was received for NR */ Tcl_Obj *auxObjList; /* execution. */ int checkInterp; + CmdFrame cmdFrame; + void * stack[1]; /* Start of the actual combined catch and obj + * stacks; the struct will be expanded as + * necessary */ } TEBCdata; #define TEBC_YIELD() \ @@ -1910,8 +1914,8 @@ TclIncrObj( * *---------------------------------------------------------------------- */ -#define bcFramePtr ((CmdFrame *) (TD + 1)) -#define initCatchTop (((ptrdiff_t *) (bcFramePtr + 1)) - 1) +#define bcFramePtr (&TD->cmdFrame) +#define initCatchTop ((ptrdiff_t *) (&TD->stack[-1])) #define initTosPtr ((Tcl_Obj **) (initCatchTop+codePtr->maxExceptDepth)) #define esPtr (iPtr->execEnvPtr->execStackPtr) @@ -1922,9 +1926,9 @@ TclNRExecuteByteCode( { Interp *iPtr = (Interp *) interp; TEBCdata *TD; - int size = sizeof(TEBCdata) + sizeof(CmdFrame) + + int size = sizeof(TEBCdata) -1 + + (codePtr->maxStackDepth + codePtr->maxExceptDepth) - *(sizeof(Tcl_Obj *)); + *(sizeof(void *)); int numWords = (size + sizeof(Tcl_Obj *) - 1)/sizeof(Tcl_Obj *); if (iPtr->execEnvPtr->rewind) { |