Heap format

In ETH Oberon systems there are three main types of heap blocks: RecBlk, ArrBlk and SysBlk. RecBlks are used for POINTER TO RECORD variables allocated with NEW. ArrBlks are used for POINTER TO ARRAY OF Type variables allocated with NEW, where type is a pointer type, or a record type containing pointers. SysBlks are used for blocks allocated with SYSTEM.NEW, or for POINTER TO ARRAY OF Type variable allocated with NEW, where Type does not contain any pointers. Special SysBlks are also used for the type descriptors and modules.

The mark phase of the garbage collector distinguishes heap blocks by the address alignment of the pointers pointing to them, and the tag word in front of them. RecBlk and ArrBlk pointer addresses are always directly divisible by 32 (adr MOD 32 = 0). SysBlk pointer addresses have a remainder of 8 when divided by 16 (adr MOD 16 = 8). A RecBlk has a tag word at adr-4, with bit 1 clear. An ArrBlk also has a tag word at adr-4, but with bit 1 set. Bit 0 is the mark bit, and is set by the mark phase when a block is reached. It is cleared by the Sweep phase. A SysBlk has an indirect tag at adr-4, which points to the real tag of the block. Type descriptors are special SysBlks.

The heap block format was originally documented in an unpublished diagram by Régis Crelier at the ETH. The diagram was redrawn by Thomas Burri and is available as gzipped PostScript.

26 Aug 2001 - Copyright © 2001 ETH Zürich. All rights reserved.
E-Mail: oberon-web at inf.ethz.ch
Homepage: http://www.ethoberon.ethz.ch/native/