[pypy-commit] pypy stmgc-c8-dictstrategy: hg merge stmgc-c8
arigo
noreply at buildbot.pypy.org
Wed Nov 25 11:08:06 EST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c8-dictstrategy
Changeset: r80953:ce27f469cac1
Date: 2015-11-25 09:36 +0100
http://bitbucket.org/pypy/pypy/changeset/ce27f469cac1/
Log: hg merge stmgc-c8
diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py
--- a/rpython/rlib/rstm.py
+++ b/rpython/rlib/rstm.py
@@ -432,7 +432,10 @@
self.iterator = iterator
def next(self):
- return next(self.iterator)
+ while 1:
+ entry = next(self.iterator)
+ if entry._obj:
+ return entry
# ____________________________________________________________
diff --git a/rpython/translator/stm/test/test_ztranslated.py b/rpython/translator/stm/test/test_ztranslated.py
--- a/rpython/translator/stm/test/test_ztranslated.py
+++ b/rpython/translator/stm/test/test_ztranslated.py
@@ -769,3 +769,33 @@
t, cbuilder = self.compile(main)
data = cbuilder.cmdexec('')
assert 'ok!\n' in data
+
+ def test_hashtable(self):
+ # minimal test
+ FOO = lltype.GcStruct('FOO')
+
+ def main(argv):
+ h = rstm.create_hashtable()
+ assert h.list()[1] == 0
+ foo = lltype.malloc(FOO)
+ h.set(123, lltype.cast_opaque_ptr(llmemory.GCREF, foo))
+ assert h.list()[1] == 1
+ assert h.get(123) == lltype.cast_opaque_ptr(llmemory.GCREF, foo)
+ assert h.get(234) == lltype.nullptr(llmemory.GCREF.TO)
+ hiter = h.iterentries()
+ entry = hiter.next()
+ try:
+ hiter.next()
+ except StopIteration:
+ pass
+ else:
+ print "hiter.next() should return only once here"
+ assert 0
+ assert entry.index == 123
+ print "ok!"
+ return 0
+
+ main([])
+ t, cbuilder = self.compile(main)
+ data = cbuilder.cmdexec('')
+ assert 'ok!\n' in data
More information about the pypy-commit
mailing list