This shows you the differences between two versions of the page.
Next revisionBoth sides next revision | |||
dev:crosscompiler:class_initialization [2014/11/03 13:31] – external edit 127.0.0.1 | dev:crosscompiler:class_initialization [2015/04/06 13:29] – [Initialize Classes] ursgraf | ||
---|---|---|---|
Line 32: | Line 32: | ||
} | } | ||
</ | </ | ||
- | Class A starts initializing, | + | Class A starts initializing, |
This error goes undetected. A user has to make sure that the initialization is done in a correct way. | This error goes undetected. A user has to make sure that the initialization is done in a correct way. | ||
==== Our Solution ==== | ==== Our Solution ==== | ||
- | Beim Linken sollen alle Top-Level Klassen als Parameter angegeben werden können. Diese Liste wird von links nach rechts geparst und die Imports | + | Before compilation all top-level classes (also called root classes) can be specified. This list will be parsed from left to right and the imports will be resolved |
- | In Java ist die Initialisierungsreihenfolge nicht klar definiert. Falls Test auf dem Host und dem Target stets das gleiche Resultat ergeben sollen, bietet sich folgende Lösung an: Im Klassenkonstruktor einer obersten Hauptklasse (die ansonsten vollständig leer ist) werden alle anderen Klassenkonstruktoren aufgerufen. Bei dieser Lösung entfällt auch die Notwendigkeit einer Systemtabelle. | + | It's important that the heap class and the kernel class are initialized first. For this they are put at the beginning of the list.\\ |
+ | Java does not define the order of initialization clearly. If tests on the host and the target should lead to the same result, the following solution would be appropriate: the class constructor of a otherwise empty helper class calls all the other class constructors. This solution would also allow to get rid of the system table. | ||
===== Initialisierung von Objekten ===== | ===== Initialisierung von Objekten ===== |