Ortal1993 / compilation-project

0 stars 0 forks source link

Mark function call\return edges with dashed line #7

Closed AdiHarif closed 1 year ago

AdiHarif commented 1 year ago

As our input programs will become more complex, we probably will have a lot of call\return edges from and to a lot of different places. This will help us see more intuitively what sub-graph belongs to which function.

Another suggestion - make inter function edges optional.

ronynudelman commented 1 year ago

Should we also create dashed edges between matching phi-merge nodes and merge-if nodes?

AdiHarif commented 1 year ago

It would be nice to have, however not a must (at least for now). Anyway i would suggest a different style for these edges to defer them from inter-function edges (maybe dotted line?).

ronynudelman commented 1 year ago

In one of our last commits (link), we switched the direction of the "call" edge and changed the semantic meaning of its label. Previously, we had the form: (call vertex) -----"call"-----> (start vertex). But calling to methods and function can be done in various ways: calling to object methods, callbacks, callable expressions, etc.. In order to deal with all kinds of calls, it seemed to us more appropriate to change the "call" edge to be: (callable expression) -----"callable"-----> (call vertex). That means the callable expression, which can be anything now, is one of the "arguments" to the call vertex. The other arguments for example are the real call arguments. It seems more logical to do so when the callable expression is a real expression and not just a regualr function. What do you think of this change? Because now it seems weird to "dash" only the "callable" edges.

AdiHarif commented 1 year ago

Technically, anything we can is a function. even if we call a method named "methodA" of an object, it looks for a field in this object (or its prototype) that is named methodA and try to call whats stored inside this field.

I do think that passing a "callable" input to the call vertex is a good way to go, as what we actually call is dynamic. That being said, it does not correspond to the old "call" edge, as it is a data edge and the old edge was a control flow edge. In case we know 100% (which is a bit of a problematic assumption) we know what is the flow of the method being called, we could have both a "callable" edge going into the call vertex and a "call" edge going out towards the start of said flow.

AdiHarif commented 1 year ago

As we no longer draw inter-procedural control edges, this is no longer relevant.