diff options
author | Carl Friedrich Bolz-Tereick <cfbolz@gmx.de> | 2020-02-19 21:28:33 +0100 |
---|---|---|
committer | Carl Friedrich Bolz-Tereick <cfbolz@gmx.de> | 2020-02-19 21:28:33 +0100 |
commit | b5aab55b6b6881eee2e76954af9f846216d2b6aa (patch) | |
tree | 8397abf132f74c229d8da62c7bea57ee08747da5 /pypy/objspace | |
parent | typo (diff) | |
download | pypy-b5aab55b6b6881eee2e76954af9f846216d2b6aa.tar.gz pypy-b5aab55b6b6881eee2e76954af9f846216d2b6aa.tar.bz2 pypy-b5aab55b6b6881eee2e76954af9f846216d2b6aa.zip |
annoying: the jit main loops get split at the can_enter_jit (or
jit_merge_point), this means that the list iterators (and range iterator)
aren't optimized away by backenopt.malloc. just replace these with an index
instead
Diffstat (limited to 'pypy/objspace')
-rw-r--r-- | pypy/objspace/std/tupleobject.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/pypy/objspace/std/tupleobject.py b/pypy/objspace/std/tupleobject.py index 9641bad567..d45521ebec 100644 --- a/pypy/objspace/std/tupleobject.py +++ b/pypy/objspace/std/tupleobject.py @@ -30,7 +30,7 @@ def _unroll_condition_cmp(self, space, other): def get_printable_location(tp): return "tuple.contains [%s]" % (tp.getname(tp.space), ) -contains_jmp = jit.JitDriver(greens = ['tp'], reds = 'auto', +contains_driver = jit.JitDriver(greens = ['tp'], reds = 'auto', name = 'tuple.contains', get_printable_location=get_printable_location) @@ -168,10 +168,14 @@ class W_AbstractTupleObject(W_Root): def _descr_contains_jmp(self, space, w_obj): tp = space.type(w_obj) - for w_item in self.tolist(): - contains_jmp.jit_merge_point(tp=tp) + list_w = self.tolist() + i = 0 + while i < len(list_w): + w_item = list_w[i] + contains_driver.jit_merge_point(tp=tp) if space.eq_w(w_obj, w_item): return space.w_True + i += 1 return space.w_False def descr_add(self, space, w_other): @@ -316,12 +320,16 @@ class W_TupleObject(W_AbstractTupleObject): x = 0x345678 z = len(self.wrappeditems) w_type = space.type(self.wrappeditems[0]) - for w_item in self.wrappeditems: + wrappeditems = self.wrappeditems + i = 0 + while i < len(wrappeditems): hash_driver.jit_merge_point(w_type=w_type) + w_item = wrappeditems[i] y = space.hash_w(w_item) x = (x ^ y) * mult z -= 1 mult += 82520 + z + z + i += 1 x += 97531 return space.newint(intmask(x)) |