Author: Armin Rigo <ar...@tunes.org>
Branch: value-profiling
Changeset: r78920:fb8245228f45
Date: 2015-08-11 17:12 +0100
http://bitbucket.org/pypy/pypy/changeset/fb8245228f45/

Log:    Add some missing see_write()s

diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py
--- a/pypy/interpreter/function.py
+++ b/pypy/interpreter/function.py
@@ -106,8 +106,7 @@
                 for i in funccallunrolling:
                     if i < nargs:
                         w_arg = args_w[i]
-                        new_frame.locals_cells_stack_w[i] = w_arg
-                        new_frame._value_profile_local(i, w_arg)
+                        new_frame._setlocal(i, w_arg)
                 return new_frame.run()
         elif nargs >= 1 and fast_natural_arity == Code.PASSTHROUGHARGS1:
             assert isinstance(code, gateway.BuiltinCodePassThroughArguments1)
@@ -173,7 +172,7 @@
                                                    self)
         for i in xrange(nargs):
             w_arg = frame.peekvalue(nargs-1-i)
-            new_frame.locals_cells_stack_w[i] = w_arg
+            new_frame._setlocal(i, w_arg)
 
         return new_frame.run()
 
@@ -184,13 +183,13 @@
                                                    self)
         for i in xrange(nargs):
             w_arg = frame.peekvalue(nargs-1-i)
-            new_frame.locals_cells_stack_w[i] = w_arg
+            new_frame._setlocal(i, w_arg)
 
         ndefs = len(self.defs_w)
         start = ndefs - defs_to_load
         i = nargs
         for j in xrange(start, ndefs):
-            new_frame.locals_cells_stack_w[i] = self.defs_w[j]
+            new_frame._setlocal(i, self.defs_w[j])
             i += 1
         return new_frame.run()
 
diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
--- a/pypy/interpreter/pycode.py
+++ b/pypy/interpreter/pycode.py
@@ -216,9 +216,7 @@
                                       fresh_virtualizable=True)
         args.parse_into_scope(None, fresh_frame.locals_cells_stack_w,
                               func.name, sig, func.defs_w)
-        for arg in range(self.co_nlocals):
-            fresh_frame._value_profile_local(
-                    arg, fresh_frame.locals_cells_stack_w[arg])
+        fresh_frame._all_locals_changed()
         fresh_frame.init_cells()
         return frame.run()
 
@@ -232,9 +230,7 @@
                                       fresh_virtualizable=True)
         args.parse_into_scope(w_obj, fresh_frame.locals_cells_stack_w, 
func.name,
                               sig, func.defs_w)
-        for arg in range(self.co_nlocals):
-            fresh_frame._value_profile_local(
-                    arg, fresh_frame.locals_cells_stack_w[arg])
+        fresh_frame._all_locals_changed()
         fresh_frame.init_cells()
         return frame.run()
 
diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py
--- a/pypy/interpreter/pyframe.py
+++ b/pypy/interpreter/pyframe.py
@@ -168,6 +168,10 @@
         vprof = self.getcode().vprofs[varindex]
         vprof.see_write(value)
 
+    def _all_locals_changed(self):
+        for i, vprof in enumerate(self.getcode().vprofs):
+            vprof.see_write(self.locals_cells_stack_w[i])
+
     def mark_as_escaped(self):
         """
         Must be called on frames that are exposed to applevel, e.g. by
@@ -525,6 +529,7 @@
         new_frame.set_blocklist([unpickle_block(space, w_blk)
                                  for w_blk in 
space.unpackiterable(w_blockstack)])
         self.locals_cells_stack_w = values_w[:]
+        self._all_locals_changed()
         valuestackdepth = space.int_w(w_stackdepth)
         if not self._check_stack_index(valuestackdepth):
             raise OperationError(space.w_ValueError, space.wrap("invalid 
stackdepth"))
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to