| Nächste ÜberarbeitungBeide Seiten der Revision |
software:deep:dev:crosscompiler:linker32 [2014-01-11 08:51] – Externe Bearbeitung 127.0.0.1 | software:deep:dev:crosscompiler:linker32 [2014-02-10 09:48] – graf |
---|
* Checksum | * Checksum |
[{{ .:constblock.png?450&direct | Structure of the constant pool for a class }}]\\ | [{{ .:constblock.png?450&direct | Structure of the constant pool for a class }}]\\ |
The //const pool// contains values of type //float// and //double// which are not placed directly into the code. After all elements are added the //constBlockSize// can be determined and the indices (''Item.index'') of all elements will be fixed. It's important to note that all elements, which are addresses (''AddressItem'', ''ConstantBlockItem'', ...), simply contain a reference to the according item. Only later after address fixing can the real addresses be inserted! | The //const pool// contains values of type //float// and //double// which are not placed directly into the code. After all elements are added the //constBlockSize// can be determined and the indices (''Item.index'') of all elements will be fixed. It's important to note that all elements, which are addresses (''AddressItem'', ''ConstantBlockItem'', ...), simply contain a reference to the according item. Only later, after address fixing, can the real addresses be inserted!\\ |
Diese Methode muss vom //Launcher// für jede Klasse aufgerufen werden.\\ | When the system ist starting up, the [[..:rts:start|Runtime System]] reads the start addresses of the constant block for all classes from the //System Table// (see below). With the predefined offset //cblkClinitAddrOffset// the address of the class constructor can be fetched in order to load a class. With another offset the heap manager can read the global references of this class. This information is used by the garbage collection. //codeBase// holds the start address of code of a class whereas //codeSize// is the size of the code. Methods, which are defined in the configuration as system methods and which are assigned a fixed offset are excluded from //codeSize// (Exception Handlers). |
Das //Laufzeitsystem// holt sich aus der //Systemtabelle// für alle Klassen die Startadresse des Konstantenblockes und kann dann daraus die Startadresse des Klassenkonstruktors (benötigt der Kernel für das Booten) oder auch die globalen Pointer dieser Klasse (benötigt der Heap für die Garbage Collection) holen. //codeBase// gibt die Startadresse der ersten Methode einer Klasse an, //codeSize// ist die Grösse aller Methoden einer Klasse summiert. Davon ausgenommen sind Systemmethoden, die in der Konfiguration definiert sind, und die einen dort fixierten Offset haben (Exception Handlers). | |
| |
Der Konstantenblock ist als Liste aufgebaut (Item). Die Basisklasse für die Listeneinträge ist ''ch.ntb.inf.dee.linker.ConstBlkEntry''. Je nach Art des Eintrages wird eine der folgenden Klassen verwendet: | In the compiler the constant block is modeled as linked list of ''ch.ntb.inf.deep.linker.ConstBlkEntry''. Depending on the type of entry one of the following classes is used. |
* **''AddressEntry''**: Für Einträge, die eine Adresse repräsentieren. | * **''AddressEntry''**: For entries representing an address. |
* **''ConstantEntry''**: Für Einträge, die eine Konstante repräsentieren (StdConstant). | * **''ConstantEntry''**: For entries representing a constant (StdConstant). |
* **''FixedValueEntry''**: Für Einträge, die einen festen Wert repräsentieren (z.B. eine Grössenangabe). | * **''FixedValueEntry''**: For entries representing a fixed value (e.g. a size). |
* **''InterfaceEntry''**: Für Einträge, die einen Interface-Eintrag repräsentieren (Interface-ID und Offset). | * **''InterfaceEntry''**: For entries representing an interface entry (id and offset). |
* **''StringEntry''**: Für Einträge, die einen konstanten String repräsentieren (StringLiteral). | * **''StringEntry''**: For entries representing a constant string (StringLiteral). |
* **''OffsetEntry''**: Für Einträge in die Tabelle allen Instanzpointern. | * **''OffsetEntry''**: For entries representing an offset to the table with all instance references. |
| |
=== Typedescriptor === | ==== Type Descriptor ==== |
Der Typdeskriptor wird benötigt um Instanzmethoden zu finden und um Typenprüfungen durchführen zu können. Der Aufbau und die Funktionsweise ist auf einer eigenen Seite beschrieben: [[Type Descriptor]]. | The structure and purpose of the [[Type Descriptor]] is described separately. |
| |
=== String pool === | ==== String pool ==== |
Der Stringpool beinhaltet die konstanten Strings einer Klasse. Dabei werden die Strings folgendermassen abgelegt (siehe auch unter [[strings|Strings]]: | The string pool holds the constant strings of a class. They are stored as follows (also see [[strings|Strings]]: |
[ tag ] | [ tag ] |
[ stringClassAddress ] | [ stringClassAddress ] |
[ chars ] | [ chars ] |
[ ⋮ ] | [ ⋮ ] |
Dabe werden die einzelnen Zeichen jeweils in 2-Byte-Unicode-Kodierung abgelegt. | The characters of the string are stored in 2-Byte-Unicode. |
| |
=== Constant pool === | ==== Constant Pool ==== |
Der Konstantenpool beinhaltet die Konstanten einer Klasse. Zur Zeit werden nur Gleitkomma-Zahlen (Float & Double) im Konstantenblock abgelegt. Ganzzahlen werden direkt in den Code integriert. Die Gleitkommazahlen werden wie in Java an IEEE 754 angelehnt abgelegt. Dabei wird bei einer 64bit Zahl das Highword an der niedrigeren Adresse abgelegt. | The constant pool holds the constants of a class. Currently we only store there floating point numbers (//float// and //double//). Integer numbers are packed into the instructions directly (even //long//). Floating point numbers are stored in IEEE 754 format, the high word of a 64 bit //double// is at the lower address (bid endian). |
| |
**Beispiel:** | **Example:** |
[40490FDB] 3.1415927 (float) | [40490FDB] 3.1415927 (float) |
[401921FB] 6.283185307179586 (double) | [401921FB] 6.283185307179586 (double) |