[pypy-svn] r61917 - in pypy/branch/pyjitpl5/pypy/jit/metainterp: . test
fijal at codespeak.net
fijal at codespeak.net
Sun Feb 15 11:54:03 CET 2009
Author: fijal
Date: Sun Feb 15 11:54:01 2009
New Revision: 61917
Modified:
pypy/branch/pyjitpl5/pypy/jit/metainterp/graphpage.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_tl.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtual.py
Log:
Add extra checks + fix tests
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/graphpage.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/graphpage.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/graphpage.py Sun Feb 15 11:54:01 2009
@@ -68,10 +68,10 @@
_prev = Box._extended_display
try:
Box._extended_display = False
- #if len(self.graphs) > 1:
- # graphs = self.graphs[1:]
- #else:
- graphs = self.graphs
+ if len(self.graphs) > 1:
+ graphs = self.graphs[1:]
+ else:
+ graphs = self.graphs
for i, graph in enumerate(graphs):
self.gengraph(graph, i)
finally:
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py Sun Feb 15 11:54:01 2009
@@ -36,17 +36,20 @@
self.list_allocations = []
self.setitems = []
- def deal_with_box(self, box, nodes, liveboxes, memo):
+ def deal_with_box(self, box, nodes, liveboxes, memo, ready):
if isinstance(box, Const):
virtual = False
virtualized = False
else:
+ prevbox = box
instnode = nodes[box]
box = instnode.source
if box in memo:
return memo[box]
virtual = instnode.virtual
virtualized = instnode.virtualized
+ if not virtual:
+ assert box in ready
if virtual:
if isinstance(instnode.cls.source, ListDescr):
ld = instnode.cls.source
@@ -65,7 +68,8 @@
res = alloc_offset
memo[box] = res
for ofs, node in instnode.curfields.items():
- num = self.deal_with_box(node.source, nodes, liveboxes, memo)
+ num = self.deal_with_box(node.source, nodes, liveboxes, memo,
+ ready)
if isinstance(instnode.cls.source, ListDescr):
ld = instnode.cls.source
x = (alloc_offset + 1) << 16
@@ -77,7 +81,8 @@
memo[box] = res
liveboxes.append(box)
for ofs, node in instnode.curfields.items():
- num = self.deal_with_box(node.source, nodes, liveboxes, memo)
+ num = self.deal_with_box(node.source, nodes, liveboxes, memo,
+ ready)
self.setfields.append((res, ofs, num))
else:
res = ~len(liveboxes)
@@ -429,7 +434,8 @@
op = op.clone()
for box in old_boxes:
indices.append(storage.deal_with_box(box, self.nodes,
- liveboxes, memo))
+ liveboxes, memo,
+ self.ready_results))
rev_boxes = {}
for i in range(len(liveboxes)):
box = liveboxes[i]
@@ -467,6 +473,7 @@
instnode = self.nodes[box]
assert not instnode.virtual
box = instnode.source
+ assert isinstance(box, Const) or box in self.ready_results
newboxes.append(box)
return newboxes
@@ -496,6 +503,7 @@
# we never perform this operation here, note
def optimize_loop(self):
+ self.ready_results = {}
newoperations = []
exception_might_have_happened = False
mp = self.loop.operations[0]
@@ -511,12 +519,19 @@
assert not self.nodes[box].virtual
for op in self.loop.operations:
+ if newoperations and newoperations[-1].results:
+ self.ready_results[newoperations[-1].results[0]] = None
opname = op.opname
if opname == 'merge_point':
args = self.expanded_version_of(op.args, None)
op = MergePoint('merge_point', args, [])
newoperations.append(op)
+ for arg in op.args:
+ self.ready_results[arg] = None
continue
+ elif opname == 'catch':
+ for arg in op.args:
+ self.ready_results[arg] = None
elif opname == 'jump':
args = self.expanded_version_of(op.args, newoperations)
self.cleanup_field_caches(newoperations)
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_tl.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_tl.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_tl.py Sun Feb 15 11:54:01 2009
@@ -102,8 +102,8 @@
def test_tl_2(self):
res = self.meta_interp(self.main.im_func, [1, 10])
- assert res == self.main(1, 10)
- self.check_loop({'merge_point':1, 'int_sub':1, 'int_le':1,
+ assert res == self.main.im_func(1, 10)
+ self.check_loops({'merge_point':1, 'int_sub':1, 'int_le':1,
'int_is_true':1, 'guard_false':1, 'jump':1})
class TestOOtype(ToyLanguageTests, OOJitMixin):
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtual.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtual.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtual.py Sun Feb 15 11:54:01 2009
@@ -168,6 +168,11 @@
res = self.meta_interp(f, [20])
assert res == 9
+ #def test_virtual_and_only_setfield(self):
+ # myjitdriver = JitDriver(greens = [], reds = ['n', 'i'])
+
+ # def f(n):
+
##class TestOOtype(VirtualTests, OOJitMixin):
## _new = staticmethod(ootype.new)
More information about the Pypy-commit
mailing list