Re: [Caml-list] How does OCaml update references when values are moved by the GC?

2010-10-30 Thread Elias Gabriel Amaral da Silva
2010/10/29 Damien Doligez damien.doli...@inria.fr: On 2010-10-28, at 23:48, Jon Harrop wrote: How does OCaml update references in the stacks and heap when values are moved by the GC? They are updated by the GC, of course. can't the GC just put a new reference for it in a data structure?

Re: [Caml-list] Re: Generalized Algebraic Datatypes

2010-10-30 Thread Jacques Carette
On 30/10/2010 1:14 AM, Jacques Garrigue wrote: On 2010/10/30, at 8:01, Jacques Le Normand wrote: Note that, as in Jacques's examples, the constructor function was not curryfied. (type t = A of bool * int) would generate a function (A : bool * int - t). Actually, curryfied constructors are

Re: [Caml-list] Re: Generalized Algebraic Datatypes

2010-10-30 Thread Dario Teixeira
Hi, While this does make sense in Haskell, in Ocaml it feels a bit out of place, because you cannot, for example, partially apply a type constructor. The types above don't allow partial applications either.  They use the OCaml/SML style of constructors were partial application is not

Re: [Caml-list] Re: Generalized Algebraic Datatypes

2010-10-30 Thread Dario Teixeira
Hi, If the risk of confusion with constructors-as-functions is deemed problematic, a syntax like    App of ('a - 'b) t * 'a t : 'b t seems OK too. Actually this would have the advantage of allowing the scope of existential variables to be explicit. I.e. one could write   App of 'a. ('a -

RE: [Caml-list] How does OCaml update references when values are moved by the GC?

2010-10-30 Thread Jon Harrop
I was hoping for a little more detail, of course. :-) How is the mapping from old to new pointers stored? Does the GC rewrite all of the thread-local stacks in series before allowing any of them to continue? Does the write barrier record pointers written into the major heap so only those specific

Re: [Caml-list] How does OCaml update references when values are moved by the GC?

2010-10-30 Thread Michael Ekstrand
On 10/30/2010 12:15 PM, Jon Harrop wrote: I was hoping for a little more detail, of course. :-) How is the mapping from old to new pointers stored? Does the GC rewrite all of the thread-local stacks in series before allowing any of them to continue? I imagine so. Does the write barrier

RE: [Caml-list] How does OCaml update references when values are moved by the GC?

2010-10-30 Thread Jon Harrop
I just found some interesting statements made by others on this post about optimizing OCaml's write barrier: http://eigenclass.org/R2/writings/optimizing-caml_modify In the comments, Mauricio said that caml_modify (the write barrier) accounted for over 30% of the total running time of the

RE: [Caml-list] How does OCaml update references when values are moved by the GC?

2010-10-30 Thread Jon Harrop
Hi Michael, Thanks for the info. I stumbled upon Richard's excellent web page describing the internals of OCaml and the write barrier but it does not describe how the pointers actually get rewritten. Cheers, Jon. -Original Message- From: caml-list-boun...@yquem.inria.fr