Author: Maciej Fijalkowski <[email protected]>
Branch: opcode-tracing-experiment
Changeset: r56408:8500db08c149
Date: 2012-07-23 12:52 +0200
http://bitbucket.org/pypy/pypy/changeset/8500db08c149/

Log:    hack at jitcells to avoid dict lookup

diff --git a/pypy/module/pypyjit/interp_jit.py 
b/pypy/module/pypyjit/interp_jit.py
--- a/pypy/module/pypyjit/interp_jit.py
+++ b/pypy/module/pypyjit/interp_jit.py
@@ -31,11 +31,15 @@
     name = opcode_method_names[ord(co)]
     return name
 
-#def get_jitcell_at(next_instr, is_being_profiled, bytecode):
-#    return bytecode.jit_cells.get((next_instr, is_being_profiled), None)
+ALL_JITCELLS = [None] * 255
 
-#def set_jitcell_at(newcell, next_instr, is_being_profiled, bytecode):
-#    bytecode.jit_cells[next_instr, is_being_profiled] = newcell
+def get_jitcell_at(is_being_profiled, opcode):
+    return ALL_JITCELLS[ord(opcode)]
+    #return bytecode.jit_cells.get((next_instr, is_being_profiled), None)
+
+def set_jitcell_at(newcell, is_being_profiled, opcode):
+    #bytecode.jit_cells[next_instr, is_being_profiled] = newcell
+    ALL_JITCELLS[ord(opcode)] = newcell
 
 #def confirm_enter_jit(next_instr, is_being_profiled, bytecode, frame, ec):
 #    return True
@@ -54,8 +58,8 @@
 #    virtualizables = ['frame']
 
 pypyjitdriver = PyPyJitDriver(get_printable_location = get_printable_location,
-#                              get_jitcell_at = get_jitcell_at,
-#                              set_jitcell_at = set_jitcell_at,
+                              get_jitcell_at = get_jitcell_at,
+                              set_jitcell_at = set_jitcell_at,
 #                              confirm_enter_jit = confirm_enter_jit,
 #                              can_never_inline = can_never_inline,
 #                              should_unroll_one_iteration =
@@ -130,10 +134,10 @@
 
     def _initialize(self):
         PyCode__initialize(self)
-        self.jit_cells = {}
+        #self.jit_cells = {}
 
     def _freeze_(self):
-        self.jit_cells = {}
+        #self.jit_cells = {}
         return False
 
 # ____________________________________________________________
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to