[pypy-svn] r40548 - in pypy/branch/jit-virtual-world/pypy/jit: goal hintannotator

arigo at codespeak.net arigo at codespeak.net
Thu Mar 15 17:18:38 CET 2007


Author: arigo
Date: Thu Mar 15 17:18:35 2007
New Revision: 40548

Modified:
   pypy/branch/jit-virtual-world/pypy/jit/goal/jitstep.py
   pypy/branch/jit-virtual-world/pypy/jit/hintannotator/bookkeeper.py
Log:
(pedronis, arre, arigo) Tweaks to the heuristics about how much of PyPy to timeshift.


Modified: pypy/branch/jit-virtual-world/pypy/jit/goal/jitstep.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/goal/jitstep.py	(original)
+++ pypy/branch/jit-virtual-world/pypy/jit/goal/jitstep.py	Thu Mar 15 17:18:35 2007
@@ -18,7 +18,7 @@
 
     def look_inside_graph(self, graph):
         if graph in self.timeshift_graphs:
-            return True
+            return self.timeshift_graphs[graph]
         try:
             func = graph.func
         except AttributeError:
@@ -31,6 +31,10 @@
                 return False
         if mod in forbidden_modules:
             return False
+        if func.__name__.startswith('_mm_') or '_mth_mm_' in func.__name__:
+            return False
+        if func.__name__.startswith('fastfunc_'):
+            return False
         return True
 
 forbidden_modules = {'pypy.interpreter.gateway': True,
@@ -101,6 +105,9 @@
         for i in range(1, len(path)):
             seefunc(path[i-1], path[i])
 
+    def dontsee(func):
+        result_graphs[_graph(func)] = False
+
     # --------------------
     import pypy
     seepath(pypy.interpreter.pyframe.PyFrame.BINARY_ADD,
@@ -118,6 +125,9 @@
     seepath(pypy.objspace.descroperation.DescrOperation.add,
             pypy.objspace.std.typeobject.W_TypeObject.lookup_where,
             pypy.objspace.std.typeobject.W_TypeObject.getdictvalue_w)
+    seepath(pypy.objspace.std.typeobject.W_TypeObject.lookup_where,
+            is_heaptype)
+    dontsee(pypy.interpreter.pyframe.PyFrame.execute_frame)
     # --------------------
 
     return result_graphs
@@ -150,6 +160,9 @@
     #import pdb; pdb.set_trace()
 
 def timeshift(drv):
+    from pypy.tool.udir import udir
+    udir.ensure(dir=1)    # fork-friendly hack
+    udir.join('.lock').ensure()
     from pypy.jit.timeshifter.hrtyper import HintRTyper
     #from pypy.jit.codegen.llgraph.rgenop import RGenOp
     from pypy.jit.codegen.i386.rgenop import RI386GenOp as RGenOp

Modified: pypy/branch/jit-virtual-world/pypy/jit/hintannotator/bookkeeper.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/hintannotator/bookkeeper.py	(original)
+++ pypy/branch/jit-virtual-world/pypy/jit/hintannotator/bookkeeper.py	Thu Mar 15 17:18:35 2007
@@ -46,8 +46,10 @@
             bk = self.bookkeeper
             if bk.annotator.policy.look_inside_graph(self.origgraph):
                 graph = copygraph(self.origgraph)
+                log(str(graph))
             else:
                 graph = self.build_callback_graph(self.origgraph)
+                log.stub(str(graph))
             graph.tag = 'timeshifted'
             try:
                 etrafo = bk.annotator.exceptiontransformer
@@ -60,7 +62,6 @@
                 graph.name = alt_name
             self._cache[key] = graph
             self.bookkeeper.annotator.translator.graphs.append(graph)
-            log(str(graph))
             return graph
 
     def build_callback_graph(self, graph):



More information about the Pypy-commit mailing list