[pypy-svn] r68692 - in pypy/branch/warmspot-jitinfo/pypy: interpreter module/pypyjit

arigo at codespeak.net arigo at codespeak.net
Wed Oct 21 18:25:55 CEST 2009


Author: arigo
Date: Wed Oct 21 18:25:55 2009
New Revision: 68692

Modified:
   pypy/branch/warmspot-jitinfo/pypy/interpreter/pycode.py
   pypy/branch/warmspot-jitinfo/pypy/module/pypyjit/interp_jit.py
Log:
In this version, pypy-c-jit seems to work.


Modified: pypy/branch/warmspot-jitinfo/pypy/interpreter/pycode.py
==============================================================================
--- pypy/branch/warmspot-jitinfo/pypy/interpreter/pycode.py	(original)
+++ pypy/branch/warmspot-jitinfo/pypy/interpreter/pycode.py	Wed Oct 21 18:25:55 2009
@@ -84,6 +84,9 @@
         self.hidden_applevel = hidden_applevel
         self.magic = magic
         self._signature = cpython_code_signature(self)
+        self._initialize()
+
+    def _initialize(self):
         # Precompute what arguments need to be copied into cellvars
         self._args_as_cellvars = []
         
@@ -116,7 +119,7 @@
 
         self._compute_flatcall()
 
-        if space.config.objspace.std.withcelldict:
+        if self.space.config.objspace.std.withcelldict:
             from pypy.objspace.std.celldict import init_code
             init_code(self)
 

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 18:25:55 2009
@@ -20,8 +20,6 @@
 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',
@@ -56,16 +54,10 @@
     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)
+    return bytecode.jit_cells.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
+    bytecode.jit_cells[next_instr] = newcell
 
 
 class PyPyJitDriver(JitDriver):
@@ -111,6 +103,20 @@
                                     pycode=f.getcode())
         return jumpto
 
+
+PyCode__initialize = PyCode._initialize
+
+class __extend__(PyCode):
+    __metaclass__ = extendabletype
+
+    def _initialize(self):
+        PyCode__initialize(self)
+        self.jit_cells = {}
+
+    def _freeze_(self):
+        self.jit_cells = {}
+        return False
+
 # ____________________________________________________________
 #
 # Public interface    



More information about the Pypy-commit mailing list