2
.globl invoke_count_words
3
.globl invoke_copy_to_stack
28
#define FRAMESZ ((NARG+LOCALSZ)*SZREG)
29
RAOFF=FRAMESZ-(1*SZREG)
30
A0OFF=FRAMESZ-(2*SZREG)
31
A1OFF=FRAMESZ-(3*SZREG)
32
A2OFF=FRAMESZ-(4*SZREG)
33
A3OFF=FRAMESZ-(5*SZREG)
34
S0OFF=FRAMESZ-(6*SZREG)
35
GPOFF=FRAMESZ-(7*SZREG)
39
// XPTC__InvokebyIndex( that, methodIndex, paramCount, params)
44
.globl XPTC__InvokebyIndex
45
.ent XPTC__InvokebyIndex,0
47
.frame sp, FRAMESZ, ra
48
subl sp,FRAMESZ,sp // allocate stack space for structure
55
// stq gp, GPOFF(sp) Don't think I am to save gp
57
// invoke_count_words(paramCount, params)
58
bis a2,zero,a0 // move a2 into a0
59
bis a3,zero,a1 // move a3 into a1
60
bsr ra,invoke_count_words
62
// invoke_copy_to_stack
63
ldq a1, A2OFF(sp) // a1 = paramCount
64
ldq a2, A3OFF(sp) // a2 = params
66
// save sp before we copy the params to the stack
67
bis sp,zero,t0 // t0 = sp
69
// assume full size of 8 bytes per param to be safe
70
sll v0,4,v0 //v0 = 8 bytes * num params
71
subl sp,v0,sp //sp = sp - v0
72
bis sp,zero,a0 //a0 = param stack address
74
// create temporary stack space to write int and fp regs
75
subl sp,64,sp //sp = sp -64 // (64 = 8 regs of eight bytes)
76
bis sp,zero,a3 // a3 = sp
78
// save the old sp and save the arg stack
79
subl sp,16,sp //sp = sp -16
82
// copy the param into the stack areas
83
bsr ra,invoke_copy_to_stack
85
ldq t3,8(sp) // get previous a0
86
ldq sp,0(sp) // get orig sp back
88
ldq a0,A0OFF(sp) // a0 = that
89
ldq a1,A1OFF(sp) // a1 = methodIndex
91
// calculate jmp address from method index
92
ldl t1,0(a0) // t1 = *that
93
sll a1,2,a1 // a1 = 4*index
95
ldl t9,0(t9) // t9=*(that + 4*index)
97
// get register save area from invoke_copy_to_stack
100
// a1..a5 and f17..f21 should now be set to what
101
// invoke_copy_to_stack told us. skip a0 and f16
102
// because that's the "this" pointer
116
// save away our stack point and create
117
// the stack pointer for the function
127
.end XPTC__InvokebyIndex