[MLton-devel] New release of MLton: call-graphs

Joe Hurd MLton@mlton.org
Tue, 1 Apr 2003 19:43:40 +0100 (BST)


On Mon, 31 Mar 2003, Stephen Weeks wrote:

> -graph <exp> evaluates <exp> to a set of nodes S as before.  The nodes
> not in S are treated like they were -ignored: i.e., there is a dotted
> edge from A to B iff A and B are in S and there is a path from A to B
> of length >1 going only through nodes not in S.

This sounds like an excellent idea.

> A -> B -> C
> A -> C
>
> Suppose we call -graph '(not B)'.  Then, should there be a solid edge
> from A to C, a dotted edge from A to C, or both?  According to the
> definition I gave above, the answer is both.

In my opinion only a solid line should be displayed, since it's "more
important". Also, a problem with the dotted lines is that they may
appear spuriously, because of the interaction with higher-order
functions (as in the example I found, copied below). Perhaps a good
solution to this is for mlton to assume -profile-split '.*', and use
mlprof to combine the profiling information for different instances of
each function that satisfies the -graph predicate. [I guess what I'm
asking for here is for the -profile-split argument to be moved from
mlton to mlprof.]

Cheers,

Joe

_____________________________________________________________

(* Example of bad connections in the call-graph due to higher-order *)
(* functions. Here f1 and f2 are both connected to g1,g2,h1,h2      *)
(* because o acts as a mediator.                                    *)

fun fib 0 = 1 | fib 1 = 1 | fib n = fib (n - 1) + fib (n - 2);

val big = 30;

fun f o g = fn x => f (g x);

fun g1 x = (print "g1\n"; fib big; x);
fun g2 x = (print "g2\n"; fib big; x);
fun h1 x = (print "h1\n"; fib big; x);
fun h2 x = (print "h2\n"; fib big; x);

fun f1 x = (g1 o h1) x;
fun f2 x = (g2 o h2) x;

val _ = f1 1;
val _ = f2 2;







-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel