Difference between revisions of "Object Layout"

m (The layout)
m (The layout)
Line 11: Line 11:
 
[[Image:EiffelStudioObjectLayout.jpg]]
 
[[Image: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 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 garbage collector.
  
 
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.  
 
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.  
 
Fields of primitive expanded types are hold at the end of the object. Their layout is not covered here.
 
Fields of primitive expanded types are hold at the end of the object. Their layout is not covered here.
 
  
 
====An example====
 
====An example====

Revision as of 05:16, 9 January 2007

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 garbage collector.

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. Fields of primitive expanded types are hold at the end of the object. Their layout is not covered here.

An example

EiffelStudioObjectLayoutExample.jpg

An example