summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--generic/tclExecute.c12
2 files changed, 10 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 0fb2471..7c6a50c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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) {