2
// Select C numeric constant
6
// Section has executable code
7
.section .text, "ax","progbits"
8
// procedure named 'SharedStub'
13
.global PrepareAndDispatch
14
// .exclass PrepareAndDispatch, @fullyvisible
15
.type PrepareAndDispatch,@function
18
// 9 arguments, first 8 are the input arguments of previous
19
// function call. The last one is methodIndex, and is passed in memory
22
// allocate 8 input args, 4 local args, and 5 output args
23
alloc r41 = ar.pfs, 8, 4, 5, 0 // M
29
mov r42 = ar.unat // M
31
add sp = -144, sp // A
32
// unwind table already knows gp, don't need to specify anything
33
add r43 = 0, gp ;; // A
35
// We have possible 8 integer registers and 8 float registers that could
36
// be arguments. We also have a stack region from the previous
37
// stack frame that may hold some stack arguments.
38
// We need to write the integer registers to a memory region, write
39
// the float registers to a memory region (making sure we don't step
40
// on NAT while touching the registers). We also mark the memory
41
// address of the stack arguments.
42
// We then call PrepareAndDispatch() specifying the three memory
47
add out0 = 0, in0 // A move self ptr
48
// 144 bytes = 16 byte stack header + 64 byte int space + 64 byte float space
49
// current frame is 144 bytes, previous frame is 112 bytes
50
// restarg is at 144 + 112 + 16 bytes away from current sp
51
// (current frame + previous frame + previous previous frame header)
52
// methodIndex is at 144 + 16 bytes away from current sp
53
// (current frame + previous frame header)
54
add out4 = 192, sp // A restarg address
55
add r11 = 160, sp ;; // A address of methodIndex
57
ld8 out1 = [r11] // M load methodIndex
58
// sp + 16 is the start of intargs
59
add out2 = 16, sp // A address of intargs
60
// the intargs take up 64 bytes, so sp + 16 + 64 is the start of floatargs
61
add out3 = 80, sp ;; // A address of floatargs
63
add r11 = 0, out2 ;; // A
64
st8.spill [r11] = in1, 8 // M
65
add r10 = 0, out3 ;; // A
67
st8.spill [r11] = in2, 8 ;; // M
68
st8.spill [r11] = in3, 8 // M
71
st8.spill [r11] = in4, 8 ;; // M
72
st8.spill [r11] = in5, 8 // M
75
st8.spill [r11] = in6, 8 ;; // M
76
st8.spill [r11] = in7 // M
77
fclass.nm p14,p15 = f8,@nat ;; // F
79
(p14) stfd [r10] = f8, 8 // M
80
(p15) add r10 = 8, r10 // A
81
fclass.nm p12,p13 = f9,@nat ;; // F
83
(p12) stfd [r10] = f9, 8 // M
84
(p13) add r10 = 8, r10 // A
85
fclass.nm p14,p15 =f10,@nat ;; // F
87
(p14) stfd [r10] = f10, 8 // M
88
(p15) add r10 = 8, r10 // A
89
fclass.nm p12,p13 =f11,@nat ;; // F
91
(p12) stfd [r10] = f11, 8 // M
92
(p13) add r10 = 8, r10 // A
93
fclass.nm p14,p15 =f12,@nat ;; // F
95
(p14) stfd [r10] = f12, 8 // M
96
(p15) add r10 = 8, r10 // A
97
fclass.nm p12,p13 =f13,@nat ;; // F
99
(p12) stfd [r10] = f13, 8 // M
100
(p13) add r10 = 8, r10 // A
101
fclass.nm p14,p15 =f14,@nat ;; // F
103
(p14) stfd [r10] = f14, 8 // M
104
(p15) add r10 = 8, r10 // A
105
fclass.nm p12,p13 =f15,@nat ;; // F
107
(p12) stfd [r10] = f15, 8 // M
108
(p13) add r10 = 8, r10 // A
110
// branch to PrepareAndDispatch
111
br.call.dptk.few rp = PrepareAndDispatch ;; // B
114
mov ar.unat = r42 // M
115
mov ar.pfs = r41 // I
119
add sp = 144, sp // A
120
br.ret.dptk.few rp ;; // B