Fixed coloring conflicts in rbyd tree renderers
A bit of a hack, but rather than handling conditional alt branches, our dbg rbyd tree renderers just represent single-pointer alts as an alt with both branches pointing to the place. Unfortunately, the two branches technically have different colors. This resulted in a bit of contention when chosing how to color the tree. Basically Python's dict ordering would determine which color won. Which was a bit confusing when dbgrbyd.py displayed different tree colorings for the same rbyd. dbgrbyd.py should be idempotent! This is solved by adding another hack to check explicitly for same-destination branches.
This commit is contained in:
+7
-6
@@ -548,12 +548,13 @@ class Rbyd:
|
|||||||
d=t_depth-1 - alt['h'],
|
d=t_depth-1 - alt['h'],
|
||||||
c=alt['c'],
|
c=alt['c'],
|
||||||
))
|
))
|
||||||
tree.add(TBranch(
|
if alt['ft'] != alt['nft']:
|
||||||
a=alt['nft'],
|
tree.add(TBranch(
|
||||||
b=alt['ft'],
|
a=alt['nft'],
|
||||||
d=t_depth-1 - alt['h'],
|
b=alt['ft'],
|
||||||
c='b',
|
d=t_depth-1 - alt['h'],
|
||||||
))
|
c='b',
|
||||||
|
))
|
||||||
|
|
||||||
return tree, t_depth
|
return tree, t_depth
|
||||||
|
|
||||||
|
|||||||
+7
-6
@@ -579,12 +579,13 @@ class Rbyd:
|
|||||||
d=t_depth-1 - alt['h'],
|
d=t_depth-1 - alt['h'],
|
||||||
c=alt['c'],
|
c=alt['c'],
|
||||||
))
|
))
|
||||||
tree.add(TBranch(
|
if alt['ft'] != alt['nft']:
|
||||||
a=alt['nft'],
|
tree.add(TBranch(
|
||||||
b=alt['ft'],
|
a=alt['nft'],
|
||||||
d=t_depth-1 - alt['h'],
|
b=alt['ft'],
|
||||||
c='b',
|
d=t_depth-1 - alt['h'],
|
||||||
))
|
c='b',
|
||||||
|
))
|
||||||
|
|
||||||
return tree, t_depth
|
return tree, t_depth
|
||||||
|
|
||||||
|
|||||||
+7
-6
@@ -563,12 +563,13 @@ class Rbyd:
|
|||||||
d=t_depth-1 - alt['h'],
|
d=t_depth-1 - alt['h'],
|
||||||
c=alt['c'],
|
c=alt['c'],
|
||||||
))
|
))
|
||||||
tree.add(TBranch(
|
if alt['ft'] != alt['nft']:
|
||||||
a=alt['nft'],
|
tree.add(TBranch(
|
||||||
b=alt['ft'],
|
a=alt['nft'],
|
||||||
d=t_depth-1 - alt['h'],
|
b=alt['ft'],
|
||||||
c='b',
|
d=t_depth-1 - alt['h'],
|
||||||
))
|
c='b',
|
||||||
|
))
|
||||||
|
|
||||||
return tree, t_depth
|
return tree, t_depth
|
||||||
|
|
||||||
|
|||||||
+7
-6
@@ -768,12 +768,13 @@ def dbg_tree(data, block_size, rev, trunk, weight, *,
|
|||||||
d=t_depth-1 - alt['h'],
|
d=t_depth-1 - alt['h'],
|
||||||
c=alt['c'],
|
c=alt['c'],
|
||||||
))
|
))
|
||||||
tree.add(TBranch(
|
if alt['ft'] != alt['nft']:
|
||||||
a=alt['nft'],
|
tree.add(TBranch(
|
||||||
b=alt['ft'],
|
a=alt['nft'],
|
||||||
d=t_depth-1 - alt['h'],
|
b=alt['ft'],
|
||||||
c='b',
|
d=t_depth-1 - alt['h'],
|
||||||
))
|
c='b',
|
||||||
|
))
|
||||||
|
|
||||||
# find the max depth from the tree
|
# find the max depth from the tree
|
||||||
t_depth = max((branch.d+1 for branch in tree), default=0)
|
t_depth = max((branch.d+1 for branch in tree), default=0)
|
||||||
|
|||||||
Reference in New Issue
Block a user