Author: Antonio Cuni <anto.c...@gmail.com> Branch: identity-dict-strategy Changeset: r45803:2171351a31a8 Date: 2011-07-21 11:29 +0200 http://bitbucket.org/pypy/pypy/changeset/2171351a31a8/
Log: write a test_pypy_c test diff --git a/pypy/module/pypyjit/test_pypy_c/test_containers.py b/pypy/module/pypyjit/test_pypy_c/test_containers.py --- a/pypy/module/pypyjit/test_pypy_c/test_containers.py +++ b/pypy/module/pypyjit/test_pypy_c/test_containers.py @@ -23,3 +23,29 @@ ops = loop.ops_by_id('look') assert log.opnames(ops) == ['setfield_gc', 'guard_not_invalidated'] + + def test_identitydict(self): + def fn(n): + class X(object): + pass + x = X() + d = {} + d[x] = 1 + res = 0 + for i in range(300): + value = d[x] # ID: getitem + res += value + return res + # + log = self.run(fn, [1000]) + assert log.result == 300 + loop, = log.loops_by_filename(self.filepath) + # check that the call to ll_dict_lookup is not a call_may_force + assert loop.match_by_id("getitem", """ + i25 = call(ConstClass(_ll_1_gc_identityhash__objectPtr), p6, descr=...) + ... + i28 = call(ConstClass(ll_dict_lookup__dicttablePtr_objectPtr_Signed), p18, p6, i25, descr=...) + ... + p33 = call(ConstClass(ll_get_value__dicttablePtr_Signed), p18, i28, descr=...) + ... + """) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit