Author: Antonio Cuni <[email protected]>
Branch: faster-rstruct-2
Changeset: r91377:64c71c919e55
Date: 2017-05-22 19:01 +0200
http://bitbucket.org/pypy/pypy/changeset/64c71c919e55/
Log: add a passing test for gc_store_indexed on a list of chars
diff --git a/rpython/translator/backendopt/test/test_writeanalyze.py
b/rpython/translator/backendopt/test/test_writeanalyze.py
--- a/rpython/translator/backendopt/test/test_writeanalyze.py
+++ b/rpython/translator/backendopt/test/test_writeanalyze.py
@@ -505,3 +505,29 @@
typed_effects = self._analyze_graph(t, wa, typed_write)
typed_effects = self._filter_reads(typed_effects)
assert typed_effects == direct_effects
+
+ def test_gc_store_indexed_list_of_chars(self):
+ from rpython.rlib.buffer import ByteBuffer
+
+ def typed_write(buf):
+ return buf.typed_write(lltype.Signed, 0, 42)
+
+ def direct_write(buf):
+ return buf.setitem(0, 'A')
+
+ def f(x):
+ buf = ByteBuffer(8)
+ return direct_write(buf), typed_write(buf)
+
+ t, wa = self.translate(f, [str])
+ # check that the effect of direct_write
+ LIST = LIST_OF(lltype.Char)
+ direct_effects = self._analyze_graph(t, wa, direct_write)
+ direct_effects = self._filter_reads(direct_effects)
+ assert direct_effects == frozenset([
+ ('array', LIST.items),
+ ])
+ #
+ typed_effects = self._analyze_graph(t, wa, typed_write)
+ typed_effects = self._filter_reads(typed_effects)
+ assert typed_effects == direct_effects
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit