Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r44569:b84adfac60d1 Date: 2011-05-28 09:19 +0200 http://bitbucket.org/pypy/pypy/changeset/b84adfac60d1/
Log: merge heads diff --git a/lib-python/TODO b/lib-python/TODO deleted file mode 100644 --- a/lib-python/TODO +++ /dev/null @@ -1,100 +0,0 @@ -TODO list for 2.7.0 -=================== - -You can find the results of the most recent buildbot run at: -http://buildbot.pypy.org/ - - -Probably easy tasks -------------------- - -- (unicode|bytearray).(index|find) should accept None as indices (see - test_unicode.py) - -- missing posix.confstr and posix.confstr_names - -- remove code duplication: bit_length() and _count_bits() in rlib/rbigint.py, - objspace/std/longobject.py and objspace/std/longtype.py. - -- missing module pyexpat.errors - -- support for PYTHONIOENCODING, this needs a way to update file.encoding - -- implement format__Complex_ANY() in pypy/objspace/std/complexobject.py - -- Code like this does not work, for two reasons:: - - \ - from __future__ import (with_statement, - unicode_literals) - assert type("") is unicode - -- Code like:: - - assert(x is not None, "error message") - - should emit a SyntaxWarning when compiled (the tuple is always true) - - -Medium tasks ------------- - -- socket module has a couple of changes (including AF_TIPC packet range) - -Longer tasks ------------- - -- Fix usage of __cmp__ in subclasses:: - - class badint(int): - def __cmp__(self, other): - raise RuntimeError - raises(RuntimeError, cmp, 0, badint(1)) - -- Fix comparison of objects layout: if two classes have the same __slots__, it - should be possible to change the instances __class__:: - - class A(object): __slots__ = ('a', 'b') - class B(object): __slots__ = ('b', 'a') - a = A() - a.__class__ = B - -- Show a ResourceWarning when a file/socket is not explicitely closed, like - CPython did for 3.2: http://svn.python.org/view?view=rev&revision=85920 - in PyPy this should be enabled by default - -Won't do for this release -------------------------- - -Note: when you give up with a missing feature, please mention it here, as well -as the various skips added to the test suite. - -- py3k warnings - - * the -3 flag is accepted on the command line, but displays a warning (see - `translator/goal/app_main.py`) - -- CJK codecs. - - * In `./conftest.py`, skipped all `test_codecencodings_*.py` and - `test_codecmaps_*.py`. - - * In test_codecs, commented out various items in `all_unicode_encodings`. - -- Error messages about ill-formed calls (like "argument after ** must be a - mapping") don't always show the function name. That's hard to fix for - the case of errors raised when the Argument object is created (as opposed - to when parsing for a given target function, which occurs later). - - * Some "..." were added to doctests in test_extcall.py - -- CPython's builtin methods are both functions and unbound methods (for - example, `str.upper is dict(str.__dict__)['upper']`). This is not the case - in pypy, and assertions like `object.__str__ is object.__str__` are False - with pypy. Use the `==` operator instead. - - * pprint.py, _threading_local.py - -- When importing a nested module fails, the ImportError message mentions the - name of the package up to the component that could not be imported (CPython - prefers to display the names starting with the failing part). diff --git a/pypy/interpreter/eval.py b/pypy/interpreter/eval.py --- a/pypy/interpreter/eval.py +++ b/pypy/interpreter/eval.py @@ -2,6 +2,7 @@ This module defines the abstract base classes that support execution: Code and Frame. """ +from pypy.rlib import jit from pypy.interpreter.error import OperationError from pypy.interpreter.baseobjspace import Wrappable @@ -97,6 +98,7 @@ "Abstract. Get the expected number of locals." raise TypeError, "abstract" + @jit.dont_look_inside def fast2locals(self): # Copy values from self.fastlocals_w to self.w_locals if self.w_locals is None: @@ -110,6 +112,7 @@ w_name = self.space.wrap(name) self.space.setitem(self.w_locals, w_name, w_value) + @jit.dont_look_inside def locals2fast(self): # Copy values from self.w_locals to self.fastlocals_w assert self.w_locals is not None diff --git a/pypy/interpreter/nestedscope.py b/pypy/interpreter/nestedscope.py --- a/pypy/interpreter/nestedscope.py +++ b/pypy/interpreter/nestedscope.py @@ -127,6 +127,7 @@ if self.cells is not None: self.cells[:ncellvars] = cellvars + @jit.dont_look_inside def fast2locals(self): super_fast2locals(self) # cellvars are values exported to inner scopes @@ -145,6 +146,7 @@ w_name = self.space.wrap(name) self.space.setitem(self.w_locals, w_name, w_value) + @jit.dont_look_inside def locals2fast(self): super_locals2fast(self) freevarnames = self.pycode.co_cellvars + self.pycode.co_freevars diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py --- a/pypy/interpreter/pyframe.py +++ b/pypy/interpreter/pyframe.py @@ -413,6 +413,7 @@ "Get the fast locals as a list." return self.fastlocals_w + @jit.dont_look_inside def setfastscope(self, scope_w): """Initialize the fast locals from a list of values, where the order is according to self.pycode.signature().""" diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py --- a/pypy/interpreter/pyopcode.py +++ b/pypy/interpreter/pyopcode.py @@ -1089,6 +1089,7 @@ w_dict = self.space.newdict() self.pushvalue(w_dict) + @jit.unroll_safe def BUILD_SET(self, itemcount, next_instr): w_set = self.space.call_function(self.space.w_set) if itemcount: diff --git a/pypy/jit/codewriter/policy.py b/pypy/jit/codewriter/policy.py --- a/pypy/jit/codewriter/policy.py +++ b/pypy/jit/codewriter/policy.py @@ -63,12 +63,27 @@ contains_loop = contains_loop and not getattr( func, '_jit_unroll_safe_', False) - res = see_function and not contains_unsupported_variable_type(graph, - self.supports_floats, - self.supports_longlong) + unsupported = contains_unsupported_variable_type(graph, + self.supports_floats, + self.supports_longlong) + res = see_function and not unsupported if res and contains_loop: self.unsafe_loopy_graphs.add(graph) - return res and not contains_loop + res = res and not contains_loop + if (see_function and not res and + getattr(graph, "access_directly", False)): + # This happens when we have a function which has an argument with + # the access_directly flag, and the annotator has determined we will + # see the function. (See + # pypy/annotation/specialize.py:default_specialize) However, + # look_inside_graph just decided that we will not see it. (It has a + # loop or unsupported variables.) If we return False, the call will + # be turned into a residual call, but the graph is access_directly! + # If such a function is called and accesses a virtualizable, the JIT + # will not notice, and the virtualizable will fall out of sync. So, + # we fail loudly now. + raise ValueError("access_directly on a function which we don't see %s" % graph) + return res def contains_unsupported_variable_type(graph, supports_floats, supports_longlong): diff --git a/pypy/jit/codewriter/test/test_policy.py b/pypy/jit/codewriter/test/test_policy.py --- a/pypy/jit/codewriter/test/test_policy.py +++ b/pypy/jit/codewriter/test/test_policy.py @@ -1,4 +1,5 @@ import sys +import py from pypy.jit.codewriter.policy import contains_unsupported_variable_type from pypy.jit.codewriter.policy import JitPolicy from pypy.jit.codewriter import support @@ -107,3 +108,19 @@ mod = called_graph.func.__module__ assert (mod == 'pypy.rpython.rlist' or mod == 'pypy.rpython.lltypesystem.rlist') + +def test_access_directly_but_not_seen(): + class X: + _virtualizable2_ = ["a"] + def h(x, y): + w = 0 + for i in range(y): + w += 4 + return w + def f(y): + x = jit.hint(X(), access_directly=True) + h(x, y) + rtyper = support.annotate(f, [3]) + h_graph = rtyper.annotator.translator.graphs[1] + assert h_graph.func is h + py.test.raises(ValueError, JitPolicy().look_inside_graph, h_graph) diff --git a/pypy/jit/metainterp/test/test_tl.py b/pypy/jit/metainterp/test/test_tl.py --- a/pypy/jit/metainterp/test/test_tl.py +++ b/pypy/jit/metainterp/test/test_tl.py @@ -58,7 +58,7 @@ exit: RETURN ''') - + codes = [code, code2] def main(n, inputarg): code = codes[n] @@ -116,7 +116,7 @@ codes = [code, ''] def main(num, arg): return interp(codes[num], inputarg=arg) - + res = self.meta_interp(main, [0, 20], enable_opts='', listops=listops, backendopt=True, policy=policy) assert res == 0 @@ -128,7 +128,6 @@ from pypy.jit.tl.tl import Stack methods = [Stack.put, Stack.pick, - Stack.roll, Stack.append, Stack.pop] for meth in methods: diff --git a/pypy/jit/tl/tl.py b/pypy/jit/tl/tl.py --- a/pypy/jit/tl/tl.py +++ b/pypy/jit/tl/tl.py @@ -40,6 +40,7 @@ assert n >= 0 self.stack[n] = elem + @dont_look_inside def roll(self, r): if r < -1: i = self.stackpos + r _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit