[pypy-commit] pypy default: removed long unused logbytescodes option

alex_gaynor noreply at buildbot.pypy.org
Sat Dec 1 20:26:38 CET 2012


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r59177:2ec6eb1a3838
Date: 2012-12-01 11:26 -0800
http://bitbucket.org/pypy/pypy/changeset/2ec6eb1a3838/

Log:	removed long unused logbytescodes option

diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -172,10 +172,6 @@
                cmdline="--translationmodules",
                suggests=[("objspace.allworkingmodules", False)]),
 
-    BoolOption("logbytecodes",
-               "keep track of bytecode usage",
-               default=False),
-
     BoolOption("usepycfiles", "Write and read pyc files when importing",
                default=True),
 
diff --git a/pypy/doc/config/objspace.logbytecodes.txt b/pypy/doc/config/objspace.logbytecodes.txt
deleted file mode 100644
--- a/pypy/doc/config/objspace.logbytecodes.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Internal option.
-
-.. internal
diff --git a/pypy/doc/config/translation.insist.txt b/pypy/doc/config/translation.insist.txt
deleted file mode 100644
--- a/pypy/doc/config/translation.insist.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-Don't stop on the first `rtyping`_ error. Instead, try to rtype as much as
-possible and show the collected error messages in the end.
-
-.. _`rtyping`: ../rtyper.html
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -318,10 +318,6 @@
         self.host_magic = cpython_magic
         # can be overridden to a subclass
 
-        if self.config.objspace.logbytecodes:
-            self.bytecodecounts = [0] * 256
-            self.bytecodetransitioncount = {}
-
         self.initialize()
 
     def startup(self):
@@ -353,8 +349,6 @@
             mod = self.interpclass_w(w_mod)
             if isinstance(mod, Module) and mod.startup_called:
                 mod.shutdown(self)
-        if self.config.objspace.logbytecodes:
-            self.reportbytecodecounts()
 
     def wait_for_thread_shutdown(self):
         """Wait until threading._shutdown() completes, provided the threading
@@ -373,26 +367,6 @@
         except OperationError, e:
             e.write_unraisable(self, "threading._shutdown()")
 
-    def reportbytecodecounts(self):
-        os.write(2, "Starting bytecode report.\n")
-        fd = os.open('bytecode.txt', os.O_CREAT|os.O_WRONLY|os.O_TRUNC, 0644)
-        os.write(fd, "bytecodecounts = {\n")
-        for opcode in range(len(self.bytecodecounts)):
-            count = self.bytecodecounts[opcode]
-            if not count:
-                continue
-            os.write(fd, "    %s: %s,\n" % (opcode, count))
-        os.write(fd, "}\n")
-        os.write(fd, "bytecodetransitioncount = {\n")
-        for opcode, probs in self.bytecodetransitioncount.iteritems():
-            os.write(fd, "    %s: {\n" % (opcode, ))
-            for nextcode, count in probs.iteritems():
-                os.write(fd, "        %s: %s,\n" % (nextcode, count))
-            os.write(fd, "    },\n")
-        os.write(fd, "}\n")
-        os.close(fd)
-        os.write(2, "Reporting done.\n")
-
     def __repr__(self):
         try:
             return self._this_space_repr_
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -63,9 +63,6 @@
     """A PyFrame that knows about interpretation of standard Python opcodes
     minus the ones related to nested scopes."""
 
-    # for logbytecode:
-    last_opcode = -1
-
     bytecode_spec = bytecode_spec
     opcode_method_names = bytecode_spec.method_names
     opcodedesc = bytecode_spec.opcodedesc
@@ -172,14 +169,6 @@
                 next_instr = r_uint(self.last_instr)
             opcode = ord(co_code[next_instr])
             next_instr += 1
-            if space.config.objspace.logbytecodes:
-                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 >= self.HAVE_ARGUMENT:
                 lo = ord(co_code[next_instr])


More information about the pypy-commit mailing list