[pypy-commit] pypy vmprof-review: Translation fix?

arigo noreply at buildbot.pypy.org
Fri Aug 7 13:48:04 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: vmprof-review
Changeset: r78849:aa7a0a00b0ca
Date: 2015-08-07 12:46 +0200
http://bitbucket.org/pypy/pypy/changeset/aa7a0a00b0ca/

Log:	Translation fix?

diff --git a/rpython/rlib/rvmprof/__init__.py b/rpython/rlib/rvmprof/__init__.py
--- a/rpython/rlib/rvmprof/__init__.py
+++ b/rpython/rlib/rvmprof/__init__.py
@@ -19,9 +19,16 @@
 
 @specialize.call_location()
 def get_unique_id(code):
+    """Return the internal unique ID of a code object.  Can only be
+    called after register_code().  Call this in the jitdriver's
+    method 'get_unique_id(*greenkey)'.  This always returns 0 if we
+    didn't call register_code_object_class() on the class.
+    """
     assert code is not None
     if _was_registered(code.__class__):
-        return _get_vmprof().get_unique_id(code)
+        # '0' can occur here too, if the code object was prebuilt,
+        # or if register_code() was not called for another reason.
+        return code._vmprof_unique_id
     return 0
 
 def enable(fileno, interval):
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
@@ -48,19 +48,6 @@
             if self.is_enabled:
                 self._write_code_registration(uid, full_name_func(code))
 
-    @specialize.argtype(1)
-    def get_unique_id(self, code):
-        """Return the internal unique ID of a code object.  Can only be
-        called after register_code().  Call this in the jitdriver's
-        method 'get_unique_id(*greenkey)'.  The wrapper from __init__.py
-        always returns 0 if we didn't call register_code_object_class()
-        on the class.
-        """
-        uid = code._vmprof_unique_id
-        # 'uid == 0' can occur here if the code object was prebuilt,
-        # or if register_code() was not called for another reason.
-        return uid
-
     def register_code_object_class(self, CodeClass, full_name_func):
         """NOT_RPYTHON
         Register statically the class 'CodeClass' as containing user


More information about the pypy-commit mailing list