[pypy-commit] pypy jit-leaner-frontend: fix test_tracingopts: in some cases heapcache got better, in some cases the
cfbolz
pypy.commits at gmail.com
Wed Mar 23 09:52:24 EDT 2016
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: jit-leaner-frontend
Changeset: r83296:552d6357376b
Date: 2016-03-23 14:50 +0100
http://bitbucket.org/pypy/pypy/changeset/552d6357376b/
Log: fix test_tracingopts: in some cases heapcache got better, in some
cases the tests depended on optimizing constants (which will be
fixed later)
diff --git a/rpython/jit/metainterp/test/test_tracingopts.py b/rpython/jit/metainterp/test/test_tracingopts.py
--- a/rpython/jit/metainterp/test/test_tracingopts.py
+++ b/rpython/jit/metainterp/test/test_tracingopts.py
@@ -112,7 +112,7 @@
self.check_operations_history(getfield_gc_i=1)
res = self.interp_operations(fn, [-7, 1, 1])
assert res == -7 * 2
- self.check_operations_history(getfield_gc_i=1)
+ self.check_operations_history(getfield_gc_i=0)
def test_heap_caching_nonnull(self):
class A:
@@ -139,17 +139,18 @@
def test_heap_caching_while_tracing_invalidation(self):
class A:
pass
- a1 = A()
- a2 = A()
@jit.dont_look_inside
def f(a):
a.x = 5
+ @jit.dont_look_inside
+ def get():
+ return A()
l = [1]
def fn(n):
if n > 0:
- a = a1
+ a = get()
else:
- a = a2
+ a = get()
a.x = n
x1 = a.x
f(a)
@@ -163,13 +164,14 @@
def test_heap_caching_dont_store_same(self):
class A:
pass
- a1 = A()
- a2 = A()
+ @jit.dont_look_inside
+ def get():
+ return A()
def fn(n):
if n > 0:
- a = a1
+ a = get()
else:
- a = a2
+ a = get()
a.x = n
a.x = n
return a.x
@@ -241,14 +243,16 @@
def test_array_and_getfield_interaction(self):
class A: pass
- a1 = A()
- a2 = A()
- a1.l = a2.l = [0, 0]
+ @jit.dont_look_inside
+ def get():
+ a = A()
+ a.l = [0, 0]
+ return a
def fn(n):
if n > 0:
- a = a1
+ a = get()
else:
- a = a2
+ a = get()
a.l = [0, 0]
a.x = 0
a.l[a.x] = n
@@ -265,15 +269,17 @@
def test_promote_changes_heap_cache(self):
class A: pass
- a1 = A()
- a2 = A()
- a1.l = a2.l = [0, 0]
- a1.x = a2.x = 0
+ @jit.dont_look_inside
+ def get():
+ a = A()
+ a.l = [0, 0]
+ a.x = 0
+ return a
def fn(n):
if n > 0:
- a = a1
+ a = get()
else:
- a = a2
+ a = get()
a.l = [0, 0]
jit.promote(a.x)
a.l[a.x] = n
@@ -290,13 +296,11 @@
getfield_gc_r=1)
def test_promote_changes_array_cache(self):
- a1 = [0, 0]
- a2 = [0, 0]
+ @jit.dont_look_inside
+ def get():
+ return [0, 0]
def fn(n):
- if n > 0:
- a = a1
- else:
- a = a2
+ a = get()
a[0] = n
jit.hint(n, promote=True)
x1 = a[0]
@@ -312,13 +316,12 @@
def test_list_caching(self):
- a1 = [0, 0]
- a2 = [0, 0]
+ @jit.dont_look_inside
+ def get():
+ return [0, 0]
def fn(n):
- if n > 0:
- a = a1
- else:
- a = a2
+ a = get()
+ if not n > 0:
if n < -1000:
a.append(5)
a[0] = n
@@ -335,6 +338,8 @@
getfield_gc_r=1)
def fn(n, ca, cb):
+ a1 = get()
+ a2 = get()
a1[0] = n
a2[0] = n
a = a1
@@ -349,11 +354,11 @@
res = self.interp_operations(fn, [7, 0, 1])
assert res == 7 * 2
self.check_operations_history(getarrayitem_gc_i=1,
- getfield_gc_r=3)
+ getfield_gc_r=2)
res = self.interp_operations(fn, [-7, 1, 1])
assert res == -7 * 2
- self.check_operations_history(getarrayitem_gc_i=1,
- getfield_gc_r=3)
+ self.check_operations_history(getarrayitem_gc_i=0,
+ getfield_gc_r=2)
def test_list_caching_negative(self):
def fn(n):
@@ -451,17 +456,15 @@
def test_heap_caching_and_elidable_function(self):
class A:
pass
- class B: pass
- a1 = A()
- a1.y = 6
- a2 = A()
- a2.y = 13
+ @jit.dont_look_inside
+ def get():
+ return A()
@jit.elidable
def f(b):
return b + 1
def fn(n):
if n > 0:
- a = a1
+ a = get()
else:
a = A()
a.x = n
More information about the pypy-commit
mailing list