Author: Carl Friedrich Bolz <[email protected]>
Branch: value-profiling
Changeset: r78918:d9ccb4d048c0
Date: 2015-08-11 17:10 +0200
http://bitbucket.org/pypy/pypy/changeset/d9ccb4d048c0/
Log: (arigo, cfbolz): another place where locals_cells_stack_w is written
to
diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py
--- a/pypy/interpreter/function.py
+++ b/pypy/interpreter/function.py
@@ -105,7 +105,9 @@
self)
for i in funccallunrolling:
if i < nargs:
- new_frame.locals_cells_stack_w[i] = args_w[i]
+ w_arg = args_w[i]
+ new_frame.locals_cells_stack_w[i] = w_arg
+ new_frame._value_profile_local(i, w_arg)
return new_frame.run()
elif nargs >= 1 and fast_natural_arity == Code.PASSTHROUGHARGS1:
assert isinstance(code, gateway.BuiltinCodePassThroughArguments1)
diff --git a/pypy/interpreter/test/test_pyframe.py
b/pypy/interpreter/test/test_pyframe.py
--- a/pypy/interpreter/test/test_pyframe.py
+++ b/pypy/interpreter/test/test_pyframe.py
@@ -536,3 +536,17 @@
res = f(10).g()
sys.settrace(None)
assert res == 10
+
+class TestValueProf(object):
+ def test_argument_is_constant(self):
+ space = self.space
+ w_f = space.appexec([], """():
+ def f(x):
+ y = x + 1
+ return f""")
+ import pdb; pdb.set_trace()
+ space.call_function(w_f, space.wrap(1))
+ assert len(w_f.code.vprofs) == 2
+ assert w_f.code.vprofs[0].can_fold_read_int()
+ assert w_f.code.vprofs[1].can_fold_read_int()
+
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit