diff options
author | Carl Friedrich Bolz-Tereick <cfbolz@gmx.de> | 2017-09-05 16:33:39 +0200 |
---|---|---|
committer | Carl Friedrich Bolz-Tereick <cfbolz@gmx.de> | 2017-09-05 16:33:39 +0200 |
commit | ed62fb205feaaf1227b6e35197dff69d80c33d3d (patch) | |
tree | 494dbe54054f15e6cab2ca4ba84f89cd905c9048 /rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py | |
parent | cleanup (diff) | |
download | pypy-ed62fb205feaaf1227b6e35197dff69d80c33d3d.tar.gz pypy-ed62fb205feaaf1227b6e35197dff69d80c33d3d.tar.bz2 pypy-ed62fb205feaaf1227b6e35197dff69d80c33d3d.zip |
emit guard_nonnull_class in the short preamble, instead of two guards in case
of remove_gctypeptr = True
Diffstat (limited to 'rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py')
-rw-r--r-- | rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py index 7f87a18aa1..caade936f5 100644 --- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py @@ -7541,6 +7541,33 @@ class OptimizeOptTest(BaseTestWithUnroll): """ self.optimize_loop(ops, expected, expected_short=short) + def test_guards_before_getfields_in_short_preamble_removetypeptr(self, monkeypatch): + monkeypatch.setattr(self.cpu, "remove_gctypeptr", True) + ops = """ + [p0] + guard_nonnull_class(p0, ConstClass(node_vtable)) [] + p1 = getfield_gc_r(p0, descr=nextdescr) + guard_nonnull_class(p1, ConstClass(node_vtable)) [] + p2 = getfield_gc_r(p1, descr=nextdescr) + guard_nonnull_class(p2, ConstClass(node_vtable)) [] + jump(p0) + """ + expected = """ + [p0, p1] + jump(p0, p1) + """ + short = """ + [p0] + guard_nonnull_class(p0, ConstClass(node_vtable)) [] + p1 = getfield_gc_r(p0, descr=nextdescr) + guard_nonnull_class(p1, ConstClass(node_vtable)) [] + p2 = getfield_gc_r(p1, descr=nextdescr) + guard_nonnull_class(p2, ConstClass(node_vtable)) [] + jump(p1) + """ + self.optimize_loop(ops, expected, expected_short=short) + + def test_forced_virtual_pure_getfield(self): ops = """ [p0] |