[pypy-svn] r32970 - in pypy/dist/pypy: jit/codegen/llgraph objspace/flow translator translator/backendopt translator/tool
pedronis at codespeak.net
pedronis at codespeak.net
Fri Oct 6 18:51:55 CEST 2006
Author: pedronis
Date: Fri Oct 6 18:51:47 2006
New Revision: 32970
Modified:
pypy/dist/pypy/jit/codegen/llgraph/llimpl.py
pypy/dist/pypy/objspace/flow/flowcontext.py
pypy/dist/pypy/objspace/flow/model.py
pypy/dist/pypy/objspace/flow/objspace.py
pypy/dist/pypy/translator/backendopt/inline.py
pypy/dist/pypy/translator/tool/graphpage.py
pypy/dist/pypy/translator/tool/make_dot.py
pypy/dist/pypy/translator/unsimplify.py
Log:
(arre, arigo, pedronis)
assign a color to flex switches generated with codegen/llgraph.
kill the unused exc_handler flag on blocks, now blocks have a uniform
blockcolor slot.
Modified: pypy/dist/pypy/jit/codegen/llgraph/llimpl.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/llgraph/llimpl.py (original)
+++ pypy/dist/pypy/jit/codegen/llgraph/llimpl.py Fri Oct 6 18:51:47 2006
@@ -233,8 +233,22 @@
return pseudotuple(to_opaque_object(false_link),
to_opaque_object(true_link))
+_color_num = 1
+_color_den = 2
+def getcolor():
+ global _color_den, _color_num
+ import colorsys
+ hue = _color_num/float(_color_den)
+ _color_num +=2
+ if _color_num > _color_den:
+ _color_num = 1
+ _color_den *= 2
+ rgb = list(colorsys.hsv_to_rgb(hue, 0.10, 1.0))
+ return '#'+''.join(['%02x' % int(p*255) for p in rgb])
+
def closeblockswitch(block, exitswitch):
block = from_opaque_object(block)
+ block.blockcolor = getcolor()
exitswitch = from_opaque_object(exitswitch)
assert isinstance(exitswitch, flowmodel.Variable)
block.exitswitch = exitswitch
Modified: pypy/dist/pypy/objspace/flow/flowcontext.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/flowcontext.py (original)
+++ pypy/dist/pypy/objspace/flow/flowcontext.py Fri Oct 6 18:51:47 2006
@@ -22,7 +22,7 @@
class SpamBlock(Block):
# make slots optional, for debugging
if hasattr(Block, '__slots__'):
- __slots__ = "dead framestate fillcolor".split()
+ __slots__ = "dead framestate".split()
def __init__(self, framestate):
Block.__init__(self, framestate.getvariables())
@@ -39,7 +39,7 @@
class EggBlock(Block):
# make slots optional, for debugging
if hasattr(Block, '__slots__'):
- __slots__ = "prevblock booloutcome last_exception fillcolor".split()
+ __slots__ = "prevblock booloutcome last_exception".split()
def __init__(self, inputargs, prevblock, booloutcome):
Block.__init__(self, inputargs)
Modified: pypy/dist/pypy/objspace/flow/model.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/model.py (original)
+++ pypy/dist/pypy/objspace/flow/model.py Fri Oct 6 18:51:47 2006
@@ -183,7 +183,7 @@
class Block(object):
__slots__ = """isstartblock inputargs operations exitswitch
- exits exc_handler""".split()
+ exits blockcolor""".split()
def __init__(self, inputargs):
self.isstartblock = False
@@ -193,8 +193,6 @@
# Constant(last_exception), see below
self.exits = [] # list of Link(s)
- self.exc_handler = False # block at the start of exception handling code
-
def at(self):
if self.operations and self.operations[0].offset >= 0:
return "@%d" % self.operations[0].offset
@@ -206,8 +204,6 @@
txt = "block@%d" % self.operations[0].offset
else:
txt = "codeless block"
- if self.exc_handler:
- txt = txt +" EH"
return txt
def __repr__(self):
@@ -547,7 +543,6 @@
return result
newblock.operations = copyoplist(block.operations)
newblock.exitswitch = copyvar(block.exitswitch)
- newblock.exc_handler = block.exc_handler
return newblock
for block in graph.iterblocks():
Modified: pypy/dist/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/objspace.py (original)
+++ pypy/dist/pypy/objspace/flow/objspace.py Fri Oct 6 18:51:47 2006
@@ -191,7 +191,6 @@
specialcase.setup(self)
def exception_match(self, w_exc_type, w_check_class):
- self.executioncontext.recorder.crnt_block.exc_handler = True
try:
check_class = self.unwrap(w_check_class)
except UnwrapException:
Modified: pypy/dist/pypy/translator/backendopt/inline.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/inline.py (original)
+++ pypy/dist/pypy/translator/backendopt/inline.py Fri Oct 6 18:51:47 2006
@@ -228,7 +228,6 @@
newblock.operations = [self.copy_operation(op) for op in block.operations]
newblock.exits = [self.copy_link(link, block) for link in block.exits]
newblock.exitswitch = self.get_new_name(block.exitswitch)
- newblock.exc_handler = block.exc_handler
self.search_for_calls(newblock)
return newblock
Modified: pypy/dist/pypy/translator/tool/graphpage.py
==============================================================================
--- pypy/dist/pypy/translator/tool/graphpage.py (original)
+++ pypy/dist/pypy/translator/tool/graphpage.py Fri Oct 6 18:51:47 2006
@@ -124,7 +124,7 @@
if self.annotator and self.annotator.blocked_graphs:
for block, was_annotated in self.annotator.annotated.items():
if not was_annotated:
- block.fillcolor = "red"
+ block.blockcolor = "red"
if graphs:
name = graphs[0].name+"_graph"
else:
Modified: pypy/dist/pypy/translator/tool/make_dot.py
==============================================================================
--- pypy/dist/pypy/translator/tool/make_dot.py (original)
+++ pypy/dist/pypy/translator/tool/make_dot.py Fri Oct 6 18:51:47 2006
@@ -132,7 +132,7 @@
lines.append("")
numblocks = len(block.exits)
color = "black"
- fillcolor = getattr(block, "fillcolor", "white")
+ fillcolor = getattr(block, "blockcolor", "white")
if not numblocks:
shape = "box"
fillcolor="green"
Modified: pypy/dist/pypy/translator/unsimplify.py
==============================================================================
--- pypy/dist/pypy/translator/unsimplify.py (original)
+++ pypy/dist/pypy/translator/unsimplify.py Fri Oct 6 18:51:47 2006
@@ -109,12 +109,10 @@
newblock.operations = moved_operations
newblock.recloseblock(*links)
newblock.exitswitch = exitswitch
- newblock.exc_handler = block.exc_handler
link = Link(linkargs, newblock)
block.operations = block.operations[:index]
block.recloseblock(link)
block.exitswitch = None
- block.exc_handler = False
return link
def split_block_at_start(annotator, block):
More information about the Pypy-commit
mailing list