[pypy-svn] r35519 - pypy/branch/temp/pypy/objspace/flow

arigo at codespeak.net arigo at codespeak.net
Sat Dec 9 02:31:30 CET 2006


Author: arigo
Date: Sat Dec  9 02:31:25 2006
New Revision: 35519

Modified:
   pypy/branch/temp/pypy/objspace/flow/flowcontext.py
Log:
merging of http://codespeak.net/svn/pypy/branch/jit-real-world/pypy/objspace/flow/flowcontext.py
revisions 35112 to 35513:

    ------------------------------------------------------------------------
    r35184 | arigo | 2006-12-01 03:43:34 +0100 (Fri, 01 Dec 2006) | 16 lines
    
    (pedronis, arigo)
    
    Intermediate check-in #2.
    
    More seriously, we rewrote the interpreter main loop in a style that
    should be easier for the JIT to grasp, but also -- possibly -- easier
    for human beings to grasp.  A bit.  Many levels of wrapping of stuff
    into other stuff are avoided now, and the PyFrame class hierarchy was
    completely removed.  There is a possibly nice way to add opcodes from
    outside, with config options to enable them.  The drawback is that the
    core main loop uses modern RPython magic.
    
    Translation not tested.  It makes py.py slower by 30% but we hope that
    pypy-c will be faster.
    
    
    ------------------------------------------------------------------------
    r35118 | arigo | 2006-11-29 13:45:27 +0100 (Wed, 29 Nov 2006) | 7 lines
    
    (arre, pedronis, arigo)
    
    Be afraid.  Very afraid.  (pedronis)
    
    A branch to experiment with throwing PyPy at the JIT.  (arigo)
    
    
    ------------------------------------------------------------------------


Modified: pypy/branch/temp/pypy/objspace/flow/flowcontext.py
==============================================================================
--- pypy/branch/temp/pypy/objspace/flow/flowcontext.py	(original)
+++ pypy/branch/temp/pypy/objspace/flow/flowcontext.py	Sat Dec  9 02:31:25 2006
@@ -95,7 +95,7 @@
 
     def bytecode_trace(self, ec, frame):
         assert frame is ec.crnt_frame, "seeing an unexpected frame!"
-        ec.crnt_offset = frame.next_instr      # save offset for opcode
+        ec.crnt_offset = frame.last_instr      # save offset for opcode
         if self.enterspamblock:
             # If we have a SpamBlock, the first call to bytecode_trace()
             # occurs as soon as frame.resume() starts, before interpretation
@@ -218,8 +218,10 @@
         # create an empty frame suitable for the code object
         # while ignoring any operation like the creation of the locals dict
         self.recorder = []
-        return self.code.create_frame(self.space, self.w_globals,
-                                      self.closure)
+        frame = self.code.create_frame(self.space, self.w_globals,
+                                       self.closure)
+        frame.last_instr = 0
+        return frame
 
     def bytecode_trace(self, frame):
         self.recorder.bytecode_trace(self, frame)
@@ -256,11 +258,15 @@
             except StopFlowing:
                 continue   # restarting a dead SpamBlock
             try:
+                self.framestack.push(frame)
                 self.crnt_frame = frame
                 try:
-                    w_result = frame.resume()
+                    w_result = frame.dispatch(frame.pycode.co_code,
+                                              frame.last_instr,
+                                              self)
                 finally:
                     self.crnt_frame = None
+                    self.framestack.pop()
 
             except OperationThatShouldNotBePropagatedError, e:
                 raise Exception(



More information about the Pypy-commit mailing list