Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: [Caml-list] 32 bit floats, SSE instructions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Ennals, Robert <robert.ennals@i...>
Subject: RE: [Caml-list] 32 bit floats, SSE instructions

[snip]

> The main problem with float's - whatever if they are 32 or 64 bits -
is
> their boxing . OCaml runtime value representation is efficient but a
float
> -
> even 32 bits - cannot be carried in a register as it could be in C.
> (actually some unboxing can be performed locally by ocamlopt). This is
> mainly because OCaml is an high-level language, with a garbage
collector,
> and so needs to keep the track of what is being allocated in an
efficient
> way. 

I assume you are referring to the way in which OCaml reserves one bit in
each word to use as a tag that indicates whether the word represents a
pointer or not (which is also the reason for ints being 31 bits).

While a GC does need to have some way to distinguish between pointers
and data, this is not the only way that this can be done. Another
approach (used by GHC) is to dispense with tag bits and instead store a
bitmask for each datatype and each stack layout, indicating which fields
are pointers.

I don't know much about the relative advantages/disadvantages of the two
approaches, but there is definitely a design space to be explored, and
it is definitely possible to have native 32 bit floats in a garbage
collected language.

[snip]

-Rob


-------------------
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