summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2016-01-16 10:17:09 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2016-01-16 10:17:09 (GMT)
commit8beaa94c839778cfbe50eb7c46981aa386af9ce2 (patch)
treebc2f0783e9ea8d62265b03285115baaa78c100d3
parentad9a780e831b95f70d0b6f667ba1c9775e0854cb (diff)
downloadtcl-8beaa94c839778cfbe50eb7c46981aa386af9ce2.zip
tcl-8beaa94c839778cfbe50eb7c46981aa386af9ce2.tar.gz
tcl-8beaa94c839778cfbe50eb7c46981aa386af9ce2.tar.bz2
TODO; removed old NRE_callback memory model
-rw-r--r--TODO_DONE5
-rw-r--r--generic/tclNRE.h60
2 files changed, 20 insertions, 45 deletions
diff --git a/TODO_DONE b/TODO_DONE
index f84e648..bb9e585 100644
--- a/TODO_DONE
+++ b/TODO_DONE
@@ -6,12 +6,17 @@
indirect on rewinding. Replace NRRunCallbacks with optimized sibling
calls
+* review the whole interp/execEnv relationship - who's boss?
+
* improve local var handling in tebc? restrict, etc
* optimize proc setup and teardown - any gains to be had in there?
* bring up relevant mods (if any) from mig-alloc-reform
+* mod NRE api - nreProc with the same sig as Tcl_NRPostProc (callbacks)?
+ Should be a win on the sibling jumps model
+
*************************************************************************
**** DONE ***************************************************************
diff --git a/generic/tclNRE.h b/generic/tclNRE.h
index d740105..86f25b5 100644
--- a/generic/tclNRE.h
+++ b/generic/tclNRE.h
@@ -3,16 +3,26 @@
* **********************************************
*/
-#define NRE_STACK_DEBUG 0
#define NRE_STACK_SIZE 100
-
/*
- * This is the main data struct for representing NR commands. It is designed
- * to fit in sizeof(Tcl_Obj) in order to exploit the fastest memory allocator
- * available.
+ * This is the main data struct for representing NR commands. It was
+ * originally designed to fit in sizeof(Tcl_Obj) in order to exploit the
+ * fastest memory allocator available. The current version completely changed
+ * the memory management approach (stack vs linked list), but the struct was
+ * kept as it proved to be a "good" fit.
*/
+typedef struct NRE_callback {
+ Tcl_NRPostProc *procPtr;
+ ClientData data[4];
+} NRE_callback;
+
+typedef struct NRE_stack {
+ struct NRE_callback items[NRE_STACK_SIZE];
+ struct NRE_stack *next;
+} NRE_stack;
+
/*
* Inline versions of Tcl_NRAddCallback and friends
*/
@@ -35,44 +45,6 @@
cbPtr->data[3] = (ClientData)(data3); \
} while (0)
-#if NRE_STACK_DEBUG
-
-typedef struct NRE_callback {
- Tcl_NRPostProc *procPtr;
- ClientData data[4];
- struct NRE_callback *nextPtr;
-} NRE_callback;
-
-#define POP_CB(interp, cbPtr) \
- do { \
- cbPtr = TOP_CB(interp); \
- TOP_CB(interp) = cbPtr->nextPtr; \
- } while (0)
-
-#define ALLOC_CB(interp, cbPtr) \
- do { \
- cbPtr = ckalloc(sizeof(NRE_callback)); \
- cbPtr->nextPtr = TOP_CB(interp); \
- TOP_CB(interp) = cbPtr; \
- } while (0)
-
-#define FREE_CB(interp, ptr) \
- ckfree((char *) (ptr))
-
-#define NEXT_CB(ptr) (ptr)->nextPtr
-
-#else /* not debugging the NRE stack */
-
-typedef struct NRE_callback {
- Tcl_NRPostProc *procPtr;
- ClientData data[4];
-} NRE_callback;
-
-typedef struct NRE_stack {
- struct NRE_callback items[NRE_STACK_SIZE];
- struct NRE_stack *next;
-} NRE_stack;
-
#define POP_CB(interp, cbPtr) \
(cbPtr) = TOP_CB(interp)--
@@ -96,5 +68,3 @@ typedef struct NRE_stack {
MODULE_SCOPE NRE_callback *TclNewCallback(Tcl_Interp *interp);
MODULE_SCOPE NRE_callback *TclPopCallback(Tcl_Interp *interp);
MODULE_SCOPE NRE_callback *TclNextCallback(NRE_callback *ptr);
-
-#endif