Use exception generating functions.
[cacao.git] / src / vm / jit / powerpc / asmpart.S
1 /* jit/powerpc/asmpart.S - Java-C interface functions for powerpc
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.text;  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 1501 2004-11-12 16:36:13Z twisti $
32
33 */
34
35 #include "config.h"
36 #include "jit/powerpc/offsets.h"
37
38
39 #define     MethodPointer   -8
40 #define     FrameSize       -12
41 #define     IsSync          -16
42 #define     IsLeaf          -20
43 #define     IntSave         -24
44 #define     FltSave         -28
45 #define     ExTableSize     -32
46 #define     ExTableStart    -32
47
48 #define     ExEntrySize     -16
49 #define     ExStartPC       -4
50 #define     ExEndPC         -8
51 #define     ExHandlerPC     -12
52 #define     ExCatchType     -16
53
54 #define itmp1 r11
55 #define itmp2 r12
56 #define itmp3 r0
57
58 #define xptr itmp1
59 #define xpc itmp2
60
61 #define pv r13
62 #define mptr r12
63 #define mptrn 12
64
65
66         .text
67
68         .align 2
69
70         .globl _asm_calljavafunction
71         .globl _asm_calljavafunction2
72         .globl _asm_calljavafunction2long
73         .globl _asm_calljavafunction2double
74         .globl _asm_call_jit_compiler
75
76         .globl _jit_compile
77         .globl _asm_handle_nat_exception
78         .globl _asm_handle_exception
79         .globl _asm_check_clinit
80         .globl _asm_builtin_checkarraycast
81         .globl _asm_builtin_aastore
82         .globl _builtin_canstore
83         .globl _builtin_trace_exception
84         .globl _builtin_monitorenter
85         .globl _builtin_monitorexit
86         .globl _builtin_ldiv
87         .globl _builtin_lrem
88         .globl _builtin_checkarraycast
89         .globl _asm_builtin_monitorenter
90         .globl _asm_builtin_monitorexit
91         .globl _asm_builtin_idiv
92         .globl _asm_builtin_irem
93         .globl _asm_builtin_ldiv
94         .globl _asm_builtin_lrem
95         .globl _asm_cacheflush
96         .globl _asm_initialize_thread_stack
97         .globl _asm_perform_threadswitch
98         .globl _asm_switchstackandcall
99         .globl _asm_criticalsections
100         .globl _asm_getclassvalues_atomic
101
102         .globl _string_java_lang_NullPointerException
103         .globl _string_java_lang_ArrayIndexOutOfBoundsException
104         .globl _string_java_lang_ArrayStoreException
105         .globl _string_java_lang_ArithmeticException
106         .globl _string_java_lang_ArithmeticException_message
107         .globl _string_java_lang_ClassCastException
108
109 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
110         .globl _builtin_asm_get_exceptionptrptr
111 #endif
112 #if !defined(USE_THREADS) || !defined(NATIVE_THREADS)
113         .globl __exceptionptr
114 #endif
115
116         .globl _builtin_throw_exception
117         .globl _class_load
118         .globl _class_link
119         .globl _class_init
120
121         .globl _new_classcastexception
122         .globl _new_nullpointerexception
123         .globl _new_arrayindexoutofboundsexception
124         .globl _new_arraystoreexception
125         .globl _new_arithmeticexception
126
127 jitcompile:
128         .long _jit_compile
129
130 class_load:
131         .long _class_load
132 class_link:
133         .long _class_link
134 class_init:
135         .long _class_init
136                 
137 builtinthrow:
138         .long _builtin_throw_exception
139
140 builtin_traceexception:
141         .long _builtin_trace_exception
142 builtin_monitorenter:
143         .long _builtin_monitorenter
144 builtin_monitorexit:
145         .long _builtin_monitorexit
146 builtin_ldiv:
147         .long _builtin_ldiv
148 builtin_lrem:
149         .long _builtin_lrem
150
151 builtincanstore:
152         .long _builtin_canstore
153 builtincheckarraycast:
154         .long _builtin_checkarraycast
155         
156 new_classcastexception:
157         .long _new_classcastexception
158 new_nullpointerexception:
159         .long _new_nullpointerexception
160 new_arrayindexoutofboundsexception:
161         .long _new_arrayindexoutofboundsexception
162 new_arraystoreexception:
163         .long _new_arraystoreexception
164 new_arithmeticexception:
165         .long _new_arithmeticexception
166
167
168 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
169 builtin_asm_get_exceptionptrptr:
170         .long _builtin_asm_get_exceptionptrptr
171 #endif
172 #if !defined(USE_THREADS) || !defined(NATIVE_THREADS)
173 _exceptionptr:
174         .long __exceptionptr
175 #endif
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_calljavamethod (methodinfo *m,                     *
188 *         void *arg1, void *arg2, void *arg3, void *arg4);                      *
189 *                                                                              *
190 *******************************************************************************/
191                 
192         .align 2
193     .long   0                         /* catch type all                       */
194     .long   calljava_xhandler         /* handler pc                           */
195     .long   calljava_xhandler         /* end pc                               */
196     .long   _asm_calljavafunction     /* start pc                             */
197     .long   1                         /* extable size                         */
198     .long   0                         /* fltsave                              */
199     .long   0                         /* intsave                              */
200     .long   0                         /* isleaf                               */
201     .long   0                         /* IsSync                               */
202     .long   24                        /* frame size                           */
203     .long   0                         /* method pointer (pointer to name)     */
204         .long   0                         /* padding                              */
205
206 _asm_calljavafunction:
207         mflr    r0
208         stw     r31,-4(r1)
209 //      stw     r30,-8(r1)
210         stw     pv,-12(r1)
211         stw     r0,8(r1)
212         stwu    r1,-148(r1)
213         bl      0f
214 0:
215         mflr    r31
216
217         stw             r16,40(r1)
218         stw             r17,44(r1)
219         stw             r18,48(r1)
220         stw             r19,52(r1)
221         stw             r20,56(r1)
222         stw             r21,60(r1)
223         stw             r22,64(r1)
224         stw             r23,68(r1)
225         stfd    f16,72(r1)
226         stfd    f17,80(r1)
227         stfd    f18,88(r1)
228         stfd    f19,96(r1)
229         stfd    f20,104(r1)
230         stfd    f21,112(r1)
231         stfd    f22,120(r1)
232         stfd    f23,128(r1)
233
234         stw     r3,36(r1)
235         addi    r2,r1,36
236         mr      r3,r4
237         mr      r4,r5
238         mr      r5,r6
239         mr      r6,r7
240
241 //      addis   mptr,r31,ha16(_asm_call_jit_compiler-0b)
242         addi    mptr,r31,lo16(_asm_call_jit_compiler-0b)
243         stw     mptr,32(r1)
244         addi    mptr,r1,28
245
246         lwz     pv,4(mptr)
247         mtctr   pv
248         bctrl
249 1:
250         mflr    itmp1
251         addi    pv,itmp1,lo16(_asm_calljavafunction-1b)
252
253 calljava_regrestore:
254         lwz     r16,40(r1)
255         lwz             r17,44(r1)
256         lwz             r18,48(r1)
257         lwz             r19,52(r1)
258         lwz             r20,56(r1)
259         lwz             r21,60(r1)
260         lwz             r22,64(r1)
261         lwz             r23,68(r1)
262         lfd             f16,72(r1)
263         lfd             f17,80(r1)
264         lfd             f18,88(r1)
265         lfd             f19,96(r1)
266         lfd             f20,104(r1)
267         lfd             f21,112(r1)
268         lfd             f22,120(r1)
269         lfd             f23,128(r1)
270
271         lwz     r0,148+8(r1)
272         mtlr    r0
273         addi    r1,r1,148
274         lwz     pv,-12(r1)
275 //      lwz     r30,-8(r1)
276         lwz     r31,-4(r1)
277         blr
278
279 calljava_xhandler:
280         mr      r3,itmp1
281 //      addis   pv,r31,ha16(builtinthrow-0b)
282         lwz     itmp1,lo16(builtinthrow-0b)(r31)
283         mtctr   itmp1
284         bctrl
285         b       calljava_regrestore
286
287
288
289
290         .align 2
291     .long   0                         /* catch type all                       */
292     .long   calljava_xhandler2        /* handler pc                           */
293     .long   calljava_xhandler2        /* end pc                               */
294     .long   _asm_calljavafunction2    /* start pc                             */
295     .long   1                         /* extable size                         */
296     .long   0                         /* fltsave                              */
297     .long   0                         /* intsave                              */
298     .long   0                         /* isleaf                               */
299     .long   0                         /* IsSync                               */
300     .long   24                        /* frame size                           */
301     .long   0                         /* method pointer (pointer to name)     */
302         .long   0                         /* padding                              */
303
304 _asm_calljavafunction2:
305 _asm_calljavafunction2long:
306 _asm_calljavafunction2double:
307         mflr    r0
308         stw     r31,-4(r1)
309 //      stw     r30,-8(r1)
310         stw     pv,-12(r1)
311         stw     r0,8(r1)
312         addi    r1,r1,-148
313         bl      0f
314 0:
315         mflr    r31
316
317         stw     r16,40(r1)
318         stw         r17,44(r1)
319         stw     r18,48(r1)
320         stw         r19,52(r1)
321         stw     r20,56(r1)
322         stw     r21,60(r1)
323         stw     r22,64(r1)
324         stw     r23,68(r1)
325         stfd    f16,72(r1)
326         stfd    f17,80(r1)
327         stfd    f18,88(r1)
328         stfd    f19,96(r1)
329         stfd    f20,104(r1)
330         stfd    f21,112(r1)
331         stfd    f22,120(r1)
332         stfd    f23,128(r1)
333
334         stw     r3,36(r1)                 /* save method pointer for compiler     */
335         addi    r2,r1,36
336         mr      itmp1,r6                  /* pointer to arg block                 */
337         mr      itmp2,r4                  /* arg count                            */
338
339         mr.     itmp2,itmp2
340         ble     calljava_argsloaded
341
342         addi    itmp2,itmp2,-1
343         lwz     r3,offjniitem+4(itmp1)
344         mr.     itmp2,itmp2
345         ble     calljava_argsloaded
346
347         addi    itmp2,itmp2,-1
348         lwz     r4,offjniitem+sizejniblock*1+4(itmp1)
349         mr.     itmp2,itmp2
350         ble     calljava_argsloaded
351     addi    itmp2,itmp2,-1
352
353     addi    itmp2,itmp2,-1
354     lwz     r5,offjniitem+sizejniblock*2+4(itmp1)
355     mr.     itmp2,itmp2
356     ble     calljava_argsloaded
357     addi    itmp2,itmp2,-1
358
359     addi    itmp2,itmp2,-1
360     lwz     r6,offjniitem+sizejniblock*3+4(itmp1)
361     mr.     itmp2,itmp2
362     ble     calljava_argsloaded
363     addi    itmp2,itmp2,-1
364
365 calljava_argsloaded:
366 //      addis   mptr,r31,ha16(_asm_call_jit_compiler-0b)
367         addi    mptr,r31,lo16(_asm_call_jit_compiler-0b)
368         stw     mptr,32(r1)
369         addi    mptr,r1,28
370
371         lwz     pv,4(mptr)
372         mtctr   pv
373         bctrl
374 1:
375         mflr    itmp1
376         addi    pv,itmp1,lo16(_asm_calljavafunction2-1b)
377         
378 calljava_regrestore2:
379         lwz             r16,40(r1)
380         lwz             r17,44(r1)
381         lwz             r18,48(r1)
382         lwz             r19,52(r1)
383         lwz             r20,56(r1)
384         lwz             r21,60(r1)
385         lwz             r22,64(r1)
386         lwz             r23,68(r1)
387         lfd             f16,72(r1)
388         lfd             f17,80(r1)
389         lfd             f18,88(r1)
390         lfd             f19,96(r1)
391         lfd             f20,104(r1)
392         lfd             f21,112(r1)
393         lfd             f22,120(r1)
394         lfd             f23,128(r1)
395
396         lwz     r0,148+8(r1)
397         mtlr    r0
398         addi    r1,r1,148
399         lwz     pv,-12(r1)
400 //      lwz     r30,-8(r1)
401         lwz     r31,-4(r1)
402         blr
403
404 calljava_xhandler2:
405         mr      r3,itmp1
406 //      addis   pv,r31,ha16(builtinthrow-0b)
407         lwz     itmp1,lo16(builtinthrow-0b)(r31)
408         mtctr   itmp1
409         bctrl
410         b       calljava_regrestore2
411
412
413 _asm_call_jit_compiler:
414 0:
415         mflr    itmp1
416         stw     r31,-4(r1)
417 //      stw     pv,-8(r1)
418         stw     r29,-12(r1)
419         stw     itmp1,8(r1)
420         addi    r1,r1,-176
421         mr      r31,pv
422
423         lwz     itmp3,-12(itmp1)
424         srwi    itmp3,itmp3,16
425         andi.   itmp3,itmp3,31
426         cmpwi   itmp3,mptrn
427         beq     noregchange
428         lwz     itmp3,4(itmp1)
429         extsh   itmp3,itmp3
430         add     mptr,itmp3,itmp1
431         lwz     itmp3,8(itmp1)
432         srwi    itmp3,itmp3,16
433         cmpwi   itmp3,0x3dad
434         bne     noregchange
435         lwz     itmp3,8(itmp1)
436         slwi    itmp3,itmp3,16
437         add     mptr,mptr,itmp3
438                 
439 noregchange:
440         mr      r29,mptr
441         stw     r3,28(r1)
442         stw     r4,32(r1)
443         stw     r5,36(r1)
444         stw     r6,40(r1)
445         stw     r7,44(r1)
446         stw     r8,48(r1)
447         stw     r9,52(r1)
448         stfd    f1,56(r1)
449         stfd    f2,64(r1)
450         stfd    f3,72(r1)
451         stfd    f4,80(r1)
452         stfd    f5,88(r1)
453         stfd    f6,96(r1)
454         stfd    f7,104(r1)
455         stfd    f8,112(r1)
456         stfd    f9,120(r1)
457         stfd    f10,128(r1)
458         stfd    f11,136(r1)
459         stfd    f12,144(r1)
460         stfd    f13,152(r1)
461         stw     r10,160(r1)
462
463         lwz     r3,0(r2)
464 //      addis   pv,r31,ha16(jitcompile-0b)
465         lwz     itmp1,lo16(jitcompile-0b)(r31)
466         mtctr   itmp1
467         bctrl
468
469         mr      pv,r3
470         mr      mptr,r29
471         lwz     r3,28(r1)
472         lwz             r4,32(r1)
473         lwz             r5,36(r1)
474         lwz             r6,40(r1)
475         lwz             r7,44(r1)
476         lwz             r8,48(r1)
477         lwz             r9,52(r1)
478         lfd             f1,56(r1)
479         lfd             f2,64(r1)
480         lfd             f3,72(r1)
481         lfd             f4,80(r1)
482         lfd             f5,88(r1)
483         lfd             f6,96(r1)
484         lfd             f7,104(r1)
485         lfd             f8,112(r1)
486         lfd             f9,120(r1)
487         lfd             f10,128(r1)
488         lfd             f11,136(r1)
489         lfd             f12,144(r1)
490         lfd             f13,152(r1)
491         lwz             r10,160(r1)
492
493         lwz     itmp1,176+8(r1)
494         lwz     itmp3,-12(itmp1)
495         extsh   itmp3,itmp3
496         add     mptr,mptr,itmp3
497         stw     pv,0(mptr)
498
499         mtctr   pv
500
501         lwz     r0,176+8(r1)
502         mtlr    r0
503         addi    r1,r1,176
504         lwz     r29,-12(r1)
505 //      lwz     pv,-8(r1)
506         lwz     r31,-4(r1)
507         bctr
508
509
510
511 /********************* function asm_handle_exception ***************************
512 *                                                                              *
513 *   This function handles an exception. It does not use the usual calling      *
514 *   conventions. The exception pointer is passed in REG_ITMP1 and the          *
515 *   pc from the exception raising position is passed in REG_ITMP2. It searches *
516 *   the local exception table for a handler. If no one is found, it unwinds    *
517 *   stacks and continues searching the callers.                                *
518 *                                                                              *
519 *   void asm_handle_exception (exceptionptr, exceptionpc);                     *
520 *                                                                              *
521 *******************************************************************************/
522                 
523 _asm_handle_nat_exception:
524         mflr    r2
525         lwz     itmp3,4(r2)
526         extsh   itmp3,itmp3
527         add     pv,itmp3,r2
528         lwz     itmp3,8(r2)
529         srwi    itmp3,itmp3,16
530         cmpwi   itmp3,0x3dad
531         bne     _asm_handle_exception
532         lwz     itmp3,8(r2)
533         slwi    itmp3,itmp3,16
534         add     pv,pv,itmp3
535
536 _asm_handle_exception:
537         addi    r1,r1,-18*4
538         stw     r0,0*4(r1)
539         stw     r2,1*4(r1)
540         stw     r3,2*4(r1)
541         stw     r4,3*4(r1)
542         stw     r5,4*4(r1)
543         stw     r6,5*4(r1)
544         stw     r7,6*4(r1)
545         stw     r8,7*4(r1)
546         stw     r9,8*4(r1)
547         stw     r10,9*4(r1)
548         stw     r16,10*4(r1)
549         stw     r17,11*4(r1)
550         stw     r18,12*4(r1)
551         stw     r19,13*4(r1)
552         stw     r20,14*4(r1)
553         stw     r21,15*4(r1)
554         stw     r22,16*4(r1)
555         stw     r23,17*4(r1)
556
557         li      r2,1
558 ex_stack_loop:
559         addi    r1,r1,-4*4
560         stw     xptr,0*4(r1)
561         stw     xpc,1*4(r1)
562         mflr    xptr
563         stw     xptr,2*4(r1)
564         stw     r2,3*4(r1)
565
566         lwz     r3,0*4(r1)            /* exception pointer                        */
567         lwz     r4,MethodPointer(pv)  /* method pointer                           */
568         mr      r5,xpc                /* exception pc                             */
569 /*      mr      r6,r2 */
570         li      r6,0                  /* line number                              */
571         li      r7,4                  /* set no unwind flag                       */
572
573         bl      0f
574 0:
575         mflr    itmp1
576         lwz     itmp1,lo16(builtin_traceexception-0b)(itmp1)
577         mtctr   itmp1
578         addi    r1,r1,-(24+5*4)       /* 24 linkage area + 5 argument * 4         */
579         bctrl
580         addi    r1,r1,(24+5*4)
581
582         lwz     xptr,2*4(r1)
583         mtlr    xptr
584         lwz     xptr,0*4(r1)          /* restore xptr                             */
585         lwz     xpc,1*4(r1)
586         lwz     r2,3*4(r1)
587         addi    r1,r1,4*4
588
589         lwz     r3,ExTableSize(pv)    /* r3 = exception table size                */
590         mr.     r3,r3                 /* if empty table skip                      */
591         beq     empty_table
592
593         addi    r4,pv,ExTableStart    /* r4 = start of exception table            */
594
595 ex_table_loop:
596         lwz     r5,ExStartPC(r4)      /* r5 = exception start pc                  */
597         cmplw   r5,xpc                /* (startpc <= xpc)                         */
598         bgt     ex_table_cont
599         lwz     r5,ExEndPC(r4)        /* r5 = exception end pc                    */
600         cmplw   xpc,r5                /* (xpc < endpc)                            */
601         bge     ex_table_cont
602         lwz     r7,ExCatchType(r4)    /* r7 = exception catch type                */
603         mr.     r7,r7
604         beq     ex_handle_it
605
606         lwz     itmp3,offclassloaded(r7)
607         mr.     itmp3,itmp3
608         bne     L_class_loaded
609
610         addi    r1,r1,-16*4           /* allocate stack                           */
611         stw     r3,7*4(r1)            /* save used registers                      */
612         stw     r4,8*4(r1)            /* 6*4 (linkage) + 1*4 (arg1) + 7*4 (save)  */
613         stw     r2,9*4(r1)
614         stw     xptr,10*4(r1)
615         stw     xpc,11*4(r1)
616         mflr    xptr
617         stw     xptr,12*4(r1)
618         stw     r7,13*4(r1)
619
620         mr      r3,r7                 /* arg1 = exceptionclass                    */
621         bl      0f
622 0:
623         mflr    itmp1
624         lwz     itmp1,lo16(class_load-0b)(itmp1)
625         mtctr   itmp1
626         bctrl
627
628         lwz     r3,7*4(r1)
629         lwz     r4,8*4(r1)
630         lwz     r2,9*4(r1)
631         lwz     xptr,10*4(r1)
632         lwz     xpc,11*4(r1)
633         lwz     itmp3,12*4(r1)
634         mtlr    itmp3
635         lwz     r7,13*4(r1)     
636         addi    r1,r1,16*4
637
638 L_class_loaded:
639         lwz     itmp3,offclasslinked(r7)
640         mr.     itmp3,itmp3
641         addi    r1,r1,-16*4           /* allocate stack                           */
642         stw     r7,13*4(r1)
643         bne     L_class_linked
644
645         stw     r3,7*4(r1)            /* save used registers                      */
646         stw     r4,8*4(r1)            /* 6*4 (linkage) + 1*4 (arg1) + 7*4 (save)  */
647         stw     r2,9*4(r1)
648         stw     xptr,10*4(r1)
649         stw     xpc,11*4(r1)
650         mflr    xptr
651         stw     xptr,12*4(r1)
652
653         mr      r3,r7                 /* arg1 = exceptionclass                    */
654         bl      0f
655 0:
656         mflr    itmp1
657         lwz     itmp1,lo16(class_link-0b)(itmp1)
658         mtctr   itmp1
659         bctrl
660
661         lwz     r3,7*4(r1)
662         lwz     r4,8*4(r1)
663         lwz     r2,9*4(r1)
664         lwz     xptr,10*4(r1)
665         lwz     xpc,11*4(r1)
666         lwz     itmp3,12*4(r1)
667         mtlr    itmp3
668
669 L_class_linked:
670 _crit_restart1:
671         lwz     r7,13*4(r1)     
672 _crit_begin1:
673         lwz     r6,offobjvftbl(xptr)  /* r6 = vftblptr(xptr)                      */
674         lwz     r7,offclassvftbl(r7)  /* r7 = vftblptr(catchtype) class (not obj) */
675         lwz     r6,offbaseval(r6)     /* r6 = baseval(xptr)                       */
676         lwz     r8,offbaseval(r7)     /* r8 = baseval(catchtype)                  */
677         lwz     r7,offdiffval(r7)     /* r7 = diffval(catchtype)                  */
678 _crit_end1:
679         subf    r6,r8,r6              /* r6 = baseval(xptr) - baseval(catchtype)  */
680         cmplw   r6,r7                 /* xptr is instanceof catchtype             */
681         addi    r1,r1,16*4
682         bgt     ex_table_cont         /* if (false) continue                      */
683
684 ex_handle_it:
685         lwz     xpc,ExHandlerPC(r4)   /* xpc = exception handler pc               */
686         mr.     r2,r2
687         beq     ex_jump
688
689         lwz     r0,0*4(r1)
690         lwz     r2,1*4(r1)
691         lwz     r3,2*4(r1)
692         lwz     r4,3*4(r1)
693         lwz     r5,4*4(r1)
694         lwz     r6,5*4(r1)
695         lwz     r7,6*4(r1)
696         lwz     r8,7*4(r1)
697         lwz     r9,8*4(r1)
698         lwz     r10,9*4(r1)
699         lwz     r16,10*4(r1)
700         lwz     r17,11*4(r1)
701         lwz     r18,12*4(r1)
702         lwz     r19,13*4(r1)
703         lwz     r20,14*4(r1)
704         lwz     r21,15*4(r1)
705         lwz     r22,16*4(r1)
706         lwz     r23,17*4(r1)
707         addi    r1,r1,18*4
708
709 ex_jump:
710         mtctr   xpc
711         bctr
712
713 ex_table_cont:
714         addi    r4,r4,ExEntrySize
715         addic.  r3,r3,-1
716         bgt     ex_table_loop
717
718 empty_table:
719         mr.     r2,r2                 /* if here the first time, then             */
720         beq     ex_already_cleared
721         addi    r1,r1,18*4            /* deallocate stack and                     */
722         li      r2,0                  /* clear the no unwind flag                 */
723 ex_already_cleared:
724         lwz     r3,IsSync(pv)
725         mr.     r3,r3
726         beq     no_monitor_exit
727         add     r3,r1,r3
728         lwz     r6,-4(r3)
729
730         addi    r1,r1,-6*4
731         stw     r3,0*4(r1)
732         stw     r4,1*4(r1)
733         stw     r2,2*4(r1)
734         stw     xptr,3*4(r1)
735         stw     xpc,4*4(r1)
736         mflr    xptr
737         stw     xptr,5*4(r1)
738
739         mr      r3,r6
740         bl      0f
741 0:
742         mflr    itmp1
743         lwz     itmp1,lo16(builtin_monitorexit-0b)(itmp1)
744         mtctr   itmp1
745         addi    r1,r1,-40
746         bctrl
747         addi    r1,r1,40
748
749         lwz     xptr,5*4(r1)
750         mtlr    xptr
751         lwz     r3,0*4(r1)
752         lwz     r4,1*4(r1)
753         lwz     r2,2*4(r1)
754         lwz     xptr,3*4(r1)
755         lwz     xpc,4*4(r1)
756         addi    r1,r1,6*4
757
758 no_monitor_exit:
759         lwz     r3,FrameSize(pv)      /* r3 = frame size                          */
760         add     r1,r1,r3              /* unwind stack                             */
761         mr      r3,r1                 /* r3 = pointer to save area                */
762         lwz     r4,IsLeaf(pv)         /* r4 = is leaf procedure                   */
763         mr.     r4,r4
764         bne     ex_no_restore         /* if (leaf) skip                           */
765         lwz     r4,8(r3)              /* restore ra                               */
766         mtlr    r4                    /* t0--                                     */
767 ex_no_restore:
768         mflr    r4                    /* the new xpc is ra                        */
769         mr      xpc,r4
770         lwz     r4,IntSave(pv)        /* r4 = saved int register count            */
771         bl      ex_int1
772 ex_int1:
773         mflr    r5
774         addi    r5,r5,lo16(ex_int2-ex_int1)
775         slwi    r4,r4,2
776         subf    r5,r4,r5
777         mtctr   r5
778         bctr
779         lwz     r14,-40(r3)
780         lwz     r15,-36(r3)
781         lwz     r24,-32(r3)
782         lwz     r25,-28(r3)
783         lwz     r26,-24(r3)
784         lwz     r27,-20(r3)
785         lwz     r28,-16(r3)
786         lwz     r29,-12(r3)
787         lwz     r30,-8(r3)
788         lwz     r31,-4(r3)
789 ex_int2:
790         subf    r3,r4,r3
791
792         lwz     r4,FltSave(pv)
793         bl      ex_flt1
794 ex_flt1:
795         mflr    r5
796         addi    r5,r5,lo16(ex_flt2-ex_flt1)
797         slwi    r4,r4,2
798         subf    r5,r4,r5
799         mtctr   r5
800         bctr
801         lfd     f14,-80(r3)
802         lfd     f15,-72(r3)
803         lfd     f24,-64(r3)
804         lfd     f25,-56(r3)
805         lfd     f26,-48(r3)
806         lfd     f27,-40(r3)
807         lfd     f28,-32(r3)
808         lfd     f29,-24(r3)
809         lfd     f30,-16(r3)
810         lfd     f31,-8(r3)
811 ex_flt2:
812         mtlr    xpc
813         lwz     itmp3,4(xpc)
814         extsh   itmp3,itmp3
815         add     pv,itmp3,xpc
816         lwz     itmp3,8(xpc)
817         srwi    itmp3,itmp3,16
818         cmpwi   itmp3,0x3dad
819         bne     ex_stack_loop
820         lwz     itmp3,8(xpc)
821         slwi    itmp3,itmp3,16
822         add     pv,pv,itmp3
823         b       ex_stack_loop
824
825
826 /********************* asm_check_clinit ****************************************
827 *                                                                              *
828 *   call static class initializer for PUT/GETSTATIC instructions               *
829 *                                                                              *
830 *******************************************************************************/
831
832 _asm_check_clinit:
833 0:
834         lwz     itmp2,offclassinit(itmp1)
835         mr.     itmp2,itmp2
836         bne     L_is_initialized
837
838         mflr    r0
839         stw     r0,8(r1)
840         addi    r1,r1,-(26*8)         /* keep stack 16-bytes aligned              */
841
842     stw     r3,4*8(r1)            /* save argument registers                  */
843     stw     r4,5*8(r1)            /* preserve linkage area (24 bytes)         */
844     stw     r5,6*8(r1)            /* and 4 bytes (better 8) for 1 argument    */
845     stw     r6,7*8(r1)
846     stw     r7,8*8(r1)
847     stw     r8,9*8(r1)
848     stw     r9,10*8(r1)
849         stw     r10,11*8(r1)
850
851         stfd    f1,12*8(r1)
852     stfd    f2,13*8(r1)
853     stfd    f3,14*8(r1)
854     stfd    f4,15*8(r1)
855     stfd    f5,16*8(r1)
856     stfd    f6,17*8(r1)
857     stfd    f7,18*8(r1)
858     stfd    f8,19*8(r1)
859     stfd    f9,20*8(r1)
860     stfd    f10,21*8(r1)
861     stfd    f11,22*8(r1)
862     stfd    f12,23*8(r1)
863     stfd    f13,24*8(r1)
864                 
865         mr      r3,itmp1
866         lwz     itmp1,lo16(class_init-0b)(pv)
867         mtctr   itmp1
868         bctrl
869         mr      itmp1,r3              /* save return value in temp register       */
870
871         lwz     r3,4*8(r1)
872         lwz     r4,5*8(r1)
873         lwz     r5,6*8(r1)
874         lwz     r6,7*8(r1)
875         lwz     r7,8*8(r1)
876         lwz     r8,9*8(r1)
877         lwz     r9,10*8(r1)
878         lwz     r10,11*8(r1)
879
880     lfd     f1,12*8(r1)
881     lfd     f2,13*8(r1)
882     lfd     f3,14*8(r1)
883     lfd         f4,15*8(r1)
884     lfd         f5,16*8(r1)
885     lfd         f6,17*8(r1)
886     lfd         f7,18*8(r1)
887     lfd         f8,19*8(r1)
888     lfd         f9,20*8(r1)
889     lfd         f10,21*8(r1)
890     lfd         f11,22*8(r1)
891     lfd         f12,23*8(r1)
892     lfd         f13,24*8(r1)
893                 
894         lwz     r0,(26*8)+8(r1)
895         mtlr    r0
896         addi    r1,r1,(26*8)
897
898         mr.         itmp1,itmp1           /* check for an exception                   */
899         beq     L_initializererror
900
901 L_is_initialized:
902         blr
903
904 L_initializererror:
905 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
906         mflr    r0
907         stw     r0,8(r1)
908         addi    r1,r1,-4*8            /* preserve linkage area (24 bytes)         */
909         lwz     itmp1,lo16(builtin_asm_get_exceptionptrptr-0b)(pv)
910         mtctr   itmp1
911         bctrl
912         lwz     r0,(4*8)+8(r1)
913         mtlr    r0      
914         addi    r1,r1,4*8
915 #else
916         lwz     r3,lo16(_exceptionptr-0b)(pv)
917 #endif
918
919         lwz     xptr,0(r3)            /* get the exception pointer                */
920         li      r0,0
921         stw     r0,0(r3)              /* clear the exception pointer              */
922
923         mflr    xpc
924         b       _asm_handle_nat_exception
925
926
927 /******************* function asm_builtin_checkarraycast ***********************
928 *                                                                              *
929 *   Does the cast check and eventually throws an exception                     *
930 *                                                                              *
931 *******************************************************************************/
932                 
933 _asm_builtin_checkarraycast:
934 0:
935         mflr    r0
936         stw     r0,8(r1)
937         stwu    r1,-48(r1)
938
939         stw     r3,32(r1)
940         lwz     itmp1,lo16(builtincheckarraycast-0b)(pv)
941         mtctr   itmp1
942         bctrl
943
944         lwz     r0,48+8(r1)
945         mtlr    r0
946         mr.     r3,r3
947         beq     nb_carray_throw
948         lwz     r3,32(r1)
949         addi    r1,r1,48
950         blr
951
952 nb_carray_throw:
953         addi    r1,r1,48
954         mflr    r0
955         stw     r0,8(r1)
956         addi    r1,r1,-(24+4)
957         lwz     itmp1,lo16(new_classcastexception-0b)(pv)
958         mtctr   itmp1
959         bctrl
960         mr      xptr,r3
961         addi    r1,r1,24+4
962         lwz     r0,8(r1)
963         mr      xpc,r0
964         mtlr    r0
965         b       _asm_handle_nat_exception
966
967
968 /******************* function asm_builtin_aastore ******************************
969 *                                                                              *
970 *   Does the cast check and eventually throws an exception                     *
971 *                                                                              *
972 *******************************************************************************/
973         
974 _asm_builtin_aastore:
975 0:
976         mr.     r3,r3
977         beq     nb_aastore_null
978         mflr    r0
979         stw     r0,8(r1)
980         addi    r1,r1,-48
981
982         lwz     itmp1,offarraysize(r3)
983         slwi    itmp3,r4,2
984         add     itmp2,r3,itmp3
985         cmplw   r4,itmp1
986         bge     nb_aastore_bound
987         mr      r4,r5
988         stw     itmp2,32(r1)
989         stw     r4,36(r1)
990 //      addis   pv,r31,ha16(builtincanstore-0b)
991         lwz     itmp1,lo16(builtincanstore-0b)(pv)
992         mtctr   itmp1
993         bctrl
994
995         lwz     r0,48+8(r1)
996         mtlr    r0
997         lwz     itmp1,32(r1)
998         lwz     itmp2,36(r1)
999         addi    r1,r1,48
1000         mr.     r3,r3
1001         beq     nb_aastore_store
1002         stw     itmp2,offobjarrdata(itmp1)
1003         blr
1004
1005 nb_aastore_null:
1006         mflr    r0
1007         stw     r0,8(r1)
1008         addi    r1,r1,-(24+4)
1009         lwz     itmp1,lo16(new_nullpointerexception-0b)(pv)
1010         mtctr   itmp1
1011         bctrl
1012         mr      xptr,r3
1013         addi    r1,r1,(24+4)
1014         lwz     r0,8(r1)
1015         mr      xpc,r0
1016         mtlr    r0
1017         b       _asm_handle_nat_exception
1018
1019 nb_aastore_bound:
1020         addi    r1,r1,48
1021         mflr    r0
1022         stw     r0,8(r1)
1023         addi    r1,r1,-(24+2*4)
1024         lwz     itmp1,lo16(new_arrayindexoutofboundsexception-0b)(pv)
1025         mtctr   itmp1
1026         mr      r3,r4                 /* move index into a0                       */
1027         bctrl
1028         mr      xptr,r3
1029         addi    r1,r1,(24+2*4)
1030         lwz     r0,8(r1)
1031         mr      xpc,r0
1032         mtlr    r0
1033         b       _asm_handle_nat_exception
1034
1035 nb_aastore_store:
1036         mflr    r0
1037         stw     r0,8(r1)
1038         addi    r1,r1,-(24+4)
1039         lwz     itmp1,lo16(new_arraystoreexception-0b)(pv)
1040         mtctr   itmp1
1041         bctrl
1042         mr      xptr,r3
1043         addi    r1,r1,(24+4)
1044         lwz     r0,8(r1)
1045         mr      xpc,r0
1046         mtlr    r0
1047         b       _asm_handle_nat_exception
1048
1049
1050 _asm_builtin_monitorenter:
1051 0:
1052         lwz     itmp2,lo16(builtin_monitorenter-0b)(pv)
1053         mr.     r3,r3
1054         beq     nb_monitorenter
1055         mtctr   itmp2
1056         bctr
1057
1058 nb_monitorenter:
1059         mflr    r0
1060         stw     r0,8(r1)
1061         addi    r1,r1,-(24+4)
1062         lwz     itmp1,lo16(new_nullpointerexception-0b)(pv)
1063         mtctr   itmp1
1064         bctrl
1065         mr      xptr,r3
1066         addi    r1,r1,24+4
1067         lwz     r0,8(r1)
1068 /*      addi    xpc,r0,-4 */
1069         mr      xpc,r0
1070         addi    xpc,xpc,-4
1071
1072         mtlr    r0
1073         b       _asm_handle_nat_exception
1074
1075
1076 _asm_builtin_monitorexit:
1077 0:
1078         lwz     itmp2,lo16(builtin_monitorexit-0b)(pv)
1079         mr.     r3,r3
1080         beq     nb_monitorexit
1081         mtctr   itmp2
1082         bctr
1083
1084 nb_monitorexit:
1085         mflr    r0
1086         stw     r0,8(r1)
1087         addi    r1,r1,-(24+4)
1088         lwz     itmp1,lo16(new_nullpointerexception-0b)(pv)
1089         mtctr   itmp1
1090         bctrl
1091         mr      xptr,r3
1092         addi    r1,r1,24+4
1093         lwz     r0,8(r1)
1094 /*      addi    xpc,r0,-4 */
1095         mr      xpc,r0
1096         addi    xpc,xpc,-4
1097
1098         mtlr    r0
1099         b       _asm_handle_nat_exception
1100         
1101         
1102 _asm_builtin_idiv:
1103 0:
1104         mr.     r4,r4
1105         beq     nb_idiv
1106         lis     itmp3,0x8000
1107         cmpw    r3,itmp3
1108         bne     normal_idiv
1109         cmpwi   r4,-1
1110         bne     normal_idiv
1111         blr
1112
1113 normal_idiv:
1114         divw    r3,r3,r4
1115         blr
1116
1117 nb_idiv:
1118         mflr    r0
1119         stw     r0,8(r1)
1120         addi    r1,r1,-(24+2*4)
1121         lwz     itmp1,lo16(new_arithmeticexception-0b)(pv)
1122         mtctr   itmp1
1123         bctrl
1124         mr      xptr,r3
1125         addi    r1,r1,(24+2*4)
1126         lwz     r0,8(r1)
1127         mr      xpc,r0
1128         mtlr    r0
1129         b       _asm_handle_nat_exception
1130
1131
1132 _asm_builtin_irem:
1133 0:
1134         mr      itmp2,r3
1135         mr.     r4,r4
1136         beq     nb_irem
1137         lis     itmp3,0x8000
1138         cmpw    itmp2,itmp3
1139         bne     normal_irem
1140         cmpwi   r4,-1
1141         bne     normal_irem
1142         li      r3,0
1143         beqlr
1144
1145 normal_irem:
1146         divw    itmp3,itmp2,r4
1147         mullw   itmp3,itmp3,r4
1148         subf    r3,itmp3,itmp2
1149         blr
1150
1151 nb_irem:
1152         mflr    r0
1153         stw     r0,8(r1)
1154         addi    r1,r1,-(24+2*4)
1155         lwz     itmp1,lo16(new_arithmeticexception-0b)(pv)
1156         mtctr   itmp1
1157         bctrl
1158         mr      xptr,r3
1159         addi    r1,r1,(24+2*4)
1160         lwz     r0,8(r1)
1161         mr      xpc,r0
1162         mtlr    r0
1163         b       _asm_handle_nat_exception
1164
1165
1166 _asm_builtin_ldiv:
1167 0:
1168         or.     r0,r5,r6
1169         beq     nb_ldiv
1170         lwz     itmp1,lo16(builtin_ldiv-0b)(pv)
1171         mtctr   itmp1
1172         bctr
1173
1174 nb_ldiv:
1175         mflr    r0
1176         stw     r0,8(r1)
1177         addi    r1,r1,-(24+2*4)
1178         lwz     itmp1,lo16(new_arithmeticexception-0b)(pv)
1179         mtctr   itmp1
1180         bctrl
1181         mr      xptr,r3
1182         addi    r1,r1,(24+2*4)
1183         lwz     r0,8(r1)
1184         mr      xpc,r0
1185         mtlr    r0
1186         b       _asm_handle_nat_exception
1187
1188
1189  _asm_builtin_lrem:
1190 0:
1191         or.     r0,r5,r6
1192         beq     nb_lrem
1193         lwz     itmp1,lo16(builtin_lrem-0b)(pv)
1194         mtctr   itmp1
1195         bctr
1196
1197 nb_lrem:
1198         mflr    r0
1199         stw     r0,8(r1)
1200         addi    r1,r1,-(24+2*4)
1201         lwz     itmp1,lo16(new_arithmeticexception-0b)(pv)
1202         mtctr   itmp1
1203         bctrl
1204         mr      xptr,r3
1205         addi    r1,r1,(24+2*4)
1206         lwz     r0,8(r1)
1207         mr      xpc,r0
1208         mtlr    r0
1209         b       _asm_handle_nat_exception
1210
1211
1212 _asm_cacheflush:
1213         addi    r4,r4,31
1214         mr      r5,r3
1215         add     r4,r3,r4
1216 1:
1217         cmplw   r3,r4
1218         bge     0f
1219         dcbst   0,r3
1220         addi    r3,r3,32
1221         b       1b
1222 0:
1223         sync
1224 1:
1225         cmplw   r5,r4
1226         bge     0f
1227         icbi    0,r5
1228         addi    r5,r5,32
1229         b       1b
1230 0:
1231         sync
1232         isync
1233         blr
1234
1235
1236         .align 3
1237 doublezero:
1238         .double 0.0
1239
1240 _asm_initialize_thread_stack:
1241         addi r4,r4,-256
1242         stw r3,120(r4)
1243         li r3,0
1244         stw r3,124(r4)
1245         stw r3,0(r4)
1246         stw r3,4(r4)
1247         stw r3,8(r4)
1248         stw r3,12(r4)
1249         stw r3,16(r4)
1250         stw r3,20(r4)
1251         stw r3,24(r4)
1252         stw r3,28(r4)
1253         stw r3,32(r4)
1254         stw r3,36(r4)
1255
1256         stw r3,128(r4)
1257         stw r3,132(r4)
1258         stw r3,136(r4)
1259         stw r3,140(r4)
1260         stw r3,144(r4)
1261         stw r3,148(r4)
1262         stw r3,152(r4)
1263         stw r3,156(r4)
1264
1265         mflr r0
1266         bl 0f
1267 0:
1268         mflr r3
1269         mtlr r0
1270         lfd f0,lo16(doublezero-0b)(r3)
1271
1272         stfd f0,40(r4)
1273         stfd f0,48(r4)
1274         stfd f0,56(r4)
1275         stfd f0,64(r4)
1276         stfd f0,72(r4)
1277         stfd f0,80(r4)
1278         stfd f0,88(r4)
1279         stfd f0,96(r4)
1280         stfd f0,104(r4)
1281         stfd f0,112(r4)
1282
1283         stfd f0,160(r4)
1284         stfd f0,168(r4)
1285         stfd f0,176(r4)
1286         stfd f0,184(r4)
1287         stfd f0,192(r4)
1288         stfd f0,200(r4)
1289         stfd f0,208(r4)
1290         stfd f0,216(r4)
1291
1292         mr r3,r4
1293         blr
1294
1295
1296 _asm_perform_threadswitch:
1297         mflr r0
1298         addi r1,r1,-224
1299         stw r0,120(r1)
1300         stw pv,124(r1)
1301         stw r14,0(r1)
1302         stw r15,4(r1)
1303         stw r24,8(r1)
1304         stw r25,12(r1)
1305         stw r26,16(r1)
1306         stw r27,20(r1)
1307         stw r28,24(r1)
1308         stw r29,28(r1)
1309         stw r30,32(r1)
1310         stw r31,36(r1)
1311         stfd f14,40(r1)
1312         stfd f15,48(r1)
1313         stfd f24,56(r1)
1314         stfd f25,64(r1)
1315         stfd f26,72(r1)
1316         stfd f27,80(r1)
1317         stfd f28,88(r1)
1318         stfd f29,96(r1)
1319         stfd f30,104(r1)
1320         stfd f31,112(r1)
1321
1322         stw r16,128(r1)
1323         stw r17,132(r1)
1324         stw r18,136(r1)
1325         stw r19,140(r1)
1326         stw r20,144(r1)
1327         stw r21,148(r1)
1328         stw r22,152(r1)
1329         stw r23,156(r1)
1330         stfd f16,160(r1)
1331         stfd f17,168(r1)
1332         stfd f18,176(r1)
1333         stfd f19,184(r1)
1334         stfd f20,192(r1)
1335         stfd f21,200(r1)
1336         stfd f22,208(r1)
1337         stfd f23,216(r1)
1338
1339         stw r1,0(r3)
1340         stw r1,0(r5)
1341         lwz r1,0(r4)
1342
1343         lwz r0,120(r1)
1344         lwz pv,124(r1)
1345         lwz r14,0(r1)
1346         lwz r15,4(r1)
1347         lwz r24,8(r1)
1348         lwz r25,12(r1)
1349         lwz r26,16(r1)
1350         lwz r27,20(r1)
1351         lwz r28,24(r1)
1352         lwz r29,28(r1)
1353         lwz r30,32(r1)
1354         lwz r31,36(r1)
1355         lfd f14,40(r1)
1356         lfd f15,48(r1)
1357         lfd f24,56(r1)
1358         lfd f25,64(r1)
1359         lfd f26,72(r1)
1360         lfd f27,80(r1)
1361         lfd f28,88(r1)
1362         lfd f29,96(r1)
1363         lfd f30,104(r1)
1364         lfd f31,112(r1)
1365
1366         lwz r16,128(r1)
1367         lwz r17,132(r1)
1368         lwz r18,136(r1)
1369         lwz r19,140(r1)
1370         lwz r20,144(r1)
1371         lwz r21,148(r1)
1372         lwz r22,152(r1)
1373         lwz r23,156(r1)
1374         lfd f16,160(r1)
1375         lfd f17,168(r1)
1376         lfd f18,176(r1)
1377         lfd f19,184(r1)
1378         lfd f20,192(r1)
1379         lfd f21,200(r1)
1380         lfd f22,208(r1)
1381         lfd f23,216(r1)
1382
1383         mtlr r0
1384         addi r1,r1,224
1385         blr
1386
1387
1388 _asm_switchstackandcall:
1389         mflr r0
1390         addi r3,r3,-48
1391         stw r0,40(r3)
1392         stw r1,44(r3)
1393         stw r1,0(r5)
1394         mr r1,r3
1395
1396         mtctr r4
1397         mr r3,r6
1398         bctrl
1399
1400         lwz r0,40(r1)
1401         mtlr r0
1402         lwz r1,44(r1)
1403         blr
1404
1405
1406 _asm_getclassvalues_atomic:
1407 _crit_restart2:
1408 _crit_begin2:
1409         lwz     r6,offbaseval(r3)
1410         lwz     r7,offdiffval(r3)
1411         lwz     r8,offbaseval(r4)
1412 _crit_end2:
1413         stw     r6,offcast_super_baseval(r5)
1414         stw     r7,offcast_super_diffval(r5)
1415         stw     r8,offcast_sub_baseval(r5)
1416         blr
1417
1418         .data
1419
1420 _asm_criticalsections:
1421 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
1422         .long   _crit_begin1
1423         .long   _crit_end1
1424         .long   _crit_restart1
1425         .long   _crit_begin2
1426         .long   _crit_end2
1427         .long   _crit_restart2
1428 #endif
1429         .long 0
1430
1431
1432 /*
1433  * These are local overrides for various environment variables in Emacs.
1434  * Please do not remove this and leave it at the end of the file, where
1435  * Emacs will automagically detect them.
1436  * ---------------------------------------------------------------------
1437  * Local variables:
1438  * mode: asm
1439  * indent-tabs-mode: t
1440  * c-basic-offset: 4
1441  * tab-width: 4
1442  * End:
1443  */