[pypy-commit] pypy value-profiling: print about classes too

cfbolz noreply at buildbot.pypy.org
Wed Aug 12 17:57:56 CEST 2015


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: value-profiling
Changeset: r78936:7bb77134dbae
Date: 2015-08-12 13:15 +0200
http://bitbucket.org/pypy/pypy/changeset/7bb77134dbae/

Log:	print about classes too

diff --git a/pypy/interpreter/valueprof.py b/pypy/interpreter/valueprof.py
--- a/pypy/interpreter/valueprof.py
+++ b/pypy/interpreter/valueprof.py
@@ -52,8 +52,9 @@
         elif status == SEEN_CONSTANT_INT:
             if self.is_int(w_value):
                 if self.read_constant_int() != self.get_int_val(w_value):
-                    if self._vprof_counter >= 200:
-                        print "NO LONGER CONSTANT", self._vprof_msg, 'int', w_value
+                    if not jit.we_are_jitted():
+                        if self._vprof_counter >= 200:
+                            print "NO LONGER CONSTANT", self._vprof_msg, 'int', w_value
                     self._vprof_status = SEEN_CONSTANT_CLASS
                     self._vprof_const_cls = type(w_value)
                 else:
@@ -85,6 +86,13 @@
             cls = self.read_constant_cls()
             if cls is not type(w_value):
                 self._vprof_status = SEEN_TOO_MUCH
+                if self._vprof_counter >= 200:
+                    print "NO LONGER CONSTANT CLASS", self._vprof_msg, 'cls', cls
+            else:
+                if not jit.we_are_jitted():
+                    self._vprof_counter += 1
+                    if self._vprof_counter == 200:
+                        print self._vprof_msg, 'cls', cls
 
     def can_fold_read_int(self):
         return self._vprof_status == SEEN_CONSTANT_INT
@@ -92,6 +100,9 @@
     def can_fold_read_obj(self):
         return self._vprof_status == SEEN_CONSTANT_OBJ
 
+    def class_is_known(self):
+        return self._vprof_status == SEEN_CONSTANT_CLASS
+
     @jit.elidable
     def read_constant_int(self):
         assert self.can_fold_read_int()


More information about the pypy-commit mailing list