[pypy-svn] r76942 - pypy/branch/jit-generator/pypy/module/pypyjit

arigo at codespeak.net arigo at codespeak.net
Wed Sep 8 14:00:39 CEST 2010


Author: arigo
Date: Wed Sep  8 14:00:37 2010
New Revision: 76942

Modified:
   pypy/branch/jit-generator/pypy/module/pypyjit/interp_jit.py
   pypy/branch/jit-generator/pypy/module/pypyjit/policy.py
Log:
First attempt.


Modified: pypy/branch/jit-generator/pypy/module/pypyjit/interp_jit.py
==============================================================================
--- pypy/branch/jit-generator/pypy/module/pypyjit/interp_jit.py	(original)
+++ pypy/branch/jit-generator/pypy/module/pypyjit/interp_jit.py	Wed Sep  8 14:00:37 2010
@@ -60,7 +60,10 @@
                               set_jitcell_at = set_jitcell_at,
                               confirm_enter_jit = confirm_enter_jit)
 
+PyFrame__execute_generator_frame = PyFrame.execute_generator_frame
+
 class __extend__(PyFrame):
+    last_yield = -1
 
     def dispatch(self, pycode, next_instr, ec):
         self = hint(self, access_directly=True)
@@ -75,7 +78,16 @@
         except ExitFrame:
             return self.popvalue()
 
+    def execute_generator_frame(self, w_inputvalue, operr=None):
+        self.last_yield = self.last_instr
+        return PyFrame__execute_generator_frame(self, w_inputvalue, operr)
+
     def jump_absolute(self, jumpto, _, ec=None):
+        if jumpto <= self.last_yield:
+            # Here we are in a generator, closing the loop that did a YIELD.
+            # In that case, we should not consider this a loop at all.
+            self.last_yield = -1
+            return jumpto
         if we_are_jitted():
             self.last_instr = intmask(jumpto)
             ec.bytecode_trace(self)

Modified: pypy/branch/jit-generator/pypy/module/pypyjit/policy.py
==============================================================================
--- pypy/branch/jit-generator/pypy/module/pypyjit/policy.py	(original)
+++ pypy/branch/jit-generator/pypy/module/pypyjit/policy.py	Wed Sep  8 14:00:37 2010
@@ -32,8 +32,6 @@
             return False
         if mod.startswith('pypy.interpreter.pyparser.'):
             return False
-        if mod == 'pypy.interpreter.generator':
-            return False
         if mod.startswith('pypy.module.'):
             modname = mod[len('pypy.module.'):]
             if not self.look_inside_pypy_module(modname):



More information about the Pypy-commit mailing list