This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
dev:crosscompiler:interfaces [2014/01/11 08:31] – external edit 127.0.0.1 | dev:crosscompiler:interfaces [2019/07/11 19:34] (current) – [Methods] ursgraf | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Interfaces ====== | ====== Interfaces ====== | ||
- | Interfaces generally don't have to be translated. All fields are constant and the methods are abstract. Interfaces don't need a type descriptor with a single exception as mentioned in [[.: | + | Interfaces generally don't have to be translated. All fields are constant and the methods are abstract. Interfaces don't need a type descriptor with a single exception as mentioned in [[.: |
===== Class Constructors ===== | ===== Class Constructors ===== | ||
Line 17: | Line 17: | ||
</ | </ | ||
- | Such an interface must be inserted into the list // | + | Such an interface must be inserted into the list // |
===== Methods ===== | ===== Methods ===== | ||
Line 72: | Line 72: | ||
=== Case 2 === | === Case 2 === | ||
- | A class implements one interface with several methods or several interfaces -> in the type descriptor we place the address of a // | + | If a class implements one interface with several methods or several interfaces -> in the type descriptor we place the address of a // |
- | Important: For jumping into the interface method the LR cannot be used anymore, because the LR contains the address of the caller and the LR was not saved so far. This happens only at the start of the interface method. | + | The // |
- | + | Important: For jumping into the interface method the LR cannot be used anymore, because the LR contains the address of the caller and the LR was not saved so far. This happens only at the start of the interface method. | |
- | ==== Practical Implementation ==== | + | |
- | Case 2 needs 3 auxiliary registers. At compile time we cannot reserve such auxiliary registers as these registers must always be the same. Therefore, we use parameter registers. They are volatile and can be freely used though this means, that interface methods can pass less parameters, which is generally true. If true the compiler will report.\\ | + | |
- | R0 holds the necessary information | + | |
==== Special Case ==== | ==== Special Case ==== | ||
- | What happens if two independent interfaces each give a method with identical signature and class A implements both? A will have the address of method once in its method table and will have the method | + | What happens if two independent interfaces each give a method with identical signature and class A implements both? A will have the address of the method once in its method table and will have the method listed in both interface blocks. |