[pypy-svn] r68676 - pypy/branch/warmspot-jitinfo/pypy/module/pypyjit

arigo at codespeak.net arigo at codespeak.net
Wed Oct 21 10:55:58 CEST 2009


Author: arigo
Date: Wed Oct 21 10:55:56 2009
New Revision: 68676

Modified:
   pypy/branch/warmspot-jitinfo/pypy/module/pypyjit/interp_jit.py
Log:
Add get_jitcell_at and set_jitcell_at to the PyPy jit.
Still tracking segfaults...


Modified: pypy/branch/warmspot-jitinfo/pypy/module/pypyjit/interp_jit.py
==============================================================================
--- pypy/branch/warmspot-jitinfo/pypy/module/pypyjit/interp_jit.py	(original)
+++ pypy/branch/warmspot-jitinfo/pypy/module/pypyjit/interp_jit.py	Wed Oct 21 10:55:56 2009
@@ -20,6 +20,8 @@
 from opcode import opmap
 from pypy.rlib.objectmodel import we_are_translated
 
+PyCode.jit_cells = None
+
 PyFrame._virtualizable2_ = ['last_instr', 'pycode',
                             'valuestackdepth', 'valuestack_w[*]',
                             'fastlocals_w[*]', 'f_forward',
@@ -53,6 +55,19 @@
     # annotation       XXX no longer true, could be fixed
     ExecutionContext._jit_rechain_frame(ec, frame)
 
+def get_jitcell_at(next_instr, bytecode):
+    d = bytecode.jit_cells
+    if d is None:
+        return None
+    return d.get(next_instr, None)
+
+def set_jitcell_at(newcell, next_instr, bytecode):
+    d = bytecode.jit_cells
+    if d is None:
+        d = bytecode.jit_cells = {}
+    d[next_instr] = newcell
+
+
 class PyPyJitDriver(JitDriver):
     reds = ['frame', 'ec']
     greens = ['next_instr', 'pycode']
@@ -68,7 +83,9 @@
 
 pypyjitdriver = PyPyJitDriver(can_inline = can_inline,
                               get_printable_location = get_printable_location,
-                              leave = leave)
+                              leave = leave,
+                              get_jitcell_at = get_jitcell_at,
+                              set_jitcell_at = set_jitcell_at)
 
 class __extend__(PyFrame):
 



More information about the Pypy-commit mailing list