[pypy-commit] pypy all_ordered_dicts: (ltratt, arigo)
arigo
noreply at buildbot.pypy.org
Wed Dec 17 13:36:36 CET 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: all_ordered_dicts
Changeset: r74967:1a8e8c05fb54
Date: 2014-12-17 12:35 +0000
http://bitbucket.org/pypy/pypy/changeset/1a8e8c05fb54/
Log: (ltratt, arigo)
Add some jit.look_inside_iff(): so far the ll_dict_grow() call ends
up as a residual call
diff --git a/rpython/rtyper/lltypesystem/rordereddict.py b/rpython/rtyper/lltypesystem/rordereddict.py
--- a/rpython/rtyper/lltypesystem/rordereddict.py
+++ b/rpython/rtyper/lltypesystem/rordereddict.py
@@ -620,8 +620,12 @@
some += newsize >> 3
return newsize + some
- at jit.dont_look_inside
+ at jit.look_inside_iff(lambda d: jit.isvirtual(d))
def ll_dict_grow(d):
+ # note: this @jit.look_inside_iff is here to inline the three lines
+ # at the end of this function. It's important because dicts start
+ # with a length-zero 'd.entries' which must be grown as soon as we
+ # insert an element.
if d.num_live_items < d.num_ever_used_items // 2:
# At least 50% of the allocated entries are dead, so perform a
# compaction. If ll_dict_remove_deleted_items detects that over
@@ -644,6 +648,7 @@
d.entries = newitems
return False
+ at jit.dont_look_inside
def ll_dict_remove_deleted_items(d):
if d.num_live_items < len(d.entries) // 4:
# At least 75% of the allocated entries are dead, so shrink the memory
More information about the pypy-commit
mailing list