5 I setup an IRC channel on the Freenode network, for those that use IRC
6 it should be easier to get support.
10 Getting closer on the method call:
12 .0: afa4fffc sw a0,-4(sp)
13 .4: afa5fff8 sw a1,-8(sp)
14 .8: afa6fff4 sw a2,-12(sp)
15 .c: afbdffec sw sp,-20(sp)
16 10: 27bdffec addiu sp,sp,-20
17 14: 8f810034 lw at,52(gp)
19 Since method calls are more often perform, it would be most efficient to
20 have the stack pointer restoration on the callee since there are usually
25 Actually that is for the frame pointer.
29 But that is not truly needed.
33 Actually, I write above the stack and not below it. Although it really
34 does not matter unless I correctly restore it.
38 So do I preforward the stack and potentially waste it, or use the
39 frame pointer? The frame pointer should simplify things. But it still is not
44 Well for PowerPC, the stack is increased to its needed size and the old size
45 is stored just before the end.
49 So I suppose use it, since it would simplify things a bit.
53 The simplest but most wasteful route would be to preallocate all of the slots
54 that are used and make it only use a stack register. However the preallocation
55 would waste much space on 64-bit systems because object can be 64-bits. This
56 would mean that long/double would cost 16 bytes to store a single value. So
57 that would definitely be wasteful. I just need the calls to be natively
62 So essentially the stack pointer is accessed using the base and is incremented
67 So at the start of a method:
69 1. Store the frame pointer.
70 2. Copy the frame pointer value to the stack value.
74 1. Restore the old stack pointer.
78 1. Store the frame pointer
82 1. Restore the frame pointer
86 So actually this will be quite complex to determine and to support multiple
87 targets using the same logic. So I will essentially need a `NativeStackFrame`
88 class along with a builder that can be set in the ABI. This class would
89 contain the information needed for method calls, where arguments are placed
90 and if frame pointers and such are used.
94 So yes, I will need a class which knows how to handle how stack frames are
95 to be done for a given ABI. Then with this, I should be able to call native
96 libraries without requiring that I setup a specific state before a call.
100 So I will definitely need a class to show the layout, since some architectures
101 may require reserved space and such (such as PowerPC).