Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] generating a call-graph
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-06-03 (04:27)
From: John Max Skaller <skaller@o...>
Subject: Re: [Caml-list] generating a call-graph
Xavier Leroy wrote:

>>Does anyone know a way of generating a call-graph from a set of ocaml
>>sources?  What I want to do is, at a minimum, get a list of all the
>>functions that could be called as a result of a given function invocation.
> This requires a non-trivial static analysis called "control flow
> analysis" in the literature; particular instances include Shivers'
> 0-CFA and k-CFA, Jagannathan and Wright's "polymorphic splitting",
> etc.
> The difficulty is that functions are first-class values

.. and the difficulty can be bypassed by considering
the actual industrial requirement, which probably
isn't as stated above.

We often want to know what the definition
of a function depends on, and that clearly *excludes*
any functions passed in as parameters.

Second, an incomplete graph would still be very useful.
For example to determine if you can move a function
definition earlier in the code, so as to call it from
some other function -- or whether you would have to move
a lot more functions back -- and if so which ones --
and, indeed, if it is possible at all (without recursion).

I guess a patch to the parser could gather the required
information easily ( the main difficulty being
the huge number of anonymous functions that tend to
float around when one does currying).

John Max Skaller,
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: