From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA11079; Wed, 7 Jul 2004 17:41:40 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA11110; Wed, 7 Jul 2004 17:41:39 +0200 (MET DST) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i67FfbEV014545; Wed, 7 Jul 2004 17:41:38 +0200 Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id i67FfJi15185; Wed, 7 Jul 2004 10:41:19 -0500 (CDT) Date: Wed, 7 Jul 2004 10:48:02 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: Diego Olivier Fernandez Pons cc: "Basile Starynkevitch [local]" , Subject: Re: [Caml-list] Does Caml have slow arithmetics ? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at nez-perce with ID 40EC19B1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 arithmetics:01 pons:01 subsidiary:99 silently:01 aligned:01 pointers:01 aligned:01 pointers:01 unboxed:01 unboxed:01 fernandez:01 -bit:01 -bit:01 caml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, 7 Jul 2004, Diego Olivier Fernandez Pons wrote: > Subsidiary question : why LSB instead of MSB ? I thought it would be > simpler to let the computations silently overflow and correct when > necessary the tag bit. Because everything is a word and word aligned, so pointers always point to a word aligned address- which means that the low 2 (on 32-bit machines) or 3 (on 64-bit machines) bits are always zero for pointers. So if we set the low bit of unboxed values, the garbage collector can simply walk through memory, looking at every word. If the low bit is set, then it's an unboxed integer type and not a point. If the low bit is clear, it's a pointer. This speeds up the garbage collector, making the overall program faster. -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners