[pypy-svn] r66047 - pypy/branch/pyjitpl5/pypy/interpreter
arigo at codespeak.net
arigo at codespeak.net
Tue Jun 30 16:35:22 CEST 2009
Author: arigo
Date: Tue Jun 30 16:35:21 2009
New Revision: 66047
Added:
pypy/branch/pyjitpl5/pypy/interpreter/baseobjspace.py.merge.tmp
- copied, changed from r66039, pypy/branch/pyjitpl5/pypy/interpreter/baseobjspace.py
Log:
merging of svn+ssh://codespeak.net/svn/pypy/trunk/pypy/interpreter/baseobjspace.py
revisions 62865 to 66039:
------------------------------------------------------------------------
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
------------------------------------------------------------------------
r64501 | cfbolz | 2009-04-21 12:45:54 +0200 (Tue, 21 Apr 2009) | 4 lines
fix the test by adding a new space method resolve_target (that just returns its
argument, by default) that the thunk obj space overrides to act like force. This
method is called on the sliced-on argument by std objspace multimethods.
------------------------------------------------------------------------
r64114 | iko | 2009-04-15 19:50:42 +0200 (Wed, 15 Apr 2009) | 5 lines
(iko, tismer, pedronis)
Hide pypy applevel helper frames
------------------------------------------------------------------------
r64092 | iko | 2009-04-15 13:06:47 +0200 (Wed, 15 Apr 2009) | 3 lines
improve buffer repr to approch cpython info, and pass cpython test
------------------------------------------------------------------------
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/baseobjspace.py.merge.tmp (from r66039, pypy/branch/pyjitpl5/pypy/interpreter/baseobjspace.py)
==============================================================================
--- pypy/branch/pyjitpl5/pypy/interpreter/baseobjspace.py (original)
+++ pypy/branch/pyjitpl5/pypy/interpreter/baseobjspace.py.merge.tmp Tue Jun 30 16:35:21 2009
@@ -79,7 +79,7 @@
return default
raise
- def getrepr(self, space, info, moreinfo=''):
+ def getaddrstring(self, space):
# XXX slowish
w_id = space.id(self)
w_4 = space.wrap(4)
@@ -96,7 +96,11 @@
if i == 0:
break
w_id = space.rshift(w_id, w_4)
- return space.wrap("<%s at 0x%s%s>" % (info, ''.join(addrstring),
+ return ''.join(addrstring)
+
+ def getrepr(self, space, info, moreinfo=''):
+ addrstring = self.getaddrstring(space)
+ return space.wrap("<%s at 0x%s%s>" % (info, addrstring,
moreinfo))
def getslotvalue(self, index):
@@ -250,8 +254,9 @@
from pypy.interpreter.pyframe import PyFrame
self.FrameClass = PyFrame # can be overridden to a subclass
-# if self.config.objspace.logbytecodes:
-# self.bytecodecounts = {}
+ if self.config.objspace.logbytecodes:
+ self.bytecodecounts = [0] * 256
+ self.bytecodetransitioncount = {}
if self.config.objspace.timing:
self.timer = Timer()
@@ -298,8 +303,20 @@
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)
- for opcode, count in self.bytecodecounts.items():
- os.write(fd, str(opcode) + ", " + str(count) + "\n")
+ 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")
@@ -825,14 +842,15 @@
# module when it is loaded.
return self.type(w_obj)
- def eval(self, expression, w_globals, w_locals):
+ def eval(self, expression, w_globals, w_locals, hidden_applevel=False):
"NOT_RPYTHON: For internal debugging."
import types
from pypy.interpreter.pycode import PyCode
if isinstance(expression, str):
expression = compile(expression, '?', 'eval')
if isinstance(expression, types.CodeType):
- expression = PyCode._from_code(self, expression)
+ expression = PyCode._from_code(self, expression,
+ hidden_applevel=hidden_applevel)
if not isinstance(expression, PyCode):
raise TypeError, 'space.eval(): expected a string, code or PyCode object'
return expression.exec_code(self, w_globals, w_locals)
@@ -1001,6 +1019,11 @@
warnings.warn(msg, warningcls, stacklevel=2)
""")
+ def resolve_target(self, w_obj):
+ """ A space method that can be used by special object spaces (like
+ thunk) to replace an object by another. """
+ return w_obj
+
class AppExecCache(SpaceCache):
def build(cache, source):
More information about the Pypy-commit
mailing list