Hi Clement,

for something like that, try the Sugiyama Layout in Roassal. This is the layout we usually use when we have to display control flow graphs over code with Dot.

Thierry

Le 14/01/2014 16:50, Clément Bera a écrit :
Hello Roassal developers,

A few time ago Usman Bhatti showed me Roassal. Today I decided to use it
for my daily work on a project that aims to optimize Pharo's methods.

Firstly I am quite impressed by the quality of Roassal, I am currently
using the Roassal + Mondrian builder and I have a visual representation
which is very close to what I want after 1 hour of work with the help of
Usman. Good job guys.

Here are 2 examples of what I use:

exampleIfTrueIfFalse2
| a b |
a := true.
a
ifTrue: [
false ifTrue: [ ^ b := 1 ] ifFalse: [ b := 2 ] ]
ifFalse: [
true ifTrue: [ b := 4 ] ifFalse: [ b := 5 ] ].
^ b

Images intégrées 1

Here there's one rectangle for each basic block, entrance/exits are
basic blocks with bigger borders, and borders in red represents the "hot
path", which the path the execution flow most frequently uses (based on
native code counters added at some spots in the method by Cogit).

Another example:

exampleToDo
1 to: 10 do: [ :i |
self kick: i ]

Images intégrées 3

Now I have a few issues with the layout. I am currently using
the narrowTreeLayout which seems to be the best for my visualisation.

*issue 1:* When branches merges, which is in a tree when a node has 2 or
more parents, or when I have a #ifTrue:ifFalse:, the child is not well
aligned horizontally. Here in the first visualisation I showed,
BasicBlock 5 is below but not in the middle of Basic block 8,7 and 4
(horizontally). I put a minimal width for each basic block to make it
better but it's still not perfect.
*issue 2:* (most important issue) I cannot display back jumps because
then all the graph is missdrawn, therefore I need to remember where they
are instead of visualizing them all the time (I cannot display the back
jump from basic block 3 to basic block 2 in the second representation.
In addition, the back jump edge, when well displayed, overlaps the basic
blocks visualizations.

Here is an example of what I would like for the edges and basic block
positions:

Images intégrées 2

As you can see, here exit is in the middle of B2 and B5 horizontally,
which is not the case in my roassal visualization.
In addition, there's a back jump from B6 to B4 that I cannot display (or
all the visual representation goes nuts). The edge for the back jump
does not overlap with the basic blocks. In this graph, arrows follow a
grid. I don't care that arrows are diagonals instead of a mix of
horizontal and vertical lines but I would like to be able to see nicely
the back jumps as in this graph.

Do you have an idea on what layout/view options I could use with Roassal
+Mondrian to have a better result ?

I tried to create my own layout but after 2 hours I understood this cost
too much time for my planning (or perhaps I'm just too dumb to do it
fast :-( ).

Anyway, the representation I have now is good enough for me to use it.
But a better one would be better, especially for back jumps :-).

Thanks for any help.

Clement

--
Thierry Goubier
CEA list
Laboratoire des Fondations des Systèmes Temps Réel Embarqués
91191 Gif sur Yvette Cedex
France
Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95

Reply via email to