Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Nächste Überarbeitung
Vorhergehende Überarbeitung
Nächste ÜberarbeitungBeide Seiten der Revision
software:deep:dev:crosscompiler:linker32 [2014-01-11 08:51] – Externe Bearbeitung 127.0.0.1software:deep:dev:crosscompiler:linker32 [2014-02-10 10:35] graf
Zeile 21: Zeile 21:
   * 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 laterafter address fixingcan 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 codeMethodswhich 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 summiertDavon ausgenommen sind Systemmethodendie 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.Beine Grössenangabe). +  * **''FixedValueEntry''**: For entries representing a fixed value (e.ga 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 KlasseDabei werden die Strings folgendermassen abgelegt (siehe auch unter [[strings|Strings]]:+The string pool holds the constant strings of a classThey are stored as follows (also see [[strings|Strings]]:
   [ tag                ]   [ tag                ]
   [ stringClassAddress ]   [ stringClassAddress ]
Zeile 44: Zeile 43:
   [ 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 KlasseZur Zeit werden nur Gleitkomma-Zahlen (Float & Doubleim Konstantenblock abgelegtGanzzahlen werden direkt in den Code integriertDie 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 classCurrently 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)
Zeile 55: Zeile 54:
  
  
-===== Grösse und Offsets berechnen ===== +===== Calculate Size and Offsets ===== 
-[{{  .:linker_code_methods.png?300px&direct|MaschinencodeGrösse und Offsets}}] +[{{  .:linker_code_methods.png?350px&direct|Machine CodeSize and Offsets}}] 
-Bevor die Memory Map fixiert werden kannmüssen noch ein paar Grössen und Offsets pro Standard-Klasse berechnet werden+Before the memory map can be fixeda couple sizes and offsets must be calculated for each class
-  * ''void calculateCodeSizeAndOffsets(Class)'': Diese Methode berechnet die Grösse des Maschinencodes für die gesamte Klasse und setzt das Feld ''offset'' jeder Methode dieser KlasseDieses beschreibt den Byte-Offset des Maschinencodes einer Methode im Speicher ausgehend von der Startaddresse des Codes der KlasseWenn der Offset einer Methode direkt von der Konfiguration vorgegeben ist (für Exception-Handler-Codewird diese Methode nicht in die Berechnung der Codegrösse miteinbezogenDer durch die Konfiguration vorgegebene Offset bezieht sich nicht auf die Basis einer Klasse, sondern auf die Basis des zugehörigen Segmentes+  * ''void calculateCodeSizeAndOffsets(Class)'': This methods determines the size of the machine code of the whole class and sets the field //offset// of each method of this class//offset// is the byte offset of the machine code of a method in the memory starting from the start address of the code of this classIf a method offset is given by the configuration (e.g. exception handlers), then this method is not included in the culculation of the code sizeThe offset given by the configuration is not relative to the base of a class but to the base of the appropriate segment
-  * ''void calculateGlobalConstantTableSize()'': Berechnet die Grösse der globalen Konstanten-Tabelle.+  * ''void calculateGlobalConstantTableSize()'': This method calculates the size of the global constant table.
  
-===== Systemtabelle erstellen ===== +===== Create System Table ===== 
-Der Linker stellt für das gesamte System eine Systemtabelle zusammenDiese muss an eine fixe Adresse geladen werden und enthält wichtige Informationen für das LaufzeitsystemGrundsätzlich muss dabei zwischen drei Fällen unterschieden werden+The linker assembles a system table for the whole system. This table must be loaded to a prefixed address in the target system and holds information for the [[..:rts:start|Runtime System]]. Various settings must be handled
-  - Das gesamte System befindet sich im Flash. +  - The system runs from the flash 
-  - Das gesamte System befindet sich im Ram+  - The system runs from the RAM
-  - Das Basissystem befinden sich im FlashWeitere Klassen werden nachträglich ins Ram geladenFür diesen Fall werden zwei Systemtabellen benötigtIm Flash befindet sich eine Systemtabelle, welche nur die Klassen im Flash abdecktIm RAM hingegen befindet sich eine Systemtabelle, die sowohl die Klassen im RAM als auch die im Flash abdeckt-> IMPORTANT Dies ist zur Zeit noch nicht implementiert IMPORTANT +  - The base system is in the flashFurther classes are later loaded into the RAMThis case needs two system tablesThe flash holds a system table which contains only classes which are present in the flashThe system table in the RAM must hold all classes. IMPORTANT This feature is not implemented yet IMPORTANT
-\\ +
-Die Methode ''void createSystemtable()'' erstellt die Systemtabelle. Diese ist als doppelt verkettete Liste realisiert und verwendet die selben von ''BlockEntry'' abgeleiteten Listenelemente wie die Konstantenblöcke der Klassen, zusätzlich noch die Klasse ''SysTabEntry''. Diese referenziert den Konstantenblock einer Klasse.+
  
-Die Systemtabelle hat den folgenden Aufbau+In the compiler the system table is modeled as list. as elements it uses the same blocks as for the constant block. Additionally ''SysTabEntry'' is used to reference the constant block of a class. 
-[{{ .:systemtable.png?450&direct |//Aufbau der Systemtabelle// }}]+ 
 +The structure of the system table is
 +[{{ .:systemtable.png?450&direct |//Structure of the system table// }}]
  
 Bevor die Systemtabelle zusammengestellt werden kann, muss der Klassenkonstruktor der Kernel-Klasse gefunden werden. Dazu wird der Klassennamen aus der Konfiguration geladen und anschliessend die Methode ''<clinit>'' gesucht. Bevor die Systemtabelle zusammengestellt werden kann, muss der Klassenkonstruktor der Kernel-Klasse gefunden werden. Dazu wird der Klassennamen aus der Konfiguration geladen und anschliessend die Methode ''<clinit>'' gesucht.