ab55c89e26517a7d1cd10bd7d20e8db07e56a7ae
[cacao.git] / src / vm / jit / powerpc / asmpart.S
1 /* src/vm/jit/powerpc/asmpart.S - Java-C interface functions for PowerPC
2                 
3    Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
4    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6    J. Wenninger, Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software.text;  you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation;  either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY ;  without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program;  if not, write to the Free Software
22    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23    02110-1301, USA.
24
25    $Id: asmpart.S 7989 2007-05-30 21:04:42Z twisti $
26
27 */
28
29
30 #include "config.h"
31
32 #include "md-abi.h"
33 #include "md-asm.h"
34
35 #include "vm/jit/abi-asm.h"
36 #include "vm/jit/methodheader.h"
37 #include "vm/jit/powerpc/offsets.h"
38
39
40         .text
41
42         .align 2
43
44
45 /* export functions ***********************************************************/
46
47         .globl asm_vm_call_method
48         .globl asm_vm_call_method_int
49         .globl asm_vm_call_method_long
50         .globl asm_vm_call_method_float
51         .globl asm_vm_call_method_double
52
53         .globl asm_vm_call_method_exception_handler
54         .globl asm_vm_call_method_end
55
56         .globl asm_call_jit_compiler
57
58         .globl asm_handle_nat_exception
59         .globl asm_handle_exception
60
61         .globl asm_abstractmethoderror
62
63         .globl asm_patcher_wrapper
64
65 #if defined(ENABLE_REPLACEMENT)
66         .globl asm_replacement_out
67         .globl asm_replacement_in
68 #endif
69
70         .globl asm_cacheflush
71
72         .globl asm_compare_and_swap
73         .globl asm_memory_barrier
74
75         .globl asm_criticalsections
76         .globl asm_getclassvalues_atomic
77
78
79 /* asm_vm_call_method **********************************************************
80 *                                                                              *
81 *   This function calls a Java-method (which possibly needs compilation)       *
82 *   with up to 4 address parameters.                                           *
83 *                                                                              *
84 *   This functions calls the JIT-compiler which eventually translates the      *
85 *   method into machine code.                                                  *
86 *                                                                              *
87 *   C-prototype:                                                               *
88 *    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
89 *         void *arg1, void *arg2, void *arg3, void *arg4);                     *
90 *                                                                              *
91 *******************************************************************************/
92
93         .align 2
94
95         .long   0                         /* catch type all                       */
96         .long   0                         /* exception handler pc                 */
97         .long   0                         /* end pc                               */
98         .long   0                         /* start pc                             */
99         .long   1                         /* extable size                         */
100         .long   0                         /* line number table start              */
101         .long   0                         /* line number table size               */
102         .long   0                         /* fltsave                              */
103         .long   0                         /* intsave                              */
104         .long   0                         /* IsLeaf                               */
105         .long   0                         /* IsSync                               */
106         .long   0                         /* frame size                           */
107         .long   0                         /* codeinfo pointer                     */
108
109 asm_vm_call_method:
110 asm_vm_call_method_int:
111 asm_vm_call_method_long:
112 asm_vm_call_method_float:
113 asm_vm_call_method_double:
114         mflr    r0
115         stw     r0,LA_LR_OFFSET(sp)
116         stwu    sp,-40*4(sp)              /* keep stack 16-byte aligned           */
117
118         stw     s0,8*4(sp)                /* save used callee saved registers     */
119         stw     a0,9*4(sp)                /* save method pointer for compiler     */
120
121 #if defined(__DARWIN__)
122         stw     itmp1,10*4(sp)            /* register r11 is callee saved         */
123 #endif
124         stw     pv,11*4(sp)               /* save PV register                     */
125
126         stw     itmp3,12*4(sp)            /* registers r14-r31 are callee saved   */
127         stfd    ftmp1,14*4(sp)            /* registers f14-f31 are callee saved   */
128         stfd    ftmp2,16*4(sp)
129
130 #if defined(__DARWIN__)
131         stw     t1,18*4(sp)
132         stw     t2,19*4(sp)
133         stw     t3,20*4(sp)
134         stw     t4,21*4(sp)
135         stw     t5,22*4(sp)
136         stw     t6,23*4(sp)
137         stw     t7,24*4(sp)
138
139         stfd    ft0,26*4(sp)
140         stfd    ft1,28*4(sp)
141         stfd    ft2,30*4(sp)
142         stfd    ft3,32*4(sp)
143         stfd    ft4,34*4(sp)
144         stfd    ft5,36*4(sp)
145 #else
146         SAVE_TEMPORARY_REGISTERS(18)      /* the offset has to be even            */
147 #endif
148
149         mr      itmp2,a1                  /* arg count                            */
150         mr      itmp1,a2                  /* pointer to arg block                 */
151
152         mr      t4,itmp2                  /* save argument count                  */
153         mr      t5,itmp1                  /* save argument block pointer          */
154
155         mr      s0,sp                     /* save current sp to s0                */
156
157         addi    itmp1,itmp1,-sizevmarg    /* initialize pointer (smaller code)    */
158         addi    itmp2,itmp2,1             /* initialize argument count            */
159         li      t0,0                      /* initialize integer argument counter  */
160         li      t1,0                      /* initialize float argument counter    */
161         li      t6,0                      /* initialize integer register counter  */
162 #if defined(__DARWIN__)
163         li      t7,0                      /* initialize stack slot counter        */
164 #endif
165
166         mflr    r0                        /* save link register (PIC code)        */
167         bl      L_asm_vm_call_method_get_pc
168 L_asm_vm_call_method_get_pc:
169         mflr    t3                        /* t3 contains the current pc           */
170         mtlr    r0
171
172 L_register_copy:
173         addi    itmp1,itmp1,sizevmarg     /* goto next argument block             */
174         addi    itmp2,itmp2,-1            /* argument count - 1                   */
175         mr.     itmp2,itmp2
176         beq     L_register_copy_done
177
178         lwz     itmp3,offvmargtype+4(itmp1)
179         andi.   r0,itmp3,0x0002           /* is this a float/double type?         */
180         bne     L_register_handle_float
181         
182 L_register_handle_int:
183         cmpwi   t6,INT_ARG_CNT            /* are we out of integer argument       */
184         beq     L_register_copy           /* registers? yes, next loop            */
185
186         andi.   r0,itmp3,0x0001           /* is this a 2-word type?               */
187         bne     L_register_handle_long
188
189 #if defined(__DARWIN__)
190         addis   itmp3,t3,ha16(L_jumptable_int - L_asm_vm_call_method_get_pc)
191         la      itmp3,lo16(L_jumptable_int - L_asm_vm_call_method_get_pc)(itmp3)
192 #else
193         lis     itmp3,L_jumptable_int@ha
194         addi    itmp3,itmp3,L_jumptable_int@l
195 #endif
196
197         slwi    t2,t6,2                   /* multiple of 4-bytes                  */
198         add     itmp3,itmp3,t2            /* calculate address of jumptable       */
199         lwz     itmp3,0(itmp3)            /* load function address                */
200         mtctr   itmp3
201         addi    t0,t0,1                   /* integer argument counter             */
202         addi    t6,t6,1                   /* integer argument register counter    */
203 #if defined(__DARWIN__)
204         addi    t7,t7,1                   /* stack slot counter                   */
205 #endif
206         bctr
207
208 L_register_handle_long:
209 #if defined(__DARWIN__)
210         addis   itmp3,t3,ha16(L_jumptable_long - L_asm_vm_call_method_get_pc)
211         la      itmp3,lo16(L_jumptable_long - L_asm_vm_call_method_get_pc)(itmp3)
212 #else
213         lis     itmp3,L_jumptable_long@ha
214         addi    itmp3,itmp3,L_jumptable_long@l
215 #endif
216 #if !defined(__DARWIN__)
217         addi    t6,t6,1                   /* align to even numbers                */
218         andi.   t6,t6,0xfffe
219 #endif
220
221         cmpwi   t6,(INT_ARG_CNT - 1)      /* are we out of integer argument       */
222         blt     L_register_handle_long_continue /* registers?                     */
223
224         li      t6,INT_ARG_CNT            /* yes, set integer argument register   */
225         b       L_register_copy           /* count to max and next loop           */
226
227 L_register_handle_long_continue:
228         slwi    t2,t6,2                   /* multiple of 4-bytes                  */
229         add     itmp3,itmp3,t2            /* calculate address of jumptable       */
230         lwz     itmp3,0(itmp3)            /* load function address                */
231         mtctr   itmp3
232         addi    t0,t0,1                   /* integer argument counter             */
233         addi    t6,t6,2                   /* integer argument register counter    */
234 #if defined(__DARWIN__)
235         addi    t7,t7,2                   /* stack slot counter                   */
236 #endif
237         bctr
238
239 L_register_handle_float:
240         cmpwi   t1,FLT_ARG_CNT            /* are we out of float argument         */
241         beq     L_register_copy           /* registers? yes, next loop            */
242
243         andi.   r0,itmp3,0x0001           /* is this a 2-word type?               */
244         bne     L_register_handle_double
245
246 #if defined(__DARWIN__)
247         addis   itmp3,t3,ha16(L_jumptable_float - L_asm_vm_call_method_get_pc)
248         la      itmp3,lo16(L_jumptable_float - L_asm_vm_call_method_get_pc)(itmp3)
249 #else
250         lis     itmp3,L_jumptable_float@ha
251         addi    itmp3,itmp3,L_jumptable_float@l
252 #endif
253
254         slwi    t2,t1,2                   /* multiple of 4-bytes                  */
255         add     itmp3,itmp3,t2            /* calculate address of jumptable       */
256         lwz     itmp3,0(itmp3)            /* load function address                */
257         mtctr   itmp3
258         addi    t1,t1,1                   /* float argument counter               */
259 #if defined(__DARWIN__)
260         addi    t7,t7,1                   /* stack slot counter                   */
261         addi    t6,t6,1                   /* skip 1 integer argument register     */
262 #endif
263         bctr
264
265 L_register_handle_double:
266 #if defined(__DARWIN__)
267         addis   itmp3,t3,ha16(L_jumptable_double - L_asm_vm_call_method_get_pc)
268         la      itmp3,lo16(L_jumptable_double - L_asm_vm_call_method_get_pc)(itmp3)
269 #else
270         lis     itmp3,L_jumptable_double@ha
271         addi    itmp3,itmp3,L_jumptable_double@l
272 #endif
273
274         slwi    t2,t1,2                   /* multiple of 4-bytes                  */
275         add     itmp3,itmp3,t2            /* calculate address of jumptable       */
276         lwz     itmp3,0(itmp3)            /* load function address                */
277         mtctr   itmp3
278         addi    t1,t1,1                   /* float argument counter               */
279 #if defined(__DARWIN__)
280         addi    t7,t7,2                   /* stack slot counter                   */
281         addi    t6,t6,2                   /* skip 2 integer argument registers    */
282 #endif
283         bctr
284
285 L_register_copy_done:
286                                           /* calculate remaining arguments        */
287         sub     itmp3,t4,t0               /* - integer arguments in registers     */
288         sub     itmp3,itmp3,t1            /* - float arguments in registers       */
289         mr.     itmp3,itmp3
290         beq     L_stack_copy_done
291
292         mr      itmp2,t4                  /* restore argument count               */
293         mr      itmp1,t5                  /* restore argument block pointer       */
294
295         slwi    t4,itmp3,3                /* XXX use 8-bytes slots for now        */
296         addi    t4,t4,LA_SIZE             /* add size of linkage area             */
297
298 #if defined(__DARWIN__)
299         slwi    t5,t7,2                   /* add stack space for arguments        */
300         add     t4,t4,t5
301 #endif
302
303         sub     sp,sp,t4
304
305         mr      t6,sp                     /* use t6 as temporary sp               */
306         addi    t6,t6,LA_SIZE             /* skip linkage area                    */
307 #if defined(__DARWIN__)
308         add     t6,t6,t5                  /* skip stack space for arguments       */
309 #endif
310
311         addi    itmp1,itmp1,-sizevmarg    /* initialize pointer (smaller code)    */
312         addi    itmp2,itmp2,1             /* initialize argument count            */
313         
314 L_stack_copy_loop:
315         addi    itmp1,itmp1,sizevmarg     /* goto next argument block             */
316         addi    itmp2,itmp2,-1            /* argument count - 1                   */
317         mr.     itmp2,itmp2
318         beq     L_stack_copy_done
319         
320         lwz     itmp3,offvmargtype+4(itmp1)
321         andi.   r0,itmp3,0x0002           /* is this a float/double type?         */
322         bne     L_stack_handle_float
323
324 L_stack_handle_int:
325         addi    t0,t0,-1                  /* arguments assigned to registers      */
326         mr.     t0,t0
327         bge     L_stack_copy_loop
328
329         andi.   r0,itmp3,0x0001           /* is this a 2-word type?               */
330         bne     L_stack_handle_long
331
332         lwz     itmp3,offvmargdata+4(itmp1) /* get integer argument               */
333         stw     itmp3,0(t6)               /* and store it on the stack            */
334         addi    t6,t6,4                   /* increase temporary sp by 1 slot      */
335         b       L_stack_copy_loop
336
337 L_stack_handle_long:
338 #if !defined(__DARWIN__)
339         addi    t6,t6,4                   /* align stack to 8-bytes               */
340         rlwinm  t6,t6,0,30,28             /* clear lower 4-bits                   */
341 #endif
342
343         lwz     itmp3,offvmargdata+0(itmp1) /* get long argument                  */
344         stw     itmp3,0(t6)               /* and store it on the stack            */
345         lwz     itmp3,offvmargdata+4(itmp1)
346         stw     itmp3,4(t6)
347         addi    t6,t6,8                   /* increase temporary sp by 2 slots     */
348         b       L_stack_copy_loop
349                 
350 L_stack_handle_float:
351         addi    t1,t1,-1                  /* arguments assigned to registers      */
352         mr.     t1,t1
353         bge     L_stack_copy_loop
354
355         andi.   r0,itmp3,0x0001           /* is this a 2-word type?               */
356         bne     L_stack_handle_double
357
358         lfs     ftmp3,offvmargdata(itmp1) /* get float argument                   */
359         stfs    ftmp3,0(t6)               /* and store it on the stack            */
360         addi    t6,t6,4                   /* increase temporary sp by 1 slot      */
361         b       L_stack_copy_loop
362
363 L_stack_handle_double:
364 #if !defined(__DARWIN__)
365         addi    t6,t6,4                   /* align stack to 8-bytes               */
366         rlwinm  t6,t6,0,30,28             /* clear lower 4-bits                   */
367 #endif
368
369         lfd     ftmp3,offvmargdata(itmp1) /* get double argument                  */
370         stfd    ftmp3,0(t6)               /* and store it on the stack            */
371         addi    t6,t6,8                   /* increase temporary sp by 2 slots     */
372         b       L_stack_copy_loop
373
374 L_stack_copy_done:
375         lwz     itmp1,9*4(s0)             /* pass method pointer via tmp1         */
376
377 #if defined(__DARWIN__)
378         addis   mptr,t3,ha16(L_asm_call_jit_compiler - L_asm_vm_call_method_get_pc)
379         la      mptr,lo16(L_asm_call_jit_compiler - L_asm_vm_call_method_get_pc)(mptr)
380 #else
381         lis     mptr,L_asm_call_jit_compiler@ha
382         addi    mptr,mptr,L_asm_call_jit_compiler@l
383 #endif
384         stw     mptr,7*4(s0)
385         addi    mptr,s0,7*4
386
387         lwz     pv,0*4(mptr)
388         mtctr   pv
389         bctrl
390 1:
391         mflr    itmp1
392 #if defined(__DARWIN__)
393         addi    pv,itmp1,lo16(asm_vm_call_method - 1b)
394 #else
395         addi    pv,itmp1,(asm_vm_call_method - 1b)@l
396 #endif
397
398 L_asm_vm_call_method_return:
399         mr      sp,s0                     /* restore the function's sp            */
400
401         lwz     s0,8*4(sp)                /* restore used callee saved registers  */
402
403 #if defined(__DARWIN__)
404         lwz     itmp1,10*4(sp)            /* register r11 is callee saved         */
405 #endif
406         lwz     pv,11*4(sp)               /* save PV register                     */
407
408         lwz     itmp3,12*4(sp)
409         lfd     ftmp1,14*4(sp)            /* registers f14-f31 are callee saved   */
410         lfd     ftmp2,16*4(sp)
411
412 #if defined(__DARWIN__)
413         lwz     t1,18*4(sp)
414         lwz     t2,19*4(sp)
415         lwz     t3,20*4(sp)
416         lwz     t4,21*4(sp)
417         lwz     t5,22*4(sp)
418         lwz     t6,23*4(sp)
419         lwz     t7,24*4(sp)
420
421         lfd     ft0,26*4(sp)
422         lfd     ft1,28*4(sp)
423         lfd     ft2,30*4(sp)
424         lfd     ft3,32*4(sp)
425         lfd     ft4,34*4(sp)
426         lfd     ft5,36*4(sp)
427 #else
428         RESTORE_TEMPORARY_REGISTERS(18)   /* the offset has to be even            */
429 #endif
430
431         lwz     r0,40*4+LA_LR_OFFSET(sp)
432         mtlr    r0
433         addi    sp,sp,40*4
434         blr
435
436 asm_vm_call_method_exception_handler:
437         mr      a0,itmp1
438         bl      builtin_throw_exception
439         b       L_asm_vm_call_method_return
440
441
442         .data
443         .align  2
444
445 L_jumptable_int:
446         .long   L_handle_a0
447         .long   L_handle_a1
448         .long   L_handle_a2
449         .long   L_handle_a3
450         .long   L_handle_a4
451         .long   L_handle_a5
452         .long   L_handle_a6
453         .long   L_handle_a7
454
455         .text
456         .align  2
457
458 L_handle_a0:
459         lwz     a0,offvmargdata+4(itmp1)
460         b       L_register_copy
461 L_handle_a1:
462         lwz     a1,offvmargdata+4(itmp1)
463         b       L_register_copy
464 L_handle_a2:
465         lwz     a2,offvmargdata+4(itmp1)
466         b       L_register_copy
467 L_handle_a3:
468         lwz     a3,offvmargdata+4(itmp1)
469         b       L_register_copy
470 L_handle_a4:
471         lwz     a4,offvmargdata+4(itmp1)
472         b       L_register_copy
473 L_handle_a5:
474         lwz     a5,offvmargdata+4(itmp1)
475         b       L_register_copy
476 L_handle_a6:
477         lwz     a6,offvmargdata+4(itmp1)
478         b       L_register_copy
479 L_handle_a7:
480         lwz     a7,offvmargdata+4(itmp1)
481         b       L_register_copy
482
483
484         .data
485         .align  2
486
487 L_jumptable_long:
488 #if defined(__DARWIN__)
489         .long   L_handle_a0_a1
490         .long   L_handle_a1_a2
491         .long   L_handle_a2_a3
492         .long   L_handle_a3_a4
493         .long   L_handle_a4_a5
494         .long   L_handle_a5_a6
495         .long   L_handle_a6_a7
496 #else
497         /* we have two entries here, so we get the even argument register
498         alignment for linux */
499
500         .long   L_handle_a0_a1
501         .long   0
502         .long   L_handle_a2_a3
503         .long   0
504         .long   L_handle_a4_a5
505         .long   0
506         .long   L_handle_a6_a7
507 #endif
508
509         .text
510         .align  2
511
512 L_handle_a0_a1:
513         lwz     a0,offvmargdata+0(itmp1)
514         lwz     a1,offvmargdata+4(itmp1)
515         b       L_register_copy
516 #if defined(__DARWIN__)
517 L_handle_a1_a2:
518         lwz     a1,offvmargdata+0(itmp1)
519         lwz     a2,offvmargdata+4(itmp1)
520         b       L_register_copy
521 #endif
522 L_handle_a2_a3:
523         lwz     a2,offvmargdata+0(itmp1)
524         lwz     a3,offvmargdata+4(itmp1)
525         b       L_register_copy
526 #if defined(__DARWIN__)
527 L_handle_a3_a4:
528         lwz     a3,offvmargdata+0(itmp1)
529         lwz     a4,offvmargdata+4(itmp1)
530         b       L_register_copy
531 #endif
532 L_handle_a4_a5:
533         lwz     a4,offvmargdata+0(itmp1)
534         lwz     a5,offvmargdata+4(itmp1)
535         b       L_register_copy
536 #if defined(__DARWIN__)
537 L_handle_a5_a6:
538         lwz     a5,offvmargdata+0(itmp1)
539         lwz     a6,offvmargdata+4(itmp1)
540         b       L_register_copy
541 #endif
542 L_handle_a6_a7:
543         lwz     a6,offvmargdata+0(itmp1)
544         lwz     a7,offvmargdata+4(itmp1)
545         b       L_register_copy
546
547
548         .data
549         .align  2
550
551 L_jumptable_float:
552         .long   L_handle_fa0
553         .long   L_handle_fa1
554         .long   L_handle_fa2
555         .long   L_handle_fa3
556         .long   L_handle_fa4
557         .long   L_handle_fa5
558         .long   L_handle_fa6
559         .long   L_handle_fa7
560
561 #if defined(__DARWIN__)
562         .long   L_handle_fa8
563         .long   L_handle_fa9
564         .long   L_handle_fa10
565         .long   L_handle_fa11
566         .long   L_handle_fa12
567 #endif
568
569         .text
570         .align  2
571
572 L_handle_fa0:
573         lfs     fa0,offvmargdata(itmp1)
574         b       L_register_copy
575 L_handle_fa1:
576         lfs     fa1,offvmargdata(itmp1)
577         b       L_register_copy
578 L_handle_fa2:
579         lfs     fa2,offvmargdata(itmp1)
580         b       L_register_copy
581 L_handle_fa3:
582         lfs     fa3,offvmargdata(itmp1)
583         b       L_register_copy
584 L_handle_fa4:
585         lfs     fa4,offvmargdata(itmp1)
586         b       L_register_copy
587 L_handle_fa5:
588         lfs     fa5,offvmargdata(itmp1)
589         b       L_register_copy
590 L_handle_fa6:
591         lfs     fa6,offvmargdata(itmp1)
592         b       L_register_copy
593 L_handle_fa7:
594         lfs     fa7,offvmargdata(itmp1)
595         b       L_register_copy
596
597 #if defined(__DARWIN__)
598 L_handle_fa8:
599         lfs     fa8,offvmargdata(itmp1)
600         b       L_register_copy
601 L_handle_fa9:
602         lfs     fa9,offvmargdata(itmp1)
603         b       L_register_copy
604 L_handle_fa10:
605         lfs     fa10,offvmargdata(itmp1)
606         b       L_register_copy
607 L_handle_fa11:
608         lfs     fa11,offvmargdata(itmp1)
609         b       L_register_copy
610 L_handle_fa12:
611         lfs     fa12,offvmargdata(itmp1)
612         b       L_register_copy
613 #endif
614
615
616         .data
617         .align  2
618
619 L_jumptable_double:
620         .long   L_handle_fda0
621         .long   L_handle_fda1
622         .long   L_handle_fda2
623         .long   L_handle_fda3
624         .long   L_handle_fda4
625         .long   L_handle_fda5
626         .long   L_handle_fda6
627         .long   L_handle_fda7
628
629 #if defined(__DARWIN__)
630         .long   L_handle_fda8
631         .long   L_handle_fda9
632         .long   L_handle_fda10
633         .long   L_handle_fda11
634         .long   L_handle_fda12
635 #endif
636
637         .text
638         .align  2
639
640 L_handle_fda0:
641         lfd     fa0,offvmargdata(itmp1)
642         b       L_register_copy
643 L_handle_fda1:
644         lfd     fa1,offvmargdata(itmp1)
645         b       L_register_copy
646 L_handle_fda2:
647         lfd     fa2,offvmargdata(itmp1)
648         b       L_register_copy
649 L_handle_fda3:
650         lfd     fa3,offvmargdata(itmp1)
651         b       L_register_copy
652 L_handle_fda4:
653         lfd     fa4,offvmargdata(itmp1)
654         b       L_register_copy
655 L_handle_fda5:
656         lfd     fa5,offvmargdata(itmp1)
657         b       L_register_copy
658 L_handle_fda6:
659         lfd     fa6,offvmargdata(itmp1)
660         b       L_register_copy
661 L_handle_fda7:
662         lfd     fa7,offvmargdata(itmp1)
663         b       L_register_copy
664
665 #if defined(__DARWIN__)
666 L_handle_fda8:
667         lfd     fa8,offvmargdata(itmp1)
668         b       L_register_copy
669 L_handle_fda9:
670         lfd     fa9,offvmargdata(itmp1)
671         b       L_register_copy
672 L_handle_fda10:
673         lfd     fa10,offvmargdata(itmp1)
674         b       L_register_copy
675 L_handle_fda11:
676         lfd     fa11,offvmargdata(itmp1)
677         b       L_register_copy
678 L_handle_fda12:
679         lfd     fa12,offvmargdata(itmp1)
680         b       L_register_copy
681 #endif
682
683 asm_vm_call_method_end:
684         nop
685
686 /* asm_call_jit_compiler *******************************************************
687
688    Invokes the compiler for untranslated JavaVM methods.
689
690 *******************************************************************************/
691
692 asm_call_jit_compiler:
693 L_asm_call_jit_compiler:                /* required for PIC code              */
694         mflr    r0
695         stw     r0,LA_LR_OFFSET(sp)         /* save return address                */
696         stwu    sp,-(LA_SIZE + 4*4 + INT_ARG_CNT*4 + FLT_ARG_CNT*8)(sp)
697
698 #if defined(__DARWIN__)
699         stw     a0,LA_SIZE+(4+0)*4(sp)
700         stw     a1,LA_SIZE+(4+1)*4(sp)
701         stw     a2,LA_SIZE+(4+2)*4(sp)
702         stw     a3,LA_SIZE+(4+3)*4(sp)
703         stw     a4,LA_SIZE+(4+4)*4(sp)
704         stw     a5,LA_SIZE+(4+5)*4(sp)
705         stw     a6,LA_SIZE+(4+6)*4(sp)
706         stw     a7,LA_SIZE+(4+7)*4(sp)
707
708         stfd    fa0,LA_SIZE+(4+8)*4(sp)
709         stfd    fa1,LA_SIZE+(4+10)*4(sp)
710         stfd    fa2,LA_SIZE+(4+12)*4(sp)
711         stfd    fa3,LA_SIZE+(4+14)*4(sp)
712         stfd    fa4,LA_SIZE+(4+16)*4(sp)
713         stfd    fa5,LA_SIZE+(4+18)*4(sp)
714         stfd    fa6,LA_SIZE+(4+20)*4(sp)
715         stfd    fa7,LA_SIZE+(4+22)*4(sp)
716         stfd    fa8,LA_SIZE+(4+24)*4(sp)
717         stfd    fa9,LA_SIZE+(4+26)*4(sp)
718         stfd    fa10,LA_SIZE+(4+28)*4(sp)
719         stfd    fa11,LA_SIZE+(4+30)*4(sp)
720         stfd    fa12,LA_SIZE+(4+32)*4(sp)
721 #else
722         SAVE_ARGUMENT_REGISTERS(LA_SIZE_IN_POINTERS)
723 #endif
724
725         mr      a0,itmp1
726         mr      a1,mptr
727         addi    a2,sp,(LA_SIZE + 4*4 + INT_ARG_CNT*4 + FLT_ARG_CNT*8)
728         lwz     a3,(LA_SIZE + 4*4 + INT_ARG_CNT*4 + FLT_ARG_CNT*8)+LA_LR_OFFSET(sp)
729         bl      jit_asm_compile
730         mr      pv,v0                       /* move address to pv register        */
731
732 #if defined(__DARWIN__)
733         lwz     a0,LA_SIZE+(4+0)*4(sp)
734         lwz     a1,LA_SIZE+(4+1)*4(sp)
735         lwz     a2,LA_SIZE+(4+2)*4(sp)
736         lwz     a3,LA_SIZE+(4+3)*4(sp)
737         lwz     a4,LA_SIZE+(4+4)*4(sp)
738         lwz     a5,LA_SIZE+(4+5)*4(sp)
739         lwz     a6,LA_SIZE+(4+6)*4(sp)
740         lwz     a7,LA_SIZE+(4+7)*4(sp)
741
742         lfd     fa0,LA_SIZE+(4+8)*4(sp)
743         lfd     fa1,LA_SIZE+(4+10)*4(sp)
744         lfd     fa2,LA_SIZE+(4+12)*4(sp)
745         lfd     fa3,LA_SIZE+(4+14)*4(sp)
746         lfd     fa4,LA_SIZE+(4+16)*4(sp)
747         lfd     fa5,LA_SIZE+(4+18)*4(sp)
748         lfd     fa6,LA_SIZE+(4+20)*4(sp)
749         lfd     fa7,LA_SIZE+(4+22)*4(sp)
750         lfd     fa8,LA_SIZE+(4+24)*4(sp)
751         lfd     fa9,LA_SIZE+(4+26)*4(sp)
752         lfd     fa10,LA_SIZE+(4+28)*4(sp)
753         lfd     fa11,LA_SIZE+(4+30)*4(sp)
754         lfd     fa12,LA_SIZE+(4+32)*4(sp)
755 #else
756         RESTORE_ARGUMENT_REGISTERS(LA_SIZE_IN_POINTERS)
757 #endif
758
759         lwz     itmp1,(LA_SIZE + 4*4 + INT_ARG_CNT*4 + FLT_ARG_CNT*8)+LA_LR_OFFSET(sp)
760         mtlr    itmp1
761
762         addi    sp,sp,(LA_SIZE + 4*4 + INT_ARG_CNT*4 + FLT_ARG_CNT*8)
763
764         mr.     pv,pv                       /* test for exception                 */
765         beq     L_asm_call_jit_compiler_exception
766
767         mtctr   pv                          /* move method address to control reg */
768         bctr                                /* and call the Java method           */
769
770 L_asm_call_jit_compiler_exception:
771         mflr    r0
772         stw     r0,LA_LR_OFFSET(sp)
773         stwu    sp,-LA_SIZE_ALIGNED(sp)     /* preserve linkage area              */
774         bl      exceptions_get_and_clear_exception
775         lwz     xpc,LA_SIZE_ALIGNED+LA_LR_OFFSET(sp)
776         mtlr    xpc     
777         addi    sp,sp,LA_SIZE_ALIGNED
778
779         mr      xptr,v0                     /* get exception                      */
780         addi    xpc,xpc,-4                  /* exception address is ra - 4        */
781         b       L_asm_handle_nat_exception
782
783
784 /********************* function asm_handle_exception ***************************
785 *                                                                              *
786 *   This function handles an exception. It does not use the usual calling      *
787 *   conventions. The exception pointer is passed in REG_ITMP1 and the          *
788 *   pc from the exception raising position is passed in REG_ITMP2. It searches *
789 *   the local exception table for a handler. If no one is found, it unwinds    *
790 *   stacks and continues searching the callers.                                *
791 *                                                                              *
792 *   void asm_handle_exception (exceptionptr, exceptionpc);                     *
793 *                                                                              *
794 *******************************************************************************/
795                 
796 asm_handle_nat_exception:
797 L_asm_handle_nat_exception:             /* required for PIC code              */
798 L_asm_handle_exception_stack_loop:
799         mflr    r0
800         addi    sp,sp,-(LA_SIZE+((4+6)*4))  /* allocate stack (+4 for darwin)     */
801         stw     xptr,LA_SIZE+(4+0)*4(sp)    /* save exception pointer             */
802         stw     xpc,LA_SIZE+(4+1)*4(sp)     /* save exception pc                  */
803         stw     r0,LA_SIZE+(4+3)*4(sp)      /* save return address                */
804         li      itmp3,0
805         stw     itmp3,LA_SIZE+(4+4)*4(sp)   /* save maybe-leaf flag (cleared)     */
806
807         mr      a0,r0                       /* pass return address                */
808         bl      md_codegen_get_pv_from_pc   /* get PV from RA                     */
809         stw     v0,LA_SIZE+(4+2)*4(sp)      /* save data segment pointer          */
810
811         lwz     a0,LA_SIZE+(4+0)*4(sp)      /* pass xptr                          */
812         lwz     a1,LA_SIZE+(4+1)*4(sp)      /* pass xpc                           */
813         lwz     a2,LA_SIZE+(4+2)*4(sp)      /* pass PV (v0 == a0)                 */
814         addi    a3,sp,LA_SIZE+((4+6)*4)     /* pass Java SP                       */
815
816         b       L_asm_handle_exception_continue
817
818 asm_handle_exception:
819 L_asm_handle_exception:                 /* required for PIC code              */
820         addi    sp,sp,-(ARG_CNT+TMP_CNT)*8  /* create maybe-leaf stackframe       */
821
822 #if defined(__DARWIN__)
823 #else
824         SAVE_ARGUMENT_REGISTERS(0)          /* we save arg and temp registers in  */
825         SAVE_TEMPORARY_REGISTERS(ARG_CNT)   /* case this is a leaf method         */
826 #endif
827
828         addi    sp,sp,-(LA_SIZE+(4+6)*4)    /* allocate stack                     */
829         stw     xptr,LA_SIZE+(4+0)*4(sp)    /* save xptr                          */
830         stw     pv,LA_SIZE+(4+2)*4(sp)      /* save PV                            */
831         mflr    r0                          /* save RA                            */
832         stw     r0,LA_SIZE+(4+3)*4(sp)
833         li      t0,1                        /* set maybe-leaf flag                */
834         stw     t0,LA_SIZE+(4+4)*4(sp)      /* save maybe-leaf flag               */
835
836         mr      a0,xptr                     /* pass exception pointer             */
837         mr      a1,xpc                      /* pass exception pc                  */
838         mr      a2,pv                       /* pass data segment pointer          */
839         addi    a3,sp,LA_SIZE+(ARG_CNT+TMP_CNT)*8+(4+6)*4
840
841 L_asm_handle_exception_continue:
842         bl      exceptions_handle_exception
843
844         mr.     v0,v0
845         beq     L_asm_handle_exception_not_catched
846
847         mr      xpc,v0                      /* move handlerpc into xpc            */
848         lwz     xptr,LA_SIZE+(4+0)*4(sp)    /* restore xptr                       */
849         lwz     pv,LA_SIZE+(4+2)*4(sp)      /* restore PV                         */
850         lwz     r0,LA_SIZE+(4+3)*4(sp)      /* restore RA                         */
851         mtlr    r0
852         lwz     t0,LA_SIZE+(4+4)*4(sp)      /* get maybe-leaf flag                */
853         addi    sp,sp,LA_SIZE+(4+6)*4       /* free stack frame                   */
854
855         mr.     t0,t0
856         beq     L_asm_handle_exception_no_leaf
857
858 #if defined(__DARWIN__)
859 #else
860         RESTORE_ARGUMENT_REGISTERS(0)       /* if this is a leaf method, we have  */
861         RESTORE_TEMPORARY_REGISTERS(ARG_CNT)/* to restore arg and temp registers  */
862 #endif
863
864         addi    sp,sp,(ARG_CNT+TMP_CNT)*8   /* remove maybe-leaf stackframe       */
865
866 L_asm_handle_exception_no_leaf:
867         mtctr   xpc                         /* jump to the handler                */
868         bctr
869
870 L_asm_handle_exception_not_catched:
871         lwz     xptr,LA_SIZE+(4+0)*4(sp)    /* restore xptr                       */
872         lwz     pv,LA_SIZE+(4+2)*4(sp)      /* restore PV                         */
873         lwz     r0,LA_SIZE+(4+3)*4(sp)      /* restore RA                         */
874         mtlr    r0
875         lwz     t0,LA_SIZE+(4+4)*4(sp)      /* get maybe-leaf flag                */
876         addi    sp,sp,LA_SIZE+(4+6)*4       /* free stack frame                   */
877
878         mr.     t0,t0
879         beq     L_asm_handle_exception_no_leaf_stack
880
881         addi    sp,sp,(ARG_CNT+TMP_CNT)*8   /* remove maybe-leaf stackframe       */
882         li      t0,0                        /* clear the maybe-leaf flag          */
883
884 L_asm_handle_exception_no_leaf_stack:
885         lwz     t1,FrameSize(pv)            /* get frame size                     */
886         add     t1,sp,t1                    /* pointer to save area               */
887
888         lwz     t2,IsLeaf(pv)               /* is leaf procedure                  */
889         mr.     t2,t2
890         bne     L_asm_handle_exception_no_ra_restore
891
892         lwz     r0,LA_LR_OFFSET(t1)         /* restore ra                         */
893         mtlr    r0
894
895 L_asm_handle_exception_no_ra_restore:
896         mflr    xpc                         /* the new xpc is ra                  */
897         mr      t4,xpc                      /* save RA                            */
898         lwz     t2,IntSave(pv)              /* t2 = saved int register count      */
899         bl      ex_int1
900 ex_int1:
901         mflr    t3                          /* t3 = current pc                    */
902 #if defined(__DARWIN__)
903         addi    t3,t3,lo16(ex_int2-ex_int1)
904 #else
905         addi    t3,t3,(ex_int2-ex_int1)@l
906 #endif
907         slwi    t2,t2,2                     /* t2 = register count * 4            */
908         subf    t3,t2,t3                    /* t3 = IntSave - t2                  */
909         mtctr   t3
910         bctr
911
912         lwz     s0,-10*4(t1)
913         lwz     s1,-9*4(t1)
914         lwz     s2,-8*4(t1)
915         lwz     s3,-7*4(t1)
916         lwz     s4,-6*4(t1)
917         lwz     s5,-5*4(t1)
918         lwz     s6,-4*4(t1)
919         lwz     s7,-3*4(t1)
920         lwz     s8,-2*4(t1)
921         lwz     s9,-1*4(t1)
922
923 ex_int2:
924         subf    t1,t2,t1                    /* t1 = t1 - register count * 4       */
925
926         lwz     t2,FltSave(pv)
927         bl      ex_flt1
928 ex_flt1:
929         mflr    t3
930 #if defined(__DARWIN__)
931         addi    t3,t3,lo16(ex_flt2-ex_flt1)
932 #else
933         addi    t3,t3,(ex_flt2-ex_flt1)@l
934 #endif
935         slwi    t2,t2,2                     /* t2 = register count * 4            */
936         subf    t3,t2,t3                    /* t3 = FltSave - t2                  */
937         mtctr   t3
938         bctr
939
940         lfd     fs0,-10*8(t1)
941         lfd     fs1,-9*8(t1)
942         lfd     fs2,-8*8(t1)
943         lfd     fs3,-7*8(t1)
944         lfd     fs4,-6*8(t1)
945         lfd     fs5,-5*8(t1)
946         lfd     fs6,-4*8(t1)
947         lfd     fs7,-3*8(t1)
948         lfd     fs8,-2*8(t1)
949         lfd     fs9,-1*8(t1)
950
951 ex_flt2:
952         mtlr    t4                          /* restore RA                         */
953         lwz     t1,FrameSize(pv)            /* get frame size                     */
954         add     sp,sp,t1                    /* unwind stack                       */
955         b       L_asm_handle_exception_stack_loop
956
957
958 /* asm_abstractmethoderror *****************************************************
959
960    Creates and throws an AbstractMethodError.
961
962 *******************************************************************************/
963
964 asm_abstractmethoderror:
965         mflr    r0
966         stw     r0,LA_LR_OFFSET(sp)
967         stwu    sp,-LA_SIZE_ALIGNED(sp)     /* preserve linkage area              */
968         addi    a0,sp,LA_SIZE_ALIGNED       /* pass java sp                       */
969         mr      a1,r0                       /* pass exception address             */
970         bl      exceptions_asm_new_abstractmethoderror
971         lwz     r0,LA_SIZE_ALIGNED+LA_LR_OFFSET(sp)
972         mtlr    r0                          /* restore return address             */
973         addi    sp,sp,LA_SIZE_ALIGNED
974
975         mr      xptr,v0                     /* get exception pointer              */
976         mr      xpc,r0                      /* we can't use r0 directly in addi   */
977         addi    xpc,xpc,-4                  /* exception address is ra - 4        */
978         b       L_asm_handle_nat_exception
979
980
981 /* asm_patcher_wrapper *********************************************************
982
983    XXX
984
985    Stack layout:
986      20   return address into JIT code (patch position)
987      16   pointer to virtual java_objectheader
988      12   machine code (which is patched back later)
989       8   unresolved class/method/field reference
990       4   data segment displacement from load instructions
991       0   patcher function pointer to call (pv is saved here afterwards)
992
993 *******************************************************************************/
994
995 asm_patcher_wrapper:
996         mflr    r0                    /* get Java return address (leaf)           */
997         stw     r0,6*4(sp)            /* store it in the stub stackframe          */
998                                       /* keep stack 16-bytes aligned: 6+1+37 = 44 */
999         stwu    sp,-(LA_SIZE+(5+58)*4)(sp)
1000
1001 #if defined(__DARWIN__)
1002         stw     a0,LA_SIZE+(5+0)*4(sp)      /* save argument registers            */
1003         stw     a1,LA_SIZE+(5+1)*4(sp)      /* preserve linkage area (24 bytes)   */
1004         stw     a2,LA_SIZE+(5+2)*4(sp)      /* and 4 bytes for 4 argument         */
1005         stw     a3,LA_SIZE+(5+3)*4(sp)
1006         stw     a4,LA_SIZE+(5+4)*4(sp)
1007         stw     a5,LA_SIZE+(5+5)*4(sp)
1008         stw     a6,LA_SIZE+(5+6)*4(sp)
1009         stw     a7,LA_SIZE+(5+7)*4(sp)
1010
1011         stfd    fa0,LA_SIZE+(5+8)*4(sp)
1012         stfd    fa1,LA_SIZE+(5+10)*4(sp)
1013         stfd    fa2,LA_SIZE+(5+12)*4(sp)
1014         stfd    fa3,LA_SIZE+(5+14)*4(sp)
1015         stfd    fa4,LA_SIZE+(5+16)*4(sp)
1016         stfd    fa5,LA_SIZE+(5+18)*4(sp)
1017         stfd    fa6,LA_SIZE+(5+20)*4(sp)
1018         stfd    fa7,LA_SIZE+(5+22)*4(sp)
1019         stfd    fa8,LA_SIZE+(5+24)*4(sp)
1020         stfd    fa9,LA_SIZE+(5+26)*4(sp)
1021         stfd    fa10,LA_SIZE+(5+28)*4(sp)
1022         stfd    fa11,LA_SIZE+(5+30)*4(sp)
1023         stfd    fa12,LA_SIZE+(5+32)*4(sp)
1024
1025         stw     t0,LA_SIZE+(5+33)*4(sp)
1026         stw     t1,LA_SIZE+(5+34)*4(sp)
1027         stw     t2,LA_SIZE+(5+35)*4(sp)
1028         stw     t3,LA_SIZE+(5+36)*4(sp)
1029         stw     t4,LA_SIZE+(5+37)*4(sp)
1030         stw     t5,LA_SIZE+(5+38)*4(sp)
1031         stw     t6,LA_SIZE+(5+39)*4(sp)
1032         stw     t7,LA_SIZE+(5+40)*4(sp)
1033
1034         stfd    ft0,LA_SIZE+(5+42)*4(sp)
1035         stfd    ft1,LA_SIZE+(5+44)*4(sp)
1036         stfd    ft2,LA_SIZE+(5+46)*4(sp)
1037         stfd    ft3,LA_SIZE+(5+48)*4(sp)
1038         stfd    ft4,LA_SIZE+(5+50)*4(sp)
1039         stfd    ft5,LA_SIZE+(5+52)*4(sp)
1040 #else
1041         /* save 8 int/8 float arguments */
1042         SAVE_ARGUMENT_REGISTERS(LA_SIZE_IN_POINTERS+1)
1043         SAVE_TEMPORARY_REGISTERS(LA_SIZE_IN_POINTERS+1+24)
1044 #endif
1045
1046         stw     itmp1,LA_SIZE+(5+54)*4(sp)
1047         stw     itmp2,LA_SIZE+(5+55)*4(sp)
1048         stw     pv,LA_SIZE+(5+56)*4(sp)
1049
1050         addi    a0,sp,LA_SIZE+(5+58)*4      /* pass SP of patcher stub            */
1051         mr      a1,pv                       /* pass PV                            */
1052         mr      a2,r0                       /* pass RA (correct for leafs)        */
1053         bl      patcher_wrapper
1054         stw     v0,LA_SIZE+(5+57)*4(sp)     /* save return value                  */
1055
1056 #if defined(__DARWIN__)
1057         lwz     a0,LA_SIZE+(5+0)*4(sp)
1058         lwz     a1,LA_SIZE+(5+1)*4(sp)
1059         lwz     a2,LA_SIZE+(5+2)*4(sp)
1060         lwz     a3,LA_SIZE+(5+3)*4(sp)
1061         lwz     a4,LA_SIZE+(5+4)*4(sp)
1062         lwz     a5,LA_SIZE+(5+5)*4(sp)
1063         lwz     a6,LA_SIZE+(5+6)*4(sp)
1064         lwz     a7,LA_SIZE+(5+7)*4(sp)
1065
1066         lfd     fa0,LA_SIZE+(5+8)*4(sp)
1067         lfd     fa1,LA_SIZE+(5+10)*4(sp)
1068         lfd     fa2,LA_SIZE+(5+12)*4(sp)
1069         lfd     fa3,LA_SIZE+(5+14)*4(sp)
1070         lfd     fa4,LA_SIZE+(5+16)*4(sp)
1071         lfd     fa5,LA_SIZE+(5+18)*4(sp)
1072         lfd     fa6,LA_SIZE+(5+20)*4(sp)
1073         lfd     fa7,LA_SIZE+(5+22)*4(sp)
1074         lfd     fa8,LA_SIZE+(5+24)*4(sp)
1075         lfd     fa9,LA_SIZE+(5+26)*4(sp)
1076         lfd     fa10,LA_SIZE+(5+28)*4(sp)
1077         lfd     fa11,LA_SIZE+(5+30)*4(sp)
1078         lfd     fa12,LA_SIZE+(5+32)*4(sp)
1079
1080         lwz     t0,LA_SIZE+(5+33)*4(sp)
1081         lwz     t1,LA_SIZE+(5+34)*4(sp)
1082         lwz     t2,LA_SIZE+(5+35)*4(sp)
1083         lwz     t3,LA_SIZE+(5+36)*4(sp)
1084         lwz     t4,LA_SIZE+(5+37)*4(sp)
1085         lwz     t5,LA_SIZE+(5+38)*4(sp)
1086         lwz     t6,LA_SIZE+(5+39)*4(sp)
1087         lwz     t7,LA_SIZE+(5+40)*4(sp)
1088
1089         lfd     ft0,LA_SIZE+(5+42)*4(sp)
1090         lfd     ft1,LA_SIZE+(5+44)*4(sp)
1091         lfd     ft2,LA_SIZE+(5+46)*4(sp)
1092         lfd     ft3,LA_SIZE+(5+48)*4(sp)
1093         lfd     ft4,LA_SIZE+(5+50)*4(sp)
1094         lfd     ft5,LA_SIZE+(5+52)*4(sp)
1095 #else
1096         /* restore 8 int/8 float arguments */
1097         RESTORE_ARGUMENT_REGISTERS(LA_SIZE_IN_POINTERS+1)
1098         RESTORE_TEMPORARY_REGISTERS(LA_SIZE_IN_POINTERS+1+24)
1099 #endif
1100
1101         lwz     itmp1,LA_SIZE+(5+54)*4(sp)
1102         lwz     itmp2,LA_SIZE+(5+55)*4(sp)
1103         lwz     pv,LA_SIZE+(5+56)*4(sp)
1104         lwz     itmp3,LA_SIZE+(5+57)*4(sp)  /* restore return value into temp reg.*/
1105
1106         lwz     r0,6*4+LA_SIZE+(5+58)*4(sp) /* restore RA                         */
1107         mtlr    r0
1108
1109         mr.     itmp3,itmp3           /* check for an exception                   */
1110         bne     L_asm_patcher_wrapper_exception
1111
1112                                       /* get return address (into JIT code)       */
1113         lwz     itmp3,5*4+LA_SIZE+(5+58)*4(sp)
1114
1115                                       /* remove stack frame + patcher stub stack  */
1116         addi    sp,sp,8*4+LA_SIZE+(5+58)*4
1117
1118         mtctr   itmp3
1119         bctr                          /* jump to new patched code                 */
1120
1121 L_asm_patcher_wrapper_exception:
1122         mr      xptr,itmp3                  /* get exception                      */
1123         lwz     xpc,5*4+LA_SIZE+(5+58)*4(sp)
1124         addi    sp,sp,8*4+LA_SIZE+(5+58)*4
1125         b       L_asm_handle_exception
1126
1127 #if defined(ENABLE_REPLACEMENT)
1128
1129 /* asm_replacement_out *********************************************************
1130
1131    This code is jumped to from the replacement-out stubs that are executed
1132    when a thread reaches an activated replacement point.
1133
1134    The purpose of asm_replacement_out is to read out the parts of the
1135    execution state that cannot be accessed from C code, store this state,
1136    and then call the C function replace_me.
1137
1138    Stack layout:
1139       16                start of stack inside method to replace
1140       0   rplpoint *    info on the replacement point that was reached
1141
1142    NOTE: itmp3 has been clobbered by the replacement-out stub!
1143
1144 *******************************************************************************/
1145
1146 /* some room to accomodate changes of the stack frame size during replacement */
1147         /* XXX we should find a cleaner solution here */
1148 #define REPLACEMENT_ROOM  512
1149
1150 #define sizeexecutionstate_ALIGNED  ((sizeexecutionstate + 15) & ~15)
1151
1152 asm_replacement_out:
1153     /* create stack frame */
1154         addi    sp,sp,-(sizeexecutionstate_ALIGNED + REPLACEMENT_ROOM)
1155
1156         /* save link register */
1157         mflr    itmp3
1158
1159         /* save registers in execution state */
1160         stw     r0 ,( 0*4+offes_intregs)(sp)
1161         stw     r1 ,( 1*4+offes_intregs)(sp)
1162         stw     r2 ,( 2*4+offes_intregs)(sp)
1163         stw     r3 ,( 3*4+offes_intregs)(sp)
1164         stw     r4 ,( 4*4+offes_intregs)(sp)
1165         stw     r5 ,( 5*4+offes_intregs)(sp)
1166         stw     r6 ,( 6*4+offes_intregs)(sp)
1167         stw     r7 ,( 7*4+offes_intregs)(sp)
1168         stw     r8 ,( 8*4+offes_intregs)(sp)
1169         stw     r9 ,( 9*4+offes_intregs)(sp)
1170         stw     r10,(10*4+offes_intregs)(sp)
1171         stw     r11,(11*4+offes_intregs)(sp)
1172         stw     r12,(12*4+offes_intregs)(sp)
1173         stw     r13,(13*4+offes_intregs)(sp)
1174         stw     r14,(14*4+offes_intregs)(sp)
1175         stw     r15,(15*4+offes_intregs)(sp)
1176         stw     r16,(16*4+offes_intregs)(sp) /* link register stored as itmp3 */
1177         stw     r17,(17*4+offes_intregs)(sp)
1178         stw     r18,(18*4+offes_intregs)(sp)
1179         stw     r19,(19*4+offes_intregs)(sp)
1180         stw     r20,(20*4+offes_intregs)(sp)
1181         stw     r21,(21*4+offes_intregs)(sp)
1182         stw     r22,(22*4+offes_intregs)(sp)
1183         stw     r23,(23*4+offes_intregs)(sp)
1184         stw     r24,(24*4+offes_intregs)(sp)
1185         stw     r25,(25*4+offes_intregs)(sp)
1186         stw     r26,(26*4+offes_intregs)(sp)
1187         stw     r27,(27*4+offes_intregs)(sp)
1188         stw     r28,(28*4+offes_intregs)(sp)
1189         stw     r29,(29*4+offes_intregs)(sp)
1190         stw     r30,(30*4+offes_intregs)(sp)
1191         stw     r31,(31*4+offes_intregs)(sp)
1192         
1193         stfd    fr0 ,( 0*8+offes_fltregs)(sp)
1194         stfd    fr1 ,( 1*8+offes_fltregs)(sp)
1195         stfd    fr2 ,( 2*8+offes_fltregs)(sp)
1196         stfd    fr3 ,( 3*8+offes_fltregs)(sp)
1197         stfd    fr4 ,( 4*8+offes_fltregs)(sp)
1198         stfd    fr5 ,( 5*8+offes_fltregs)(sp)
1199         stfd    fr6 ,( 6*8+offes_fltregs)(sp)
1200         stfd    fr7 ,( 7*8+offes_fltregs)(sp)
1201         stfd    fr8 ,( 8*8+offes_fltregs)(sp)
1202         stfd    fr9 ,( 9*8+offes_fltregs)(sp)
1203         stfd    fr10,(10*8+offes_fltregs)(sp)
1204         stfd    fr11,(11*8+offes_fltregs)(sp)
1205         stfd    fr12,(12*8+offes_fltregs)(sp)
1206         stfd    fr13,(13*8+offes_fltregs)(sp)
1207         stfd    fr14,(14*8+offes_fltregs)(sp)
1208         stfd    fr15,(15*8+offes_fltregs)(sp)
1209         stfd    fr16,(16*8+offes_fltregs)(sp)
1210         stfd    fr17,(17*8+offes_fltregs)(sp)
1211         stfd    fr18,(18*8+offes_fltregs)(sp)
1212         stfd    fr19,(19*8+offes_fltregs)(sp)
1213         stfd    fr20,(20*8+offes_fltregs)(sp)
1214         stfd    fr21,(21*8+offes_fltregs)(sp)
1215         stfd    fr22,(22*8+offes_fltregs)(sp)
1216         stfd    fr23,(23*8+offes_fltregs)(sp)
1217         stfd    fr24,(24*8+offes_fltregs)(sp)
1218         stfd    fr25,(25*8+offes_fltregs)(sp)
1219         stfd    fr26,(26*8+offes_fltregs)(sp)
1220         stfd    fr27,(27*8+offes_fltregs)(sp)
1221         stfd    fr28,(28*8+offes_fltregs)(sp)
1222         stfd    fr29,(29*8+offes_fltregs)(sp)
1223         stfd    fr30,(30*8+offes_fltregs)(sp)
1224         stfd    fr31,(31*8+offes_fltregs)(sp)
1225         
1226         /* calculate sp of method */
1227         addi    itmp1,sp,(sizeexecutionstate_ALIGNED + REPLACEMENT_ROOM + 4*4)
1228         stw     itmp1,(offes_sp)(sp)
1229
1230         /* store pv */
1231         stw     pv,(offes_pv)(sp)
1232
1233         /* call replace_me */
1234         lwz     a0,-(4*4)(itmp1)            /* arg0: rplpoint *                   */
1235         mr      a1,sp                       /* arg1: execution state              */
1236         addi    sp,sp,-(LA_SIZE_ALIGNED)
1237         b       replace_me                  /* call C function replace_me         */
1238
1239 /* asm_replacement_in **********************************************************
1240
1241    This code writes the given execution state and jumps to the replacement
1242    code.
1243
1244    This function never returns!
1245
1246    NOTE: itmp3 is not restored!
1247
1248    C prototype:
1249       void asm_replacement_in(executionstate *es, replace_safestack_t *st);
1250
1251 *******************************************************************************/
1252
1253 asm_replacement_in:
1254         /* a0 == executionstate *es      */
1255         /* a1 == replace_safestack_t *st */
1256
1257         /* get arguments */
1258         mr              s1,a1                       /* replace_safestack_t *st            */
1259         mr              s2,a0                       /* executionstate *es == safe stack   */
1260
1261         /* switch to the safe stack */
1262         mr              sp,s2
1263
1264         /* reserve linkage area */
1265         addi    sp,sp,-(LA_SIZE_ALIGNED)
1266
1267         /* call replace_build_execution_state(st) */
1268         mr              a0,s1
1269         bl              replace_build_execution_state
1270
1271         /* set new sp */
1272         lwz             sp,(offes_sp)(s2)
1273
1274         /* build stack frame */
1275         addi    sp,sp,-(sizeexecutionstate_ALIGNED)
1276
1277         /* call replace_free_safestack(st,& of allocated executionstate_t) */
1278         mr              a1,sp /* tmpes */
1279         mr              a0,s1 /* st    */
1280         addi    sp,sp,-(LA_SIZE_ALIGNED)  /* reserve linkage area */
1281         bl              replace_free_safestack
1282         addi    sp,sp,+(LA_SIZE_ALIGNED)  /* tear down linkage area */
1283
1284         /* set new pv */
1285         lwz     pv,(offes_pv)(sp)
1286         
1287         /* copy registers from execution state */
1288         lwz     r0 ,( 0*4+offes_intregs)(sp)
1289         /* r1 is sp                       */
1290         /* r2 is reserved                 */
1291         lwz     a0 ,( 3*4+offes_intregs)(sp)
1292         lwz     r4 ,( 4*4+offes_intregs)(sp)
1293         lwz     r5 ,( 5*4+offes_intregs)(sp)
1294         lwz     r6 ,( 6*4+offes_intregs)(sp)
1295         lwz     r7 ,( 7*4+offes_intregs)(sp)
1296         lwz     r8 ,( 8*4+offes_intregs)(sp)
1297         lwz     r9 ,( 9*4+offes_intregs)(sp)
1298         lwz     r10,(10*4+offes_intregs)(sp)
1299         lwz     r11,(11*4+offes_intregs)(sp)
1300         lwz     r12,(12*4+offes_intregs)(sp)
1301         /* r13 is pv                      */
1302         lwz     r14,(14*4+offes_intregs)(sp)
1303         lwz     r15,(15*4+offes_intregs)(sp)
1304         lwz     r16,(16*4+offes_intregs)(sp) /* itmp3, later to link register */
1305         lwz     r17,(17*4+offes_intregs)(sp)
1306         lwz     r18,(18*4+offes_intregs)(sp)
1307         lwz     r19,(19*4+offes_intregs)(sp)
1308         lwz     r20,(20*4+offes_intregs)(sp)
1309         lwz     r21,(21*4+offes_intregs)(sp)
1310         lwz     r22,(22*4+offes_intregs)(sp)
1311         lwz     r23,(23*4+offes_intregs)(sp)
1312         lwz     r24,(24*4+offes_intregs)(sp)
1313         lwz     r25,(25*4+offes_intregs)(sp)
1314         lwz     r26,(26*4+offes_intregs)(sp)
1315         lwz     r27,(27*4+offes_intregs)(sp)
1316         lwz     r28,(28*4+offes_intregs)(sp)
1317         lwz     r29,(29*4+offes_intregs)(sp)
1318         lwz     r30,(30*4+offes_intregs)(sp)
1319         lwz     r31,(31*4+offes_intregs)(sp)
1320         
1321         lfd     fr0 ,( 0*8+offes_fltregs)(sp)
1322         lfd     fr1 ,( 1*8+offes_fltregs)(sp)
1323         lfd     fr2 ,( 2*8+offes_fltregs)(sp)
1324         lfd     fr3 ,( 3*8+offes_fltregs)(sp)
1325         lfd     fr4 ,( 4*8+offes_fltregs)(sp)
1326         lfd     fr5 ,( 5*8+offes_fltregs)(sp)
1327         lfd     fr6 ,( 6*8+offes_fltregs)(sp)
1328         lfd     fr7 ,( 7*8+offes_fltregs)(sp)
1329         lfd     fr8 ,( 8*8+offes_fltregs)(sp)
1330         lfd     fr9 ,( 9*8+offes_fltregs)(sp)
1331         lfd     fr10,(10*8+offes_fltregs)(sp)
1332         lfd     fr11,(11*8+offes_fltregs)(sp)
1333         lfd     fr12,(12*8+offes_fltregs)(sp)
1334         lfd     fr13,(13*8+offes_fltregs)(sp)
1335         lfd     fr14,(14*8+offes_fltregs)(sp)
1336         lfd     fr15,(15*8+offes_fltregs)(sp)
1337         lfd     fr16,(16*8+offes_fltregs)(sp)
1338         lfd     fr17,(17*8+offes_fltregs)(sp)
1339         lfd     fr18,(18*8+offes_fltregs)(sp)
1340         lfd     fr19,(19*8+offes_fltregs)(sp)
1341         lfd     fr20,(20*8+offes_fltregs)(sp)
1342         lfd     fr21,(21*8+offes_fltregs)(sp)
1343         lfd     fr22,(22*8+offes_fltregs)(sp)
1344         lfd     fr23,(23*8+offes_fltregs)(sp)
1345         lfd     fr24,(24*8+offes_fltregs)(sp)
1346         lfd     fr25,(25*8+offes_fltregs)(sp)
1347         lfd     fr26,(26*8+offes_fltregs)(sp)
1348         lfd     fr27,(27*8+offes_fltregs)(sp)
1349         lfd     fr28,(28*8+offes_fltregs)(sp)
1350         lfd     fr29,(29*8+offes_fltregs)(sp)
1351         lfd     fr30,(30*8+offes_fltregs)(sp)
1352         lfd     fr31,(31*8+offes_fltregs)(sp)
1353
1354         /* restore link register */
1355
1356         mtlr    itmp3
1357         
1358         /* load new pc */
1359
1360         lwz     itmp3,offes_pc(sp)
1361
1362         /* remove stack frame */
1363
1364         addi    sp,sp,+(sizeexecutionstate_ALIGNED)
1365
1366         /* jump to new code */
1367
1368         mtctr   itmp3
1369         bctr
1370
1371 #endif /* defined(ENABLE_REPLACEMENT) */
1372
1373 /*********************************************************************/
1374
1375 asm_cacheflush:
1376         add     a1,a0,a1
1377         rlwinm  a0,a0,0,0,26
1378         addi    a1,a1,31
1379         rlwinm  a1,a1,0,0,26
1380         mr      a2,a0
1381 1:
1382         cmplw   a0,a1
1383         bge     0f
1384         dcbst   0,a0
1385         addi    a0,a0,32
1386         b       1b
1387 0:
1388         sync
1389 1:
1390         cmplw   a2,a1
1391         bge     0f
1392         icbi    0,a2
1393         addi    a2,a2,32
1394         b       1b
1395 0:
1396         sync
1397         isync
1398         blr
1399
1400
1401 /* asm_compare_and_swap ********************************************************
1402
1403    XXX
1404
1405 *******************************************************************************/
1406
1407 asm_compare_and_swap:
1408 1:
1409         lwarx   a6,0,a0 
1410         subf.   r0,a6,a1 
1411         bne-    2f 
1412         or      r0,a2,a2 
1413         stwcx.  r0,0,a0 
1414         bne-    1b 
1415 2: 
1416         mr      a0,a6
1417         blr
1418
1419
1420 /* asm_memory_barrier **********************************************************
1421
1422    XXX
1423
1424 *******************************************************************************/
1425
1426 asm_memory_barrier:
1427         sync
1428         blr
1429
1430
1431 asm_getclassvalues_atomic:
1432 _crit_restart:
1433 _crit_begin:
1434         lwz     a3,offbaseval(a0)
1435         lwz     a4,offdiffval(a0)
1436         lwz     a5,offbaseval(a1)
1437 _crit_end:
1438         stw     a3,offcast_super_baseval(a2)
1439         stw     a4,offcast_super_diffval(a2)
1440         stw     a5,offcast_sub_baseval(a2)
1441         blr
1442
1443         .data
1444
1445 asm_criticalsections:
1446 #if defined(ENABLE_THREADS)
1447         .long   _crit_begin
1448         .long   _crit_end
1449         .long   _crit_restart
1450 #endif
1451         .long 0
1452
1453
1454 #if defined(__DARWIN__)
1455
1456 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1457         .align 2
1458 L_builtin_throw_exception$stub:
1459         .indirect_symbol _builtin_throw_exception
1460         mflr r0
1461         bcl 20,31,L00$_builtin_throw_exception
1462 L00$_builtin_throw_exception:
1463         mflr r11
1464         addis r11,r11,ha16(L_builtin_throw_exception$lazy_ptr - L00$_builtin_throw_exception)
1465         mtlr r0
1466         lwzu r12,lo16(L_builtin_throw_exception$lazy_ptr - L00$_builtin_throw_exception)(r11)
1467         mtctr r12
1468         bctr
1469 .data
1470 .lazy_symbol_pointer
1471 L_builtin_throw_exception$lazy_ptr:
1472         .indirect_symbol _builtin_throw_exception
1473         .long dyld_stub_binding_helper
1474
1475
1476 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1477         .align 2
1478 L_md_codegen_get_pv_from_pc$stub:
1479         .indirect_symbol _md_codegen_get_pv_from_pc
1480         mflr r0
1481         bcl 20,31,L00$_md_codegen_get_pv_from_pc
1482 L00$_md_codegen_get_pv_from_pc:
1483         mflr r11
1484         addis r11,r11,ha16(L_md_codegen_get_pv_from_pc$lazy_ptr - L00$_md_codegen_get_pv_from_pc)
1485         mtlr r0
1486         lwzu r12,lo16(L_md_codegen_get_pv_from_pc$lazy_ptr - L00$_md_codegen_get_pv_from_pc)(r11)
1487         mtctr r12
1488         bctr
1489 .data
1490 .lazy_symbol_pointer
1491 L_md_codegen_get_pv_from_pc$lazy_ptr:
1492         .indirect_symbol _md_codegen_get_pv_from_pc
1493         .long dyld_stub_binding_helper
1494
1495
1496 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1497         .align 2
1498 L_exceptions_handle_exception$stub:
1499         .indirect_symbol _exceptions_handle_exception
1500         mflr r0
1501         bcl 20,31,L00$_exceptions_handle_exception
1502 L00$_exceptions_handle_exception:
1503         mflr r11
1504         addis r11,r11,ha16(L_exceptions_handle_exception$lazy_ptr - L00$_exceptions_handle_exception)
1505         mtlr r0
1506         lwzu r12,lo16(L_exceptions_handle_exception$lazy_ptr - L00$_exceptions_handle_exception)(r11)
1507         mtctr r12
1508         bctr
1509 .data
1510 .lazy_symbol_pointer
1511 L_exceptions_handle_exception$lazy_ptr:
1512         .indirect_symbol _exceptions_handle_exception
1513         .long dyld_stub_binding_helper
1514
1515
1516 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1517         .align 2
1518 L_stacktrace_create_extern_stackframeinfo$stub:
1519         .indirect_symbol _stacktrace_create_extern_stackframeinfo
1520         mflr r0
1521         bcl 20,31,L00$_stacktrace_create_extern_stackframeinfo
1522 L00$_stacktrace_create_extern_stackframeinfo:
1523         mflr r11
1524         addis r11,r11,ha16(L_stacktrace_create_extern_stackframeinfo$lazy_ptr - L00$_stacktrace_create_extern_stackframeinfo)
1525         mtlr r0
1526         lwzu r12,lo16(L_stacktrace_create_extern_stackframeinfo$lazy_ptr - L00$_stacktrace_create_extern_stackframeinfo)(r11)
1527         mtctr r12
1528         bctr
1529 .data
1530 .lazy_symbol_pointer
1531 L_stacktrace_create_extern_stackframeinfo$lazy_ptr:
1532         .indirect_symbol _stacktrace_create_extern_stackframeinfo
1533         .long dyld_stub_binding_helper
1534
1535
1536 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1537         .align 2
1538 L_jit_asm_compile$stub:
1539         .indirect_symbol _jit_asm_compile
1540         mflr r0
1541         bcl 20,31,L00$_jit_asm_compile
1542 L00$_jit_asm_compile:
1543         mflr r11
1544         addis r11,r11,ha16(L_jit_asm_compile$lazy_ptr - L00$_jit_asm_compile)
1545         mtlr r0
1546         lwzu r12,lo16(L_jit_asm_compile$lazy_ptr - L00$_jit_asm_compile)(r11)
1547         mtctr r12
1548         bctr
1549 .data
1550 .lazy_symbol_pointer
1551 L_jit_asm_compile$lazy_ptr:
1552         .indirect_symbol _jit_asm_compile
1553         .long dyld_stub_binding_helper
1554
1555
1556 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1557         .align 2
1558 L_stacktrace_remove_stackframeinfo$stub:
1559         .indirect_symbol _stacktrace_remove_stackframeinfo
1560         mflr r0
1561         bcl 20,31,L00$_stacktrace_remove_stackframeinfo
1562 L00$_stacktrace_remove_stackframeinfo:
1563         mflr r11
1564         addis r11,r11,ha16(L_stacktrace_remove_stackframeinfo$lazy_ptr - L00$_stacktrace_remove_stackframeinfo)
1565         mtlr r0
1566         lwzu r12,lo16(L_stacktrace_remove_stackframeinfo$lazy_ptr - L00$_stacktrace_remove_stackframeinfo)(r11)
1567         mtctr r12
1568         bctr
1569 .data
1570 .lazy_symbol_pointer
1571 L_stacktrace_remove_stackframeinfo$lazy_ptr:
1572         .indirect_symbol _stacktrace_remove_stackframeinfo
1573         .long dyld_stub_binding_helper
1574
1575
1576 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1577         .align 2
1578 L_exceptions_get_and_clear_exception$stub:
1579         .indirect_symbol _exceptions_get_and_clear_exception
1580         mflr r0
1581         bcl 20,31,L00$_exceptions_get_and_clear_exception
1582 L00$_exceptions_get_and_clear_exception:
1583         mflr r11
1584         addis r11,r11,ha16(L_exceptions_get_and_clear_exception$lazy_ptr - L00$_exceptions_get_and_clear_exception)
1585         mtlr r0
1586         lwzu r12,lo16(L_exceptions_get_and_clear_exception$lazy_ptr - L00$_exceptions_get_and_clear_exception)(r11)
1587         mtctr r12
1588         bctr
1589 .data
1590 .lazy_symbol_pointer
1591 L_exceptions_get_and_clear_exception$lazy_ptr:
1592         .indirect_symbol _exceptions_get_and_clear_exception
1593         .long dyld_stub_binding_helper
1594
1595
1596 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1597         .align 2
1598 L_exceptions_asm_new_abstractmethoderror$stub:
1599         .indirect_symbol _exceptions_asm_new_abstractmethoderror
1600         mflr r0
1601         bcl 20,31,L00$_exceptions_asm_new_abstractmethoderror
1602 L00$_exceptions_asm_new_abstractmethoderror:
1603         mflr r11
1604         addis r11,r11,ha16(L_exceptions_asm_new_abstractmethoderror$lazy_ptr - L00$_exceptions_asm_new_abstractmethoderror)
1605         mtlr r0
1606         lwzu r12,lo16(L_exceptions_asm_new_abstractmethoderror$lazy_ptr - L00$_exceptions_asm_new_abstractmethoderror)(r11)
1607         mtctr r12
1608         bctr
1609 .data
1610 .lazy_symbol_pointer
1611 L_exceptions_asm_new_abstractmethoderror$lazy_ptr:
1612         .indirect_symbol _exceptions_asm_new_abstractmethoderror
1613         .long dyld_stub_binding_helper
1614
1615
1616 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1617         .align 2
1618 L_patcher_wrapper$stub:
1619         .indirect_symbol _patcher_wrapper
1620         mflr r0
1621         bcl 20,31,L00$_patcher_wrapper
1622 L00$_patcher_wrapper:
1623         mflr r11
1624         addis r11,r11,ha16(L_patcher_wrapper$lazy_ptr - L00$_patcher_wrapper)
1625         mtlr r0
1626         lwzu r12,lo16(L_patcher_wrapper$lazy_ptr - L00$_patcher_wrapper)(r11)
1627         mtctr r12
1628         bctr
1629 .data
1630 .lazy_symbol_pointer
1631 L_patcher_wrapper$lazy_ptr:
1632         .indirect_symbol _patcher_wrapper
1633         .long dyld_stub_binding_helper
1634
1635
1636 # if defined(ENABLE_REPLACEMENT)
1637
1638 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1639         .align 2
1640 L_replace_me$stub:
1641         .indirect_symbol _replace_me
1642         mflr r0
1643         bcl 20,31,L00$_replace_me
1644 L00$_replace_me:
1645         mflr r11
1646         addis r11,r11,ha16(L_replace_me$lazy_ptr - L00$_replace_me)
1647         mtlr r0
1648         lwzu r12,lo16(L_replace_me$lazy_ptr - L00$_replace_me)(r11)
1649         mtctr r12
1650         bctr
1651 .data
1652 .lazy_symbol_pointer
1653 L_replace_me$lazy_ptr:
1654         .indirect_symbol _replace_me
1655         .long dyld_stub_binding_helper
1656
1657
1658 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1659         .align 2
1660 L_replace_build_execution_state$stub:
1661         .indirect_symbol _replace_build_execution_state
1662         mflr r0
1663         bcl 20,31,L00$_replace_build_execution_state
1664 L00$_replace_build_execution_state:
1665         mflr r11
1666         addis r11,r11,ha16(L_replace_build_execution_state$lazy_ptr - L00$_replace_build_execution_state)
1667         mtlr r0
1668         lwzu r12,lo16(L_replace_build_execution_state$lazy_ptr - L00$_replace_build_execution_state)(r11)
1669         mtctr r12
1670         bctr
1671 .data
1672 .lazy_symbol_pointer
1673 L_replace_build_execution_state$lazy_ptr:
1674         .indirect_symbol _replace_build_execution_state
1675         .long dyld_stub_binding_helper
1676
1677
1678 .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
1679         .align 2
1680 L_replace_free_safestack$stub:
1681         .indirect_symbol _replace_free_safestack
1682         mflr r0
1683         bcl 20,31,L00$_replace_free_safestack
1684 L00$_replace_free_safestack:
1685         mflr r11
1686         addis r11,r11,ha16(L_replace_free_safestack$lazy_ptr - L00$_replace_free_safestack)
1687         mtlr r0
1688         lwzu r12,lo16(L_replace_free_safestack$lazy_ptr - L00$_replace_free_safestack)(r11)
1689         mtctr r12
1690         bctr
1691 .data
1692 .lazy_symbol_pointer
1693 L_replace_free_safestack$lazy_ptr:
1694         .indirect_symbol _replace_free_safestack
1695         .long dyld_stub_binding_helper
1696
1697 # endif /* ENABLE_REPLACEMENT */
1698
1699 #endif /* defined(__DARWIN__) */
1700
1701
1702 /* disable exec-stacks ********************************************************/
1703
1704 #if defined(__linux__) && defined(__ELF__)
1705         .section .note.GNU-stack,"",%progbits
1706 #endif
1707
1708
1709 /*
1710  * These are local overrides for various environment variables in Emacs.
1711  * Please do not remove this and leave it at the end of the file, where
1712  * Emacs will automagically detect them.
1713  * ---------------------------------------------------------------------
1714  * Local variables:
1715  * mode: asm
1716  * indent-tabs-mode: t
1717  * c-basic-offset: 4
1718  * tab-width: 4
1719  * End:
1720  * vim:noexpandtab:sw=4:ts=4:
1721  */