Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
software:deep:dev:crosscompiler:objects [2014-05-26 15:47] grafsoftware:deep:dev:crosscompiler:objects [Unbekanntes Datum] (aktuell) – gelöscht - Externe Bearbeitung (Unbekanntes Datum) 127.0.0.1
Zeile 1: Zeile 1:
-====== Objects ====== 
-Objects on the heap need a reference to their type descriptor (//Tag//) and information for the garbage collection. 
-[{{ .:object1.png?250&direct | //Implementation of an object//}}] 
-The field //size// allows for a faster sweep phase during garbage collection. //size// includes the size of the object plus heap field and //Tag//.\\  
-If the object is an array the field //size// contains the length of the array (see [[.:arrays|Arrays]]).  
- 
-===== Allocation of objects ===== 
-When a new object is created there is a call to the method //newObject// of the class //Heap//. After this follows the call of the constructor of the super class. For the class //java/lang/Object// this call is missing in the Bytecode.\\ 
-If an array is to be created things run differently. Each array is an extension of //java/lang/Object//. In the Bytecode the call to this constructor is missing. If //java/lang/Object// has fields which need to be initialized this would have to be done when allocating the array in the heap. 
- 
-==== Bytecode Instructions and Parameter Passing ==== 
-There are 4 different Bytecode instructions to create objects on the heap. The following table shows this instructions together with register usage. This usage is platform specific and must be fixed between the code generator and the //Heap// class of the runtime system. 
- 
-^Bytecode^Use^Heap Method^Parameter^Register^Return Value^Register^ 
-|new|Object|newObject|Reference to type descriptor|R2|Reference to Object|R2| 
-|newarray|Array of base type|newPrimTypeArray|Nof|R2|Reference to array|R2| 
-| | | |Java array type|R3| | | 
-| | | |Reference to type descriptor|R4| | | 
-|anewarray|Array of objects|newRefArray|Nof|R2|Reference to array|R2| 
-| | | |Reference to type descriptor|R3| | | 
-|multianewarray|Multidimensional array|newMultiDimArray|Type or reference to Type|R2|Reference to array|R2| 
-| | | |Nof dimensions|R3| | | 
-| | | |Dimension 1|R4| | | 
-| | | |Dimension 2|R5| | | 
-| | | |etc.| | | | 
-| |String|newstring|Reference to type|R2|Reference to object|R2| 
-| | | |Length|R3| | | 
- 
-The class //Heap// is a system class. Its methods will be linked to the appropriate Bytecode instructions as indicated above.\\ 
-The instruction //newstring// is used to create strings, see [[strings|Strings]].