[pypy-commit] pypy translation-cleanup: Flowspacify more stack manipulation methods

rlamy noreply at buildbot.pypy.org
Tue Oct 16 15:47:46 CEST 2012


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: translation-cleanup
Changeset: r58130:40efd825a611
Date: 2012-10-16 14:47 +0100
http://bitbucket.org/pypy/pypy/changeset/40efd825a611/

Log:	Flowspacify more stack manipulation methods

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
@@ -287,6 +287,22 @@
             "settop past the bottom of the stack")
         self.locals_stack_w[index] = w_object
 
+    def peekvalues(self, n):
+        values_w = [None] * n
+        base = self.valuestackdepth - n
+        while True:
+            n -= 1
+            if n < 0:
+                break
+            values_w[n] = self.locals_stack_w[base+n]
+        return values_w
+
+    def dropvalues(self, n):
+        finaldepth = self.valuestackdepth - n
+        for n in range(finaldepth, self.valuestackdepth):
+            self.locals_stack_w[n] = None
+        self.valuestackdepth = finaldepth
+
     def dropvaluesuntil(self, finaldepth):
         for n in range(finaldepth, self.valuestackdepth):
             self.locals_stack_w[n] = None


More information about the pypy-commit mailing list