Browse thread
[Caml-list] OCaml Speed for Block Convolutions
-
David McClain
-
William Chesters
- Chris Hecker
- David McClain
- Tom _
-
Tom _
-
Hugo Herbelin
- Charles Martin
- William Chesters
-
Hugo Herbelin
-
William Chesters
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | William Chesters <williamc@p...> |
| Subject: | Re: [Caml-list] OCaml Speed for Block Convolutions |
Hugo Herbelin writes: > Assume more generally that you can modify any local variable as in the > (standard) following example: > > let fact (mutable n) = > let mutable r = 1 in > while n > 0 do > r <- r * n; > n <- n - 1 > done; > r This doesn't actually make life much easier for the compiler. On 32-bit machines [see other thread!], `r' must be a reference (in the C++ sense) to a heap object---64-bit float, plus header. In general it is not safe to overwrite the float value in the heap, if it's possible that other variables have been assigned to it (unless floats are assigned by value not by reference, but in that case you get heap allocation at the time of assignment ...). The analysis necessary for determining that no such aliasing references can exist, and indeed that the value can simply be kept in a float register/on the FPU stack, is already there in the compiler and applies perfectly well to mutable references. ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr