[pypy-svn] r13749 - in pypy/dist/pypy: annotation translator/goal

pedronis at codespeak.net pedronis at codespeak.net
Thu Jun 23 21:42:31 CEST 2005


Author: pedronis
Date: Thu Jun 23 21:42:28 2005
New Revision: 13749

Modified:
   pypy/dist/pypy/annotation/bookkeeper.py
   pypy/dist/pypy/annotation/unaryop.py
   pypy/dist/pypy/translator/goal/query.py
Log:
stats on builtin functions



Modified: pypy/dist/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/dist/pypy/annotation/bookkeeper.py	(original)
+++ pypy/dist/pypy/annotation/bookkeeper.py	Thu Jun 23 21:42:28 2005
@@ -315,7 +315,7 @@
                     result.dictdef.generalize_key(self.immutablevalue(ek))
                     result.dictdef.generalize_value(self.immutablevalue(ev))
         elif ishashable(x) and x in BUILTIN_ANALYZERS:
-            result = SomeBuiltin(BUILTIN_ANALYZERS[x])
+            result = SomeBuiltin(BUILTIN_ANALYZERS[x], methodname="%s.%s" % (x.__module__, x.__name__))
         elif isinstance(x, lltype._ptr):
             result = SomePtr(lltype.typeOf(x))
         elif callable(x) or isinstance(x, staticmethod): # XXX

Modified: pypy/dist/pypy/annotation/unaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/unaryop.py	(original)
+++ pypy/dist/pypy/annotation/unaryop.py	Thu Jun 23 21:42:28 2005
@@ -379,6 +379,7 @@
         if bltn.s_self is not None:
             return bltn.analyser(bltn.s_self, *args)
         else:
+            getbookkeeper().count(bltn.methodname.replace('.', '_'), *args)
             return bltn.analyser(*args)
 
     def call(bltn, args, implicit_init=False):

Modified: pypy/dist/pypy/translator/goal/query.py
==============================================================================
--- pypy/dist/pypy/translator/goal/query.py	(original)
+++ pypy/dist/pypy/translator/goal/query.py	Thu Jun 23 21:42:28 2005
@@ -405,6 +405,11 @@
     for (f,a), c in result.iteritems():
         print "%s %s %d" % (f, keyrepr(a), c)
 
+def statbuiltins(t):
+    stats = t.annotator.bookkeeper.stats.classify
+    for k in stats:
+        if k.startswith('__builtin__'):
+            statsfor(t, k)
 
 # debug helper
 def tryout(f, *args):



More information about the Pypy-commit mailing list