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

antocuni at codespeak.net antocuni at codespeak.net
Tue Oct 7 16:12:50 CEST 2008


Author: antocuni
Date: Tue Oct  7 16:12:48 2008
New Revision: 58757

Modified:
   pypy/dist/pypy/annotation/specialize.py
   pypy/dist/pypy/translator/goal/ann_override.py
Log:
(antocuni, xoraxax) add a "virtual" module name to these lambda functions, so that we can track them when generating statistics about static data



Modified: pypy/dist/pypy/annotation/specialize.py
==============================================================================
--- pypy/dist/pypy/annotation/specialize.py	(original)
+++ pypy/dist/pypy/annotation/specialize.py	Tue Oct  7 16:12:48 2008
@@ -415,14 +415,14 @@
 ##    return funcdesc.cachedgraph(s1_type, alt_name='memo_%s' % funcdesc.name, 
 ##                                         builder=builder)
 
-def make_constgraphbuilder(n, v=None, factory=None):
+def make_constgraphbuilder(n, v=None, factory=None, srcmodule=None):
     def constgraphbuilder(translator, ignore):
         args = ','.join(["arg%d" % i for i in range(n)])
         if factory is not None:
             computed_v = factory()
         else:
             computed_v = v
-        miniglobals = {'v': computed_v}
+        miniglobals = {'v': computed_v, '__name__': srcmodule}
         exec "constf = lambda %s: v" % args in miniglobals
         return translator.buildflowgraph(miniglobals['constf'])
     return constgraphbuilder

Modified: pypy/dist/pypy/translator/goal/ann_override.py
==============================================================================
--- pypy/dist/pypy/translator/goal/ann_override.py	(original)
+++ pypy/dist/pypy/translator/goal/ann_override.py	Tue Oct  7 16:12:48 2008
@@ -65,7 +65,8 @@
                             return space.new_interned_str(x)
                         else:
                             return space.wrap(x)
-                    builder = specialize.make_constgraphbuilder(2, factory=fold)
+                    builder = specialize.make_constgraphbuilder(2, factory=fold,
+                                                                srcmodule='<ann_override.wrap>')
                     return funcdesc.cachedgraph((typ, x), builder=builder)
         return funcdesc.cachedgraph(typ)
     



More information about the Pypy-commit mailing list