[pypy-svn] r56994 - in pypy/dist/pypy/lang/gameboy: . profiling

cami at codespeak.net cami at codespeak.net
Tue Aug 5 10:40:34 CEST 2008


Author: cami
Date: Tue Aug  5 10:40:34 2008
New Revision: 56994

Modified:
   pypy/dist/pypy/lang/gameboy/gameboy_implementation.py
   pypy/dist/pypy/lang/gameboy/profiling/gameboy_profiling_implementation.py
   pypy/dist/pypy/lang/gameboy/profiling/profiling_cpu.py
Log:
fixed some bugs for the profiling version discovered during translation


Modified: pypy/dist/pypy/lang/gameboy/gameboy_implementation.py
==============================================================================
--- pypy/dist/pypy/lang/gameboy/gameboy_implementation.py	(original)
+++ pypy/dist/pypy/lang/gameboy/gameboy_implementation.py	Tue Aug  5 10:40:34 2008
@@ -37,9 +37,9 @@
                 self.emulate(constants.GAMEBOY_CLOCK >> 2)
                 #RSDL.Delay(1)
         except :
-            self.handle_execution_error()
             lltype.free(self.event, flavor='raw')
             RSDL.Quit()
+            self.handle_execution_error()
         return 0
     
     def handle_execution_error(self):

Modified: pypy/dist/pypy/lang/gameboy/profiling/gameboy_profiling_implementation.py
==============================================================================
--- pypy/dist/pypy/lang/gameboy/profiling/gameboy_profiling_implementation.py	(original)
+++ pypy/dist/pypy/lang/gameboy/profiling/gameboy_profiling_implementation.py	Tue Aug  5 10:40:34 2008
@@ -11,9 +11,10 @@
 class GameBoyProfilingImplementation(GameBoyImplementation):
     
     def __init__(self, cycleLimit=0):
-        GameBoy.__init__(self)
+        GameBoyImplementation.__init__(self)
         self.cycleLimit = cycleLimit
-        self.cpu = ProfilingCPU(self.interrupt, self, self.cycleLimit)
+        self.cpu = ProfilingCPU(self.interrupt, self)
+        self.cpu.cycle_limit = cycleLimit
         
     def handle_executed_op_code(self, is_fetch_execute=True):
         self.process_cpu_profiling_data()

Modified: pypy/dist/pypy/lang/gameboy/profiling/profiling_cpu.py
==============================================================================
--- pypy/dist/pypy/lang/gameboy/profiling/profiling_cpu.py	(original)
+++ pypy/dist/pypy/lang/gameboy/profiling/profiling_cpu.py	Tue Aug  5 10:40:34 2008
@@ -7,8 +7,8 @@
 class ProfilingCPU(CPU):
     
     
-    def __init__(self, interrupt, memory, cycle_limit):
-        CPU.__init__(interrupt, memory)
+    def __init__(self, interrupt, memory):
+        CPU.__init__(self, interrupt, memory)
         self.cycle_limit = 0
         self.op_code_count           = 0
         self.fetch_exec_opcode_histo = [0]*(0xFF+1)
@@ -16,13 +16,13 @@
     
     def fetch_execute(self):
         CPU.fetch_execute(self)
-        self.count += 1
+        self.op_code_count += 1
         self.fetch_exec_opcode_histo[self.last_fetch_execute_op_code] += 1
         
     
     def execute(self, opCode):
         CPU.execute(self, opCode)
-        self.count += 1
+        self.op_code_count += 1
         self.opcode_histo[self.last_op_code] += 1
         if self.op_code_count >= self.cycle_limit:
             raise Exception("Maximal Cyclecount reached")
\ No newline at end of file



More information about the Pypy-commit mailing list