Author: Remi Meier <[email protected]>
Branch: stmgc-c8
Changeset: r83557:39060b21f026
Date: 2016-04-07 10:29 +0300
http://bitbucket.org/pypy/pypy/changeset/39060b21f026/

Log:    attempt to fix JIT support for vmprof for STM by resetting the
        thread-local variable that points to the frame on abort.

diff --git a/rpython/jit/backend/x86/test/test_zrpy_vmprof.py 
b/rpython/jit/backend/x86/test/test_zrpy_vmprof.py
--- a/rpython/jit/backend/x86/test/test_zrpy_vmprof.py
+++ b/rpython/jit/backend/x86/test/test_zrpy_vmprof.py
@@ -1,7 +1,22 @@
 
 from rpython.jit.backend.llsupport.test.zrpy_vmprof_test import 
CompiledVmprofTest
+from rpython.translator.translator import TranslationContext
+
+class TestZVMprofSTM(CompiledVmprofTest):
+    gcrootfinder = "stm"
+    gc = "stmgc"
+    thread = True
+    stm = True
+
+    def _get_TranslationContext(self):
+        t = TranslationContext()
+        t.config.translation.thread = True
+        t.config.translation.stm = True
+        t.config.translation.gc = "stmgc"
+        t.config.translation.list_comprehension_operations = True
+        return t
 
 class TestZVMprof(CompiledVmprofTest):
     
     gcrootfinder = "shadowstack"
-    gc = "incminimark"
\ No newline at end of file
+    gc = "incminimark"
diff --git a/rpython/translator/stm/src_stm/extracode.h 
b/rpython/translator/stm/src_stm/extracode.h
--- a/rpython/translator/stm/src_stm/extracode.h
+++ b/rpython/translator/stm/src_stm/extracode.h
@@ -1,4 +1,9 @@
 #include <string.h>
+#include <stdlib.h>
+
+#ifdef RPYTHON_VMPROF
+#include "src/threadlocal.h"
+#endif
 
 
 static void _stm_call_finalizer(object_t *obj)
@@ -42,12 +47,23 @@
     stm_register_thread_local(&stm_thread_local);
     stm_thread_local.mem_clear_on_abort = (char *)&pypy_g_ExcData;
     stm_thread_local.mem_bytes_to_clear_on_abort = sizeof(pypy_g_ExcData);
+
+#ifdef RPYTHON_VMPROF
+    stm_thread_local.mem_reset_on_abort = (char 
*)&pypy_threadlocal.vmprof_tl_stack;
+    stm_thread_local.mem_bytes_to_reset_on_abort = 
sizeof(pypy_threadlocal.vmprof_tl_stack);
+    stm_thread_local.mem_stored_for_reset_on_abort = 
malloc(sizeof(pypy_threadlocal.vmprof_tl_stack));
+#else
+    stm_thread_local.mem_reset_on_abort = NULL;
+#endif
 }
 
 void pypy_stm_unregister_thread_local(void)
 {
     stm_unregister_thread_local(&stm_thread_local);
     stm_thread_local.shadowstack_base = NULL;
+#ifdef RPYTHON_VMPROF
+    free(stm_thread_local.mem_stored_for_reset_on_abort);
+#endif
 }
 
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to