[pypy-svn] r56447 - pypy/dist/pypy/interpreter
arigo at codespeak.net
arigo at codespeak.net
Fri Jul 11 15:10:10 CEST 2008
Author: arigo
Date: Fri Jul 11 15:10:09 2008
New Revision: 56447
Modified:
pypy/dist/pypy/interpreter/baseobjspace.py
pypy/dist/pypy/interpreter/pyframe.py
Log:
Performance improvement: hide the base PyFrame class from the annotator;
only see the StdObjSpaceFrame subclass.
Modified: pypy/dist/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/dist/pypy/interpreter/baseobjspace.py (original)
+++ pypy/dist/pypy/interpreter/baseobjspace.py Fri Jul 11 15:10:09 2008
@@ -229,6 +229,9 @@
self.actionflag.register_action(self.frame_trace_action)
self.setoptions(**kw)
+ from pypy.interpreter.pyframe import PyFrame
+ self.FrameClass = PyFrame # can be overridden to a subclass
+
# if self.config.objspace.logbytecodes:
# self.bytecodecounts = {}
@@ -484,8 +487,7 @@
def createframe(self, code, w_globals, closure=None):
"Create an empty PyFrame suitable for this code object."
- from pypy.interpreter import pyframe
- return pyframe.PyFrame(self, code, w_globals, closure)
+ return self.FrameClass(self, code, w_globals, closure)
def allocate_lock(self):
"""Return an interp-level Lock object if threads are enabled,
Modified: pypy/dist/pypy/interpreter/pyframe.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyframe.py (original)
+++ pypy/dist/pypy/interpreter/pyframe.py Fri Jul 11 15:10:09 2008
@@ -101,6 +101,10 @@
def execute_frame(self):
"""Execute this frame. Main entry point to the interpreter."""
from pypy.rlib import rstack
+ # the following 'assert' is an annotation hint: it hides from
+ # the annotator all methods that are defined in PyFrame but
+ # overridden in the FrameClass subclass of PyFrame.
+ assert isinstance(self, self.space.FrameClass)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
try:
More information about the Pypy-commit
mailing list