[pypy-commit] pypy stmgc-c4: fix and add more tests

Raemi noreply at buildbot.pypy.org
Mon Jul 15 16:17:54 CEST 2013


Author: Remi Meier <remi.meier at gmail.com>
Branch: stmgc-c4
Changeset: r65402:586771804a5c
Date: 2013-07-15 16:16 +0200
http://bitbucket.org/pypy/pypy/changeset/586771804a5c/

Log:	fix and add more tests

diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -315,6 +315,9 @@
         exc0, exc1 = None, None
         if descr is None:
             return
+
+        if is_stm and withcards:
+            return
         
         if not withcards:
             func = descr.get_barrier_fn(self.cpu, 
diff --git a/rpython/memory/gctransform/test/test_framework.py b/rpython/memory/gctransform/test/test_framework.py
--- a/rpython/memory/gctransform/test/test_framework.py
+++ b/rpython/memory/gctransform/test/test_framework.py
@@ -23,7 +23,7 @@
     class transformerclass(ShadowStackFrameworkGCTransformer):
         root_stack_depth = 100
 
-def test_framework_simple():
+def test_framework_simple(gc="minimark"):
     def g(x):
         return x + 1
     class A(object):
@@ -37,7 +37,10 @@
     from rpython.translator.c.genc import CStandaloneBuilder
 
     t = rtype(entrypoint, [s_list_of_strings])
-    t.config.translation.gc = "minimark"
+    if gc == "stmgc":
+        t.config.translation.stm = True
+    t.config.translation.gc = gc
+    
     cbuild = CStandaloneBuilder(t, entrypoint, t.config,
                                 gcpolicy=FrameworkGcPolicy2)
     db = cbuild.generate_graphs_for_llinterp()
@@ -54,6 +57,9 @@
 
     assert res == 2
 
+def test_framework_simple_stm():
+    test_framework_simple("stmgc")
+    
 def test_cancollect():
     S = lltype.GcStruct('S', ('x', lltype.Signed))
     def g():
@@ -94,7 +100,7 @@
     gg = graphof(t, g)
     assert CollectAnalyzer(t).analyze_direct_call(gg)
 
-def test_no_collect():
+def test_no_collect(gc="minimark"):
     from rpython.rlib import rgc
     from rpython.translator.c.genc import CStandaloneBuilder
 
@@ -109,12 +115,17 @@
         return g() + 2
     
     t = rtype(entrypoint, [s_list_of_strings])
-    t.config.translation.gc = "minimark"
+    if gc == "stmgc":
+        t.config.translation.stm = True
+    t.config.translation.gc = gc
     cbuild = CStandaloneBuilder(t, entrypoint, t.config,
                                 gcpolicy=FrameworkGcPolicy2)
     db = cbuild.generate_graphs_for_llinterp()
 
-def test_no_collect_detection():
+def test_no_collect_stm():
+    test_no_collect("stmgc")
+
+def test_no_collect_detection(gc="minimark"):
     from rpython.rlib import rgc
     from rpython.translator.c.genc import CStandaloneBuilder
 
@@ -133,13 +144,18 @@
         return g() + 2
     
     t = rtype(entrypoint, [s_list_of_strings])
-    t.config.translation.gc = "minimark"
+    if gc == "stmgc":
+        t.config.translation.stm = True
+    t.config.translation.gc = gc
     cbuild = CStandaloneBuilder(t, entrypoint, t.config,
                                 gcpolicy=FrameworkGcPolicy2)
     f = py.test.raises(Exception, cbuild.generate_graphs_for_llinterp)
     expected = "'no_collect' function can trigger collection: <function g at "
     assert str(f.value).startswith(expected)
 
+def test_no_collect_detection_stm():
+    test_no_collect_detection("stmgc")
+    
 class WriteBarrierTransformer(ShadowStackFrameworkGCTransformer):
     clean_sets = {}
     GC_PARAMS = {}
diff --git a/rpython/rlib/rstack.py b/rpython/rlib/rstack.py
--- a/rpython/rlib/rstack.py
+++ b/rpython/rlib/rstack.py
@@ -20,10 +20,10 @@
         includes=['src/stack.h'],
         separate_module_files=[srcdir / 'stack.c', srcdir / 'threadlocal.c'])
 
-def llexternal(name, args, res, _callable=None):
+def llexternal(name, args, res, _callable=None, **kwds):
     return rffi.llexternal(name, args, res, compilation_info=compilation_info,
                            sandboxsafe=True, _nowrapper=True,
-                           _callable=_callable)
+                           _callable=_callable, **kwds)
 
 _stack_get_end = llexternal('LL_stack_get_end', [], lltype.Signed,
                             lambda: 0)
@@ -34,7 +34,8 @@
                                         lambda frac: None)
 _stack_too_big_slowpath = llexternal('LL_stack_too_big_slowpath',
                                      [lltype.Signed], lltype.Char,
-                                     lambda cur: '\x00')
+                                     lambda cur: '\x00',
+                                     transactionsafe=True)
 # the following is used by the JIT
 _stack_get_end_adr   = llexternal('LL_stack_get_end_adr',   [], lltype.Signed)
 _stack_get_length_adr= llexternal('LL_stack_get_length_adr',[], lltype.Signed)


More information about the pypy-commit mailing list