[pypy-commit] pypy stmgc-c8: enable vmprof and nearly pass the tests

Raemi pypy.commits at gmail.com
Tue Apr 5 08:35:03 EDT 2016


Author: Remi Meier <remi.meier at gmail.com>
Branch: stmgc-c8
Changeset: r83522:61b4b82f90cb
Date: 2016-04-05 15:34 +0300
http://bitbucket.org/pypy/pypy/changeset/61b4b82f90cb/

Log:	enable vmprof and nearly pass the tests

diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -228,9 +228,6 @@
             config.translation.stm = True
             config.translation.thread = True
             config.objspace.usemodules.pypystm = True
-            # for now, disable _vmprof: the JIT's stm parts are not adapted
-            # to track the stack depth
-            config.objspace.usemodules._vmprof = False
             # we don't support rlib.rawrefcount for our GC, so we need
             # to disable cpyext...
             config.objspace.usemodules.cpyext = False
diff --git a/rpython/rlib/rvmprof/rvmprof.py b/rpython/rlib/rvmprof/rvmprof.py
--- a/rpython/rlib/rvmprof/rvmprof.py
+++ b/rpython/rlib/rvmprof/rvmprof.py
@@ -96,7 +96,6 @@
                     uid = code._vmprof_unique_id
                     if uid != 0:
                         self._write_code_registration(uid, full_name_func(code))
-                    self._write_code_registration(uid, full_name_func(code))
             prev()
         # make a chained list of the gather() functions for all
         # the types of code objects
diff --git a/rpython/rlib/rvmprof/test/test_rvmprof.py b/rpython/rlib/rvmprof/test/test_rvmprof.py
--- a/rpython/rlib/rvmprof/test/test_rvmprof.py
+++ b/rpython/rlib/rvmprof/test/test_rvmprof.py
@@ -6,7 +6,11 @@
 from rpython.rlib.nonconst import NonConstant
 
 
-def test_vmprof_execute_code_1():
+STM_TRANSLATE_KWARGS = {"gcpolicy": "stmgc", "thread": True, "stm": True}
+
+
+ at py.test.mark.parametrize("stmparams", [{}, STM_TRANSLATE_KWARGS])
+def test_vmprof_execute_code_1(stmparams):
 
     class MyCode:
         pass
@@ -26,11 +30,12 @@
         return 0
 
     assert f() == 0
-    fn = compile(f, [])
+    fn = compile(f, [], **stmparams)
     assert fn() == 0
 
 
-def test_vmprof_execute_code_2():
+ at py.test.mark.parametrize("stmparams", [{}, STM_TRANSLATE_KWARGS])
+def test_vmprof_execute_code_2(stmparams):
 
     class MyCode:
         pass
@@ -54,11 +59,12 @@
         return 0
 
     assert f() == 0
-    fn = compile(f, [])
+    fn = compile(f, [], **stmparams)
     assert fn() == 0
 
 
-def test_register_code():
+ at py.test.mark.parametrize("stmparams", [{"gcpolicy": "minimark"}, STM_TRANSLATE_KWARGS])
+def test_register_code(stmparams):
 
     class MyCode:
         pass
@@ -80,11 +86,12 @@
         return 0
 
     assert f() == 0
-    fn = compile(f, [], gcpolicy="minimark")
+    fn = compile(f, [], **stmparams)
     assert fn() == 0
 
 
-def test_enable():
+ at py.test.mark.parametrize("stmparams", [{"gcpolicy": "minimark"}, STM_TRANSLATE_KWARGS])
+def test_enable(stmparams):
 
     class MyCode:
         pass
@@ -136,7 +143,7 @@
 
     assert f() == 0
     assert os.path.exists(tmpfilename)
-    fn = compile(f, [], gcpolicy="minimark")
+    fn = compile(f, [], **stmparams)
     assert fn() == 0
     try:
         import vmprof
diff --git a/rpython/translator/c/gc.py b/rpython/translator/c/gc.py
--- a/rpython/translator/c/gc.py
+++ b/rpython/translator/c/gc.py
@@ -274,11 +274,11 @@
 
     gc_startup_code = RefcountingGcPolicy.gc_startup_code.im_func
 
-    def gettransformer(self):
+    def gettransformer(self, translator):
         if self.db.translator.config.translation.stm:
             from rpython.memory.gctransform import nogcstm
-            return nogcstm.NoneSTMGCTransformer(self.db.translator)
-        return BoehmGcPolicy.gettransformer(self)
+            return nogcstm.NoneSTMGCTransformer(translator)
+        return BoehmGcPolicy.gettransformer(self, translator)
 
     def compilation_info(self):
         eci = BasicGcPolicy.compilation_info(self)


More information about the pypy-commit mailing list