[pypy-svn] r63314 - pypy/branch/pyjitpl5-PyGirl/pypy/lang/gameboy

cfbolz at codespeak.net cfbolz at codespeak.net
Wed Mar 25 11:01:05 CET 2009


Author: cfbolz
Date: Wed Mar 25 11:01:04 2009
New Revision: 63314

Modified:
   pypy/branch/pyjitpl5-PyGirl/pypy/lang/gameboy/cpu.py
Log:
use some jit hints to improve the code


Modified: pypy/branch/pyjitpl5-PyGirl/pypy/lang/gameboy/cpu.py
==============================================================================
--- pypy/branch/pyjitpl5-PyGirl/pypy/lang/gameboy/cpu.py	(original)
+++ pypy/branch/pyjitpl5-PyGirl/pypy/lang/gameboy/cpu.py	Wed Mar 25 11:01:04 2009
@@ -250,13 +250,16 @@
     def fetch(self, use_cycles=True):
         # Fetching  1 cycle
         if use_cycles:
-            self.cycles += 1
+            self.cycles -= 1 # upate cycles manually
         pc = self.pc.get(use_cycles)
+        pc = hint(pc, promote=True)
         if pc <= 0x3FFF:
-            data = ord(self.rom[self.pc.get(use_cycles)])
+            rom = hint(self.rom, promote=True)
+            data = ord(rom[pc])
+            data = hint(data, promote=True)
         else:
-            data = self.memory.read(self.pc.get(use_cycles))
-        self.pc.inc(use_cycles) # 2 cycles
+            data = self.memory.read(pc)
+        self.pc.value = pc + 1 # do the update manually to help the jit
         return data
     
     def fetch_double_address(self):



More information about the Pypy-commit mailing list