caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Re: Closures serialization and hash.
@ 2013-04-16  7:17 oleg
  0 siblings, 0 replies; only message in thread
From: oleg @ 2013-04-16  7:17 UTC (permalink / raw)
  To: christophe.raffalli; +Cc: caml-list



>   - use a table associating function "names" (position in the .cmo, or the
> lambda-tree or anything
> portable) to source code adresses. The function name should be portable
> across architecture and
> distinct binary using common librairies.
>
>  - (1) fill this table by calling a function "register_code_pointer : ('a ->
> 'b) -> unit"
>
>  - (2) or even better offer a linking option to register all closures from
> some compilation unit.

Incidentally delimcc has to do something similar when serializing
captured byte-code delimited continuations. Delimcc has a function
to register a closure, unimaginatively named
        val register_global_closure : ('a -> 'b) -> unit

It also provides a third way of registration. The function

        val relativitize : Obj.t -> bool -> Obj.t
takes an object (usually a closure, but can be anything), and, when
called with with true as the second argument, registers all closures
found during the traversal of the object (provided they are in the old heap -- 
there is little sense to register closures that are transient). Sec 8
of
        http://okmij.org/ftp/continuations/caml-shift-journal.pdf
explains what relativitize (and the dual, absolutize) do and
especially why they are needed.





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-04-16  7:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-16  7:17 [Caml-list] Re: Closures serialization and hash oleg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).