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 LAA11268; Sat, 24 May 2003 11:56:34 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 LAA10829 for ; Sat, 24 May 2003 11:56:33 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h4O9uVH26383; Sat, 24 May 2003 11:56:31 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA11237; Sat, 24 May 2003 11:56:31 +0200 (MET DST) Date: Sat, 24 May 2003 11:56:31 +0200 From: Xavier Leroy To: John Carr Cc: OCaml List Subject: Re: [Caml-list] register windows Message-ID: <20030524115631.C10663@pauillac.inria.fr> References: <20030520214854.A31426@pauillac.inria.fr> <200305202126.RAA03623@no-knife.mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <200305202126.RAA03623@no-knife.mit.edu>; from jfc@MIT.EDU on Tue, May 20, 2003 at 05:26:28PM -0400 X-Spam: no; 0.00; caml-list:01 implemented:01 recursion:01 reloaded:01 inlining:01 ocaml:01 caml:01 overflow:02 loads:03 overhead:03 observation:03 functions:05 guess:06 giant:93 registers:07 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > A fixed-size register window is always going to save and restore too > > many registers. > > As long as you stay within the eight windows implemented in hardware > saving the extra registers costs nothing -- a save instruction takes > one cycle. Well, you're thinking of the best case, and I'm thinking of the worst case where the 8 hardware windows will overflow -- and in many programs involving recursion, they do overflow very often. In this case, the whole contents of one or several windows are stored in memory (or reloaded from memory), including those registers that are not used by the program. So, even if the corresponding OS traps have no overhead (which is not true), the processor ends up doing more memory stores and loads than strictly necessary. > Register windows were invented when somebody observed that programs > tended to stay within a small range of call depth. That observation > is about 25 years old. Since then inlining has reduced call depth > while the rise of giant libraries with layers and layers of wrapper > functions has increased call depth. > > The question is, are present-day ocaml programs typically the sort for > which register windows are better? My guess is "no". Heavy use of recursion, as encouraged by Caml, leads to call depths much larger than what the SPARC designers observed on a few C programs 25 years ago. - Xavier Leroy ------------------- 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