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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 5EDF57FD1D for ; Wed, 4 Nov 2015 16:23:40 +0100 (CET) IronPort-PHdr: 9a23:u973shwAWYJx5uvXCy+O+j09IxM/srCxBDY+r6Qd0eIeIJqq85mqBkHD//Il1AaPBtWGrakcwLeJ+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuStOU1Jz8ir/60qaQSjsLrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYeVcyDAgD1uSmxHh+pX4p8Y7oGx48sgs/M9YUKj8Y79wDfkBVGxnYCgJ45jEvBPZTAaLrkAXUmgMnwAAVwfM5gv7U5O3qSD6u/BwwgGVOMT3SfY/XjH0vIlxTxq9wh0GPD4w6m2ftYpVyup5pxSsvFY3l5TVa4G9Pfx4c7PcdJUdX2UXDZUZbDBIHo7pN9hHNOEGJ+sN6tCl/1Y= Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=rich@annexia.org; spf=Pass smtp.mailfrom=rich@annexia.org; spf=Pass smtp.helo=postmaster@annexia.org Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of rich@annexia.org) identity=pra; client-ip=80.68.91.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="rich@annexia.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of rich@annexia.org designates 80.68.91.176 as permitted sender) identity=mailfrom; client-ip=80.68.91.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="rich@annexia.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of postmaster@annexia.org designates 80.68.91.176 as permitted sender) identity=helo; client-ip=80.68.91.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="postmaster@annexia.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BEBQA4IjpW/7BbRFBegzusFwaUWoYTAoE+PBABAQEBAQEBAYEJgi6CBwEBAQMBJxM/EAsYCRMSDwUoIYg5DMIbAQshhg4+hQeJOAWSZ4NhAY0agWKSFIhTOCuEBD6FaAEBAQ X-IPAS-Result: A0BEBQA4IjpW/7BbRFBegzusFwaUWoYTAoE+PBABAQEBAQEBAYEJgi6CBwEBAQMBJxM/EAsYCRMSDwUoIYg5DMIbAQshhg4+hQeJOAWSZ4NhAY0agWKSFIhTOCuEBD6FaAEBAQ X-IronPort-AV: E=Sophos;i="5.20,243,1444687200"; d="scan'208";a="186053032" Received: from annexia.org ([80.68.91.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 04 Nov 2015 16:23:39 +0100 Received: from rich by annexia.org with local (Exim 4.84) (envelope-from ) id 1ZtzuV-0008T4-5z; Wed, 04 Nov 2015 15:23:39 +0000 Date: Wed, 4 Nov 2015 15:23:39 +0000 From: "Richard W.M. Jones" To: Gabriel Scherer Cc: caml users Message-ID: <20151104152339.GP3006@annexia.org> References: <20151104124321.GA25230@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [Caml-list] Are refs volatile? On Wed, Nov 04, 2015 at 04:08:48PM +0100, Gabriel Scherer wrote: > I find the question hard to understand, so I may have missed a subtlety in > the code you have shown. It's very possible I don't know what I'm talking about, but this is my analysis: > > List.iter ( > > fun task -> > > if not !quit then task (); > > ) tasks; Suppose that the optimizer can see the contents of `task', and see that it cannot update the quit variable. In that case, could it assume that quit is a constant, and hoist the test outside the loop? ie. transforming the code to: if not !quit then ( List.iter ( fun task -> task (); ) tasks ) Rich. -- Richard Jones Red Hat