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