Author: Armin Rigo <ar...@tunes.org>
Branch: stmgc-c7
Changeset: r73990:f626a453d3e4
Date: 2014-10-17 12:51 +0200
http://bitbucket.org/pypy/pypy/changeset/f626a453d3e4/

Log:    (fijal, arigo)

        Reintroduce a direct test for _stm_expand_marker_for_pypy

diff --git a/rpython/translator/stm/funcgen.py 
b/rpython/translator/stm/funcgen.py
--- a/rpython/translator/stm/funcgen.py
+++ b/rpython/translator/stm/funcgen.py
@@ -222,7 +222,7 @@
 
 def stm_expand_marker(funcgen, op):
     result = funcgen.expr(op.result)
-    return '%s = _stm_expand_marker();' % (result,)
+    return '%s = _pypy_stm_test_expand_marker();' % (result,)
 
 def stm_setup_expand_marker_for_pypy(funcgen, op):
     # hack hack hack
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
@@ -128,6 +128,28 @@
     return result;
 }
 
+char *_pypy_stm_test_expand_marker(void)
+{
+    /* only for tests: XXX fishing */
+    stm_loc_marker_t marker;
+    marker.tl = &stm_thread_local;
+    marker.segment_base = STM_SEGMENT->segment_base;
+
+    struct stm_shadowentry_s *_ss = stm_thread_local.shadowstack - 2;
+    while (!(((uintptr_t)(_ss->ss)) & 1)) {
+        _ss--;
+        assert(_ss >= stm_thread_local.shadowstack_base);
+    }
+    marker.odd_number = (uintptr_t)(_ss->ss);
+    marker.object = (_ss + 1)->ss;
+
+    static char buffer[80];
+    int length = _stm_expand_marker_for_pypy(&marker, buffer, 80);
+    assert(length >= 0 && length < 80);
+    buffer[length] = 0;
+    return buffer;
+}
+
 void pypy_stm_setup_expand_marker(long co_filename_ofs,
                                   long co_name_ofs,
                                   long co_firstlineno_ofs,
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to