caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* RE: AW: [Caml-list] The tag bit
@ 2004-08-13 13:43 Ennals, Robert
  0 siblings, 0 replies; 11+ messages in thread
From: Ennals, Robert @ 2004-08-13 13:43 UTC (permalink / raw)
  To: Christophe Raffalli, caml-list

Unfortunately, conservative GC is incompatible with copying collection (which I believe is what O'Caml uses - though I may be wrong).


With a copying collector, data is allocated sequentially in a nursery buffer, and the collector periodically moves the reachable data to a new area area of memory, fixing up all pointers to point to new locations.

The advantage of this approach is that allocation on the heap is very cheap - just return the current position of the heap pointer, and increment it by the object size.

The downside is that one must know for certain whether or not an object is a pointer - as pointers will be changed when the data they point to is moved.


Regarding the block-based approach: as others have mentioned - this approach is entirely practical, and is indeed the approach taken by several other compiler implementations (including GHC), however anecdotal evidence suggests that the bit tagging approach makes GC faster.


> -----Original Message-----
> From: owner-caml-list@pauillac.inria.fr [mailto:owner-caml-
> list@pauillac.inria.fr] On Behalf Of Christophe Raffalli
> Sent: 13 August 2004 13:59
> To: Jacques Garrigue
> Cc: Christoph.Bauer@lms-gmbh.de; caml-list@inria.fr
> Subject: Re: AW: [Caml-list] The tag bit
> 
> There is a less costly way to avoid the tag bit in integer:
> "conservative GC": any int which happens to point in an alloccated block
> (or only at the beginning if you do not consider C but ML) is considered
> as a pointer. You will have very few wrong pointers (especially in the
> second case). Moreover, array of int or float, or block of memory can be
> tagged with a flag saying they do not old pointer.
> 
> The Boehm GC for C and C++ is very succefull to do that and very often
> allow you to share data-structure in C as you would in ML (not caring
> about who will release first the data) and gain both speed and memory.
> 
> Does anyone have  a comparison between two identical GC except one
> should have a tag bit and the other be conservative ?
> 
> The cost of conservative GC is the test to know if an int is pointing in
> (or at the beginning) of an allocated block which require for instance a
> hashtbl of allocated blocks by adress ranges. I don't know if the gain
> for arithmetic + easier C interface would compensate the lost in the GC
> for a real GC like Caml's.
> 
> 
> --
> Christophe Raffalli
> Université de Savoie
> Batiment Le Chablais, bureau 21
> 73376 Le Bourget-du-Lac Cedex
> 
> tél: (33) 4 79 75 81 03
> fax: (33) 4 79 75 87 42
> mail: Christophe.Raffalli@univ-savoie.fr
> www: http://www.lama.univ-savoie.fr/~RAFFALLI
> ---------------------------------------------
> IMPORTANT: this mail is signed using PGP/MIME
> At least Enigmail/Mozilla, mutt or evolution
> can check this signature
> ---------------------------------------------
> 
> -------------------
> 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

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


^ permalink raw reply	[flat|nested] 11+ messages in thread
* RE: AW: [Caml-list] The tag bit
@ 2004-08-13 14:58 Ennals, Robert
  0 siblings, 0 replies; 11+ messages in thread
From: Ennals, Robert @ 2004-08-13 14:58 UTC (permalink / raw)
  To: T. Kurt Bond, caml-list

Do mostly copying collectors actually solve the problem Andreas was
discussing?

My impression was that mostly copying collectors are only really useful
when the vast majority of pointers are tagged. If all pointers into a
block are tagged, then the block is copied (just as it would be in a
copying collector); however if there are some ambiguous pointers into a
block (e.g. from within some C code you have linked to) then that block
is "pinned" into position, and must remain pinned until there are no
ambiguous pointers into it.

Thus, my impression was the mostly copying collection is great if one
has a language that uses tagged pointers, but wishes it to share GC-ed
objects with a language that doesn't understand tags, but that it
wouldn't really buy you anything in a situation where nothing was tagged
(which is what I think people were proposing).


Of course, I may be talking complete rubbish here - this isn't really my
field. Please feel free to tell me that I've completely misunderstood
everything.


-Rob

> -----Original Message-----
> From: owner-caml-list@pauillac.inria.fr [mailto:owner-caml-
> list@pauillac.inria.fr] On Behalf Of T. Kurt Bond
> Sent: 13 August 2004 15:33
> To: Andreas Rossberg
> Cc: caml-list@inria.fr
> Subject: Re: AW: [Caml-list] The tag bit
> 
> Andreas Rossberg writes:
> > AFAIK, a conservative collector is not allowed to move anything.
Hence
> > it is inherently incompatible with compacting and generational GC,
like
> > used in OCaml (and highly desirable).
> 
> Joel F. Bartlett's 1988 paper "Compacting garbage collection with
> ambiguous roots" describes a conservative "mostly copying" compacting
> GC scheme; his 1989 paper "Mostly-Copying Garbage Collection Picks Up
> Generations and C++" descibes a generation variation.  Frederick Smith
> and Greg Morrisett's 1997 paper "Mostly-Copying Collection: A Viable
> Alternative to Conservative Mark-Sweep" describes an improved variant
> that they compared with the BDW by using both with the TIL/C ML
> compiler.  Giuseppe Attardi, Tito Flagella, and Pietro Iglio describe
> a GC in their 1998 paper "A Customisable Memory Management Framework
> for C++" that uses mostly copying GC for the default heap.
> 
> --
> T. Kurt Bond, tkb@tkb.mpl.com
> 
> -------------------
> 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

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


^ permalink raw reply	[flat|nested] 11+ messages in thread
* AW: [Caml-list] The tag bit
@ 2004-08-12 15:22 Bauer, Christoph
  2004-08-13  3:53 ` Jacques Garrigue
  0 siblings, 1 reply; 11+ messages in thread
From: Bauer, Christoph @ 2004-08-12 15:22 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 902 bytes --]


>     Well, I can see several reasons :
>   * processors like powers of two, especially when it comes 
> to the size 
> of a memory address, because of cache issues, so you'd better 
> make it 32 
> or 64 words than 33 or 65.
>   * If the tag bit can be anywhere in a word you have to spend extra 
> time to extract it, whereas when it is at a fixed place, 
> especially LSB 
> or MSB, it is very cheap and easy.
>   * You would need two registers to access a value and its 
> tag instead 
> of one, and registers are very precious, at least on IA-32 
> architectures.

But who needs the tag bit? Only the garbage collector. Maybe it's
an advantage to see 32 tag bits as a whole, e.g. the question
"does the block contains any pointer" can be calculated bit-parallel.
Anyway the garbage collector could works on blocks and needs 
just one additional memory access per block.

Regards,
Christoph Bauer

[-- Attachment #2: Type: text/html, Size: 1807 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-08-13 16:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-13 13:43 AW: [Caml-list] The tag bit Ennals, Robert
  -- strict thread matches above, loose matches on Subject: below --
2004-08-13 14:58 Ennals, Robert
2004-08-12 15:22 Bauer, Christoph
2004-08-13  3:53 ` Jacques Garrigue
2004-08-13 12:58   ` Christophe Raffalli
2004-08-13 13:24     ` Andreas Rossberg
2004-08-13 14:32       ` T. Kurt Bond
2004-08-13 16:14         ` Ville-Pertti Keinonen
2004-08-13 14:28     ` skaller
2004-08-13 15:44       ` Christophe Raffalli
2004-08-13 15:40     ` Brian Hurt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).