Search code examples
garbage-collectionheap-memorycompiler-theoryobject-layout

Heap Object representation for OO language


As part of my masters thesis I am writing a compiler for an object oriented language that was developed at my home university. Currently the compiler outputs assembler that runs on a virtual machine. The virtual machine handles all things like stack operations, object generation, heap management and garbage collection.

Target architecture for my compiler is a MIPS-alike CPU.

I am searching for strategies to develop an object layout and ideas to implement and trigger garbage collection during runtime. I could of course analyze how GCC implements this with C++, but I'd prefer to be pointed to some good publications/ressources.


Solution

  • Read up on Python's internal object management. They use reference counting and dispose of objects when the reference count goes to zero.

    Here's an older (but still helpful) document: http://docs.python.org/release/2.5.2/ext/refcounts.html

    Here's general stuff: http://en.wikipedia.org/wiki/Reference_counting

    And some more: http://code.google.com/p/augustus/wiki/OptionalGarbageCollection