Hi Clement,

Pretty exciting.

As Alex says, your desired algorithm is pretty specific, but it looks similar to a UML layout. If you could find one that would fit your needs, it would be a valuable addition to point us to it. Perhaps we can find the resources to implement it.

Now, about your workflow. Roassal alone can already provide value added on top of existing default tools, and it's great that you could show what you could do in one hour. It takes a bit of leap of faith, but then you do not want to go back :).

But, I think you would benefit even more by taking a look at the GTInspector and other related tools. For example, here are a couple of posts that might be of interest (they talk precisely about code analysis in Pharo):
http://www.humane-assessment.com/blog/guiding-custom-changes-with-gtinspector
http://www.humane-assessment.com/blog/a-pharo-refactoring-story-adding-theme-ability-to-a-morph

I would actually be interested in helping you build tools that would match your case. The reason is that in order to show the value of these tools we need custom problems - and you happen to have identified some. Could you describe the needs you have in more details?

As far as I can see, the visualization is derived from source code. This can be seen as being similar to how an AST is derived from source code. The GTInspector already provides an implementation of understanding this mapping. For example, in an image with GTInspector (just download the Moose one for quick tests) do:
(Collection>>#collect:) parseTree inspect�

and you get a picture like the attached one.
Inline image 1

If you give me more concrete things to look at, I can try to help.

Cheers,
Doru



On Tue, Jan 14, 2014 at 4:50 PM, Cl�ment Bera <bera.clement@gmail.com> wrote:
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



--
www.tudorgirba.com

"Every thing has its own flow"