Author: Carl Friedrich Bolz <cfb...@gmx.de> Branch: Changeset: r80025:be4b389d856e Date: 2015-10-07 18:18 +0200 http://bitbucket.org/pypy/pypy/changeset/be4b389d856e/
Log: Merged in sbauman/pypy (pull request #338) Factor in field immutability when invalidating heap information diff --git a/rpython/jit/metainterp/optimizeopt/heap.py b/rpython/jit/metainterp/optimizeopt/heap.py --- a/rpython/jit/metainterp/optimizeopt/heap.py +++ b/rpython/jit/metainterp/optimizeopt/heap.py @@ -414,6 +414,8 @@ for arraydescr in effectinfo.readonly_descrs_arrays: self.force_lazy_setarrayitem(arraydescr) for fielddescr in effectinfo.write_descrs_fields: + if fielddescr.is_always_pure(): + continue try: del self.cached_dict_reads[fielddescr] except KeyError: diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py --- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py @@ -3520,6 +3520,27 @@ """ self.optimize_loop(ops, expected) + def test_residual_call_does_not_invalidate_immutable_caches(self): + ops = """ + [p1] + i1 = getfield_gc_pure_i(p1, descr=valuedescr3) + i2 = call_i(i1, descr=writevalue3descr) + i3 = getfield_gc_pure_i(p1, descr=valuedescr3) + jump(p1) + """ + expected_preamble = """ + [p1] + i1 = getfield_gc_pure_i(p1, descr=valuedescr3) + i2 = call_i(i1, descr=writevalue3descr) + jump(p1, i1) + """ + expected = """ + [p1, i1] + i2 = call_i(i1, descr=writevalue3descr) + jump(p1, i1) + """ + self.optimize_loop(ops, expected, expected_preamble=expected_preamble) + def test_residual_call_invalidate_some_caches(self): ops = """ [p1, p2] diff --git a/rpython/jit/metainterp/optimizeopt/test/test_util.py b/rpython/jit/metainterp/optimizeopt/test/test_util.py --- a/rpython/jit/metainterp/optimizeopt/test/test_util.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_util.py @@ -280,6 +280,8 @@ writearraydescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, EffectInfo([], [], [], [adescr], [arraydescr], [])) + writevalue3descr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, + EffectInfo([], [], [], [valuedescr3], [], [])) readadescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, EffectInfo([adescr], [], [], [], [], [])) mayforcevirtdescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit