Author: Armin Rigo <[email protected]>
Branch: shadowstack-perf-2
Changeset: r84378:be524ccde2f4
Date: 2016-05-11 16:57 +0200
http://bitbucket.org/pypy/pypy/changeset/be524ccde2f4/
Log: Pass test_interesting_vars_3.
diff --git a/rpython/memory/gctransform/shadowcolor.py
b/rpython/memory/gctransform/shadowcolor.py
--- a/rpython/memory/gctransform/shadowcolor.py
+++ b/rpython/memory/gctransform/shadowcolor.py
@@ -5,7 +5,7 @@
return op.opname in ('same_as', 'cast_pointer', 'cast_opaque_ptr')
-def find_precessors(graph, pending_pred):
+def find_predecessors(graph, pending_pred):
"""Return the set of variables whose content can end up inside one
of the 'pending_pred', which is a list of (block, var) tuples.
"""
@@ -86,9 +86,10 @@
# where predecessors are variables which (sometimes) end in a
# gc_push_roots, and successors are variables which (sometimes)
# come from a gc_pop_roots.
+ pred = find_predecessors(graph, pending_pred)
+ succ = find_successors(graph, pending_succ)
+ interesting_vars |= (pred & succ)
-
- #....
return interesting_vars
diff --git a/rpython/memory/gctransform/test/test_shadowcolor.py
b/rpython/memory/gctransform/test/test_shadowcolor.py
--- a/rpython/memory/gctransform/test/test_shadowcolor.py
+++ b/rpython/memory/gctransform/test/test_shadowcolor.py
@@ -24,7 +24,7 @@
c = a + b
return c
graph = make_graph(f, [int, int])
- pred = find_precessors(graph, [(graph.returnblock, graph.getreturnvar())])
+ pred = find_predecessors(graph, [(graph.returnblock,
graph.getreturnvar())])
assert summary(pred) == {'c': 1, 'v': 1}
def test_find_predecessors_2():
@@ -34,7 +34,7 @@
a -= 2
return c
graph = make_graph(f, [int, int])
- pred = find_precessors(graph, [(graph.returnblock, graph.getreturnvar())])
+ pred = find_predecessors(graph, [(graph.returnblock,
graph.getreturnvar())])
assert summary(pred) == {'c': 3, 'v': 1}
def test_find_predecessors_3():
@@ -47,7 +47,7 @@
c = a - b # 'c' created in this block
return c # 'v' is the return var
graph = make_graph(f, [int, int])
- pred = find_precessors(graph, [(graph.returnblock, graph.getreturnvar())])
+ pred = find_predecessors(graph, [(graph.returnblock,
graph.getreturnvar())])
assert summary(pred) == {'c': 2, 'v': 1}
def test_find_predecessors_4():
@@ -62,7 +62,7 @@
c = a
return c # 'v' is the return var
graph = make_graph(f, [int, int])
- pred = find_precessors(graph, [(graph.returnblock, graph.getreturnvar())])
+ pred = find_predecessors(graph, [(graph.returnblock,
graph.getreturnvar())])
assert summary(pred) == {'a': 4, 'c': 1, 'v': 1}
def test_find_successors_1():
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit