Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #934 > unrolled thread

Re: how to find gc roots in stack machine?

Started by"Nils M Holm" <nmh@t3x.org>
First post2013-07-01 17:33 +0200
Last post2013-07-04 11:57 -0400
Articles 2 — 2 participants

Back to article view | Back to comp.compilers


Contents

  Re: how to find gc roots in stack machine? "Nils M Holm" <nmh@t3x.org> - 2013-07-01 17:33 +0200
    Re: how to find gc roots in stack machine? George Neuner <gneuner2@comcast.net> - 2013-07-04 11:57 -0400

#934 — Re: how to find gc roots in stack machine?

From"Nils M Holm" <nmh@t3x.org>
Date2013-07-01 17:33 +0200
SubjectRe: how to find gc roots in stack machine?
Message-ID<13-07-003@comp.compilers>
n.oje.bar@gmail.com:
> I am writing a simple compiler for a simple stack machine. Now I want
> to add a garbage collector. To do this I need a way to be able to find
> all roots in the stack at any given time (or at least at some special
> points in time).

Basically any value on the stack is a potential root. The real problem
is to distinguish values that point to addresses in the address space
of the virtual machine from literal values (which do not point to any
address or to an address outside of the scope of the GC).

A common approach is to check whether a value on the stack is in the
(collectable part of the) address space of the VM. If so, treat it as
a root. This approach is simple and does not require any meta
information. The drawback is, of course, that it may mark objects that
are not longer used. This is called the "conservative" approach to GC.

The other variant, the "precise" approach, usually sacrifices one bit
of information per stack element. This bit is then used to indicate
whether or not that value points to an address.

The book "Garbage Collection" by Jones & Lins is still a valuable
resource on that topic.
--
Nils M Holm  < n m h @ t 3 x . o r g >  www.t3x.org

[toc] | [next] | [standalone]


#939

FromGeorge Neuner <gneuner2@comcast.net>
Date2013-07-04 11:57 -0400
Message-ID<13-07-008@comp.compilers>
In reply to#934
On Mon, 1 Jul 2013 17:33:33 +0200, "Nils M Holm" <nmh@t3x.org> wrote:

>The book "Garbage Collection" by Jones & Lins is still a valuable
>resource on that topic.

Richard Jones has two GC books now.

The first, with Rafael Lins is an excellent source for learning GC
theory and the basic algorithms.
http://net.gurus.org/bk/a/0471941484

The second book with Antony Hosking and Eliot Moss is a compendium of
GC state of art.  It is focused on modern concurrent and parallel
implementation and is relatively light on theory.
http://net.gurus.org/bk/a/1420082795

George

[toc] | [prev] | [standalone]


Back to top | Article view | comp.compilers


csiph-web