From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id ACD837EE51 for ; Tue, 16 Apr 2013 09:17:32 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of oleg@okmij.org) identity=pra; client-ip=66.39.3.115; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="oleg@okmij.org"; x-sender="oleg@okmij.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of oleg@okmij.org designates 66.39.3.115 as permitted sender) identity=mailfrom; client-ip=66.39.3.115; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="oleg@okmij.org"; x-sender="oleg@okmij.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@www1.g3.pair.com) identity=helo; client-ip=66.39.3.115; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="oleg@okmij.org"; x-sender="postmaster@www1.g3.pair.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgQDAOD5bFFCJwNzemdsb2JhbABQgzyvGQGRa4EdDgEBCwcNCTyCJClSGxIiWyKIGQy8No8XHYMrA5cEAYEhkns8 X-IPAS-Result: AgQDAOD5bFFCJwNzemdsb2JhbABQgzyvGQGRa4EdDgEBCwcNCTyCJClSGxIiWyKIGQy8No8XHYMrA5cEAYEhkns8 X-IronPort-AV: E=Sophos;i="4.87,483,1363129200"; d="scan'208";a="11098202" Received: from www1.g3.pair.com ([66.39.3.115]) by mail3-smtp-sop.national.inria.fr with SMTP; 16 Apr 2013 09:17:31 +0200 Received: (qmail 92922 invoked by uid 9370); 16 Apr 2013 07:17:30 -0000 Date: 16 Apr 2013 07:17:30 -0000 Message-ID: <20130416071730.92921.qmail@www1.g3.pair.com> From: oleg@okmij.org To: christophe.raffalli@univ-savoie.fr CC: caml-list@inria.fr X-Validation-by: oleg@okmij.org Subject: [Caml-list] Re: Closures serialization and hash. > - 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.