Author: fijal
Branch: improve-vmprof-testing
Changeset: r86035:a7b374677365
Date: 2016-08-05 17:48 +0200
http://bitbucket.org/pypy/pypy/changeset/a7b374677365/

Log:    fight fight fight

diff --git a/rpython/jit/backend/test/test_rvmprof.py 
b/rpython/jit/backend/test/test_rvmprof.py
--- a/rpython/jit/backend/test/test_rvmprof.py
+++ b/rpython/jit/backend/test/test_rvmprof.py
@@ -35,6 +35,7 @@
         def get_name(code):
             return "foo"
 
+        _get_vmprof().use_weaklist = False
         register_code_object_class(CodeObj, get_name)
 
         @vmprof_execute_code("main", get_code_fn,
@@ -49,7 +50,6 @@
                 llfn()
 
         def main(n):
-            vmprof = _get_vmprof()
             codes = [CodeObj("main"), CodeObj("not main")]
             for code in codes:
                 register_code(code, get_name)
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
@@ -29,6 +29,8 @@
 
     _immutable_fields_ = ['is_enabled?']
 
+    use_weaklist = True # False for tests
+
     def __init__(self):
         "NOT_RPYTHON: use _get_vmprof()"
         self._code_classes = set()
@@ -56,7 +58,7 @@
             self._code_unique_id = uid
             if self.is_enabled:
                 self._write_code_registration(uid, full_name_func(code))
-            else:
+            elif self.use_weaklist:
                 code._vmprof_weak_list.add_handle(code)
 
     def register_code_object_class(self, CodeClass, full_name_func):
@@ -86,7 +88,8 @@
         class WeakCodeObjectList(RWeakListMixin):
             def __init__(self):
                 self.initialize()
-        CodeClass._vmprof_weak_list = WeakCodeObjectList()
+        if self.use_weaklist:
+            CodeClass._vmprof_weak_list = WeakCodeObjectList()
         #
         def gather_all_code_objs():
             all_code_wrefs = CodeClass._vmprof_weak_list.get_all_handles()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to