From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id B979A7EE7D for ; Tue, 2 Jun 2015 14:06:24 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of stedolan@stedolan.net) identity=pra; client-ip=209.85.214.182; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="stedolan@stedolan.net"; x-sender="stedolan@stedolan.net"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of stedolan@stedolan.net) identity=mailfrom; client-ip=209.85.214.182; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="stedolan@stedolan.net"; x-sender="stedolan@stedolan.net"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ob0-f182.google.com) identity=helo; client-ip=209.85.214.182; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="stedolan@stedolan.net"; x-sender="postmaster@mail-ob0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AbAgCNm21VlLbWVdFbgmaBXAaDGMRcBzsRAQEBAQEBAREBAQEBBwsLCR8whCMBAQQSEVYQAQoLDQICJgICIhIBBQEcGSKICwGoZj4xiz+fSoR/CoEXiiKFI4JSgUUBBJ4mlW4SI4EVhBxugkcBAQE X-IPAS-Result: A0AbAgCNm21VlLbWVdFbgmaBXAaDGMRcBzsRAQEBAQEBAREBAQEBBwsLCR8whCMBAQQSEVYQAQoLDQICJgICIhIBBQEcGSKICwGoZj4xiz+fSoR/CoEXiiKFI4JSgUUBBJ4mlW4SI4EVhBxugkcBAQE X-IronPort-AV: E=Sophos;i="5.13,539,1427752800"; d="scan'208";a="161443933" Received: from mail-ob0-f182.google.com ([209.85.214.182]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 02 Jun 2015 14:04:47 +0200 Received: by obew15 with SMTP id w15so126251787obe.1 for ; Tue, 02 Jun 2015 05:04:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=NUwAlTFdyNRgyQUZXBx68vRv5X5dYyP7bD8IxEwB6T8=; b=FFl44n9t3ni1wUK1OmETaOugIlAd4S6luSs1fhTgII2DVVlvkqqOTKLiXwtk588k+F cNF1F0xEwZiKVsxWbNZU1yPhEhMUR1u344P9FyOhynDBKMYGaTAh25O38GwANVCkUm0L aDrqEx27/lQ6Jgfh6ovz27RE0AEgN3D0Kzo6feJKYEs+T+O8I6SlouEA+2lfQNDwwVkU 92uEz/J3+nKVqCXhErcMj8Ny5FsrzaAR1QdjMgtlwcJhKrH2w/E8yeWSZTbBggl9xpwZ dsiOBtiatcV7+hwaUHTWeKlWuT9FdiXAsNMJuHrWulrQF3o4Zh6wgWPQon3ZvlB1V4Tp turQ== X-Gm-Message-State: ALoCoQlhgSj3U322D2Wjffm8EPvwo89y+LiLAeV7k9yVPtvoi2WE7wrHXQZXQnuQhqa03mk0dF+D MIME-Version: 1.0 X-Received: by 10.182.118.163 with SMTP id kn3mr22549672obb.80.1433246686169; Tue, 02 Jun 2015 05:04:46 -0700 (PDT) Sender: stedolan@stedolan.net Received: by 10.202.207.203 with HTTP; Tue, 2 Jun 2015 05:04:46 -0700 (PDT) X-Originating-IP: [2001:630:212:238:21c:c0ff:fe4b:2a6f] In-Reply-To: <00fb01d09c62$c5da4ad0$518ee070$@ffconsultancy.com> References: <20140929120817.GB20628@frosties> <54296663.8080902@laposte.net> <00fb01d09c62$c5da4ad0$518ee070$@ffconsultancy.com> Date: Tue, 2 Jun 2015 13:04:46 +0100 X-Google-Sender-Auth: NSIP3pK2gkIwqsVjwxpDqadjad4 Message-ID: From: Stephen Dolan To: jon@ffconsultancy.com Cc: Gabriel Scherer , Pierre Chambart , Goswin von Brederlow , caml users Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] Why List.map does not be implemented tail-recursively? On Mon, Jun 1, 2015 at 1:02 PM, Jon Harrop wrote: > What happens when the first allocation in the creation of a cyclic immutable structure incurs a minor collection? > > let rec xs = 0::ys and ys = 1::xs Such allocations are handled specially. Essentially, it boils down to having a write barrier on the final mutation that ties the knot on the cyclic data structure. This isn't multicore-specific: see caml_alloc_dummy and caml_update_dummy in byterun/alloc.c for the gory details. In multicore, this mutation needs to promote (copy to the shared heap) the cyclic data structure if the head node has already been collected. Stephen