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 UAA05167; Tue, 1 Apr 2003 20:10:28 +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 UAA04773 for ; Tue, 1 Apr 2003 20:10:25 +0200 (MET DST) Received: from lobus.fungible.com (adsl-64-161-114-2.dsl.snfc21.pacbell.net [64.161.114.2]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h31IAN527203 for ; Tue, 1 Apr 2003 20:10:24 +0200 (MET DST) Received: by lobus.fungible.com (Postfix, from userid 1000) id 245567F4D; Tue, 1 Apr 2003 10:10:17 -0800 (PST) Date: Tue, 1 Apr 2003 09:45:54 -0700 From-Tims-Fingers: true To: caml-list@inria.fr In-reply-to: <20030401101946.B14164@pauillac.inria.fr> (message from Xavier Leroy on Tue, 1 Apr 2003 10:19:46 +0200) Subject: Re: [Caml-list] Bug? Printf, %X and negative numbers References: <20030330115111.A22539@pauillac.inria.fr> <20030401101946.B14164@pauillac.inria.fr> Message-Id: <20030401181017.245567F4D@lobus.fungible.com> From: tim@fungible.com (Tim Freeman) X-Spam: no; 0.00; fungible:01 caml-list:01 bug:01 printf:01 redesign:01 pointers:01 boxing:01 gcc:01 ocaml's:01 subroutine:01 ecdf:01 7180:01 compiler:01 -bit:01 ints:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Somebody I don't know said: > Or, I suppose, we could > completely redesign Ocaml to use 32-bit ints and do something else to > differentiate ints from pointers :-). Then Xavier said: >If you can find a "something else" that is faster than systematically >boxing the 32-bit ints, you'll be hailed as the savior in compiler >circles :-) I'm guessing that the standard solution to doing full-word ints with a garbage collector is to generate some code for each data structure that plugs into the garbage collector and knows what fields are ints and what fields are pointers. That's the way the gcc compiler did it as of 3.0.1 or so. (In that case the code was manually generated.) I don't know if this would be faster than OCAML's approach. You'd pay for more code in your cache, and for an indirect goto for each block that is garbage collected (unless you managed to garbage collect them in batches of blocks of identical type, or you organized things so in the absence of polymorphism it was a subroutine call instead of an indirect goto. You could maybe even inline the subroutine call sometimes. Hmm.). You'd benefit because you don't have to do the bit twiddling that's done for every arithmetic operation now, and because it should be faster to decide not to follow the non-pointers during garbage collection. Straight-line code is often faster than branching for modern architectures. Surely this has been discussed before, although perhaps not on this mailing list. Can someone point to a paper that analyzes the various tradeoffs? -- Tim Freeman tim@fungible.com Which is worse: ignorance or apathy? Who knows? Who cares? GPG public key fingerprint ECDF 46F8 3B80 BB9E 575D 7180 76DF FE00 34B1 5C78 ------------------- 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