From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA23059 for caml-red; Mon, 29 May 2000 14:27:06 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA09983 for ; Fri, 26 May 2000 21:36:51 +0200 (MET DST) Received: from sundown.cs.cornell.edu (SUNDOWN.CS.CORNELL.EDU [128.84.96.20]) by concorde.inria.fr (8.10.0/8.10.0) with ESMTP id e4QJaor19691 for ; Fri, 26 May 2000 21:36:50 +0200 (MET DST) Received: from cs.cornell.edu (DHCP99-226.CS.CORNELL.EDU [128.84.99.226]) by sundown.cs.cornell.edu (8.9.3/8.9.3/R-3.0) with ESMTP id PAA21228 for ; Fri, 26 May 2000 15:36:49 -0400 (EDT) Message-ID: <392ED1F3.A08D283D@cs.cornell.edu> Date: Fri, 26 May 2000 15:35:15 -0400 From: Dan Grossman X-Mailer: Mozilla 4.72 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: Alternative generic hash function References: <783D93998201D311B0CF00805FEAA07B7E9233@RED-MSG-42> <20000525102414.55340@pauillac.inria.fr> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: weis [Veuillez me pardonner; je ne donne pas une traduction en français parce que j'ai peur de petites fautes qui peut changer sévèrement la signification.] Francois Pottier wrote: > Currently, mutable and immutable structures cannot be distinguished at > runtime. This would require maintaining additional type information, > and would probably introduce a lot of overhead. Why do you think the overhead would be high? I agree that: * Changing the compiler and runtime system is a fair amount of work. * A slightly different hash function does not justify the cost. * The cost for recording mutability __per-field__ is probably large. But I do not see why the __per-object__ overhead would be large. From my reading of the OCaml sources, it seems that: * It is trivial for the compiler to maintain this information all the way down to an allocation site. At that point, it suffices to use a different bytecode or native-code sequence to record that the object has at least one mutable field. * Recording this information would only require 1 header bit. (I personally could live with 21 size bits.) Getting this bit into the header word should not be hard. * Checking mutability dynamically would also be cheap. I ask because there are plenty of clever tricks you can put in the runtime system that exploit the immutability of objects. Is there a deeper problem I am missing? Thanks. --Dan -- | Dan Grossman www.cs.cornell.edu/home/danieljg H:607 256 0724 | | 5157 Upson Hall danieljg@cs.cornell.edu O:607 255 9834 |