This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dev:crosscompiler:backend_ppc:code_generator [2016/05/10 08:25] – [Stackframe] ursgraf | dev:crosscompiler:backend_ppc:code_generator [2022/12/20 15:52] (current) – [Accessing the Hardware] ursgraf | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Code Generator ====== | + | ====== Code Generator |
All results of all SSA instructions have an assigned register. Now, each SSA instruction can be translated into one or a sequence of machine instructions. In order to do this, we must define the stackframe, which is used when calling a method. | All results of all SSA instructions have an assigned register. Now, each SSA instruction can be translated into one or a sequence of machine instructions. In order to do this, we must define the stackframe, which is used when calling a method. | ||
===== Stackframe ===== | ===== Stackframe ===== | ||
We use a stack pointer (R1) but no frame pointer. | We use a stack pointer (R1) but no frame pointer. | ||
- | [{{ .:stackframe.png? | + | [{{ .:stackframeppc.png? |
Explanation: | Explanation: | ||
Line 36: | Line 36: | ||
===== Accessing the Hardware ===== | ===== Accessing the Hardware ===== | ||
- | Java does not allow direct access and manipulation of absolute memory locations. Nevertheless this is essential for embedded programming. We therefore include this possibility by the use a special | + | Java does not allow direct access and manipulation of absolute memory locations. Nevertheless this is essential for embedded programming. We therefore include this possibility by using a special class //org.deepjava.unsafe.ppc.US.java// (US stand for unsafe). Wenn methods of this class are used the code generator has to insert machine code directly. |
===== Low Level Classes ===== | ===== Low Level Classes ===== | ||
Line 48: | Line 48: | ||
* Delegation of interface methods: address of this method inserted into the type descriptor by the linker | * Delegation of interface methods: address of this method inserted into the type descriptor by the linker | ||
* Exception handling: call to this methods inserted by the code generator | * Exception handling: call to this methods inserted by the code generator | ||
+ | |||
+ | ==== Practical Implementation of Searching the Correct Interface Method ==== | ||
+ | // | ||
+ | R10 holds the necessary information for the delegate method. The first two bytes are the ID of the sought-after interface, tho last to bytes contain the method offset. Loading of R10 should happen after parameter copying as R10 might be used there. | ||
+ | |||
+ |