English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Bug? Printf, %X and negative numbers
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-04-01 (18:10)
From: tim@f...
Subject: Re: [Caml-list] Bug? Printf, %X and negative numbers
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

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