[pypy-svn] r63131 - in pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp: . test
fijal at codespeak.net
fijal at codespeak.net
Fri Mar 20 13:32:08 CET 2009
Author: fijal
Date: Fri Mar 20 13:32:05 2009
New Revision: 63131
Modified:
pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/compile.py
pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/graphpage.py
pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/history.py
pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/optimize.py
pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/pyjitpl.py
pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/specnode.py
pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/test/test_virtualizable.py
Log:
* allow VirtualizableSpecNode to match NotSpecNode (unused virtualizable
becomes NotSpecNode)
* Fix the test, although everything explodes on top of llgraph backend, surprise
* Store a loop instead of single op as jump_target
Modified: pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/compile.py
==============================================================================
--- pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/compile.py (original)
+++ pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/compile.py Fri Mar 20 13:32:05 2009
@@ -129,25 +129,24 @@
def compile_fresh_loop(metainterp, loop, old_loops, endliveboxes):
history = metainterp.history
loop.operations = history.operations
- close_loop(loop, loop.operations[0], endliveboxes)
+ close_loop(loop, endliveboxes)
old_loop = optimize.optimize_loop(metainterp.options, old_loops, loop,
metainterp.cpu)
if old_loop is not None:
return old_loop
- finish_loop_or_bridge(metainterp, loop, loop.operations[0])
+ finish_loop_or_bridge(metainterp, loop, loop)
old_loops.append(loop)
return loop
-def close_loop(loop, targetmp, endliveboxes):
- assert targetmp.opnum == rop.MERGE_POINT
+def close_loop(loop, endliveboxes):
op = ResOperation(rop.JUMP, endliveboxes, None)
- op.jump_target = targetmp
+ op.jump_target = loop
loop.operations.append(op)
-def finish_loop_or_bridge(metainterp, loop, targetmp, guard_op=None):
- assert targetmp.opnum == rop.MERGE_POINT
+def finish_loop_or_bridge(metainterp, loop, target, guard_op=None):
+ assert target.operations[0].opnum == rop.MERGE_POINT
assert loop.operations[-1].opnum == rop.JUMP
- loop.operations[-1].jump_target = targetmp
+ loop.operations[-1].jump_target = target
metainterp.cpu.compile_operations(loop.operations, guard_op)
metainterp.stats.loops.append(loop)
@@ -175,6 +174,7 @@
bridge.jump_to = old_loop
if newboxlist:
# recompile loop
- optimize.update_loop(metainterp, old_loop, bridge, newboxlist, storage)
- finish_loop_or_bridge(metainterp, bridge, old_loop.operations[0], guard_op)
+ optimize.update_loop(metainterp, old_loop, bridge, newboxlist, storage,
+ old_loop)
+ finish_loop_or_bridge(metainterp, bridge, old_loop, guard_op)
return bridge
Modified: pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/graphpage.py
==============================================================================
--- pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/graphpage.py (original)
+++ pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/graphpage.py Fri Mar 20 13:32:05 2009
@@ -48,10 +48,12 @@
for attrname, delta in [('jump_target', 0),
('_jump_target_prev', 1)]:
tgt = getattr(op, attrname, None)
- if tgt is not None and tgt in self.all_operations:
- tgt_g, tgt_i = self.all_operations[tgt]
- self.mark_starter(tgt_g, tgt_i+delta)
- self.mark_starter(graphindex, i+1)
+ if tgt is not None:
+ tgt = tgt.operations[0]
+ if tgt in self.all_operations:
+ tgt_g, tgt_i = self.all_operations[tgt]
+ self.mark_starter(tgt_g, tgt_i+delta)
+ self.mark_starter(graphindex, i+1)
if (op in self.highlightops) != (prevop in self.highlightops):
self.mark_starter(graphindex, i)
prevop = op
@@ -134,17 +136,19 @@
for attrname, delta in [('jump_target', 0),
('_jump_target_prev', 1)]:
tgt = getattr(op, attrname, None)
- if tgt is not None and tgt in self.all_operations:
- tgt_g, tgt_i = self.all_operations[tgt]
- kwds = {}
- #if op.opname == 'jump':
- # #kwds['constraint'] = 'false'
- # #kwds['headport'] = ':n'
- # pass
- self.genedge((graphindex, opstartindex),
- (tgt_g, tgt_i+delta),
- color='red',
- **kwds)
+ if tgt is not None:
+ tgt = tgt.operations[0]
+ if tgt in self.all_operations:
+ tgt_g, tgt_i = self.all_operations[tgt]
+ kwds = {}
+ #if op.opname == 'jump':
+ # #kwds['constraint'] = 'false'
+ # #kwds['headport'] = ':n'
+ # pass
+ self.genedge((graphindex, opstartindex),
+ (tgt_g, tgt_i+delta),
+ color='red',
+ **kwds)
opindex += 1
if opindex >= len(operations):
break
Modified: pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/history.py
==============================================================================
--- pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/history.py (original)
+++ pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/history.py Fri Mar 20 13:32:05 2009
@@ -378,7 +378,7 @@
assert box not in seen
seen[box] = True
assert operations[-1].opnum == rop.JUMP
- assert operations[-1].jump_target.opnum == rop.MERGE_POINT
+ assert operations[-1].jump_target.operations[0].opnum == rop.MERGE_POINT
def __repr__(self):
return '<%s>' % (self.name,)
Modified: pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/optimize.py
==============================================================================
--- pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/optimize.py (original)
+++ pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/optimize.py Fri Mar 20 13:32:05 2009
@@ -901,18 +901,21 @@
res.append(op)
return res
-def update_loop(metainterp, loop, bridge, newboxlist, newrebuildops):
+def update_loop(metainterp, loop, bridge, newboxlist, newrebuildops, orig_loop):
mp = loop.operations[0]
mp.args += newboxlist
jump = loop.operations[-1]
- jump.args += newboxlist
+ if jump.jump_target is orig_loop:
+ jump.args += newboxlist
renaming = {}
jump = bridge.operations[-1]
for i in range(len(mp.args)):
renaming[jump.args[i]] = mp.args[i]
- # XXX also walk all already created bridges
for op in loop.operations:
if op.is_guard():
+ if op.jump_target is not None:
+ update_loop(metainterp, op.jump_target, bridge, newboxlist,
+ newrebuildops, loop)
op.liveboxes += newboxlist
op.rebuild_ops += rename_ops(newrebuildops, renaming)
metainterp.cpu.update_loop(loop, mp, newboxlist)
Modified: pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/pyjitpl.py (original)
+++ pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/pyjitpl.py Fri Mar 20 13:32:05 2009
@@ -897,7 +897,7 @@
if not we_are_translated():
bridge._call_history = self._debug_history
self.debug_history = []
- guard_failure.guard_op.jump_target = bridge.operations[0]
+ guard_failure.guard_op.jump_target = bridge
return bridge
def get_residual_args(self, loop, args):
Modified: pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/specnode.py
==============================================================================
--- pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/specnode.py (original)
+++ pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/specnode.py Fri Mar 20 13:32:05 2009
@@ -85,7 +85,7 @@
def equals(self, other):
if type(other) is NotSpecNode:
return True
- return False
+ return other.equals(self)
def matches(self, other):
# NotSpecNode matches everything
@@ -317,6 +317,8 @@
class VirtualizableSpecNode(VirtualizedSpecNode):
def equals(self, other):
+ if type(other) is NotSpecNode:
+ return True
if not isinstance(other, VirtualizableSpecNode):
return False
return VirtualizedSpecNode.equals(self, other)
@@ -331,6 +333,8 @@
self.known_class.arraydescr)
def equals(self, other):
+ if type(other) is NotSpecNode:
+ return True
if not isinstance(other, VirtualizableListSpecNode):
return False
return VirtualizedSpecNode.equals(self, other)
Modified: pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/test/test_virtualizable.py
==============================================================================
--- pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/test/test_virtualizable.py (original)
+++ pypy/branch/virtualizable-specnodes-2/pypy/jit/metainterp/test/test_virtualizable.py Fri Mar 20 13:32:05 2009
@@ -461,7 +461,6 @@
def test_virtual_obj_on_always_virtual_more_bridges(self):
- py.test.skip("Broken")
jitdriver = JitDriver(greens = [], reds = ['frame', 'n', 's'],
virtualizables = ['frame'])
More information about the Pypy-commit
mailing list