b62ef2ae055a148ccb5e1323909b941e1abb0722
[cacao.git] / alpha / asmpart.S
1 /* -*- mode: asm; tab-width: 4 -*- */
2 /****************************** asmpart.S **************************************
3 *                                                                              *
4 *   It contains the Java-C interface functions for Alpha processors.           *
5 *                                                                              *
6 *   Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst              *
7 *                                                                              *
8 *   See file COPYRIGHT for information on usage and disclaimer of warranties   *
9 *                                                                              *
10 *   Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at            *
11 *            Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at            *
12 *                                                                              *
13 *   Last Change: 2003/02/17                                                    *
14 *                                                                              *
15 *******************************************************************************/
16
17 #include "offsets.h"
18
19 #define v0      $0
20
21 #define t0      $1
22 #define t1      $2
23 #define t2      $3
24 #define t3      $4
25 #define t4      $5
26 #define t5      $6
27 #define t6      $7
28 #define t7      $8
29
30 #define s0      $9
31 #define s1      $10
32 #define s2      $11
33 #define s3      $12
34 #define s4      $13
35 #define s5      $14
36 #define s6      $15
37
38 #define a0      $16
39 #define a1      $17
40 #define a2      $18
41 #define a3      $19
42 #define a4      $20
43 #define a5      $21
44
45 #define t8      $22
46 #define t9      $23
47 #define t10     $24
48 #define t11     $25
49 #define ra      $26
50 #define t12     $27
51
52 #define pv      t12
53 #define AT      $at
54 #define gp      $29
55 #define sp      $30
56 #define zero    $31
57
58 #define itmp1   $25
59 #define itmp2   $28
60 #define itmp3   $29
61
62 #define xptr    itmp1
63 #define xpc     itmp2
64
65 #define sf0     $f2
66 #define sf1     $f3
67 #define sf2     $f4
68 #define sf3     $f5
69 #define sf4     $f6
70 #define sf5     $f7
71 #define sf6     $f8
72 #define sf7     $f9
73
74 #define fzero   $f31
75
76
77 #define PAL_imb 134
78
79         .text
80         .set    noat
81         .set    noreorder
82
83
84 /********************* exported functions and variables ***********************/
85
86         .globl has_no_x_instr_set
87         .globl synchronize_caches
88         .globl asm_calljavamethod
89         .globl asm_calljavafunction
90         .globl asm_call_jit_compiler
91         .globl asm_dumpregistersandcall
92         .globl asm_handle_exception
93         .globl asm_handle_nat_exception
94         .globl asm_builtin_checkcast    
95         .globl asm_builtin_checkarraycast
96         .globl asm_builtin_aastore
97         .globl asm_builtin_monitorenter
98         .globl asm_builtin_monitorexit
99         .globl asm_builtin_idiv
100         .globl asm_builtin_irem
101         .globl asm_builtin_ldiv
102         .globl asm_builtin_lrem
103         .globl asm_perform_threadswitch
104         .globl asm_initialize_thread_stack
105         .globl asm_switchstackandcall
106         .globl asm_getcallingmethod
107         .globl asm_builtin_trace
108         .globl asm_builtin_exittrace
109
110 /*************************** imported variables *******************************/
111
112         .globl newcompiler
113
114
115 /*************************** imported functions *******************************/
116
117         .globl jit_compile
118         .globl builtin_monitorexit
119         .globl builtin_throw_exception
120         .globl builtin_trace_exception
121         .globl class_java_lang_Object
122
123
124 /*********************** function has_no_x_instr_set ***************************
125 *                                                                              *
126 *   determines if the byte support instruction set (21164a and higher)         *
127 *   is available.                                                              *
128 *                                                                              *
129 *******************************************************************************/
130
131         .ent    has_no_x_instr_set
132 has_no_x_instr_set:
133
134         .long   0x47e03c20                /* amask   1,v0                         */
135         jmp     zero,(ra)                 /* return                               */
136
137         .end    has_no_x_instr_set
138
139
140 /********************* function synchronize_caches ****************************/
141
142         .ent    synchronize_caches
143 synchronize_caches:
144
145         call_pal PAL_imb                  /* synchronise instruction cache        */
146         jmp     zero,(ra)                 /* return                               */
147
148         .end    synchronize_caches
149
150
151 /********************* function asm_calljavamethod *****************************
152 *                                                                              *
153 *   This function calls a Java-method (which possibly needs compilation)       *
154 *   with up to 4 parameters.                                                   *
155 *                                                                              *
156 *   This functions calls the JIT-compiler which eventually translates the      *
157 *   method into machine code.                                                  *
158 *                                                                              *
159 *   An possibly throwed exception will be returned to the caller as function   *
160 *   return value, so the java method cannot return a fucntion value (this      *
161 *   function usually calls 'main' and '<clinit>' which do not return a         *
162 *   function value).                                                           *
163 *                                                                              *
164 *   C-prototype:                                                               *
165 *    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
166 *         void *arg1, void *arg2, void *arg3, void *arg4);                     *
167 *                                                                              *
168 *******************************************************************************/
169
170 #define         MethodPointer   -8
171 #define         FrameSize       -12
172 #define     IsSync          -16
173 #define     IsLeaf          -20
174 #define     IntSave         -24
175 #define     FltSave         -28
176 #define     ExTableSize     -32
177 #define     ExTableStart    -32
178
179 #define     ExEntrySize     -32
180 #define     ExStartPC       -8
181 #define     ExEndPC         -16
182 #define     ExHandlerPC     -24
183 #define     ExCatchType     -32
184
185         .ent    asm_calljavamethod
186
187 call_name:
188         .ascii  "calljavamethod\0\0"
189
190         .align  3
191         .quad   0                         /* catch type all                       */
192         .quad   calljava_xhandler         /* handler pc                           */
193         .quad   calljava_xhandler         /* end pc                               */
194         .quad   asm_calljavamethod        /* start pc                             */
195         .long   1                         /* extable size                         */
196         .long   0                         /* fltsave                              */
197         .long   0                         /* intsave                              */
198         .long   0                         /* isleaf                               */
199         .long   0                         /* IsSync                               */
200         .long   32                        /* frame size                           */
201         .quad   0                         /* method pointer (pointer to name)     */
202
203 asm_calljavamethod:
204
205         .frame $30,32,$26
206         .mask 0x4000000,-32
207         ldgp    gp,0(pv)
208         lda     sp,-32(sp)                /* allocate stack space                 */
209         stq     gp,24(sp)                 /* save global pointer                  */
210         stq     ra,0(sp)                  /* save return address                  */
211         .prologue 1
212
213         stq     a0,16(sp)                 /* save method pointer for compiler     */
214         lda     v0,16(sp)                 /* pass pointer to method pointer via v0*/
215
216         mov     a1,a0                     /* pass the remaining parameters        */
217         mov     a2,a1
218         mov     a3,a2
219         mov     a4,a3
220
221         lda     $28,asm_call_jit_compiler /* fake virtual function call (2 instr) */
222         stq     $28,8(sp)                 /* store function address               */
223         mov     sp,$28                    /* set method pointer                   */
224
225         ldq     pv,8($28)                 /* method call as in Java               */
226         jmp     ra,(pv)                   /* call JIT compiler                    */
227 calljava_jit:
228         lda     pv,-64(ra)                /* asm_calljavamethod-calljava_jit !!!!!*/
229
230 calljava_return:
231
232         ldq     ra,0(sp)                  /* restore return address               */
233         ldq     gp,24(sp)                 /* restore global pointer               */
234         lda     sp,32(sp)                 /* free stack space                     */
235         ldl     v0,newcompiler            /* load newcompiler flag                */
236         subq    v0,1,v0                   /* negate for clearing v0               */
237         beq     v0,calljava_ret           /* if newcompiler skip ex copying       */
238         mov     $1,v0                     /* pass exception to caller (C)         */
239 calljava_ret:
240         jmp     zero,(ra)
241
242 calljava_xhandler:
243
244         ldq     gp,24(sp)                 /* restore global pointer               */
245         mov     itmp1,a0
246         jsr     ra,builtin_throw_exception
247         ldq     ra,0(sp)                  /* restore return address               */
248         lda     sp,32(sp)                 /* free stack space                     */
249         jmp     zero,(ra)
250         .end    asm_calljavamethod
251
252
253 /********************* function asm_calljavafunction ***************************
254 *                                                                              *
255 *   This function calls a Java-method (which possibly needs compilation)       *
256 *   with up to 4 address parameters.                                           *
257 *                                                                              *
258 *   This functions calls the JIT-compiler which eventually translates the      *
259 *   method into machine code.                                                  *
260 *                                                                              *
261 *   C-prototype:                                                               *
262 *    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
263 *         void *arg1, void *arg2, void *arg3, void *arg4);                     *
264 *                                                                              *
265 *******************************************************************************/
266
267         .ent    asm_calljavafunction
268
269 call_name2:
270         .ascii  "calljavafunction\0\0"
271
272         .align  3
273         .quad   0                         /* catch type all                       */
274         .quad   calljava_xhandler2        /* handler pc                           */
275         .quad   calljava_xhandler2        /* end pc                               */
276         .quad   asm_calljavafunction      /* start pc                             */
277         .long   1                         /* extable size                         */
278         .long   0                         /* fltsave                              */
279         .long   0                         /* intsave                              */
280         .long   0                         /* isleaf                               */
281         .long   0                         /* IsSync                               */
282         .long   32                        /* frame size                           */
283         .quad   0                         /* method pointer (pointer to name)     */
284
285 asm_calljavafunction:
286
287         .frame $30,32,$26
288         .mask 0x4000000,-32
289         ldgp    gp,0(pv)
290         lda     sp,-32(sp)                /* allocate stack space                 */
291         stq     gp,24(sp)                 /* save global pointer                  */
292         stq     ra,0(sp)                  /* save return address                  */
293         .prologue 1
294
295         stq     a0,16(sp)                 /* save method pointer for compiler     */
296         lda     v0,16(sp)                 /* pass pointer to method pointer via v0*/
297
298         mov     a1,a0                     /* pass the remaining parameters        */
299         mov     a2,a1
300         mov     a3,a2
301         mov     a4,a3
302
303         lda     $28,asm_call_jit_compiler /* fake virtual function call (2 instr) */
304         stq     $28,8(sp)                 /* store function address               */
305         mov     sp,$28                    /* set method pointer                   */
306
307         ldq     pv,8($28)                 /* method call as in Java               */
308         jmp     ra,(pv)                   /* call JIT compiler                    */
309 calljava_jit2:
310         lda     pv,-64(ra)                /* asm_calljavafunction-calljava_jit !!!!!*/
311
312 calljava_return2:
313
314         ldq     ra,0(sp)                  /* restore return address               */
315         ldq     gp,24(sp)                 /* restore global pointer               */
316         lda     sp,32(sp)                 /* free stack space                     */
317
318 /*      ldl     v0,newcompiler */         /* load newcompiler flag                */
319 /*      subq    v0,1,v0        */         /* negate for clearing v0               */
320 /*      beq     v0,calljava_ret*/         /* if newcompiler skip ex copying       */
321 /*      mov     $1,v0 */                  /* pass exception to caller (C)         */
322 calljava_ret2:
323         jmp     zero,(ra)
324
325 calljava_xhandler2:
326
327         ldq     gp,24(sp)                 /* restore global pointer               */
328         mov     itmp1,a0
329         jsr     ra,builtin_throw_exception
330         ldq     ra,0(sp)                  /* restore return address               */
331         lda     sp,32(sp)                 /* free stack space                     */
332         jmp     zero,(ra)
333         .end    asm_calljavafunction
334                                                 
335
336 /****************** function asm_call_jit_compiler *****************************
337 *                                                                              *
338 *   invokes the compiler for untranslated JavaVM methods.                      *
339 *                                                                              *
340 *   Register R0 contains a pointer to the method info structure (prepared      *
341 *   by createcompilerstub). Using the return address in R26 and the            *
342 *   offset in the LDA instruction or using the value in methodptr R28 the      *
343 *   patching address for storing the method address can be computed:           *
344 *                                                                              *
345 *   method address was either loaded using                                     *
346 *   M_LDQ (REG_PV, REG_PV, a)        ; invokestatic/special    ($27)           *
347 *   M_LDA (REG_PV, REG_RA, low)                                                *
348 *   M_LDAH(REG_PV, REG_RA, high)     ; optional                                *
349 *   or                                                                         *
350 *   M_LDQ (REG_PV, REG_METHODPTR, m) ; invokevirtual/interface ($28)           *
351 *   in the static case the method pointer can be computed using the            *
352 *   return address and the lda function following the jmp instruction          *
353 *                                                                              *
354 *******************************************************************************/
355
356
357         .ent    asm_call_jit_compiler
358 asm_call_jit_compiler:
359
360         .frame $30,0,$26
361         ldgp    gp,0(pv)
362         ldl     t8,-8(ra)             /* load instruction LDQ PV,xxx($yy)         */
363         srl     t8,16,t8              /* shift right register number $yy          */
364         and     t8,31,t8              /* isolate register number                  */
365         subl    t8,28,t8              /* test for REG_METHODPTR                   */
366         beq     t8,noregchange       
367         ldl     t8,0(ra)              /* load instruction LDA PV,xxx(RA)          */
368         sll     t8,48,t8
369         sra     t8,48,t8              /* isolate offset                           */
370         addq    t8,ra,$28             /* compute update address                   */
371         ldl     t8,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
372         srl     t8,16,t8              /* isolate instruction code                 */
373         lda     t8,-0x177b(t8)        /* test for LDAH                            */
374         bne     t8,noregchange       
375         ldl     t8,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
376         sll     t8,16,t8              /* compute high offset                      */
377         addl    t8,0,t8               /* sign extend high offset                  */
378         addq    t8,$28,$28            /* compute update address                   */
379 noregchange:
380         lda     sp,-14*8(sp)          /* reserve stack space                      */
381         stq     a0,0*8(sp)            /* save all argument registers              */
382         stq     a1,1*8(sp)            /* they could be used by method             */
383         stq     a2,2*8(sp)
384         stq     a3,3*8(sp)
385         stq     a4,4*8(sp)
386         stq     a5,5*8(sp)
387         stt     $f16,6*8(sp)
388         stt     $f17,7*8(sp)
389         stt     $f18,8*8(sp)
390         stt     $f19,9*8(sp)
391         stt     $f20,10*8(sp)
392         stt     $f21,11*8(sp)
393         stq     $28,12*8(sp)          /* save method pointer                      */
394         stq     ra,13*8(sp)           /* save return address                      */
395
396         ldq     a0,0(v0)              /* pass 'methodinfo' pointer to             */
397         jsr     ra,jit_compile        /* jit compiler                             */
398         ldgp    gp,0(ra)
399
400         call_pal PAL_imb              /* synchronise instruction cache            */
401
402         ldq     a0,0*8(sp)            /* load argument registers                  */
403         ldq     a1,1*8(sp)
404         ldq     a2,2*8(sp)
405         ldq     a3,3*8(sp)
406         ldq     a4,4*8(sp)
407         ldq     a5,5*8(sp)
408         ldt     $f16,6*8(sp)
409         ldt     $f17,7*8(sp)
410         ldt     $f18,8*8(sp)
411         ldt     $f19,9*8(sp)
412         ldt     $f20,10*8(sp)
413         ldt     $f21,11*8(sp)
414         ldq     $28,12*8(sp)          /* load method pointer                      */
415         ldq     ra,13*8(sp)           /* load return address                      */
416         lda     sp,14*8(sp)           /* deallocate stack area                    */
417
418         ldl     t8,-8(ra)             /* load instruction LDQ PV,xxx($yy)         */
419         sll     t8,48,t8
420         sra     t8,48,t8              /* isolate offset                           */
421
422         addq    t8,$28,t8             /* compute update address via method pointer*/
423         stq     v0,0(t8)              /* save new method address there            */
424
425         mov     v0,pv                 /* load method address into pv              */
426
427         jmp     zero,(pv)             /* and call method. The method returns      */
428                                       /* directly to the caller (ra).             */
429
430         .end    asm_call_jit_compiler
431
432
433 /****************** function asm_dumpregistersandcall **************************
434 *                                                                              *
435 *   This funtion saves all callee saved registers and calls the function       *
436 *   which is passed as parameter.                                              *
437 *                                                                              *
438 *   This function is needed by the garbage collector, which needs to access    *
439 *   all registers which are stored on the stack. Unused registers are          *
440 *   cleared to avoid interferances with the GC.                                *
441 *                                                                              *
442 *   void asm_dumpregistersandcall (functionptr f);                             *
443 *                                                                              *
444 *******************************************************************************/
445
446         .ent    asm_dumpregistersandcall
447 asm_dumpregistersandcall:
448         lda     sp,-16*8(sp)          /* allocate stack                           */
449         stq     ra,0(sp)              /* save return address                      */
450
451         stq     s0,1*8(sp)            /* save all callee saved registers          */
452         stq     s1,2*8(sp)            /* intialize the remaining registers        */
453         stq     s2,3*8(sp)
454         stq     s3,4*8(sp)
455         stq     s4,5*8(sp)
456         stq     s5,6*8(sp)
457         stq     s6,7*8(sp)
458         stt     $f2,8*8(sp)
459         stt     $f3,9*8(sp)
460         stt     $f4,10*8(sp)
461         stt     $f5,11*8(sp)
462         stt     $f6,12*8(sp)
463         stt     $f7,13*8(sp)
464         stt     $f8,14*8(sp)
465         stt     $f9,15*8(sp)
466
467         clr     v0                   /* intialize the remaining registers         */
468         clr     t0
469         clr     t1
470         clr     t2
471         clr     t3
472         clr     t4
473         clr     t5
474         clr     t6
475         clr     t7
476         clr     a1
477         clr     a2
478         clr     a3
479         clr     a4
480         clr     a5
481         clr     t8
482         clr     t9
483         clr     t10
484         clr     t11
485         clr     t12
486         clr     $28
487         clr     $29
488         cpys    $f31,$f31,$f0
489         cpys    $f31,$f31,$f1
490         cpys    $f31,$f31,$f10
491         cpys    $f31,$f31,$f11
492         cpys    $f31,$f31,$f12
493         cpys    $f31,$f31,$f13
494         cpys    $f31,$f31,$f14
495         cpys    $f31,$f31,$f15
496         cpys    $f31,$f31,$f16
497         cpys    $f31,$f31,$f17
498         cpys    $f31,$f31,$f18
499         cpys    $f31,$f31,$f19
500         cpys    $f31,$f31,$f20
501         cpys    $f31,$f31,$f21
502         cpys    $f31,$f31,$f22
503         cpys    $f31,$f31,$f23
504         cpys    $f31,$f31,$f24
505         cpys    $f31,$f31,$f25
506         cpys    $f31,$f31,$f26
507         cpys    $f31,$f31,$f27
508         cpys    $f31,$f31,$f28
509         cpys    $f31,$f31,$f29
510         cpys    $f31,$f31,$f30
511
512         mov     a0,pv                 /* load function pointer                    */
513         jmp     ra,(pv)               /* and call function                        */
514
515         ldq     ra,0(sp)              /* load return address                      */
516         lda     sp,16*8(sp)           /* deallocate stack                         */
517         jmp     zero,(ra)             /* return                                   */
518
519         .end    asm_dumpregistersandcall
520
521
522 /********************* function asm_handle_exception ***************************
523 *                                                                              *
524 *   This function handles an exception. It does not use the usual calling      *
525 *   conventions. The exception pointer is passed in REG_ITMP1 and the          *
526 *   pc from the exception raising position is passed in REG_ITMP2. It searches *
527 *   the local exception table for a handler. If no one is found, it unwinds    *
528 *   stacks and continues searching the callers.                                *
529 *                                                                              *
530 *   void asm_handle_exception (exceptionptr, exceptionpc);                     *
531 *                                                                              *
532 *******************************************************************************/
533
534         .ent    asm_handle_nat_exception
535 asm_handle_nat_exception:
536
537         ldl     t0,0(ra)              /* load instruction LDA PV,xxx(RA)          */
538         sll     t0,48,t0
539         sra     t0,48,t0              /* isolate offset                           */
540         addq    t0,ra,pv              /* compute update address                   */
541         ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
542         srl     t0,16,t0              /* isolate instruction code                 */
543         lda     t0,-0x177b(t0)        /* test for LDAH                            */
544         bne     t0,asm_handle_exception       
545         ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
546         sll     t0,16,t0              /* compute high offset                      */
547         addl    t0,0,t0               /* sign extend high offset                  */
548         addq    t0,pv,pv              /* compute update address                   */
549
550         .aent    asm_handle_exception
551 asm_handle_exception:
552
553         lda     sp,-18*8(sp)          /* allocate stack                           */
554         stq     t0,0*8(sp)            /* save possible used registers             */
555         stq     t1,1*8(sp)            /* also registers used by trace_exception   */
556         stq     t2,2*8(sp)
557         stq     t3,3*8(sp)
558         stq     t4,4*8(sp)
559         stq     t5,5*8(sp)
560         stq     t6,6*8(sp)
561         stq     t7,7*8(sp)
562         stq     t8,8*8(sp)
563         stq     t9,9*8(sp)
564         stq     t10,10*8(sp)
565         stq     v0,11*8(sp)
566         stq     a0,12*8(sp)
567         stq     a1,13*8(sp)
568         stq     a2,14*8(sp)
569         stq     a3,15*8(sp)
570         stq     a4,16*8(sp)
571         stq     a5,17*8(sp)
572
573         lda     t3,1(zero)            /* set no unwind flag                       */
574 ex_stack_loop:
575         lda     sp,-5*8(sp)           /* allocate stack                           */
576         stq     xptr,0*8(sp)          /* save used register                       */
577         stq     xpc,1*8(sp)
578         stq     pv,2*8(sp)
579         stq     ra,3*8(sp)
580         stq     t3,4*8(sp)
581
582         mov     xptr,a0
583         ldq     a1,MethodPointer(pv)
584         mov     xpc,a2
585         mov     t3,a3
586         br      ra,ex_trace           /* set ra for gp loading                    */
587 ex_trace:
588         ldgp    gp,0(ra)              /* load gp                                  */
589         jsr     ra,builtin_trace_exception /* trace_exception(xptr,methodptr)     */
590         
591         ldq     xptr,0*8(sp)          /* restore used register                    */
592         ldq     xpc,1*8(sp)
593         ldq     pv,2*8(sp)
594         ldq     ra,3*8(sp)
595         ldq     t3,4*8(sp)
596         lda     sp,5*8(sp)            /* deallocate stack                         */
597         
598         ldl     t0,ExTableSize(pv)    /* t0 = exception table size                */
599         beq     t0,empty_table        /* if empty table skip                      */
600         lda     t1,ExTableStart(pv)   /* t1 = start of exception table            */
601
602 ex_table_loop:
603         ldq     t2,ExStartPC(t1)      /* t2 = exception start pc                  */
604         cmple   t2,xpc,t2             /* t2 = (startpc <= xpc)                    */
605         beq     t2,ex_table_cont      /* if (false) continue                      */
606         ldq     t2,ExEndPC(t1)        /* t2 = exception end pc                    */
607         cmplt   xpc,t2,t2             /* t2 = (xpc < endpc)                       */
608         beq     t2,ex_table_cont      /* if (false) continue                      */
609         ldq     a1,ExCatchType(t1)    /* arg1 = exception catch type              */
610         beq     a1,ex_handle_it       /* NULL catches everything                  */
611
612         ldq     a0,offobjvftbl(xptr)  /* a0 = vftblptr(xptr)                      */
613         ldq     a1,offobjvftbl(a1)    /* a1 = vftblptr(catchtype) class (not obj) */
614         ldl     a0,offbaseval(a0)     /* a0 = baseval(xptr)                       */
615         ldl     v0,offbaseval(a1)     /* a2 = baseval(catchtype)                  */
616         ldl     a1,offdiffval(a1)     /* a1 = diffval(catchtype)                  */
617         subl    a0,v0,a0              /* a0 = baseval(xptr) - baseval(catchtype)  */
618         cmpule  a0,a1,v0              /* v0 = xptr is instanceof catchtype        */
619         beq     v0,ex_table_cont      /* if (false) continue                      */
620
621 ex_handle_it:
622
623         ldq     xpc,ExHandlerPC(t1)   /* xpc = exception handler pc               */
624
625         beq     t3,ex_jump            /* if (!(no stack unwinding) skip           */
626
627         ldq     t0,0*8(sp)            /* restore possible used registers          */
628         ldq     t1,1*8(sp)            /* also registers used by trace_exception   */
629         ldq     t2,2*8(sp)
630         ldq     t3,3*8(sp)
631         ldq     t4,4*8(sp)
632         ldq     t5,5*8(sp)
633         ldq     t6,6*8(sp)
634         ldq     t7,7*8(sp)
635         ldq     t8,8*8(sp)
636         ldq     t9,9*8(sp)
637         ldq     t10,10*8(sp)
638         ldq     v0,11*8(sp)
639         ldq     a0,12*8(sp)
640         ldq     a1,13*8(sp)
641         ldq     a2,14*8(sp)
642         ldq     a3,15*8(sp)
643         ldq     a4,16*8(sp)
644         ldq     a5,17*8(sp)
645         lda     sp,18*8(sp)           /* deallocate stack                         */
646
647 ex_jump:
648         jmp     zero,(xpc)            /* jump to the handler                      */
649
650 ex_table_cont:
651         lda     t1,ExEntrySize(t1)    /* next exception table entry               */
652         subl    t0,1,t0               /* decrement entry counter                  */
653         bgt     t0,ex_table_loop      /* if (t0 > 0) next entry                   */
654
655 empty_table:
656         beq     t3,ex_already_cleared /* if here the first time, then             */
657         lda     sp,18*8(sp)           /* deallocate stack and                     */
658         clr     t3                    /* clear the no unwind flag                 */
659 ex_already_cleared:
660         ldl     t0,IsSync(pv)         /* t0 = SyncOffset                          */
661         beq     t0,no_monitor_exit    /* if zero no monitorexit                   */
662         addq    sp,t0,t0              /* add stackptr to Offset                   */
663         ldq     a0,-8(t0)             /* load monitorexit pointer                 */
664
665         lda     sp,-7*8(sp)           /* allocate stack                           */
666         stq     t0,0*8(sp)            /* save used register                       */
667         stq     t1,1*8(sp)
668         stq     t3,2*8(sp)
669         stq     xptr,3*8(sp)
670         stq     xpc,4*8(sp)
671         stq     pv,5*8(sp)
672         stq     ra,6*8(sp)
673
674         br      ra,ex_mon_load        /* set ra for gp loading                    */
675 ex_mon_load:
676         ldgp    gp,0(ra)              /* load gp                                  */
677         jsr     ra,builtin_monitorexit/* builtin_monitorexit(objectptr)           */
678         
679         ldq     t0,0*8(sp)            /* restore used register                    */
680         ldq     t1,1*8(sp)
681         ldq     t3,2*8(sp)
682         ldq     xptr,3*8(sp)
683         ldq     xpc,4*8(sp)
684         ldq     pv,5*8(sp)
685         ldq     ra,6*8(sp)
686         lda     sp,7*8(sp)            /* deallocate stack                         */
687
688 no_monitor_exit:
689         ldl     t0,FrameSize(pv)      /* t0 = frame size                          */
690         addq    sp,t0,sp              /* unwind stack                             */
691         mov     sp,t0                 /* t0 = pointer to save area                */
692         ldl     t1,IsLeaf(pv)         /* t1 = is leaf procedure                   */
693         bne     t1,ex_no_restore      /* if (leaf) skip                           */
694         ldq     ra,-8(t0)             /* restore ra                               */
695         lda     t0,-8(t0)             /* t0--                                     */
696 ex_no_restore:
697         mov     ra,xpc                /* the new xpc is ra                        */
698         ldl     t1,IntSave(pv)        /* t1 = saved int register count            */
699         br      t2,ex_int1            /* t2 = current pc                          */
700 ex_int1:
701         lda     t2,44(t2)             /* lda t2,ex_int2-ex_int1(t2) !!!!!!!!!!!!! */
702         negl    t1,t1                 /* negate register count                    */
703         s4addq  t1,t2,t2              /* t2 = ex_int_sav - 4 * register count     */
704         jmp     zero,(t2)             /* jump to save position                    */
705         ldq     s0,-56(t0)
706         ldq     s1,-48(t0)
707         ldq     s2,-40(t0)
708         ldq     s3,-32(t0)
709         ldq     s4,-24(t0)
710         ldq     s5,-16(t0)
711         ldq     s6,-8(t0)
712 ex_int2:
713         s8addq  t1,t0,t0              /* t0 = t0 - 8 * register count             */
714
715         ldl     t1,FltSave(pv)        /* t1 = saved flt register count            */
716         br      t2,ex_flt1            /* t2 = current pc                          */
717 ex_flt1:
718         lda     t2,48(t2)             /* lda t2,ex_flt2-ex_flt1(t2) !!!!!!!!!!!!! */
719         negl    t1,t1                 /* negate register count                    */
720         s4addq  t1,t2,t2              /* t2 = ex_flt_sav - 4 * register count     */
721         jmp     zero,(t2)             /* jump to save position                    */
722         ldt     $f2,-64(t0)
723         ldt     $f3,-56(t0)
724         ldt     $f4,-48(t0)
725         ldt     $f5,-40(t0)
726         ldt     $f6,-32(t0)
727         ldt     $f7,-24(t0)
728         ldt     $f8,-16(t0)
729         ldt     $f9,-8(t0)
730 ex_flt2:
731         ldl     t0,0(ra)              /* load instruction LDA PV,xxx(RA)          */
732         sll     t0,48,t0
733         sra     t0,48,t0              /* isolate offset                           */
734         addq    t0,ra,pv              /* compute update address                   */
735         ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
736         srl     t0,16,t0              /* isolate instruction code                 */
737         lda     t0,-0x177b(t0)        /* test for LDAH                            */
738         bne     t0,ex_stack_loop       
739         ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(RA)         */
740         sll     t0,16,t0              /* compute high offset                      */
741         addl    t0,0,t0               /* sign extend high offset                  */
742         addq    t0,pv,pv              /* compute update address                   */
743         br      ex_stack_loop
744
745         .end    asm_handle_nat_exception
746
747
748 /********************* function asm_builtin_monitorenter ***********************
749 *                                                                              *
750 *   Does null check and calls monitorenter or throws an exception              *
751 *                                                                              *
752 *******************************************************************************/
753
754         .ent    asm_builtin_monitorenter
755 asm_builtin_monitorenter:
756
757         ldgp    gp,0(pv)
758         lda     pv,builtin_monitorenter
759         beq     a0,nb_monitorenter        /* if (null) throw exception            */
760         jmp     zero,(pv)                 /* else call builtin_monitorenter       */
761
762 nb_monitorenter:
763         ldq     xptr,proto_java_lang_NullPointerException
764         lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
765         br      asm_handle_nat_exception
766         .end    asm_builtin_monitorenter
767
768
769 /********************* function asm_builtin_monitorexit ************************
770 *                                                                              *
771 *   Does null check and calls monitorexit or throws an exception               *
772 *                                                                              *
773 *******************************************************************************/
774
775         .ent    asm_builtin_monitorexit
776 asm_builtin_monitorexit:
777
778         ldgp    gp,0(pv)
779         lda     pv,builtin_monitorexit
780         beq     a0,nb_monitorexit         /* if (null) throw exception            */
781         jmp     zero,(pv)                 /* else call builtin_monitorexit        */
782
783 nb_monitorexit:
784         ldq     xptr,proto_java_lang_NullPointerException
785         lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
786         br      asm_handle_nat_exception
787         .end    asm_builtin_monitorexit
788
789
790 /************************ function asm_builtin_idiv ****************************
791 *                                                                              *
792 *   Does null check and calls idiv or throws an exception                      *
793 *                                                                              *
794 *******************************************************************************/
795
796         .ent    asm_builtin_idiv
797 asm_builtin_idiv:
798
799         ldgp    gp,0(pv)
800         lda     pv,builtin_idiv
801         beq     a1,nb_idiv                /* if (null) throw exception            */
802         jmp     zero,(pv)                 /* else call builtin_idiv               */
803
804 nb_idiv:
805         ldq     xptr,proto_java_lang_ArithmeticException
806         lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
807         br      asm_handle_nat_exception
808         .end    asm_builtin_idiv
809
810
811 /************************ function asm_builtin_ldiv ****************************
812 *                                                                              *
813 *   Does null check and calls ldiv or throws an exception                      *
814 *                                                                              *
815 *******************************************************************************/
816
817         .ent    asm_builtin_ldiv
818 asm_builtin_ldiv:
819
820         ldgp    gp,0(pv)
821         lda     pv,builtin_ldiv
822         beq     a1,nb_ldiv                /* if (null) throw exception            */
823         jmp     zero,(pv)                 /* else call builtin_ldiv               */
824
825 nb_ldiv:
826         ldq     xptr,proto_java_lang_ArithmeticException
827         lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
828         br      asm_handle_nat_exception
829         .end    asm_builtin_ldiv
830
831
832 /************************ function asm_builtin_irem ****************************
833 *                                                                              *
834 *   Does null check and calls irem or throws an exception                      *
835 *                                                                              *
836 *******************************************************************************/
837
838         .ent    asm_builtin_irem
839 asm_builtin_irem:
840
841         ldgp    gp,0(pv)
842         lda     pv,builtin_irem
843         beq     a1,nb_irem                /* if (null) throw exception            */
844         jmp     zero,(pv)                 /* else call builtin_irem               */
845
846 nb_irem:
847         ldq     xptr,proto_java_lang_ArithmeticException
848         lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
849         br      asm_handle_nat_exception
850         .end    asm_builtin_irem
851
852
853 /************************ function asm_builtin_lrem ****************************
854 *                                                                              *
855 *   Does null check and calls lrem or throws an exception                      *
856 *                                                                              *
857 *******************************************************************************/
858
859         .ent    asm_builtin_lrem
860 asm_builtin_lrem:
861
862         ldgp    gp,0(pv)
863         lda     pv,builtin_lrem
864         beq     a1,nb_lrem                /* if (null) throw exception            */
865         jmp     zero,(pv)                 /* else call builtin_lrem               */
866
867 nb_lrem:
868         ldq     xptr,proto_java_lang_ArithmeticException
869         lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
870         br      asm_handle_nat_exception
871         .end    asm_builtin_lrem
872
873
874  /*********************** function new_builtin_checkcast ************************
875  *                                                                              *
876  *   Does the cast check and eventually throws an exception                     *
877  *                                                                              *
878  *******************************************************************************/
879
880     .ent    asm_builtin_checkcast
881 asm_builtin_checkcast:
882
883     ldgp    gp,0(pv)
884     lda     sp,-16(sp)                  # allocate stack space
885     stq     ra,0(sp)                    # save return address
886     stq     a0,8(sp)                    # save object pointer
887     jsr     ra,builtin_checkcast        # builtin_checkcast
888     ldgp    gp,0(ra)
889     beq     v0,nb_ccast_throw           # if (false) throw exception
890     ldq     ra,0(sp)                    # restore return address
891     ldq     v0,8(sp)                    # return object pointer
892     lda     sp,16(sp)                   # free stack space
893     jmp     zero,(ra)
894
895 nb_ccast_throw:
896     ldq     xptr,proto_java_lang_ClassCastException
897     ldq     ra,0(sp)                    # restore return address
898     lda     sp,16(sp)                   # free stack space
899     lda     xpc,-4(ra)                  # faulting address is return adress - 4
900     br      asm_handle_nat_exception
901     .end    asm_builtin_checkcast
902
903                 
904 /******************* function asm_builtin_checkarraycast ***********************
905 *                                                                              *
906 *   Does the cast check and eventually throws an exception                     *
907 *                                                                              *
908 *******************************************************************************/
909
910         .ent    asm_builtin_checkarraycast
911 asm_builtin_checkarraycast:
912
913         ldgp    gp,0(pv)
914         lda     sp,-16(sp)                /* allocate stack space                 */
915         stq     ra,0(sp)                  /* save return address                  */
916         stq     a0,8(sp)                  /* save object pointer                  */
917         jsr     ra,builtin_checkarraycast /* builtin_checkarraycast               */
918         ldgp    gp,0(ra)
919         beq     v0,nb_carray_throw        /* if (false) throw exception           */
920         ldq     ra,0(sp)                  /* restore return address               */
921         ldq     v0,8(sp)                  /* return object pointer                */
922         lda     sp,16(sp)                 /* free stack space                     */
923         jmp     zero,(ra)
924
925 nb_carray_throw:
926         ldq     xptr,proto_java_lang_ClassCastException
927         ldq     ra,0(sp)                  /* restore return address               */
928         lda     sp,16(sp)                 /* free stack space                     */
929         lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
930         br      asm_handle_nat_exception
931         .end    asm_builtin_checkarraycast
932
933
934 /******************* function asm_builtin_aastore ******************************
935 *                                                                              *
936 *   Does the cast check and eventually throws an exception                     *
937 *                                                                              *
938 *******************************************************************************/
939
940         .ent    asm_builtin_aastore
941 asm_builtin_aastore:
942
943         ldgp    gp,0(pv)
944         beq     a0,nb_aastore_null        /* if null pointer throw exception      */
945         ldl     t0,offarraysize(a0)       /* load size                            */
946         lda     sp,-24(sp)                /* allocate stack space                 */
947         stq     ra,0(sp)                  /* save return address                  */
948         s8addq  a1,a0,t1                  /* add index*8 to arrayref              */
949         cmpult  a1,t0,t0                  /* do bound check                       */
950         beq     t0,nb_aastore_bound       /* if out of bounds throw exception     */
951         mov     a2,a1                     /* object is second argument            */
952         stq     t1,8(sp)                  /* save store position                  */
953         stq     a1,16(sp)                 /* save object                          */
954         jsr     ra,builtin_canstore       /* builtin_canstore(arrayref,object)    */
955         ldgp    gp,0(ra)
956         ldq     ra,0(sp)                  /* restore return address               */
957         ldq     a0,8(sp)                  /* restore store position               */
958         ldq     a1,16(sp)                 /* restore object                       */
959         lda     sp,24(sp)                 /* free stack space                     */
960         beq     v0,nb_aastore_throw       /* if (false) throw exception           */
961         stq     a1,offobjarrdata(a0)      /* store objectptr in array             */
962         jmp     zero,(ra)
963
964 nb_aastore_null:
965         ldq     xptr,proto_java_lang_NullPointerException
966         mov     ra,xpc                    /* faulting address is return adress    */
967         br      asm_handle_nat_exception
968
969 nb_aastore_bound:
970         ldq     xptr,proto_java_lang_ArrayIndexOutOfBoundsException
971         lda     sp,24(sp)                 /* free stack space                     */
972         mov     ra,xpc                    /* faulting address is return adress    */
973         br      asm_handle_nat_exception
974
975 nb_aastore_throw:
976         ldq     xptr,proto_java_lang_ArrayStoreException
977         mov     ra,xpc                    /* faulting address is return adress    */
978         br      asm_handle_nat_exception
979
980         .end    asm_builtin_aastore
981
982
983 /******************* function asm_initialize_thread_stack **********************
984 *                                                                              *
985 *   initialized a thread stack                                                 *
986 *                                                                              *
987 *******************************************************************************/
988
989         .ent    asm_initialize_thread_stack
990 asm_initialize_thread_stack:
991
992         lda     a1,-128(a1)
993         stq     zero, 0(a1)
994         stq     zero, 8(a1)
995         stq     zero, 16(a1)
996         stq     zero, 24(a1)
997         stq     zero, 32(a1)
998         stq     zero, 40(a1)
999         stq     zero, 48(a1)
1000         stt     fzero, 56(a1)
1001         stt     fzero, 64(a1)
1002         stt     fzero, 72(a1)
1003         stt     fzero, 80(a1)
1004         stt     fzero, 88(a1)
1005         stt     fzero, 96(a1)
1006         stt     fzero, 104(a1)
1007         stt     fzero, 112(a1)
1008         stq     a0, 120(a1)
1009         mov     a1, v0
1010         jmp     zero,(ra)
1011         .end    asm_initialize_thread_stack
1012
1013
1014 /******************* function asm_perform_threadswitch *************************
1015 *                                                                              *
1016 *   void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);         *
1017 *                                                                              *
1018 *   performs a threadswitch                                                    *
1019 *                                                                              *
1020 *******************************************************************************/
1021
1022         .ent    asm_perform_threadswitch
1023 asm_perform_threadswitch:
1024
1025         subq    sp,128,sp
1026         stq     s0, 0(sp)
1027         stq     s1, 8(sp)
1028         stq     s2, 16(sp)
1029         stq     s3, 24(sp)
1030         stq     s4, 32(sp)
1031         stq     s5, 40(sp)
1032         stq     s6, 48(sp)
1033         stt     sf0, 56(sp)
1034         stt     sf1, 64(sp)
1035         stt     sf2, 72(sp)
1036         stt     sf3, 80(sp)
1037         stt     sf4, 88(sp)
1038         stt     sf5, 96(sp)
1039         stt     sf6, 104(sp)
1040         stt     sf7, 112(sp)
1041         stq     ra, 120(sp)
1042         stq     sp, 0(a0)
1043         stq     sp, 0(a2)
1044         ldq     sp, 0(a1)
1045         ldq     s0, 0(sp)
1046         ldq     s1, 8(sp)
1047         ldq     s2, 16(sp)
1048         ldq     s3, 24(sp)
1049         ldq     s4, 32(sp)
1050         ldq     s5, 40(sp)
1051         ldq     s6, 48(sp)
1052         ldt     sf0, 56(sp)
1053         ldt     sf1, 64(sp)
1054         ldt     sf2, 72(sp)
1055         ldt     sf3, 80(sp)
1056         ldt     sf4, 88(sp)
1057         ldt     sf5, 96(sp)
1058         ldt     sf6, 104(sp)
1059         ldt     sf7, 112(sp)
1060         ldq     ra, 120(sp)
1061         mov     ra, pv
1062         addq    sp, 128, sp
1063         jmp     zero,(ra)
1064         .end    asm_perform_threadswitch
1065
1066
1067 /********************* function asm_switchstackandcall *************************
1068 *                                                                              *
1069 *  void *asm_switchstackandcall (void *stack, void *func, void **stacktopsave, *
1070 *                               void *p);                                      *
1071 *                                                                              *
1072 *   Switches to a new stack, calls a function and switches back.               *
1073 *       a0      new stack pointer                                              *
1074 *       a1      function pointer                                               *
1075 *               a2              pointer to variable where stack top should be stored           *
1076 *               a3      pointer to user data, is passed to the function                *
1077 *                                                                              *
1078 *******************************************************************************/
1079
1080
1081         .ent    asm_switchstackandcall
1082 asm_switchstackandcall:
1083         lda     a0,-2*8(a0)     /* allocate new stack                                 */
1084         stq     ra,0(a0)        /* save return address on new stack                   */
1085         stq     sp,1*8(a0)      /* save old stack pointer on new stack                */
1086         stq sp,0(a2)        /* save old stack pointer to variable                 */
1087         mov     a0,sp           /* switch to new stack                                */
1088         
1089         mov     a1,pv           /* load function pointer                              */
1090         mov a3,a0           /* pass pointer */
1091         jmp     ra,(pv)         /* and call function                                  */
1092
1093         ldq     ra,0(sp)        /* load return address                                */
1094         ldq     sp,1*8(sp)      /* switch to old stack                                */
1095
1096         jmp     zero,(ra)       /* return                                             */
1097
1098         .end    asm_switchstackandcall
1099
1100                 
1101 /********************* function asm_getcallingmethod ***************************
1102 *                                                                              *
1103 *   classinfo *asm_getcallingmethodclass ();                                                               *
1104 *                                                                                                                                                          *    
1105 *   goes back stack frames to get the calling method                                               *       
1106 *                                                                                                                                                          *    
1107 *                               t2 .. sp                                                                                                       *
1108 *                               t3 .. ra                                                                                                       *
1109 *                               t4 .. pv                                                                                                       *
1110 *                                                                              *
1111 *******************************************************************************/
1112
1113
1114         .ent    asm_getcallingmethod
1115 asm_getcallingmethod:
1116
1117         ldq             t3,16(sp)             /* load return address of native function   */                            
1118         addq    sp,24,t2                          /* skip frames of C-Function and nativestub */        
1119                 
1120     /* determine pv (t3) of java-function from ra */
1121
1122         ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
1123         sll     t0,48,t0
1124         sra     t0,48,t0              /* isolate offset                           */
1125         addq    t0,t3,t4              /* compute update address                   */
1126         ldl     t0,4(t3)              /* load instruction LDAH PV,xxx(PV)         */
1127         srl     t0,16,t0              /* isolate instruction code                 */
1128         lda     t0,-0x177b(t0)        /* test for LDAH                            */
1129         bne     t0,pv_ok1       
1130         ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
1131         sll     t0,16,t0              /* compute high offset                      */
1132         addl    t0,0,t0               /* sign extend high offset                  */
1133         addq    t0,t4,t4              /* compute update address                   */
1134
1135 pv_ok1:                 
1136         ldl     t0,FrameSize(t4)      /* t0 = frame size                          */            
1137         addq    t2,t0,t2                          /* skip frame of java function                          */
1138         ldq             t3,-8(t2)                         /* load new ra                              */                                                                
1139
1140     /* determine pv (t3) of java-function from ra */
1141
1142         ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
1143         sll     t0,48,t0
1144         sra     t0,48,t0              /* isolate offset                           */
1145         addq    t0,t3,t4              /* compute update address                   */
1146         ldl     t0,4(t3)              /* load instruction LDAH PV,xxx(PV)         */
1147         srl     t0,16,t0              /* isolate instruction code                 */
1148         lda     t0,-0x177b(t0)        /* test for LDAH                            */
1149         bne     t0,pv_ok2
1150         ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
1151         sll     t0,16,t0              /* compute high offset                      */
1152         addl    t0,0,t0               /* sign extend high offset                  */
1153         addq    t0,t4,t4              /* compute update address                   */
1154
1155 pv_ok2:         
1156         ldq     v0,MethodPointer(t4)  /*                                                                                  */
1157
1158                                                                                 
1159         jmp     zero,(ra)                                 /* return                                   */
1160
1161         .end    asm_getcallingmethod
1162
1163
1164
1165
1166
1167
1168
1169
1170 /*********************** function asm_builtin_trace ****************************
1171 *                                                                              *
1172 *   Intended to be called from the native stub. Saves all argument registers   *
1173 *   and calls builtin_trace_args.                                              *
1174 *                                                                              *
1175 *******************************************************************************/
1176
1177         .ent asm_builtin_trace
1178 asm_builtin_trace:
1179         ldgp gp,0(pv)
1180         lda sp,-112(sp)
1181         stq itmp1,0(sp)
1182         stq ra,8(sp)
1183         stq a0,16(sp)
1184         stq a1,24(sp)
1185         stq a2,32(sp)
1186         stq a3,40(sp)
1187         stq a4,48(sp)
1188         stq a5,56(sp)
1189         stt $f16,64(sp)
1190         stt $f17,72(sp)
1191         stt $f18,80(sp)
1192         stt $f19,88(sp)
1193         stt $f20,96(sp)
1194         stt $f21,104(sp)
1195         
1196         jsr ra,builtin_trace_args
1197         
1198         ldq ra,8(sp)
1199         ldq a0,16(sp)
1200         ldq a1,24(sp)
1201         ldq a2,32(sp)
1202         ldq a3,40(sp)
1203         ldq a4,48(sp)
1204         ldq a5,56(sp)
1205         ldt $f16,64(sp)
1206         ldt $f17,72(sp)
1207         ldt $f18,80(sp)
1208         ldt $f19,88(sp)
1209         ldt $f20,96(sp)
1210         ldt $f21,104(sp)
1211         lda sp,112(sp)
1212         jmp zero,(ra)
1213
1214         .end asm_builtin_trace
1215
1216
1217 /********************* function asm_builtin_exittrace **************************
1218 *                                                                              *
1219 *   Intended to be called from the native stub. Saves return value and calls   *
1220 *   builtin_displaymethodstop.                                                 *
1221 *                                                                              *
1222 *******************************************************************************/
1223
1224         .ent asm_builtin_exittrace
1225 asm_builtin_exittrace:
1226         ldgp gp,0(pv)
1227         lda sp,-24(sp)
1228         stq ra,0(sp)
1229         stq v0,8(sp)
1230         stt $f0,16(sp)
1231         
1232         jsr ra,builtin_displaymethodstop
1233         
1234         ldq ra,0(sp)
1235         ldq v0,8(sp)
1236         ldt $f0,16(sp)
1237         lda sp,24(sp)
1238         jmp zero,(ra)
1239
1240         .end asm_builtin_exittrace