[pypy-commit] pypy translation-cleanup: Store the frame on the FlowObjSpace, instead of the EC

rlamy noreply at buildbot.pypy.org
Thu Sep 20 19:39:05 CEST 2012


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: translation-cleanup
Changeset: r57421:9932605f1456
Date: 2012-09-14 17:27 +0100
http://bitbucket.org/pypy/pypy/changeset/9932605f1456/

Log:	Store the frame on the FlowObjSpace, instead of the EC

diff --git a/pypy/objspace/flow/flowcontext.py b/pypy/objspace/flow/flowcontext.py
--- a/pypy/objspace/flow/flowcontext.py
+++ b/pypy/objspace/flow/flowcontext.py
@@ -219,7 +219,7 @@
 
     def build_flow(self, func, constargs={}):
         space = self.space
-        self.frame = frame = FlowSpaceFrame(self.space, func, constargs)
+        space.frame = frame = FlowSpaceFrame(self.space, func, constargs)
         self.joinpoints = {}
         self.graph = frame._init_graph(func)
         self.pendingblocks = collections.deque([self.graph.startblock])
diff --git a/pypy/objspace/flow/objspace.py b/pypy/objspace/flow/objspace.py
--- a/pypy/objspace/flow/objspace.py
+++ b/pypy/objspace/flow/objspace.py
@@ -228,7 +228,7 @@
         except error.FlowingError, a:
             # attach additional source info to AnnotatorError
             _, _, tb = sys.exc_info()
-            formated = error.format_global_error(ec.graph, ec.frame.last_instr,
+            formated = error.format_global_error(ec.graph, self.frame.last_instr,
                                                  str(a))
             e = error.FlowingError(formated)
             raise error.FlowingError, e, tb
@@ -268,7 +268,7 @@
     # ____________________________________________________________
     def do_operation(self, name, *args_w):
         spaceop = SpaceOperation(name, args_w, Variable())
-        spaceop.offset = self.executioncontext.frame.last_instr
+        spaceop.offset = self.frame.last_instr
         self.executioncontext.recorder.append(spaceop)
         return spaceop.result
 
@@ -312,7 +312,7 @@
                 except IndexError:
                     raise OperationError(self.w_StopIteration, self.w_None)
                 else:
-                    context.frame.replace_in_stack(it, next_unroller)
+                    self.frame.replace_in_stack(it, next_unroller)
                     return self.wrap(v)
         w_item = self.do_operation("next", w_iter)
         outcome, w_exc_cls, w_exc_value = context.guessexception(StopIteration,
@@ -327,8 +327,7 @@
 
     def setitem(self, w_obj, w_key, w_val):
         # protect us from globals write access
-        ec = self.getexecutioncontext()
-        if ec and w_obj is ec.frame.w_globals:
+        if w_obj is self.frame.w_globals:
             raise SyntaxError("attempt to modify global attribute %r in %r"
                             % (w_key, ec.graph.func))
         return self.do_operation_with_implicit_exceptions('setitem', w_obj,


More information about the pypy-commit mailing list