Author: Remi Meier
Branch: 
Changeset: r1106:af451d3e606c
Date: 2014-03-27 14:57 +0100
http://bitbucket.org/pypy/stmgc/changeset/af451d3e606c/

Log:    fix obvious HTM disabler

diff --git a/htm-c7/htm.h b/htm-c7/htm.h
--- a/htm-c7/htm.h
+++ b/htm-c7/htm.h
@@ -18,6 +18,7 @@
 #define XBEGIN_XABORT_ARG(x) (((x) >> 24) & 0xFF)
 
 static __thread char buf[128];
+__attribute__((unused))
 static char* xbegin_status(int status)
 {
     if (status == XBEGIN_OK)
diff --git a/htm-c7/stmgc.c b/htm-c7/stmgc.c
--- a/htm-c7/stmgc.c
+++ b/htm-c7/stmgc.c
@@ -130,13 +130,6 @@
 }
 
 
-void stm_unregister_thread_local(stm_thread_local_t *tl) {
-    fprintf(stderr,
-            "in %p\ngil_transactions: %d\nhtm_transactions: %d\nratio: %f\n",
-            tl, gil_transactions, htm_transactions,
-            (float)gil_transactions / (float)htm_transactions);
-    free(tl->shadowstack_base);
-}
 
 /************************************************************/
 /* some simple thread-local malloc: */
@@ -266,20 +259,40 @@
 
 #define GCFLAG_WRITE_BARRIER  _STM_GCFLAG_WRITE_BARRIER
 
-static struct list_s *objects_pointing_to_nursery;
-static struct list_s *young_weakrefs;
+static __thread struct list_s *objects_pointing_to_nursery;
+static __thread struct list_s *young_weakrefs;
 
 void stm_setup(void)
 {
-    objects_pointing_to_nursery = list_create();
-    young_weakrefs = list_create();
 }
 
 void stm_teardown(void)
 {
+}
+
+void stm_register_thread_local(stm_thread_local_t *tl) {
+    objects_pointing_to_nursery = list_create();
+    young_weakrefs = list_create();
+
+    tl->thread_local_obj = NULL;
+    tl->shadowstack_base = (object_t **)malloc(768*1024);
+    assert(tl->shadowstack_base);
+    tl->shadowstack = tl->shadowstack_base;
+    tl->last_abort__bytes_in_nursery = 0;
+}
+
+void stm_unregister_thread_local(stm_thread_local_t *tl) {
+    fprintf(stderr,
+            "in %p\ngil_transactions: %d\nhtm_transactions: %d\nratio: %f\n",
+            tl, gil_transactions, htm_transactions,
+            (float)gil_transactions / (float)htm_transactions);
+    free(tl->shadowstack_base);
+
     list_free(objects_pointing_to_nursery);
+    list_free(young_weakrefs);
 }
 
+
 void _stm_write_slowpath(object_t *obj)
 {
     obj->gil_flags &= ~GCFLAG_WRITE_BARRIER;
diff --git a/htm-c7/stmgc.h b/htm-c7/stmgc.h
--- a/htm-c7/stmgc.h
+++ b/htm-c7/stmgc.h
@@ -79,13 +79,7 @@
     return (object_t *)p;
 }
 
-inline static void stm_register_thread_local(stm_thread_local_t *tl) {
-    tl->thread_local_obj = NULL;
-    tl->shadowstack_base = (object_t **)malloc(768*1024);
-    assert(tl->shadowstack_base);
-    tl->shadowstack = tl->shadowstack_base;
-    tl->last_abort__bytes_in_nursery = 0;
-}
+void stm_register_thread_local(stm_thread_local_t *tl);
 void stm_unregister_thread_local(stm_thread_local_t *tl);
 
 extern pthread_mutex_t _stm_gil;
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to