[pypy-commit] pypy default: if code class for vmprof has attrs, extend that

timfel pypy.commits at gmail.com
Mon Aug 22 10:44:19 EDT 2016


Author: Tim Felgentreff <timfelgentreff at gmail.com>
Branch: 
Changeset: r86420:edea3287d97a
Date: 2016-08-22 11:34 +0200
http://bitbucket.org/pypy/pypy/changeset/edea3287d97a/

Log:	if code class for vmprof has attrs, extend that

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
@@ -90,6 +90,9 @@
         CodeClass._vmprof_unique_id = 0     # default value: "unknown"
         immut = CodeClass.__dict__.get('_immutable_fields_', [])
         CodeClass._immutable_fields_ = list(immut) + ['_vmprof_unique_id']
+        attrs = CodeClass.__dict__.get('_attrs_', None)
+        if attrs:
+            CodeClass._attrs_ = list(attrs) + ['_vmprof_unique_id']
         self._code_classes.add(CodeClass)
         #
         class WeakCodeObjectList(RWeakListMixin):
@@ -189,7 +192,7 @@
 
         def decorated_function(*args):
             unique_id = get_code_fn(*args)._vmprof_unique_id
-            unique_id = rffi.cast(lltype.Signed, unique_id) 
+            unique_id = rffi.cast(lltype.Signed, unique_id)
             # ^^^ removes the "known non-negative" hint for annotation
             if not jit.we_are_jitted():
                 x = enter_code(unique_id)


More information about the pypy-commit mailing list