From: Damien Doligez <damien.doligez@inria.fr>
To: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] flow optimisation q
Date: Sat, 3 Jan 2004 19:02:03 +0100 [thread overview]
Message-ID: <EF4DE230-3E16-11D8-BEFF-00039310CAE8@inria.fr> (raw)
In-Reply-To: <1072936720.4626.18.camel@pelican>
On Saturday, January 3, 2004, at 03:54 AM, skaller wrote:
> Nothing to do with ocaml, but some people here
> might know.. Suppose there is a set of
> primitive procedures pr1 pr2 and a procedure constructor:
>
> proc = proc list
>
> which defines a new procedure to be a list of calls
> to other procedures, with mutual recursion allowed.
>
> A special procedure is the empty
> procedure whose call list is empty.
>
> Problem: remove all empty procedures
> (and of course calls to them).
This is a garbage collection problem. I assume that you also
want to remove recursive cycles of procedures that never
call any primitive.
Your roots are the primitive procedures, and your pointers
are the is-called-by relation.
You can use a two-pass mark-and-sweep algorithm, or a one-pass
copying algorithm. You'll need to invert the graph first,
making the called procedures point to its callers, and then it's
straightforward.
> A generalisation of this problem is: how to inline?
That's a much harder problem, of course.
-- Damien
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2004-01-03 18:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-03 2:54 skaller
2004-01-02 21:42 ` Jean-Baptiste Rouquier
2004-01-03 18:02 ` Damien Doligez [this message]
2004-01-03 18:16 ` skaller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=EF4DE230-3E16-11D8-BEFF-00039310CAE8@inria.fr \
--to=damien.doligez@inria.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox