This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
dev:crosscompiler:type_descriptor [2014/02/08 12:01] – external edit 127.0.0.1 | dev:crosscompiler:type_descriptor [2019/07/11 19:11] – [Structure] ursgraf | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Type Descriptor ====== | ====== Type Descriptor ====== | ||
- | Each class needs a type descriptor in the constant block of this class (see [[Linker32]]). This type descriptor will be needed to find instance methods or to do type checking. All arrays - even arrays with elements being of an interface type - need a type descriptor. Interfaces themselves need no type descriptor because there cannot be instances of interfaces. \\ | + | Each class needs a type descriptor in the constant block of this class (see [[dev: |
However, there is one exeption to this. If an object, which is of type "array of interface type", is checked with instructions like // | However, there is one exeption to this. If an object, which is of type "array of interface type", is checked with instructions like // | ||
Line 6: | Line 6: | ||
[{{ .: | [{{ .: | ||
- | The fields //size// indicates the size (in Bytes) of an object of this type (without tag, see [[.: | + | The fields //size// indicates the size (in bytes) of an object of this type (without tag, see [[.: |
- | The entry // | + | The entry // |
- | The garbage collector has to know which instance fields are references. For this there is a field // | + | The garbage collector has to know which instance fields are references. For this there is a field // |
- | Type descriptors for arrays are solely used for type checking. They contain the references to all type descritors of the lower dimensional arrays of the same base type. If necessary, these lower dimensional types must be created by the class file reader. The field // | + | Type descriptors for arrays are solely used for type checking. They contain the references to all type descritors of the lower dimensional arrays of the same base type. If necessary, these lower dimensional types must be created by the class file reader. The field // |
The reduced type descriptor for interfaces comprises the fields from //size// to // | The reduced type descriptor for interfaces comprises the fields from //size// to // | ||
Line 30: | Line 30: | ||
[{{ .: | [{{ .: | ||
Please note: | Please note: | ||
- | * Class //CXexA// implements just one interface with a single method. At the place of the interface delegation method the address of this method can be put directly, see [[software: | + | * Class //CXexA// implements just one interface with a single method. At the place of the interface delegation method the address of this method can be put directly, see [[.: |
* The class file reader numbers all interfaces with methods, which are called by the instruction // | * The class file reader numbers all interfaces with methods, which are called by the instruction // | ||
* For efficient searching, the interfaces with id != -1 are listed for each class sorted with //id//. The last interface in the list must be id = 0. This ensures a simple termination of the search. | * For efficient searching, the interfaces with id != -1 are listed for each class sorted with //id//. The last interface in the list must be id = 0. This ensures a simple termination of the search. |