summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2016-01-31 08:28:44 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2016-01-31 08:28:44 (GMT)
commitc53b10e8829b6f3dbbe5d21f84110037c3f3f38a (patch)
tree4de2ddd478e5da0dff4222f95ebc6a337e8eb7b7
parent1a9786cbb43500f8bce0845d8896bb02c17b4f3b (diff)
downloadtcl-mig_opt2_tmp.zip
tcl-mig_opt2_tmp.tar.gz
tcl-mig_opt2_tmp.tar.bz2
(NON_PORTABLE) insure good cache alignment of NRE_callbackmig_opt2_tmp
-rw-r--r--TODO_DONE11
-rw-r--r--generic/tclNRE.h13
2 files changed, 19 insertions, 5 deletions
diff --git a/TODO_DONE b/TODO_DONE
index 96a275b..6e59acf 100644
--- a/TODO_DONE
+++ b/TODO_DONE
@@ -15,10 +15,6 @@
* mig-alloc-reform: what can be brought in? At least forget -DPURIFY, make
it usable from normal builds.
-* mod the callback struct: make it have only 3 data fields, 4 in
- total. This will reduce the size, possible improvements due to cache and
- memory alignment issues.
-
*************************************************************************
**** DONE ***************************************************************
*************************************************************************
@@ -71,3 +67,10 @@
This is done by defining HAVE_FAST_TSD in the defaut build; can remove it
later on for the default - handy while developing. FIXME!!
+* mod the callback struct: make it have only 3 data fields, 4 in
+ total. This will reduce the size, possible improvements due to cache and
+ memory alignment issues.
+
+* INCOMPATIBILITY ... or at least, no attention paid to windows. We are
+ using __atribute__ to insure good cache alignment of NRE_callback, this
+ is certainly not portable.
diff --git a/generic/tclNRE.h b/generic/tclNRE.h
index a00e75f..7cf2a55 100644
--- a/generic/tclNRE.h
+++ b/generic/tclNRE.h
@@ -18,10 +18,21 @@ typedef struct NRE_callback {
ClientData data[3];
} NRE_callback;
+/*
+ * - NOTES ON ALIGNMENT -
+ *
+ * . Cache lines are 64B long; callbacks are 32B on x86_64 and 16B on x32. In
+ * order to insure that no callback ever strides cache line boundaries, we
+ * require the first callback to be aligned to 32b (on x32, 16B would be
+ * enough).
+ * . we use a gcc'ism to insure alignment, portability not being the priority
+ * right now.
+ */
+
typedef struct NRE_stack {
struct NRE_callback items[NRE_STACK_SIZE];
struct NRE_stack *next;
-} NRE_stack;
+} NRE_stack __attribute__ ((aligned (32)));
#define NRE_newExtra(ptr) \
TclSmallAlloc(5*sizeof(ClientData), ptr)