Re: [pypy-dev] [pypy-commit] pypy default: Inline into ll_setslice (which is really just an ll_arraycopy). Fixed a bug in the heapcache that it revealed.
How about a test? Especially for the heapcache On Fri, Apr 26, 2013 at 6:23 AM, alex_gaynor <noreply@buildbot.pypy.org> wrote:
Author: Alex Gaynor <alex.gaynor@gmail.com> Branch: Changeset: r63627:23defdb27411 Date: 2013-04-25 21:22 -0700 http://bitbucket.org/pypy/pypy/changeset/23defdb27411/
Log: Inline into ll_setslice (which is really just an ll_arraycopy). Fixed a bug in the heapcache that it revealed.
diff --git a/rpython/jit/codewriter/support.py b/rpython/jit/codewriter/support.py --- a/rpython/jit/codewriter/support.py +++ b/rpython/jit/codewriter/support.py @@ -203,7 +203,6 @@ _ll_2_list_append = rlist.ll_append _ll_2_list_extend = rlist.ll_extend _ll_3_list_insert = rlist.ll_insert_nonneg -_ll_4_list_setslice = rlist.ll_listsetslice _ll_2_list_delslice_startonly = rlist.ll_listdelslice_startonly _ll_3_list_delslice_startstop = rlist.ll_listdelslice_startstop _ll_2_list_inplace_mul = rlist.ll_inplace_mul diff --git a/rpython/jit/metainterp/heapcache.py b/rpython/jit/metainterp/heapcache.py --- a/rpython/jit/metainterp/heapcache.py +++ b/rpython/jit/metainterp/heapcache.py @@ -125,7 +125,7 @@ for descr, cache in self.heap_array_cache.iteritems(): for idx, cache in cache.iteritems(): for frombox in cache.keys(): - if frombox not in self.new_boxes: + if not self.new_boxes.get(frombox, False): del cache[frombox] return else: diff --git a/rpython/jit/metainterp/test/test_list.py b/rpython/jit/metainterp/test/test_list.py --- a/rpython/jit/metainterp/test/test_list.py +++ b/rpython/jit/metainterp/test/test_list.py @@ -128,10 +128,10 @@ res = self.interp_operations(f, [], listops=True) assert res == 10
- def test_arraycopy_bug(self): + def test_arraycopy_bug(self): def f(): l = [1, 2, 3, 4] - l2 = [1, 2, 3, 4] + l2 = [1, 2, 3, 5] l[2] = 13 l2[0:len(l2)] = l[:] return l2[0] + l2[1] + l2[2] + l2[3] diff --git a/rpython/rtyper/rlist.py b/rpython/rtyper/rlist.py --- a/rpython/rtyper/rlist.py +++ b/rpython/rtyper/rlist.py @@ -955,7 +955,7 @@ "setslice cannot resize lists in RPython") # XXX ...but it would be easy enough to support if really needed ll_arraycopy(l2, l1, 0, start, count) -ll_listsetslice.oopspec = 'list.setslice(l1, start, stop, l2)' +
# ____________________________________________________________ # _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
There was a test in rlist.py that caught the error, I'll add a unittest for heapcache though. Alex On Fri, Apr 26, 2013 at 2:04 AM, Maciej Fijalkowski <fijall@gmail.com>wrote:
How about a test? Especially for the heapcache
On Fri, Apr 26, 2013 at 6:23 AM, alex_gaynor <noreply@buildbot.pypy.org> wrote:
Author: Alex Gaynor <alex.gaynor@gmail.com> Branch: Changeset: r63627:23defdb27411 Date: 2013-04-25 21:22 -0700 http://bitbucket.org/pypy/pypy/changeset/23defdb27411/
Log: Inline into ll_setslice (which is really just an ll_arraycopy). Fixed a bug in the heapcache that it revealed.
diff --git a/rpython/jit/codewriter/support.py b/rpython/jit/codewriter/support.py --- a/rpython/jit/codewriter/support.py +++ b/rpython/jit/codewriter/support.py @@ -203,7 +203,6 @@ _ll_2_list_append = rlist.ll_append _ll_2_list_extend = rlist.ll_extend _ll_3_list_insert = rlist.ll_insert_nonneg -_ll_4_list_setslice = rlist.ll_listsetslice _ll_2_list_delslice_startonly = rlist.ll_listdelslice_startonly _ll_3_list_delslice_startstop = rlist.ll_listdelslice_startstop _ll_2_list_inplace_mul = rlist.ll_inplace_mul diff --git a/rpython/jit/metainterp/heapcache.py b/rpython/jit/metainterp/heapcache.py --- a/rpython/jit/metainterp/heapcache.py +++ b/rpython/jit/metainterp/heapcache.py @@ -125,7 +125,7 @@ for descr, cache in self.heap_array_cache.iteritems(): for idx, cache in cache.iteritems(): for frombox in cache.keys(): - if frombox not in self.new_boxes: + if not self.new_boxes.get(frombox, False): del cache[frombox] return else: diff --git a/rpython/jit/metainterp/test/test_list.py b/rpython/jit/metainterp/test/test_list.py --- a/rpython/jit/metainterp/test/test_list.py +++ b/rpython/jit/metainterp/test/test_list.py @@ -128,10 +128,10 @@ res = self.interp_operations(f, [], listops=True) assert res == 10
- def test_arraycopy_bug(self): + def test_arraycopy_bug(self): def f(): l = [1, 2, 3, 4] - l2 = [1, 2, 3, 4] + l2 = [1, 2, 3, 5] l[2] = 13 l2[0:len(l2)] = l[:] return l2[0] + l2[1] + l2[2] + l2[3] diff --git a/rpython/rtyper/rlist.py b/rpython/rtyper/rlist.py --- a/rpython/rtyper/rlist.py +++ b/rpython/rtyper/rlist.py @@ -955,7 +955,7 @@ "setslice cannot resize lists in RPython") # XXX ...but it would be easy enough to support if really needed ll_arraycopy(l2, l1, 0, start, count) -ll_listsetslice.oopspec = 'list.setslice(l1, start, stop, l2)' +
# ____________________________________________________________ # _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev
-- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero GPG Key fingerprint: 125F 5C67 DFE9 4084
participants (2)
-
Alex Gaynor
-
Maciej Fijalkowski