[pypy-svn] r4491 - pypy/trunk/src/pypy/objspace/flow

arigo at codespeak.net arigo at codespeak.net
Fri May 21 20:30:20 CEST 2004


Author: arigo
Date: Fri May 21 20:30:18 2004
New Revision: 4491

Modified:
   pypy/trunk/src/pypy/objspace/flow/flowcontext.py
   pypy/trunk/src/pypy/objspace/flow/framestate.py
   pypy/trunk/src/pypy/objspace/flow/objspace.py
Log:
Bootstrapping details. 


Modified: pypy/trunk/src/pypy/objspace/flow/flowcontext.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/flow/flowcontext.py	(original)
+++ pypy/trunk/src/pypy/objspace/flow/flowcontext.py	Fri May 21 20:30:18 2004
@@ -69,7 +69,7 @@
         ExecutionContext.__init__(self, space)
         self.code = code
         self.w_globals = w_globals = space.wrap(globals)
-        frame = code.create_frame(space, w_globals)
+        frame = self.create_frame()
         formalargcount = code.getformalargcount()
         dummy = UndefinedConstant()
         arg_list = ([Variable() for i in range(formalargcount)] +
@@ -82,6 +82,12 @@
         self.pendingblocks = [initialblock]
         self.graph = FunctionGraph(code.co_name, initialblock)
 
+    def create_frame(self):
+        # create an empty frame suitable for the code object
+        # while ignoring any operation like the creation of the locals dict
+        self.crnt_ops = []
+        return self.code.create_frame(self.space, self.w_globals)
+
     def bytecode_trace(self, frame):
         if isinstance(self.crnt_ops, ReplayList):
             return
@@ -148,7 +154,7 @@
     def build_flow(self):
         while self.pendingblocks:
             block = self.pendingblocks.pop(0)
-            frame = self.code.create_frame(self.space, self.w_globals)
+            frame = self.create_frame()
             try:
                 block.patchframe(frame, self)
             except ExitFrame:

Modified: pypy/trunk/src/pypy/objspace/flow/framestate.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/flow/framestate.py	(original)
+++ pypy/trunk/src/pypy/objspace/flow/framestate.py	Fri May 21 20:30:18 2004
@@ -11,6 +11,7 @@
                 state.blockstack.items[:],
                 state.last_exception,
                 state.next_instr,
+                state.w_locals,
             )
         elif isinstance(state, tuple):
             self.mergeable, self.nonmergeable = state
@@ -27,6 +28,7 @@
                 frame.blockstack.items[:],
                 frame.last_exception,
                 frame.next_instr,
+                frame.w_locals,
             ) = self.nonmergeable
         else:
             raise TypeError("can't set framestate for %r" % 

Modified: pypy/trunk/src/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/flow/objspace.py	(original)
+++ pypy/trunk/src/pypy/objspace/flow/objspace.py	Fri May 21 20:30:18 2004
@@ -85,7 +85,8 @@
     # ____________________________________________________________
     def do_operation(self, name, *args_w):
         spaceop = SpaceOperation(name, args_w, Variable())
-        self.executioncontext.crnt_ops.append(spaceop)
+        if hasattr(self, 'executioncontext'):  # not here during bootstrapping
+            self.executioncontext.crnt_ops.append(spaceop)
         return spaceop.result
     
     def is_true(self, w_obj):


More information about the Pypy-commit mailing list