[pypy-svn] r13853 - pypy/dist/pypy/annotation

arigo at codespeak.net arigo at codespeak.net
Sat Jun 25 15:30:23 CEST 2005


Author: arigo
Date: Sat Jun 25 15:30:22 2005
New Revision: 13853

Modified:
   pypy/dist/pypy/annotation/binaryop.py
   pypy/dist/pypy/annotation/unaryop.py
Log:
Count some rare operations.


Modified: pypy/dist/pypy/annotation/binaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/binaryop.py	(original)
+++ pypy/dist/pypy/annotation/binaryop.py	Sat Jun 25 15:30:22 2005
@@ -134,10 +134,10 @@
             return SomeBool()
 
     def cmp((obj1, obj2)):
+        getbookkeeper().count("cmp", obj1, obj2)
         if obj1.is_constant() and obj2.is_constant():
             return immutablevalue(cmp(obj1.const, obj2.const))
         else:
-            getbookkeeper().count("non_int_comp", obj1, obj2)
             return SomeInteger()
 
     def is_((obj1, obj2)):
@@ -183,9 +183,11 @@
         return r
 
     def divmod((obj1, obj2)):
+        getbookkeeper().count("divmod", obj1, obj2)
         return SomeTuple([pair(obj1, obj2).div(), pair(obj1, obj2).mod()])
 
     def coerce((obj1, obj2)):
+        getbookkeeper().count("coerce", obj1, obj2)
         return pair(obj1, obj2).union()   # reasonable enough
 
 # cloning a function with identical code, for the can_only_throw attribute
@@ -451,11 +453,13 @@
         return SomeChar()
 
     def mul((str1, int2)): # xxx do we want to support this
+        getbookkeeper().count("str_mul", str1, int2)
         return SomeString()
 
 class __extend__(pairtype(SomeInteger, SomeString)):
     
     def mul((int1, str2)): # xxx do we want to support this
+        getbookkeeper().count("str_mul", str2, int1)
         return SomeString()
 
 class __extend__(pairtype(SomeInteger, SomeList)):

Modified: pypy/dist/pypy/annotation/unaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/unaryop.py	(original)
+++ pypy/dist/pypy/annotation/unaryop.py	Sat Jun 25 15:30:22 2005
@@ -317,6 +317,7 @@
         return SomeInteger(nonneg=True)
 
     def method_split(str, patt): # XXX
+        getbookkeeper().count("str_split", str, patt)
         return getbookkeeper().newlist(SomeString())
 
 
@@ -435,6 +436,10 @@
     def is_true(pbc):
         outcome = None
         for c in pbc.prebuiltinstances:
+            if c is not None and not bool(c):
+                getbookkeeper().warning("PBC %r has truth value False" % (c,))
+                getbookkeeper().count("pbc_is_true", pbc)
+        for c in pbc.prebuiltinstances:
             if outcome is None:
                 outcome = bool(c)
             else:



More information about the Pypy-commit mailing list