[pypy-svn] r66044 - pypy/branch/pyjitpl5/pypy/interpreter

arigo at codespeak.net arigo at codespeak.net
Tue Jun 30 16:35:06 CEST 2009


Author: arigo
Date: Tue Jun 30 16:35:05 2009
New Revision: 66044

Added:
   pypy/branch/pyjitpl5/pypy/interpreter/pyopcode.py.merge.tmp
      - copied, changed from r66039, pypy/branch/pyjitpl5/pypy/interpreter/pyopcode.py
Log:
merging of svn+ssh://codespeak.net/svn/pypy/trunk/pypy/interpreter/pyopcode.py
revisions 62865 to 66039:

    ------------------------------------------------------------------------
    r65798 | benjamin | 2009-06-16 23:01:32 +0200 (Tue, 16 Jun 2009) | 1 line
    
    now fix docstring
    ------------------------------------------------------------------------
    r65797 | benjamin | 2009-06-16 22:52:37 +0200 (Tue, 16 Jun 2009) | 1 line
    
    update comment
    ------------------------------------------------------------------------
    r65525 | pedronis | 2009-06-01 08:22:12 +0200 (Mon, 01 Jun 2009) | 5 lines
    
    reverting 65522, it broke a couple tests in applevel and lib-python tests
    
    not completely clear why, in general our error code is not that well tested by our own tests
    
    
    ------------------------------------------------------------------------
    r65522 | benjamin | 2009-06-01 02:00:54 +0200 (Mon, 01 Jun 2009) | 1 line
    
    normalize raise statements
    ------------------------------------------------------------------------
    r64172 | iko | 2009-04-16 16:53:49 +0200 (Thu, 16 Apr 2009) | 8 lines
    
    (iko, pedronis)
    
    fix test_trace issues
    
    * bare except: gets line number
    * implicit return gets line number
    
    
    ------------------------------------------------------------------------
    r64155 | iko | 2009-04-16 13:48:59 +0200 (Thu, 16 Apr 2009) | 5 lines
    
    (iko, pedronis)
    
    Fix tracing / finally interaction
    
    
    ------------------------------------------------------------------------
    r63072 | cfbolz | 2009-03-19 15:33:14 +0100 (Thu, 19 Mar 2009) | 2 lines
    
    when bytecode logging is enabled, collect some more information
    
    ------------------------------------------------------------------------


Copied: pypy/branch/pyjitpl5/pypy/interpreter/pyopcode.py.merge.tmp (from r66039, pypy/branch/pyjitpl5/pypy/interpreter/pyopcode.py)
==============================================================================
--- pypy/branch/pyjitpl5/pypy/interpreter/pyopcode.py	(original)
+++ pypy/branch/pyjitpl5/pypy/interpreter/pyopcode.py.merge.tmp	Tue Jun 30 16:35:05 2009
@@ -1,7 +1,7 @@
 """
 Implementation of a part of the standard Python opcodes.
-The rest, dealing with variables in optimized ways, is in
-pyfastscope.py and pynestedscope.py.
+
+The rest, dealing with variables in optimized ways, is in nestedscope.py.
 """
 
 import sys
@@ -65,6 +65,9 @@
     """A PyFrame that knows about interpretation of standard Python opcodes
     minus the ones related to nested scopes."""
     
+    # for logbytecode:
+    last_opcode = -1
+    
     ### opcode dispatch ###
 
     def dispatch(self, pycode, next_instr, ec):
@@ -141,7 +144,12 @@
                 # dispatch_bytecode(), causing the real exception to be
                 # raised after the exception handler block was popped.
                 try:
-                    ec.bytecode_trace(self)
+                    trace = self.w_f_trace
+                    self.w_f_trace = None
+                    try:
+                        ec.bytecode_trace(self)
+                    finally:
+                        self.w_f_trace = trace
                 except OperationError, e:
                     operr = e
             pytraceback.record_application_traceback(
@@ -174,7 +182,13 @@
             opcode = ord(co_code[next_instr])
             next_instr += 1
             if space.config.objspace.logbytecodes:
-                space.bytecodecounts[opcode] = space.bytecodecounts.get(opcode, 0) + 1
+                space.bytecodecounts[opcode] += 1
+                try:
+                    probs = space.bytecodetransitioncount[self.last_opcode]
+                except KeyError:
+                    probs = space.bytecodetransitioncount[self.last_opcode] = {}
+                probs[opcode] = probs.get(opcode, 0) + 1
+                self.last_opcode = opcode
 
             if opcode >= HAVE_ARGUMENT:
                 lo = ord(co_code[next_instr])
@@ -293,9 +307,9 @@
 
     ################################################################
     ##  Implementation of the "operational" opcodes
-    ##  See also pyfastscope.py and pynestedscope.py for the rest.
+    ##  See also nestedscope.py for the rest.
     ##
-    
+
     #  the 'self' argument of opcode implementations is called 'f'
     #  for historical reasons
 
@@ -1074,7 +1088,7 @@
     def __init__(self, operr):
         self.operr = operr
     def nomoreblocks(self):
-        raise self.operr
+        raise RaiseWithExplicitTraceback(self.operr)
 
     def state_unpack_variables(self, space):
         return [self.operr.w_type, self.operr.w_value]



More information about the Pypy-commit mailing list