Object Layout

Revision as of 05:54, 9 January 2007 by Konradm (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page gives a short overview to the runtime object layout for Eiffel Systems compiled with Eiffel Studio.

Requirements

An object in memory needs to hold different informations. First of all the current values of its attributes and the dynamic type id of the object. Besides that, the garbage collection needs some additional information saved per object.

The object layout has to provide both fast access to the attributes and the garbage collector (gc) with a way to explore all the reference fields of an object. The latter is important during the marking phase of the gc.

The layout

The following picture shows the principal object layout chosen for EiffelStudio:

EiffelStudioObjectLayout.jpg

The picture shows, that a reference to an object points to the first attribute of the object. The object actually starts earlier. The part of the object that comes prior to the fields is called the overhead. The overhead contains the type id of the object and some additional information for the gc.

The picture furthermore shows that the attributes of a reference type come first. As a result of that, the garbage collector only needs to know how many references the object contains to traverse its suppliers.

An example