OSDN Git Service

am 486ac3c0: Removing inaccurate and unmaintained docs.
[android-x86/dalvik.git] / vm / mterp / out / InterpAsm-x86-atom.S
1 /*
2  * This file was generated automatically by gen-mterp.py for 'x86-atom'.
3  *
4  * --> DO NOT EDIT <--
5  */
6
7 /* File: x86-atom/header.S */
8    /* Copyright (C) 2008 The Android Open Source Project
9     *
10     * Licensed under the Apache License, Version 2.0 (the "License");
11     * you may not use this file except in compliance with the License.
12     * You may obtain a copy of the License at
13     *
14     * http://www.apache.org/licenses/LICENSE-2.0
15     *
16     * Unless required by applicable law or agreed to in writing, software
17     * distributed under the License is distributed on an "AS IS" BASIS,
18     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19     * See the License for the specific language governing permissions and
20     * limitations under the License.
21     */
22
23    /*
24     * File: header.S
25     */
26
27    /*
28     * IA32 calling convention and general notes:
29     *
30     * EAX, ECX, EDX - general purpose scratch registers (caller-saved);
31     *
32     * The stack (%esp) - used to pass arguments to functions
33     *
34     * EAX - holds the first 4 bytes of a return
35     * EDX - holds the second 4 bytes of a return
36     *
37     * EBX, ESI, EDI, EBP - are callee saved
38     *
39     * CS, DS, SS - are segment registers
40     * ES, FS, GS - are segment registers. We will try to avoid using these registers
41     *
42     * The stack is "full descending". Only the arguments that do not fit    * in the first two arg registers are placed on the stack.
43     * "%esp" points to the first stacked argument (i.e. the 3rd arg).
44     */
45
46    /*
47     * Mterp and IA32 notes
48     *
49     * mem          nick      purpose
50     * (%ebp)       rGLUE     InterpState base pointer (A.K.A. MterpGlue Pointer)
51     * %esi         rPC       interpreted program counter, used for fetching
52     *                        instructions
53     * %ebx         rINST     first 16-bit code unit of current instruction
54     * %edi         rFP       interpreted frame pointer, used for accessing
55     *                        locals and args
56     */
57
58    /*
59     * Includes
60     */
61
62 #include "../common/asm-constants.h"
63
64    /*
65     * Reserved registers
66     */
67
68 #define rGLUE  (%ebp)
69 #define rINST   %ebx
70 #define rINSTbl  %bl
71 #define rINSTbh  %bh
72 #define rINSTw  %bx
73 #define rPC     %esi
74 #define rFP     %edi
75
76    /*
77     * Temporary register used when finishing an opcode
78     */
79
80 #define rFinish %edx
81
82    /*
83     * Stack locations used for temporary data. For convenience.
84     */
85
86 #define sReg0    4(%ebp)
87 #define sReg1    8(%ebp)
88 #define sReg2   12(%ebp)
89 #define sReg3   16(%ebp)
90
91    /*
92     * Save the PC and FP to the glue struct
93     */
94
95     .macro      SAVE_PC_FP_TO_GLUE _reg
96     movl        rGLUE, \_reg
97     movl        rPC, offGlue_pc(\_reg)
98     movl        rFP, offGlue_fp(\_reg)
99     .endm
100
101    /*
102     * Restore the PC and FP from the glue struct
103     */
104
105     .macro      LOAD_PC_FP_FROM_GLUE
106     movl        rGLUE, rFP
107     movl        offGlue_pc(rFP), rPC
108     movl        offGlue_fp(rFP), rFP
109     .endm
110
111    /*
112     * "Export" the PC to the stack frame, f/b/o future exception objects. This must
113     * be done *before* something calls dvmThrowException.
114     *
115     * In C this is "SAVEAREA_FROM_FP(fp)->xtra.currentPc = pc", i.e.
116     * fp - sizeof(StackSaveArea) + offsetof(SaveArea, xtra.currentPc)
117     *
118     * It's okay to do this more than once.
119     */
120
121     .macro      EXPORT_PC
122     movl        rPC, (-sizeofStackSaveArea + offStackSaveArea_currentPc)(rFP)
123     .endm
124
125    /*
126     * Given a frame pointer, find the stack save area.
127     * In C this is "((StackSaveArea*)(_fp) -1)".
128     */
129
130     .macro      SAVEAREA_FROM_FP  _reg
131     lea         -sizeofStackSaveArea(rFP), \_reg
132     .endm
133
134    /*
135     * Get the 32-bit value from a dalvik register.
136     */
137
138     .macro      GET_VREG _vreg
139     movl        (rFP,\_vreg, 4), \_vreg
140     .endm
141
142    /*
143     * Set the 32-bit value from a dalvik register.
144     */
145
146     .macro      SET_VREG _reg _vreg
147     movl        \_reg, (rFP,\_vreg, 4)
148     .endm
149
150    /*
151     * Fetch the next instruction from rPC into rINST. Does not advance rPC.
152     */
153
154     .macro      FETCH_INST
155     movzwl      (rPC), rINST
156     .endm
157
158    /*
159     * Fetch the next instruction from the specified offset. Advances rPC
160     * to point to the next instruction. "_count" is in 16-bit code units.
161     *
162     * This must come AFTER anything that can throw an exception, or the
163     * exception catch may miss. (This also implies that it must come after
164     * EXPORT_PC())
165     */
166
167     .macro      FETCH_ADVANCE_INST _count
168     add         $(\_count*2), rPC
169     movzwl      (rPC), rINST
170     .endm
171
172    /*
173     * Fetch the next instruction from an offset specified by _reg. Updates
174     * rPC to point to the next instruction. "_reg" must specify the distance
175     * in bytes, *not* 16-bit code units, and may be a signed value.
176     */
177
178     .macro      FETCH_ADVANCE_INST_RB _reg
179     addl        \_reg, rPC
180     movzwl      (rPC), rINST
181     .endm
182
183    /*
184     * Fetch a half-word code unit from an offset past the current PC. The
185     * "_count" value is in 16-bit code units. Does not advance rPC.
186     * For example, given instruction of format: AA|op BBBB, it
187     * fetches BBBB.
188     */
189
190     .macro      FETCH _count _reg
191     movzwl      (\_count*2)(rPC), \_reg
192     .endm
193
194    /*
195     * Fetch a half-word code unit from an offset past the current PC. The
196     * "_count" value is in 16-bit code units. Does not advance rPC.
197     * This variant treats the value as signed.
198     */
199
200     .macro      FETCHs _count _reg
201     movswl      (\_count*2)(rPC), \_reg
202     .endm
203
204    /*
205     * Fetch the first byte from an offset past the current PC. The
206     * "_count" value is in 16-bit code units. Does not advance rPC.
207     * For example, given instruction of format: AA|op CC|BB, it
208     * fetches BB.
209     */
210
211     .macro      FETCH_BB _count _reg
212     movzbl      (\_count*2)(rPC), \_reg
213     .endm
214
215     /*
216     * Fetch the second byte from an offset past the current PC. The
217     * "_count" value is in 16-bit code units. Does not advance rPC.
218     * For example, given instruction of format: AA|op CC|BB, it
219     * fetches CC.
220     */
221
222     .macro      FETCH_CC _count _reg
223     movzbl      (\_count*2 + 1)(rPC), \_reg
224     .endm
225
226    /*
227     * Fetch the second byte from an offset past the current PC. The
228     * "_count" value is in 16-bit code units. Does not advance rPC.
229     * This variant treats the value as signed.
230     */
231
232     .macro      FETCH_CCs _count _reg
233     movsbl      (\_count*2 + 1)(rPC), \_reg
234     .endm
235
236
237    /*
238     * Fetch one byte from an offset past the current PC.  Pass in the same
239     * "_count" as you would for FETCH, and an additional 0/1 indicating which
240     * byte of the halfword you want (lo/hi).
241     */
242
243     .macro      FETCH_B _reg  _count  _byte
244     movzbl      (\_count*2+\_byte)(rPC), \_reg
245     .endm
246
247    /*
248     * Put the instruction's opcode field into the specified register.
249     */
250
251     .macro      GET_INST_OPCODE _reg
252     movzbl      rINSTbl, \_reg
253     .endm
254
255    /*
256     * Begin executing the opcode in _reg.
257     */
258
259     .macro      GOTO_OPCODE _reg
260     shl         $6, \_reg
261     addl        $dvmAsmInstructionStart,\_reg
262     jmp         *\_reg
263     .endm
264
265
266
267    /*
268     * Macros pair attempts to speed up FETCH_INST, GET_INST_OPCODE and GOTO_OPCODE
269     * by using a jump table. _rFinish should must be the same register for
270     * both macros.
271     */
272
273     .macro      FFETCH _rFinish
274     movzbl      (rPC), \_rFinish
275     .endm
276
277     .macro      FGETOP_JMPa _rFinish
278     movzbl      1(rPC), rINST
279     jmp         *dvmAsmInstructionJmpTable(,\_rFinish, 4)
280     .endm
281
282    /*
283     * Macro pair attempts to speed up FETCH_INST, GET_INST_OPCODE and GOTO_OPCODE
284     * by using a jump table. _rFinish and _count should must be the same register for
285     * both macros.
286     */
287
288     .macro      FFETCH_ADV _count _rFinish
289     movzbl      (\_count*2)(rPC), \_rFinish
290     .endm
291
292     .macro      FGETOP_JMP _count _rFinish
293     movzbl      (\_count*2 + 1)(rPC), rINST
294     addl        $(\_count*2), rPC
295     jmp         *dvmAsmInstructionJmpTable(,\_rFinish, 4)
296     .endm
297
298     .macro      FGETOP_JMP2 _rFinish
299     movzbl      1(rPC), rINST
300     jmp         *dvmAsmInstructionJmpTable(,\_rFinish, 4)
301     .endm
302
303     .macro      OLD_JMP_1 _count _rFinish
304     movzbl      (\_count*2)(rPC), \_rFinish
305     shl         $6, \_rFinish
306     .endm
307
308     .macro      OLD_JMP_2 _rFinish
309     addl        $dvmAsmInstructionStart,\_rFinish
310     .endm
311
312     .macro      OLD_JMP_3 _count
313     addl        $(\_count*2), rPC
314     .endm
315
316     .macro      OLD_JMP_4 _rFinish
317     movzbl      1(rPC), rINST
318     jmp         *\_rFinish
319     .endm
320
321     .macro      OLD_JMP_A_1 _reg _rFinish
322     movzbl      (rPC, \_reg), \_rFinish
323     shl         $6, \_rFinish
324     .endm
325
326     .macro      OLD_JMP_A_2 _rFinish
327     addl        $dvmAsmInstructionStart,\_rFinish
328     .endm
329
330     .macro      OLD_JMP_A_3 _reg _rFinish
331     addl        \_reg, rPC
332     movzbl      1(rPC, \_reg), rINST
333     jmp         *\_rFinish
334     .endm
335
336    /*
337     * Macro pair attempts to speed up FETCH_INST, GET_INST_OPCODE and GOTO_OPCODE
338     * by using a jump table. _rFinish and _reg should must be the same register for
339     * both macros.
340     */
341
342     .macro      FFETCH_ADV_RB _reg _rFinish
343     movzbl      (\_reg, rPC), \_rFinish
344     .endm
345
346     .macro      FGETOP_RB_JMP _reg _rFinish
347     movzbl      1(\_reg, rPC), rINST
348     addl        \_reg, rPC
349     jmp         *dvmAsmInstructionJmpTable(,\_rFinish, 4)
350     .endm
351
352    /*
353     * Attempts to speed up FETCH_INST, GET_INST_OPCODE using
354     * a jump table. This macro should be called before FINISH_JMP where
355     * rFinish should be the same register containing the opcode value.
356     * This is an attempt to split up FINISH in order to reduce or remove
357     * potential stalls due to the wait for rFINISH.
358     */
359
360     .macro      FINISH_FETCH _rFinish
361     movzbl      (rPC), \_rFinish
362     movzbl      1(rPC), rINST
363     .endm
364
365
366    /*
367     * Attempts to speed up FETCH_ADVANCE_INST, GET_INST_OPCODE using
368     * a jump table. This macro should be called before FINISH_JMP where
369     * rFinish should be the same register containing the opcode value.
370     * This is an attempt to split up FINISH in order to reduce or remove
371     * potential stalls due to the wait for rFINISH.
372     */
373
374     .macro      FINISH_FETCH_ADVANCE _count _rFinish
375     movzbl      (\_count*2)(rPC), \_rFinish
376     movzbl      (\_count*2 + 1)(rPC), rINST
377     addl        $(\_count*2), rPC
378     .endm
379
380    /*
381     * Attempts to speed up FETCH_ADVANCE_INST_RB, GET_INST_OPCODE using
382     * a jump table. This macro should be called before FINISH_JMP where
383     * rFinish should be the same register containing the opcode value.
384     * This is an attempt to split up FINISH in order to reduce or remove
385     * potential stalls due to the wait for rFINISH.
386     */
387
388     .macro      FINISH_FETCH_ADVANCE_RB _reg _rFinish
389     movzbl      (\_reg, rPC), \_rFinish
390     movzbl      1(\_reg, rPC), rINST
391     addl        \_reg, rPC
392     .endm
393
394    /*
395     * Attempts to speed up GOTO_OPCODE using a jump table. This macro should
396     * be called after a FINISH_FETCH* instruction where rFinish should be the
397     * same register containing the opcode value. This is an attempt to split up
398     * FINISH in order to reduce or remove potential stalls due to the wait for rFINISH.
399     */
400
401     .macro      FINISH_JMP _rFinish
402     jmp         *dvmAsmInstructionJmpTable(,\_rFinish, 4)
403     .endm
404
405    /*
406     * Attempts to speed up FETCH_INST, GET_INST_OPCODE, GOTO_OPCODE by using
407     * a jump table. Uses a single macro - but it should be faster if we
408     * split up the fetch for rFinish and the jump using rFinish.
409     */
410
411     .macro      FINISH_A
412     movzbl      (rPC), rFinish
413     movzbl      1(rPC), rINST
414     jmp         *dvmAsmInstructionJmpTable(,rFinish, 4)
415     .endm
416
417    /*
418     * Attempts to speed up FETCH_ADVANCE_INST, GET_INST_OPCODE,
419     * GOTO_OPCODE by using a jump table. Uses a single macro -
420     * but it should be faster if we split up the fetch for rFinish
421     * and the jump using rFinish.
422     */
423
424     .macro      FINISH _count
425     movzbl      (\_count*2)(rPC), rFinish
426     movzbl      (\_count*2 + 1)(rPC), rINST
427     addl        $(\_count*2), rPC
428     jmp         *dvmAsmInstructionJmpTable(,rFinish, 4)
429     .endm
430
431    /*
432     * Attempts to speed up FETCH_ADVANCE_INST_RB, GET_INST_OPCODE,
433     * GOTO_OPCODE by using a jump table. Uses a single macro -
434     * but it should be faster if we split up the fetch for rFinish
435     * and the jump using rFinish.
436     */
437
438     .macro      FINISH_RB _reg _rFinish
439     movzbl      (\_reg, rPC), \_rFinish
440     movzbl      1(\_reg, rPC), rINST
441     addl        \_reg, rPC
442     jmp         *dvmAsmInstructionJmpTable(,\_rFinish, 4)
443     .endm
444
445    /*
446     * Hard coded helper values.
447     */
448
449 .balign 16
450
451 .LdoubNeg:
452     .quad       0x8000000000000000
453
454 .L64bits:
455     .quad       0xFFFFFFFFFFFFFFFF
456
457 .LshiftMask2:
458     .quad       0x0000000000000000
459 .LshiftMask:
460     .quad       0x000000000000003F
461
462 .Lvalue64:
463     .quad       0x0000000000000040
464
465 .LvaluePosInfLong:
466     .quad       0x7FFFFFFFFFFFFFFF
467
468 .LvalueNegInfLong:
469     .quad       0x8000000000000000
470
471 .LvalueNanLong:
472     .quad       0x0000000000000000
473
474 .LintMin:
475 .long   0x80000000
476
477 .LintMax:
478 .long   0x7FFFFFFF
479
480
481     .global dvmAsmInstructionStart
482     .type   dvmAsmInstructionStart, %function
483 dvmAsmInstructionStart = .L_OP_NOP
484     .text
485
486 /* ------------------------------ */
487     .balign 64
488 .L_OP_NOP: /* 0x00 */
489 /* File: x86-atom/OP_NOP.S */
490    /* Copyright (C) 2008 The Android Open Source Project
491     *
492     * Licensed under the Apache License, Version 2.0 (the "License");
493     * you may not use this file except in compliance with the License.
494     * You may obtain a copy of the License at
495     *
496     * http://www.apache.org/licenses/LICENSE-2.0
497     *
498     * Unless required by applicable law or agreed to in writing, software
499     * distributed under the License is distributed on an "AS IS" BASIS,
500     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
501     * See the License for the specific language governing permissions and
502     * limitations under the License.
503     */
504
505    /*
506     * File: OP_NOP.S
507     *
508     * Code: Use a cycle. Uses no substitutions.
509     *
510     * For: nop
511     *
512     * Description: No operation. Use a cycle
513     *
514     * Format: Ã˜Ã˜|op (10x)
515     *
516     * Syntax: op
517     */
518
519     FINISH      1                       # jump to next instruction
520
521 #ifdef ASSIST_DEBUGGER
522
523    /*
524     * insert fake function header to help gdb find the stack frame
525     */
526
527     .type       dalvik_inst, %function
528 dalvik_inst:
529     MTERP_ENTRY
530 #endif
531
532 /* ------------------------------ */
533     .balign 64
534 .L_OP_MOVE: /* 0x01 */
535 /* File: x86-atom/OP_MOVE.S */
536    /* Copyright (C) 2008 The Android Open Source Project
537     *
538     * Licensed under the Apache License, Version 2.0 (the "License");
539     * you may not use this file except in compliance with the License.
540     * You may obtain a copy of the License at
541     *
542     * http://www.apache.org/licenses/LICENSE-2.0
543     *
544     * Unless required by applicable law or agreed to in writing, software
545     * distributed under the License is distributed on an "AS IS" BASIS,
546     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
547     * See the License for the specific language governing permissions and
548     * limitations under the License.
549     */
550
551    /*
552     * File: OP_MOVE.S
553     *
554     * Code: Copies contents from one register to another. Uses no
555     *       substitutions.
556     *
557     * For: move, move-object, long-to-int
558     *
559     * Description: Copies contents from one non-object register to another.
560     *              vA<- vB; fp[A]<- fp[B]
561     *
562     * Format: B|A|op (12x)
563     *
564     * Syntax: op vA, vB
565     */
566
567     movl        rINST, %ecx             # %ecx<- BA
568     shr         $4, rINST              # rINST<- B
569     and         $15, %ecx              # %ecx<- A
570     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
571     GET_VREG    rINST                   # rINST<- vB
572     SET_VREG    rINST, %ecx             # vA<- vB; %edx
573     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
574 /* ------------------------------ */
575     .balign 64
576 .L_OP_MOVE_FROM16: /* 0x02 */
577 /* File: x86-atom/OP_MOVE_FROM16.S */
578    /* Copyright (C) 2008 The Android Open Source Project
579     *
580     * Licensed under the Apache License, Version 2.0 (the "License");
581     * you may not use this file except in compliance with the License.
582     * You may obtain a copy of the License at
583     *
584     * http://www.apache.org/licenses/LICENSE-2.0
585     *
586     * Unless required by applicable law or agreed to in writing, software
587     * distributed under the License is distributed on an "AS IS" BASIS,
588     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
589     * See the License for the specific language governing permissions and
590     * limitations under the License.
591     */
592
593    /*
594     * File: OP_MOVE_FROM16.S
595     *
596     * Code: Copies contents from one register to another
597     *
598     * For: move/from16, move-object/from16
599     *
600     * Description: Copies contents from one non-object register to another.
601     *              vA<- vB; fp[A]<- fp[B]
602     *
603     * Format: AA|op BBBB (22x)
604     *
605     * Syntax: op vAA, vBBBB
606     */
607
608     FETCH       1, %edx                 # %edx<- BBBB
609     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
610     GET_VREG    %edx                    # %edx<- vB
611     SET_VREG    %edx, rINST             # vA<- vB; %edx
612     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
613
614 /* ------------------------------ */
615     .balign 64
616 .L_OP_MOVE_16: /* 0x03 */
617 /* File: x86-atom/OP_MOVE_16.S */
618    /* Copyright (C) 2008 The Android Open Source Project
619     *
620     * Licensed under the Apache License, Version 2.0 (the "License");
621     * you may not use this file except in compliance with the License.
622     * You may obtain a copy of the License at
623     *
624     * http://www.apache.org/licenses/LICENSE-2.0
625     *
626     * Unless required by applicable law or agreed to in writing, software
627     * distributed under the License is distributed on an "AS IS" BASIS,
628     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
629     * See the License for the specific language governing permissions and
630     * limitations under the License.
631     */
632
633    /*
634     * File: OP_MOVE_16.S
635     *
636     * Code: Copies contents from one register to another
637     *
638     * For: move/16, move-object/16
639     *
640     * Description: Copies contents from one non-object register to another.
641     *              fp[A]<- fp[B]
642     *
643     * Format: Ã˜Ã˜|op AAAA BBBB (32x)
644     *
645     * Syntax: op vAAAA, vBBBB
646     */
647
648     FETCH       2, %edx                 # %edx<- BBBB
649     FETCH       1, %ecx                 # %ecx<- AAAA
650     FFETCH_ADV  3, %eax                 # %eax<- next instruction hi; fetch, advance
651     GET_VREG    %edx                    # %edx<- vB
652     SET_VREG    %edx, %ecx              # vA<- vB; %edx
653     FGETOP_JMP  3, %eax                 # jump to next instruction; getop, jmp
654
655 /* ------------------------------ */
656     .balign 64
657 .L_OP_MOVE_WIDE: /* 0x04 */
658 /* File: x86-atom/OP_MOVE_WIDE.S */
659    /* Copyright (C) 2008 The Android Open Source Project
660     *
661     * Licensed under the Apache License, Version 2.0 (the "License");
662     * you may not use this file except in compliance with the License.
663     * You may obtain a copy of the License at
664     *
665     * http://www.apache.org/licenses/LICENSE-2.0
666     *
667     * Unless required by applicable law or agreed to in writing, software
668     * distributed under the License is distributed on an "AS IS" BASIS,
669     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
670     * See the License for the specific language governing permissions and
671     * limitations under the License.
672     */
673
674    /*
675     * File: OP_MOVE_WIDE.S
676     *
677     * Code: Copies contents from one register to another. Uses no
678     *       substitutions.
679     *
680     * For: move-wide
681     *
682     * Description: Copies contents from one non-object register to another.
683     *
684     * Format: B|A|op (12x)
685     *
686     * Syntax: op vA, vB
687     */
688
689     movl        rINST, %edx             # %edx<- BA+
690     shr         $4, %edx               # %edx<- B
691     and         $15, rINST             # rINST<- A
692     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
693     movq        (rFP, %edx, 4), %xmm0   # %xmm0<- vB
694     movq        %xmm0, (rFP, rINST, 4)  # vA<- vB
695     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
696 /* ------------------------------ */
697     .balign 64
698 .L_OP_MOVE_WIDE_FROM16: /* 0x05 */
699 /* File: x86-atom/OP_MOVE_WIDE_FROM16.S */
700    /* Copyright (C) 2008 The Android Open Source Project
701     *
702     * Licensed under the Apache License, Version 2.0 (the "License");
703     * you may not use this file except in compliance with the License.
704     * You may obtain a copy of the License at
705     *
706     * http://www.apache.org/licenses/LICENSE-2.0
707     *
708     * Unless required by applicable law or agreed to in writing, software
709     * distributed under the License is distributed on an "AS IS" BASIS,
710     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
711     * See the License for the specific language governing permissions and
712     * limitations under the License.
713     */
714
715    /*
716     * File: OP_MOVE_WIDE_FROM16.S
717     *
718     * Code: Copies contents from one register to another
719     *
720     * For: move-wide/from16
721     *
722     * Description: Copies contents from one non-object register to another.
723     *
724     * Format: AA|op BBBB (22x)
725     *
726     * Syntax: op vAA, vBBBB
727     */
728
729     FETCH       1, %edx                 # %edx<- BBBB
730     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
731     movq        (rFP, %edx, 4), %xmm0   # %xmm0<- vB
732     movq        %xmm0, (rFP, rINST, 4)  # vA<- vB
733     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
734
735 /* ------------------------------ */
736     .balign 64
737 .L_OP_MOVE_WIDE_16: /* 0x06 */
738 /* File: x86-atom/OP_MOVE_WIDE_16.S */
739    /* Copyright (C) 2008 The Android Open Source Project
740     *
741     * Licensed under the Apache License, Version 2.0 (the "License");
742     * you may not use this file except in compliance with the License.
743     * You may obtain a copy of the License at
744     *
745     * http://www.apache.org/licenses/LICENSE-2.0
746     *
747     * Unless required by applicable law or agreed to in writing, software
748     * distributed under the License is distributed on an "AS IS" BASIS,
749     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
750     * See the License for the specific language governing permissions and
751     * limitations under the License.
752     */
753
754    /*
755     * File: OP_MOVE_WIDE_16.S
756     *
757     * Code: Copies contents from one register to another. Uses no
758     *       substitutions.
759     *
760     * For: move-wide/16
761     *
762     * Description: Copies contents from one non-object register to another.
763     *
764     * Format: Ã˜Ã˜|op AAAA BBBB (32x)
765     *
766     * Syntax: op vAAAA, vBBBB
767     */
768
769     FETCH       2, %edx                 # %edx<- BBBB
770     FETCH       1, %ecx                 # %ecx<- AAAA
771     FFETCH_ADV  3, %eax                 # %eax<- next instruction hi; fetch, advance
772     movq        (rFP, %edx, 4), %xmm0   # %xmm0<- vB
773     movq        %xmm0, (rFP, %ecx, 4)   # vA<- vB; %xmm0
774     FGETOP_JMP  3, %eax                 # jump to next instruction; getop, jmp
775
776 /* ------------------------------ */
777     .balign 64
778 .L_OP_MOVE_OBJECT: /* 0x07 */
779 /* File: x86-atom/OP_MOVE_OBJECT.S */
780    /* Copyright (C) 2008 The Android Open Source Project
781     *
782     * Licensed under the Apache License, Version 2.0 (the "License");
783     * you may not use this file except in compliance with the License.
784     * You may obtain a copy of the License at
785     *
786     * http://www.apache.org/licenses/LICENSE-2.0
787     *
788     * Unless required by applicable law or agreed to in writing, software
789     * distributed under the License is distributed on an "AS IS" BASIS,
790     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
791     * See the License for the specific language governing permissions and
792     * limitations under the License.
793     */
794
795    /*
796     * File: OP_MOVE_OBJECT.S
797     */
798
799 /* File: x86-atom/OP_MOVE.S */
800    /* Copyright (C) 2008 The Android Open Source Project
801     *
802     * Licensed under the Apache License, Version 2.0 (the "License");
803     * you may not use this file except in compliance with the License.
804     * You may obtain a copy of the License at
805     *
806     * http://www.apache.org/licenses/LICENSE-2.0
807     *
808     * Unless required by applicable law or agreed to in writing, software
809     * distributed under the License is distributed on an "AS IS" BASIS,
810     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
811     * See the License for the specific language governing permissions and
812     * limitations under the License.
813     */
814
815    /*
816     * File: OP_MOVE.S
817     *
818     * Code: Copies contents from one register to another. Uses no
819     *       substitutions.
820     *
821     * For: move, move-object, long-to-int
822     *
823     * Description: Copies contents from one non-object register to another.
824     *              vA<- vB; fp[A]<- fp[B]
825     *
826     * Format: B|A|op (12x)
827     *
828     * Syntax: op vA, vB
829     */
830
831     movl        rINST, %ecx             # %ecx<- BA
832     shr         $4, rINST              # rINST<- B
833     and         $15, %ecx              # %ecx<- A
834     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
835     GET_VREG    rINST                   # rINST<- vB
836     SET_VREG    rINST, %ecx             # vA<- vB; %edx
837     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
838
839 /* ------------------------------ */
840     .balign 64
841 .L_OP_MOVE_OBJECT_FROM16: /* 0x08 */
842 /* File: x86-atom/OP_MOVE_OBJECT_FROM16.S */
843    /* Copyright (C) 2008 The Android Open Source Project
844     *
845     * Licensed under the Apache License, Version 2.0 (the "License");
846     * you may not use this file except in compliance with the License.
847     * You may obtain a copy of the License at
848     *
849     * http://www.apache.org/licenses/LICENSE-2.0
850     *
851     * Unless required by applicable law or agreed to in writing, software
852     * distributed under the License is distributed on an "AS IS" BASIS,
853     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
854     * See the License for the specific language governing permissions and
855     * limitations under the License.
856     */
857
858    /*
859     * File: OP_MOVE_OBJECT_FROM16.S
860     */
861
862 /* File: x86-atom/OP_MOVE_FROM16.S */
863    /* Copyright (C) 2008 The Android Open Source Project
864     *
865     * Licensed under the Apache License, Version 2.0 (the "License");
866     * you may not use this file except in compliance with the License.
867     * You may obtain a copy of the License at
868     *
869     * http://www.apache.org/licenses/LICENSE-2.0
870     *
871     * Unless required by applicable law or agreed to in writing, software
872     * distributed under the License is distributed on an "AS IS" BASIS,
873     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
874     * See the License for the specific language governing permissions and
875     * limitations under the License.
876     */
877
878    /*
879     * File: OP_MOVE_FROM16.S
880     *
881     * Code: Copies contents from one register to another
882     *
883     * For: move/from16, move-object/from16
884     *
885     * Description: Copies contents from one non-object register to another.
886     *              vA<- vB; fp[A]<- fp[B]
887     *
888     * Format: AA|op BBBB (22x)
889     *
890     * Syntax: op vAA, vBBBB
891     */
892
893     FETCH       1, %edx                 # %edx<- BBBB
894     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
895     GET_VREG    %edx                    # %edx<- vB
896     SET_VREG    %edx, rINST             # vA<- vB; %edx
897     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
898
899
900 /* ------------------------------ */
901     .balign 64
902 .L_OP_MOVE_OBJECT_16: /* 0x09 */
903 /* File: x86-atom/OP_MOVE_OBJECT_16.S */
904    /* Copyright (C) 2008 The Android Open Source Project
905     *
906     * Licensed under the Apache License, Version 2.0 (the "License");
907     * you may not use this file except in compliance with the License.
908     * You may obtain a copy of the License at
909     *
910     * http://www.apache.org/licenses/LICENSE-2.0
911     *
912     * Unless required by applicable law or agreed to in writing, software
913     * distributed under the License is distributed on an "AS IS" BASIS,
914     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
915     * See the License for the specific language governing permissions and
916     * limitations under the License.
917     */
918
919    /*
920     * File: OP_MOVE_OBJECT_16.S
921     */
922
923 /* File: x86-atom/OP_MOVE_16.S */
924    /* Copyright (C) 2008 The Android Open Source Project
925     *
926     * Licensed under the Apache License, Version 2.0 (the "License");
927     * you may not use this file except in compliance with the License.
928     * You may obtain a copy of the License at
929     *
930     * http://www.apache.org/licenses/LICENSE-2.0
931     *
932     * Unless required by applicable law or agreed to in writing, software
933     * distributed under the License is distributed on an "AS IS" BASIS,
934     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
935     * See the License for the specific language governing permissions and
936     * limitations under the License.
937     */
938
939    /*
940     * File: OP_MOVE_16.S
941     *
942     * Code: Copies contents from one register to another
943     *
944     * For: move/16, move-object/16
945     *
946     * Description: Copies contents from one non-object register to another.
947     *              fp[A]<- fp[B]
948     *
949     * Format: Ã˜Ã˜|op AAAA BBBB (32x)
950     *
951     * Syntax: op vAAAA, vBBBB
952     */
953
954     FETCH       2, %edx                 # %edx<- BBBB
955     FETCH       1, %ecx                 # %ecx<- AAAA
956     FFETCH_ADV  3, %eax                 # %eax<- next instruction hi; fetch, advance
957     GET_VREG    %edx                    # %edx<- vB
958     SET_VREG    %edx, %ecx              # vA<- vB; %edx
959     FGETOP_JMP  3, %eax                 # jump to next instruction; getop, jmp
960
961
962 /* ------------------------------ */
963     .balign 64
964 .L_OP_MOVE_RESULT: /* 0x0a */
965 /* File: x86-atom/OP_MOVE_RESULT.S */
966    /* Copyright (C) 2008 The Android Open Source Project
967     *
968     * Licensed under the Apache License, Version 2.0 (the "License");
969     * you may not use this file except in compliance with the License.
970     * You may obtain a copy of the License at
971     *
972     * http://www.apache.org/licenses/LICENSE-2.0
973     *
974     * Unless required by applicable law or agreed to in writing, software
975     * distributed under the License is distributed on an "AS IS" BASIS,
976     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
977     * See the License for the specific language governing permissions and
978     * limitations under the License.
979     */
980
981    /*
982     * File: OP_MOVE_RESULT.S
983     *
984     * Code: Copies a return value to a register
985     *
986     * For: move-result, move-result-object
987     *
988     * Description: Move the single-word non-object result of the most
989     *              recent method invocation into the indicated register. This
990     *              must be done as the instruction immediately after a
991     *              method invocation whose (single-word, non-object) result
992     *              is not to be ignored; anywhere else is invalid.
993     *
994     * Format: AA|op (11x)
995     *
996     * Syntax: op vAA
997     */
998
999     movl        rGLUE, %eax             # %eax<- pMterpGlue
1000     FFETCH_ADV  1, %ecx                 # %ecx<- next instruction hi; fetch, advance
1001     movl        offGlue_retval(%eax), %edx # %edx<- glue->retval
1002     SET_VREG    %edx, rINST             # vA<- glue->retval
1003     FGETOP_JMP  1, %ecx                 # jump to next instruction; getop, jmp
1004
1005 /* ------------------------------ */
1006     .balign 64
1007 .L_OP_MOVE_RESULT_WIDE: /* 0x0b */
1008 /* File: x86-atom/OP_MOVE_RESULT_WIDE.S */
1009    /* Copyright (C) 2008 The Android Open Source Project
1010     *
1011     * Licensed under the Apache License, Version 2.0 (the "License");
1012     * you may not use this file except in compliance with the License.
1013     * You may obtain a copy of the License at
1014     *
1015     * http://www.apache.org/licenses/LICENSE-2.0
1016     *
1017     * Unless required by applicable law or agreed to in writing, software
1018     * distributed under the License is distributed on an "AS IS" BASIS,
1019     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1020     * See the License for the specific language governing permissions and
1021     * limitations under the License.
1022     */
1023
1024    /*
1025     * File: OP_MOVE_RESULT_WIDE.S
1026     *
1027     * Code: Copies a return value to a register
1028     *
1029     * For: move-result-wide
1030     *
1031     * Description: Move the double-word non-object result of the most
1032     *              recent method invocation into the indicated register. This
1033     *              must be done as the instruction immediately after a
1034     *              method invocation whose (single-word, non-object) result
1035     *              is not to be ignored; anywhere else is invalid.
1036     *
1037     * Format: AA|op (11x)
1038     *
1039     * Syntax: op vAA
1040     */
1041
1042     movl        rGLUE, %eax             # %eax<- pMterpGlue
1043     movq        offGlue_retval(%eax), %xmm0 # %xmm0<- glue->retval
1044     movq        %xmm0, (rFP, rINST, 4)  # vA<- glue->retval
1045     FFETCH_ADV  1, %edx                 # %edx<- next instruction hi; fetch, advance
1046     FGETOP_JMP  1, %edx                 # jump to next instruction; getop, jmp
1047
1048 /* ------------------------------ */
1049     .balign 64
1050 .L_OP_MOVE_RESULT_OBJECT: /* 0x0c */
1051 /* File: x86-atom/OP_MOVE_RESULT_OBJECT.S */
1052    /* Copyright (C) 2008 The Android Open Source Project
1053     *
1054     * Licensed under the Apache License, Version 2.0 (the "License");
1055     * you may not use this file except in compliance with the License.
1056     * You may obtain a copy of the License at
1057     *
1058     * http://www.apache.org/licenses/LICENSE-2.0
1059     *
1060     * Unless required by applicable law or agreed to in writing, software
1061     * distributed under the License is distributed on an "AS IS" BASIS,
1062     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1063     * See the License for the specific language governing permissions and
1064     * limitations under the License.
1065     */
1066
1067    /*
1068     * File: OP_MOVE_RESULT_OBJECT.S
1069     */
1070
1071 /* File: x86-atom/OP_MOVE_RESULT.S */
1072    /* Copyright (C) 2008 The Android Open Source Project
1073     *
1074     * Licensed under the Apache License, Version 2.0 (the "License");
1075     * you may not use this file except in compliance with the License.
1076     * You may obtain a copy of the License at
1077     *
1078     * http://www.apache.org/licenses/LICENSE-2.0
1079     *
1080     * Unless required by applicable law or agreed to in writing, software
1081     * distributed under the License is distributed on an "AS IS" BASIS,
1082     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1083     * See the License for the specific language governing permissions and
1084     * limitations under the License.
1085     */
1086
1087    /*
1088     * File: OP_MOVE_RESULT.S
1089     *
1090     * Code: Copies a return value to a register
1091     *
1092     * For: move-result, move-result-object
1093     *
1094     * Description: Move the single-word non-object result of the most
1095     *              recent method invocation into the indicated register. This
1096     *              must be done as the instruction immediately after a
1097     *              method invocation whose (single-word, non-object) result
1098     *              is not to be ignored; anywhere else is invalid.
1099     *
1100     * Format: AA|op (11x)
1101     *
1102     * Syntax: op vAA
1103     */
1104
1105     movl        rGLUE, %eax             # %eax<- pMterpGlue
1106     FFETCH_ADV  1, %ecx                 # %ecx<- next instruction hi; fetch, advance
1107     movl        offGlue_retval(%eax), %edx # %edx<- glue->retval
1108     SET_VREG    %edx, rINST             # vA<- glue->retval
1109     FGETOP_JMP  1, %ecx                 # jump to next instruction; getop, jmp
1110
1111
1112 /* ------------------------------ */
1113     .balign 64
1114 .L_OP_MOVE_EXCEPTION: /* 0x0d */
1115 /* File: x86-atom/OP_MOVE_EXCEPTION.S */
1116    /* Copyright (C) 2008 The Android Open Source Project
1117     *
1118     * Licensed under the Apache License, Version 2.0 (the "License");
1119     * you may not use this file except in compliance with the License.
1120     * You may obtain a copy of the License at
1121     *
1122     * http://www.apache.org/licenses/LICENSE-2.0
1123     *
1124     * Unless required by applicable law or agreed to in writing, software
1125     * distributed under the License is distributed on an "AS IS" BASIS,
1126     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1127     * See the License for the specific language governing permissions and
1128     * limitations under the License.
1129     */
1130
1131    /*
1132     * File: OP_MOVE_EXCEPTION.S
1133     *
1134     * Code: Moves an exception to a register
1135     *
1136     * For: move-exception
1137     *
1138     * Description: Save a just-caught exception into the given register. This
1139     *              instruction is only valid as the first instruction of an
1140     *              exception handler.
1141     *
1142     * Format: AA|op (11x)
1143     *
1144     * Syntax: op vAA
1145     */
1146
1147     movl        rGLUE, %eax             # %eax<- pMterpGlue
1148     movl        offGlue_self(%eax), %ecx # %ecx<- glue->self
1149     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
1150     movl        offThread_exception(%ecx), %edx # %edx<- glue->self->exception
1151     movl        $0, offThread_exception(%ecx) # clear exception
1152     SET_VREG    %edx, rINST             # vAA<- glue->self->exception
1153     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
1154
1155 /* ------------------------------ */
1156     .balign 64
1157 .L_OP_RETURN_VOID: /* 0x0e */
1158 /* File: x86-atom/OP_RETURN_VOID.S */
1159    /* Copyright (C) 2008 The Android Open Source Project
1160     *
1161     * Licensed under the Apache License, Version 2.0 (the "License");
1162     * you may not use this file except in compliance with the License.
1163     * You may obtain a copy of the License at
1164     *
1165     * http://www.apache.org/licenses/LICENSE-2.0
1166     *
1167     * Unless required by applicable law or agreed to in writing, software
1168     * distributed under the License is distributed on an "AS IS" BASIS,
1169     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1170     * See the License for the specific language governing permissions and
1171     * limitations under the License.
1172     */
1173
1174    /*
1175     * File: OP_RETURN_VOID.S
1176     */
1177
1178     jmp         common_returnFromMethod
1179
1180 /* ------------------------------ */
1181     .balign 64
1182 .L_OP_RETURN: /* 0x0f */
1183 /* File: x86-atom/OP_RETURN.S */
1184    /* Copyright (C) 2008 The Android Open Source Project
1185     *
1186     * Licensed under the Apache License, Version 2.0 (the "License");
1187     * you may not use this file except in compliance with the License.
1188     * You may obtain a copy of the License at
1189     *
1190     * http://www.apache.org/licenses/LICENSE-2.0
1191     *
1192     * Unless required by applicable law or agreed to in writing, software
1193     * distributed under the License is distributed on an "AS IS" BASIS,
1194     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1195     * See the License for the specific language governing permissions and
1196     * limitations under the License.
1197     */
1198
1199    /*
1200     * File: OP_RETURN.S
1201     */
1202
1203 /* File: x86-atom/OP_RETURN_COMMON.S */
1204    /* Copyright (C) 2008 The Android Open Source Project
1205     *
1206     * Licensed under the Apache License, Version 2.0 (the "License");
1207     * you may not use this file except in compliance with the License.
1208     * You may obtain a copy of the License at
1209     *
1210     * http://www.apache.org/licenses/LICENSE-2.0
1211     *
1212     * Unless required by applicable law or agreed to in writing, software
1213     * distributed under the License is distributed on an "AS IS" BASIS,
1214     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1215     * See the License for the specific language governing permissions and
1216     * limitations under the License.
1217     */
1218
1219    /*
1220     * File: OP_RETURN_COMMON.S
1221     *
1222     * Code: Return a 32-bit value. Uses no substitutions.
1223     *
1224     * For: return, return-object
1225     *
1226     * Description: Copies the return value into the "glue"
1227     *              structure, then jumps to the return handler.
1228     *
1229     * Format: AA|op (11x)
1230     *
1231     * Syntax: op vAA
1232     */
1233
1234     movl        rGLUE, %edx             # %edx<- pMterpGlue
1235     GET_VREG    rINST                   # rINST<- vAA
1236     movl        rINST, offGlue_retval(%edx) # glue->retval<- vAA
1237     jmp         common_returnFromMethod # jump to common return code
1238
1239
1240 /* ------------------------------ */
1241     .balign 64
1242 .L_OP_RETURN_WIDE: /* 0x10 */
1243 /* File: x86-atom/OP_RETURN_WIDE.S */
1244    /* Copyright (C) 2008 The Android Open Source Project
1245     *
1246     * Licensed under the Apache License, Version 2.0 (the "License");
1247     * you may not use this file except in compliance with the License.
1248     * You may obtain a copy of the License at
1249     *
1250     * http://www.apache.org/licenses/LICENSE-2.0
1251     *
1252     * Unless required by applicable law or agreed to in writing, software
1253     * distributed under the License is distributed on an "AS IS" BASIS,
1254     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1255     * See the License for the specific language governing permissions and
1256     * limitations under the License.
1257     */
1258
1259    /*
1260     * File: OP_RETURN_WIDE.S
1261     *
1262     * Code: Return a 64-bit value. Uses no substitutions.
1263     *
1264     * For: return-wide
1265     *
1266     * Description: Copies the return value into the "glue"
1267     *              structure, then jumps to the return handler.
1268     *
1269     * Format: AA|op (11x)
1270     *
1271     * Syntax: op vAA
1272     */
1273
1274     movl        rGLUE, %edx             # %edx<- pMterpGlue
1275     movq        (rFP, rINST, 4), %xmm0  # %xmm0<- vAA
1276     movq        %xmm0, offGlue_retval(%edx)# glue->retval<- vAA
1277     jmp         common_returnFromMethod # jump to common return code
1278
1279 /* ------------------------------ */
1280     .balign 64
1281 .L_OP_RETURN_OBJECT: /* 0x11 */
1282 /* File: x86-atom/OP_RETURN_OBJECT.S */
1283    /* Copyright (C) 2008 The Android Open Source Project
1284     *
1285     * Licensed under the Apache License, Version 2.0 (the "License");
1286     * you may not use this file except in compliance with the License.
1287     * You may obtain a copy of the License at
1288     *
1289     * http://www.apache.org/licenses/LICENSE-2.0
1290     *
1291     * Unless required by applicable law or agreed to in writing, software
1292     * distributed under the License is distributed on an "AS IS" BASIS,
1293     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1294     * See the License for the specific language governing permissions and
1295     * limitations under the License.
1296     */
1297
1298    /*
1299     * File: OP_RETURN_OBJECT.S
1300     */
1301
1302 /* File: x86-atom/OP_RETURN_COMMON.S */
1303    /* Copyright (C) 2008 The Android Open Source Project
1304     *
1305     * Licensed under the Apache License, Version 2.0 (the "License");
1306     * you may not use this file except in compliance with the License.
1307     * You may obtain a copy of the License at
1308     *
1309     * http://www.apache.org/licenses/LICENSE-2.0
1310     *
1311     * Unless required by applicable law or agreed to in writing, software
1312     * distributed under the License is distributed on an "AS IS" BASIS,
1313     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1314     * See the License for the specific language governing permissions and
1315     * limitations under the License.
1316     */
1317
1318    /*
1319     * File: OP_RETURN_COMMON.S
1320     *
1321     * Code: Return a 32-bit value. Uses no substitutions.
1322     *
1323     * For: return, return-object
1324     *
1325     * Description: Copies the return value into the "glue"
1326     *              structure, then jumps to the return handler.
1327     *
1328     * Format: AA|op (11x)
1329     *
1330     * Syntax: op vAA
1331     */
1332
1333     movl        rGLUE, %edx             # %edx<- pMterpGlue
1334     GET_VREG    rINST                   # rINST<- vAA
1335     movl        rINST, offGlue_retval(%edx) # glue->retval<- vAA
1336     jmp         common_returnFromMethod # jump to common return code
1337
1338
1339 /* ------------------------------ */
1340     .balign 64
1341 .L_OP_CONST_4: /* 0x12 */
1342 /* File: x86-atom/OP_CONST_4.S */
1343    /* Copyright (C) 2008 The Android Open Source Project
1344     *
1345     * Licensed under the Apache License, Version 2.0 (the "License");
1346     * you may not use this file except in compliance with the License.
1347     * You may obtain a copy of the License at
1348     *
1349     * http://www.apache.org/licenses/LICENSE-2.0
1350     *
1351     * Unless required by applicable law or agreed to in writing, software
1352     * distributed under the License is distributed on an "AS IS" BASIS,
1353     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1354     * See the License for the specific language governing permissions and
1355     * limitations under the License.
1356     */
1357
1358    /*
1359     * File: OP_CONST_4.S
1360     *
1361     * Code: Moves a literal to a register. Uses no substitutions.
1362     *
1363     * For: const/4
1364     *
1365     * Description: Move the given literal value (right-sign-extended to 32
1366     *              bits) into the specified register.
1367     *
1368     * Format: B|A|op (11n)
1369     *
1370     * Syntax: op vA, #+B
1371     */
1372
1373     movl        rINST, %edx             # %edx<- BA
1374     andl        $15, rINST             # rINST<- A
1375     FFETCH_ADV  1, %eax                 # %eax<- next i nstruction hi; fetch, advance
1376     shl         $24, %edx              # %edx<- B000
1377     addl        $2, rPC                  # update PC
1378     sar         $28, %edx              # %edx<- right-zero-extended B
1379     SET_VREG    %edx, rINST             # vA<- %edx; literal
1380     FGETOP_JMP2 %eax                    # jump to next instruction; getop, jmp
1381 /* ------------------------------ */
1382     .balign 64
1383 .L_OP_CONST_16: /* 0x13 */
1384 /* File: x86-atom/OP_CONST_16.S */
1385    /* Copyright (C) 2008 The Android Open Source Project
1386     *
1387     * Licensed under the Apache License, Version 2.0 (the "License");
1388     * you may not use this file except in compliance with the License.
1389     * You may obtain a copy of the License at
1390     *
1391     * http://www.apache.org/licenses/LICENSE-2.0
1392     *
1393     * Unless required by applicable law or agreed to in writing, software
1394     * distributed under the License is distributed on an "AS IS" BASIS,
1395     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1396     * See the License for the specific language governing permissions and
1397     * limitations under the License.
1398     */
1399
1400    /*
1401     * File: OP_CONST_16.S
1402     *
1403     * Code: Moves a literal to a register. Uses no substitutions.
1404     *
1405     * For: const/16
1406     *
1407     * Description: Move the given literal value (right-zero-extended to 32
1408     *              bits) into the specified register
1409     *
1410     * Format: AA|op BBBB (21s)
1411     *
1412     * Syntax: op vAA, #+BBBB
1413     */
1414
1415     FETCHs      1, %edx                 # %edx<- BBBB
1416     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
1417     SET_VREG    %edx rINST              # vAA<- BBBB; literal
1418     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
1419 /* ------------------------------ */
1420     .balign 64
1421 .L_OP_CONST: /* 0x14 */
1422 /* File: x86-atom/OP_CONST.S */
1423    /* Copyright (C) 2008 The Android Open Source Project
1424     *
1425     * Licensed under the Apache License, Version 2.0 (the "License");
1426     * you may not use this file except in compliance with the License.
1427     * You may obtain a copy of the License at
1428     *
1429     * http://www.apache.org/licenses/LICENSE-2.0
1430     *
1431     * Unless required by applicable law or agreed to in writing, software
1432     * distributed under the License is distributed on an "AS IS" BASIS,
1433     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1434     * See the License for the specific language governing permissions and
1435     * limitations under the License.
1436     */
1437
1438    /*
1439     * File: OP_CONST.S
1440     *
1441     * Code: Move a literal to a register. Uses no substitutions.
1442     *
1443     * For: const
1444     *
1445     * Description: Move the given literal value into the specified register
1446     *
1447     * Format: AA|op BBBBlo BBBBhi (31i)
1448     *
1449     * Syntax: op vAA, #+BBBBBBBB
1450     */
1451
1452     FETCH       2, %edx                 # %edx<- BBBBhi
1453     FETCH       1, %ecx                 # %ecx<- BBBBlo
1454     shl         $16, %edx              # move BBBB to high bits
1455     or          %edx, %ecx              # %ecx<- #+BBBBBBBB
1456     FFETCH_ADV  3, %eax                 # %eax<- next instruction hi; fetch, advance
1457     SET_VREG    %ecx, rINST             # vAA<- %ecx; literal
1458     FGETOP_JMP  3, %eax                 # jump to next instruction; getop, jmp
1459 /* ------------------------------ */
1460     .balign 64
1461 .L_OP_CONST_HIGH16: /* 0x15 */
1462 /* File: x86-atom/OP_CONST_HIGH16.S */
1463    /* Copyright (C) 2008 The Android Open Source Project
1464     *
1465     * Licensed under the Apache License, Version 2.0 (the "License");
1466     * you may not use this file except in compliance with the License.
1467     * You may obtain a copy of the License at
1468     *
1469     * http://www.apache.org/licenses/LICENSE-2.0
1470     *
1471     * Unless required by applicable law or agreed to in writing, software
1472     * distributed under the License is distributed on an "AS IS" BASIS,
1473     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1474     * See the License for the specific language governing permissions and
1475     * limitations under the License.
1476     */
1477
1478    /*
1479     * File: OP_CONST_HIGH16.S
1480     *
1481     * Code: Move a literal to a register. Uses no substitutions.
1482     *
1483     * For: const/high16
1484     *
1485     * Description: Move the given literal value (right-zero-extended to 32
1486     *              bits) into the specified register
1487     *
1488     * Format: AA|op BBBB (21h)
1489     *
1490     * Syntax: op vAA, #+BBBB0000
1491     */
1492
1493     FETCH       1, %ecx                 # %ecx<- 0000BBBB (zero-extended)
1494     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
1495     shl         $16, %ecx              # %ecx<- BBBB0000
1496     SET_VREG    %ecx, rINST             # vAA<- %ecx; BBBB0000
1497     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
1498
1499 /* ------------------------------ */
1500     .balign 64
1501 .L_OP_CONST_WIDE_16: /* 0x16 */
1502 /* File: x86-atom/OP_CONST_WIDE_16.S */
1503    /* Copyright (C) 2008 The Android Open Source Project
1504     *
1505     * Licensed under the Apache License, Version 2.0 (the "License");
1506     * you may not use this file except in compliance with the License.
1507     * You may obtain a copy of the License at
1508     *
1509     * http://www.apache.org/licenses/LICENSE-2.0
1510     *
1511     * Unless required by applicable law or agreed to in writing, software
1512     * distributed under the License is distributed on an "AS IS" BASIS,
1513     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1514     * See the License for the specific language governing permissions and
1515     * limitations under the License.
1516     */
1517
1518    /*
1519     * File: OP_CONST_WIDE_16.S
1520     *
1521     * Code: Move a literal to a register. Uses no substitutions.
1522     *
1523     * For: const-wide/16
1524     *
1525     * Description: Move the given literal value (sign-extended to 64 bits)
1526     *              into the specified register-pair
1527     *
1528     * Format: AA|op BBBB (21s)
1529     *
1530     * Syntax: op vAA, #+BBBB
1531     */
1532
1533     FETCHs      1, %ecx                 # %ecx<- ssssBBBB (sign-extended)
1534     movl        %ecx, %edx              # %edx<- ssssBBBB (sign-extended)
1535     sar         $31, %ecx              # %ecx<- sign bit
1536     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
1537     movl        %edx, (rFP, rINST, 4)   # vAA<- ssssBBBB
1538     movl        %ecx, 4(rFP, rINST, 4)  # vAA+1<- ssssssss
1539     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
1540 /* ------------------------------ */
1541     .balign 64
1542 .L_OP_CONST_WIDE_32: /* 0x17 */
1543 /* File: x86-atom/OP_CONST_WIDE_32.S */
1544    /* Copyright (C) 2008 The Android Open Source Project
1545     *
1546     * Licensed under the Apache License, Version 2.0 (the "License");
1547     * you may not use this file except in compliance with the License.
1548     * You may obtain a copy of the License at
1549     *
1550     * http://www.apache.org/licenses/LICENSE-2.0
1551     *
1552     * Unless required by applicable law or agreed to in writing, software
1553     * distributed under the License is distributed on an "AS IS" BASIS,
1554     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1555     * See the License for the specific language governing permissions and
1556     * limitations under the License.
1557     */
1558
1559    /*
1560     * File: OP_CONST_WIDE_32.S
1561     *
1562     * Code: Move a literal to a register. Uses no substitutions.
1563     *
1564     * For: const-wide/32
1565     *
1566     * Description: Move the given literal value (sign-extended to 64 bits)
1567     *              into the specified register-pair
1568     *
1569     * Format: AA|op BBBBlo BBBBhi (31i)
1570     *
1571     * Syntax: op vAA, #+BBBBBBBB
1572     */
1573
1574     FETCH       1,  %edx                # %edx<- BBBBlo
1575     FETCHs      2, %ecx                 # %ecx<- BBBBhi
1576     shl         $16, %ecx              # prepare to create #+BBBBBBBB
1577     or          %ecx, %edx              # %edx<- %edx<- #+BBBBBBBB
1578     sar         $31, %ecx              # %ecx<- sign bit
1579     FFETCH_ADV  3, %eax                 # %eax<- next instruction hi; fetch, advance
1580     movl        %edx, (rFP, rINST, 4)   # vAA<-  BBBBBBBB
1581     movl        %ecx, 4(rFP, rINST, 4)  # vAA+1<- ssssssss
1582     FGETOP_JMP  3, %eax                 # jump to next instruction; getop, jmp
1583 /* ------------------------------ */
1584     .balign 64
1585 .L_OP_CONST_WIDE: /* 0x18 */
1586 /* File: x86-atom/OP_CONST_WIDE.S */
1587    /* Copyright (C) 2008 The Android Open Source Project
1588     *
1589     * Licensed under the Apache License, Version 2.0 (the "License");
1590     * you may not use this file except in compliance with the License.
1591     * You may obtain a copy of the License at
1592     *
1593     * http://www.apache.org/licenses/LICENSE-2.0
1594     *
1595     * Unless required by applicable law or agreed to in writing, software
1596     * distributed under the License is distributed on an "AS IS" BASIS,
1597     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1598     * See the License for the specific language governing permissions and
1599     * limitations under the License.
1600     */
1601
1602    /*
1603     * File: OP_CONST_WIDE.S
1604     *
1605     * Code: Move a literal to a register. Uses no substitutions.
1606     *
1607     * For: const-wide
1608     *
1609     * Description: Move the given literal value into the specified
1610     *              register pair
1611     *
1612     * Format: AA|op BBBBlolo BBBBlohi BBBBhilo BBBBhihi (51l)
1613     *
1614     * Syntax: op vAA, #+BBBBBBBBBBBBBBBB
1615     */
1616
1617     FETCH       1, %ecx                 # %ecx<- BBBBlolo
1618     FETCH       2, %edx                 # %edx<- BBBBlohi
1619     shl         $16, %edx              # %edx<- prepare to create #+BBBBBBBBlo
1620     or          %edx, %ecx              # %ecx<- #+BBBBBBBBlo
1621     movl        %ecx, (rFP, rINST, 4)   # vAA <- #+BBBBBBBBlo
1622     FETCH       3, %ecx                 # %ecx<- BBBBhilo
1623     FETCH       4, %edx                 # %edx<- BBBBhihi
1624     FFETCH_ADV  5, %eax                 # %eax<- next instruction hi; fetch, advance
1625     shl         $16, %edx              # %edx<- prepare to create #+BBBBBBBBhi
1626     or          %edx, %ecx              # %ecx<- #+BBBBBBBBhi
1627     movl        %ecx, 4(rFP, rINST, 4)  # vAA+1 <- #+BBBBBBBBlo
1628     FGETOP_JMP  5, %eax                 # jump to next instruction; getop, jmp
1629
1630 /* ------------------------------ */
1631     .balign 64
1632 .L_OP_CONST_WIDE_HIGH16: /* 0x19 */
1633 /* File: x86-atom/OP_CONST_WIDE_HIGH16.S */
1634    /* Copyright (C) 2008 The Android Open Source Project
1635     *
1636     * Licensed under the Apache License, Version 2.0 (the "License");
1637     * you may not use this file except in compliance with the License.
1638     * You may obtain a copy of the License at
1639     *
1640     * http://www.apache.org/licenses/LICENSE-2.0
1641     *
1642     * Unless required by applicable law or agreed to in writing, software
1643     * distributed under the License is distributed on an "AS IS" BASIS,
1644     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1645     * See the License for the specific language governing permissions and
1646     * limitations under the License.
1647     */
1648
1649    /*
1650     * File: OP_CONST_WIDE_HIGH16.S
1651     *
1652     * Code: Move a literal value to a register. Uses no substitutions.
1653     *
1654     * For: const-wide/high16
1655     *
1656     * Description: Move the given literal value (right-zero-extended to 64
1657     *              bits) into the specified register
1658     *
1659     * Format: AA|op BBBB (21h)
1660     *
1661     * Syntax: op vAA, #+BBBB000000000000
1662     */
1663
1664     FETCH       1, %ecx                 # %ecx<- 0000BBBB (zero-extended)
1665     shl         $16, %ecx              # rINST<- AA
1666     movl        $0, (rFP, rINST, 4)    # vAAlow<- 00000000
1667     movl        %ecx, 4(rFP, rINST, 4)  # vAAhigh<- %ecx; BBBB0000
1668     FINISH      2                       # jump to next instruction
1669
1670 /* ------------------------------ */
1671     .balign 64
1672 .L_OP_CONST_STRING: /* 0x1a */
1673 /* File: x86-atom/OP_CONST_STRING.S */
1674    /* Copyright (C) 2008 The Android Open Source Project
1675     *
1676     * Licensed under the Apache License, Version 2.0 (the "License");
1677     * you may not use this file except in compliance with the License.
1678     * You may obtain a copy of the License at
1679     *
1680     * http://www.apache.org/licenses/LICENSE-2.0
1681     *
1682     * Unless required by applicable law or agreed to in writing, software
1683     * distributed under the License is distributed on an "AS IS" BASIS,
1684     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1685     * See the License for the specific language governing permissions and
1686     * limitations under the License.
1687     */
1688
1689    /*
1690     * File: OP_CONST_STRING.S
1691     *
1692     * Code: Move a string reference to a register. Uses no substitutions.
1693     *
1694     * For: const/string
1695     *
1696     * Description: Move a referece to the string specified by the given
1697     *              index into the specified register. vAA <- pResString[BBBB]
1698     *
1699     * Format: AA|op BBBB (21c)
1700     *
1701     * Syntax: op vAA, string@BBBB
1702     */
1703
1704     FETCH       1, %ecx                 # %ecx<- BBBB
1705     movl        rGLUE, %edx             # get MterpGlue pointer
1706     movl        offGlue_methodClassDex(%edx), %eax # %eax<- glue->methodClassDex
1707     movl        offDvmDex_pResStrings(%eax), %eax # %eax<- glue->methodClassDex->pResStrings
1708     movl        (%eax, %ecx, 4), %eax   # %eax<- pResStrings[BBBB]
1709     cmp         $0, %eax               # check if string is resolved
1710     je          .LOP_CONST_STRING_resolve     # resolve string reference
1711     SET_VREG    %eax, rINST             # vAA<- %eax; pResString[BBBB]
1712     FINISH      2                       # jump to next instruction
1713
1714
1715 /* ------------------------------ */
1716     .balign 64
1717 .L_OP_CONST_STRING_JUMBO: /* 0x1b */
1718 /* File: x86-atom/OP_CONST_STRING_JUMBO.S */
1719    /* Copyright (C) 2008 The Android Open Source Project
1720     *
1721     * Licensed under the Apache License, Version 2.0 (the "License");
1722     * you may not use this file except in compliance with the License.
1723     * You may obtain a copy of the License at
1724     *
1725     * http://www.apache.org/licenses/LICENSE-2.0
1726     *
1727     * Unless required by applicable law or agreed to in writing, software
1728     * distributed under the License is distributed on an "AS IS" BASIS,
1729     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1730     * See the License for the specific language governing permissions and
1731     * limitations under the License.
1732     */
1733
1734    /*
1735     * File: OP_CONST_STRING_JUMBO.S
1736     *
1737     * Code: Move a string reference to a register. Uses no substitutions.
1738     *
1739     * For: const/string-jumbo
1740     *
1741     * Description: Move a reference to the string specified by the given
1742     *              index into the specified register. vAA <- pResString[BBBB]
1743     *
1744     * Format: AA|op BBBBlo BBBBhi (31c)
1745     *
1746     * Syntax: op vAA, string@BBBBBBBB
1747     */
1748
1749     movl        rGLUE, %edx             # get MterpGlue pointer
1750     movl        offGlue_methodClassDex(%edx), %eax # %eax<- glue->methodClassDex
1751     movl        offDvmDex_pResStrings(%eax), %eax # %eax<- glue->methodClassDex->pResStrings
1752     FETCH       1, %ecx                 # %ecx<- BBBBlo
1753     FETCH       2, %edx                 # %edx<- BBBBhi
1754     shl         $16, %edx              # %edx<- prepare to create &BBBBBBBB
1755     or          %edx, %ecx              # %ecx<- &BBBBBBBB
1756     movl        (%eax, %ecx, 4), %eax   # %eax<- pResStrings[BBBB]
1757     cmp         $0, %eax               # check if string is resolved
1758     je          .LOP_CONST_STRING_JUMBO_resolve     # resolve string reference
1759     SET_VREG    %eax, rINST             # vAA<- %eax; pResString[BBBB]
1760     FINISH      3                       # jump to next instruction
1761
1762 /* ------------------------------ */
1763     .balign 64
1764 .L_OP_CONST_CLASS: /* 0x1c */
1765 /* File: x86-atom/OP_CONST_CLASS.S */
1766    /* Copyright (C) 2008 The Android Open Source Project
1767     *
1768     * Licensed under the Apache License, Version 2.0 (the "License");
1769     * you may not use this file except in compliance with the License.
1770     * You may obtain a copy of the License at
1771     *
1772     * http://www.apache.org/licenses/LICENSE-2.0
1773     *
1774     * Unless required by applicable law or agreed to in writing, software
1775     * distributed under the License is distributed on an "AS IS" BASIS,
1776     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1777     * See the License for the specific language governing permissions and
1778     * limitations under the License.
1779     */
1780
1781    /*
1782     * File: OP_CONST_CLASS.S
1783     *
1784     * Code: Move a class reference to a register. Uses no substitutions.
1785     *
1786     * For: const/class
1787     *
1788     * Description: Move a reference to the class specified
1789     *              by the given index into the specified register.
1790     *              In the case where the indicated type is primitive,
1791     *              this will store a reference to the primitive type's
1792     *              degenerate class.
1793     *
1794     * Format: AA|op BBBBlo BBBBhi (21c)
1795     *
1796     * Syntax: op vAA, field@BBBB
1797     */
1798
1799     movl        rGLUE, %edx             # get MterpGlue pointer
1800     FETCH       1, %ecx                 # %ecx<- BBBB
1801     movl        offGlue_methodClassDex(%edx), %eax # %eax<- pDvmDex
1802     movl        offDvmDex_pResClasses(%eax), %eax # %eax<- pDvmDex->pResClasses
1803     movl        (%eax, %ecx, 4), %eax   # %eax<- resolved class
1804     cmp         $0, %eax               # check if classes is resolved before?
1805     je          .LOP_CONST_CLASS_resolve     # resolve class
1806     SET_VREG    %eax, rINST             # vAA<- resolved class
1807     FINISH      2                       # jump to next instruction
1808
1809 /* ------------------------------ */
1810     .balign 64
1811 .L_OP_MONITOR_ENTER: /* 0x1d */
1812 /* File: x86-atom/OP_MONITOR_ENTER.S */
1813    /* Copyright (C) 2008 The Android Open Source Project
1814     *
1815     * Licensed under the Apache License, Version 2.0 (the "License");
1816     * you may not use this file except in compliance with the License.
1817     * You may obtain a copy of the License at
1818     *
1819     * http://www.apache.org/licenses/LICENSE-2.0
1820     *
1821     * Unless required by applicable law or agreed to in writing, software
1822     * distributed under the License is distributed on an "AS IS" BASIS,
1823     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1824     * See the License for the specific language governing permissions and
1825     * limitations under the License.
1826     */
1827
1828    /*
1829     * File: OP_MONITOR_ENTER.S
1830     *
1831     * Code: Aquire a monitor
1832     *
1833     * For: monitor-enter
1834     *
1835     * Description: Aquire a monitor for the indicated object.
1836     *
1837     *
1838     *
1839     * Format: AA|op (11x)
1840     *
1841     * Syntax: op vAA
1842     */
1843
1844     movl        rGLUE, %eax             # %eax<- pMterpGlue
1845     GET_VREG    rINST                   # rINST<- vAA
1846     cmp         $0, rINST              # check for null object
1847     movl        offGlue_self(%eax), %eax # %eax<- glue->self
1848 #ifdef WITH_MONITOR_TRACKING
1849     EXPORT_PC   # export PC so we can grab stack trace
1850 #endif
1851     je          common_errNullObject    # handle null object
1852 #    jmp         .LOP_MONITOR_ENTER_finish
1853 #%break
1854 #.LOP_MONITOR_ENTER_finish:
1855     movl        rINST, -4(%esp)         # push parameter reference
1856     movl        %eax, -8(%esp)          # push parameter
1857     lea         -8(%esp), %esp
1858     call        dvmLockObject           # call: (struct Thread* self,
1859                                         #       struct Object* obj)
1860                                         # return: void
1861     FFETCH_ADV  1, %edx                 # %edx<- next instruction hi; fetch, advance
1862     lea         8(%esp), %esp
1863 #ifdef WITH_DEADLOCK_PREDICTION
1864     movl        rGLUE, %eax             # %eax<- pMterpGlue
1865     movl        offGlue_self(%eax), %eax # %eax<- glue->self
1866     movl        offThread_exception(%eax), %eax # %eax<- glue->self->exception
1867     cmp         $0, %eax               # check for exception
1868     jne         common_exceptionThrown  # handle exception
1869 #endif
1870     FGETOP_JMP  1, %edx                 # jump to next instruction; getop, jmp
1871
1872 /* ------------------------------ */
1873     .balign 64
1874 .L_OP_MONITOR_EXIT: /* 0x1e */
1875 /* File: x86-atom/OP_MONITOR_EXIT.S */
1876    /* Copyright (C) 2008 The Android Open Source Project
1877     *
1878     * Licensed under the Apache License, Version 2.0 (the "License");
1879     * you may not use this file except in compliance with the License.
1880     * You may obtain a copy of the License at
1881     *
1882     * http://www.apache.org/licenses/LICENSE-2.0
1883     *
1884     * Unless required by applicable law or agreed to in writing, software
1885     * distributed under the License is distributed on an "AS IS" BASIS,
1886     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1887     * See the License for the specific language governing permissions and
1888     * limitations under the License.
1889     */
1890
1891    /*
1892     * File: OP_MONITOR_EXIT.S
1893     *
1894     * Code: Release a monitor
1895     *
1896     * For: monitor-exit
1897     *
1898     * Description: Release a monitor for the indicated object. If this instruction needs
1899     *              to throw an execption, it must do so as if the pc has already
1900     *              advanced pased the instruction.
1901     *
1902     * Format: AA|op (11x)
1903     *
1904     * Syntax: op vAA
1905     */
1906
1907     movl        rGLUE, %eax             # %eax<- pMterpGlue
1908     EXPORT_PC                           # export the pc
1909     GET_VREG    rINST                   # rINST<- vAA
1910     cmp         $0, rINST              # rINST<- check for null object
1911     je          common_errNullObject    # handle null object
1912     push        rINST                   # push parameter object
1913     push        offGlue_self(%eax)      # push parameter self
1914     call        dvmUnlockObject         # call: (struct Thread* self,
1915                                         #       struct Object* obj)
1916                                         # return: bool
1917     FINISH_FETCH_ADVANCE 1, %edx        # advance pc before exception
1918     cmp         $0, %eax               # check for success
1919     lea         8(%esp), %esp
1920     je          common_exceptionThrown  # handle exception
1921     FINISH_JMP  %edx                    # jump to next instruction
1922
1923 /* ------------------------------ */
1924     .balign 64
1925 .L_OP_CHECK_CAST: /* 0x1f */
1926 /* File: x86-atom/OP_CHECK_CAST.S */
1927    /* Copyright (C) 2008 The Android Open Source Project
1928     *
1929     * Licensed under the Apache License, Version 2.0 (the "License");
1930     * you may not use this file except in compliance with the License.
1931     * You may obtain a copy of the License at
1932     *
1933     * http://www.apache.org/licenses/LICENSE-2.0
1934     *
1935     * Unless required by applicable law or agreed to in writing, software
1936     * distributed under the License is distributed on an "AS IS" BASIS,
1937     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1938     * See the License for the specific language governing permissions and
1939     * limitations under the License.
1940     */
1941
1942    /*
1943     * File: OP_CHECK_CAST.S
1944     *
1945     * Code: Checks to see if a cast is allowed. Uses no substitutions.
1946     *
1947     * For: check-cast
1948     *
1949     * Description: Throw if the reference in the given register cannot be
1950     *              cast to the indicated type. The type must be a reference
1951     *              type (not a primitive type).
1952     *
1953     * Format: AA|op BBBB (21c)
1954     *
1955     * Syntax: op vAA, type@BBBB
1956     */
1957
1958     movl        rGLUE, %edx             # get MterpGlue pointer
1959     movl        offGlue_methodClassDex(%edx), %eax # %eax<- pDvmDex
1960     GET_VREG    rINST                   # rINST<- vAA
1961     movl        offDvmDex_pResClasses(%eax), %eax # %eax<- pDvmDex->pResClasses
1962     cmp         $0, rINST              # check for null reference object
1963     je          .LOP_CHECK_CAST_okay        # can always cast null object
1964     FETCH       1, %ecx                 # %ecx<- BBBB
1965     movl        (%eax, %ecx, 4), %ecx   # %ecx<- resolved class
1966     cmp         $0, %ecx               # check if classes is resolved before?
1967     je          .LOP_CHECK_CAST_resolve     # resolve class
1968     jmp         .LOP_CHECK_CAST_resolved    # continue
1969
1970 /* ------------------------------ */
1971     .balign 64
1972 .L_OP_INSTANCE_OF: /* 0x20 */
1973 /* File: x86-atom/OP_INSTANCE_OF.S */
1974    /* Copyright (C) 2008 The Android Open Source Project
1975     *
1976     * Licensed under the Apache License, Version 2.0 (the "License");
1977     * you may not use this file except in compliance with the License.
1978     * You may obtain a copy of the License at
1979     *
1980     * http://www.apache.org/licenses/LICENSE-2.0
1981     *
1982     * Unless required by applicable law or agreed to in writing, software
1983     * distributed under the License is distributed on an "AS IS" BASIS,
1984     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1985     * See the License for the specific language governing permissions and
1986     * limitations under the License.
1987     */
1988
1989    /*
1990     * File: OP_INSTANCE_OF.S
1991     *
1992     * Code: Checks if object is instance of a class. Uses no substitutions.
1993     *
1994     * For: instance-of
1995     *
1996     * Description: Store in the given destination register 1 if the indicated
1997     *              reference is an instance of the given type, or 0 if not.
1998     *              The type must be a reference type (not a primitive type).
1999     *
2000     * Format: B|A|op CCCC (22c)
2001     *
2002     * Syntax: op vA, vB, type@CCCC
2003     *         op vA, vB, field@CCCC
2004     */
2005
2006     movl        rINST, %edx             # %edx<- BA
2007     shr         $4, %edx               # %edx<- B
2008     GET_VREG    %edx                    # %edx<- vB
2009     cmp         $0, %edx               # check for null object
2010     je          .LOP_INSTANCE_OF_store       # null object
2011     jmp         .LOP_INSTANCE_OF_break
2012
2013 /* ------------------------------ */
2014     .balign 64
2015 .L_OP_ARRAY_LENGTH: /* 0x21 */
2016 /* File: x86-atom/OP_ARRAY_LENGTH.S */
2017    /* Copyright (C) 2008 The Android Open Source Project
2018     *
2019     * Licensed under the Apache License, Version 2.0 (the "License");
2020     * you may not use this file except in compliance with the License.
2021     * You may obtain a copy of the License at
2022     *
2023     * http://www.apache.org/licenses/LICENSE-2.0
2024     *
2025     * Unless required by applicable law or agreed to in writing, software
2026     * distributed under the License is distributed on an "AS IS" BASIS,
2027     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2028     * See the License for the specific language governing permissions and
2029     * limitations under the License.
2030     */
2031
2032    /*
2033     * File: OP_ARRAY_LENGTH.S
2034     *
2035     * Code: 32-bit array length operation.
2036     *
2037     * For: array-length
2038     *
2039     * Description: Store the length of the indicated array in the given
2040     *              destination register. vB <- offArrayObject_length(vA)
2041     *
2042     * Format: B|A|op (12x)
2043     *
2044     * Syntax: op vA, vB
2045     */
2046
2047     movl        rINST, %eax             # %eax<- BA
2048     shr         $4, %eax               # %eax<- B
2049     andl        $15, rINST             # rINST<- A
2050     FFETCH_ADV  1, %edx                 # %edx<- next instruction hi; fetch, advance
2051     GET_VREG    %eax                    # %eax<- vB
2052     testl       %eax, %eax              # check for null array object
2053     je          common_errNullObject    # handle null array object
2054     movl        offArrayObject_length(%eax), %eax # %eax<- array length
2055     movl        %eax, (rFP, rINST, 4)   # vA<- %eax; array length
2056     FGETOP_JMP  1, %edx                 # jump to next instruction; getop, jmp
2057
2058 /* ------------------------------ */
2059     .balign 64
2060 .L_OP_NEW_INSTANCE: /* 0x22 */
2061 /* File: x86-atom/OP_NEW_INSTANCE.S */
2062    /* Copyright (C) 2008 The Android Open Source Project
2063     *
2064     * Licensed under the Apache License, Version 2.0 (the "License");
2065     * you may not use this file except in compliance with the License.
2066     * You may obtain a copy of the License at
2067     *
2068     * http://www.apache.org/licenses/LICENSE-2.0
2069     *
2070     * Unless required by applicable law or agreed to in writing, software
2071     * distributed under the License is distributed on an "AS IS" BASIS,
2072     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2073     * See the License for the specific language governing permissions and
2074     * limitations under the License.
2075     */
2076
2077    /*
2078     * File: OP_NEW_INSTANCE.S
2079     *
2080     * Code: Create a new instance of a given type. Uses no substitutions.
2081     *
2082     * For: new-instance
2083     *
2084     * Description: Construct a new instance of the indicated type,
2085     *              storing a reference to it in the destination.
2086     *              The type must refer to a non-array class.
2087     *
2088     *
2089     *
2090     * Format: AA|op BBBB (21c)
2091     *
2092     * Syntax: op vAA, type@BBBB
2093     *         op vAA, field@BBBB
2094     *         op vAA, string@BBBB
2095     */
2096
2097     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
2098     movl        offGlue_methodClassDex(%ecx), %ecx # %ecx<- glue->pDvmDex
2099     FETCH       1, %edx                 # %edx<- BBBB
2100     movl        offDvmDex_pResClasses(%ecx), %ecx # %ecx<- glue->pDvmDex->pResClasses
2101     movl        (%ecx, %edx, 4), %edx   # %edx<- vB
2102     EXPORT_PC                           # required for resolve
2103     cmp         $0, %edx               # check for null
2104     je          .LOP_NEW_INSTANCE_resolve     # need to resolve
2105
2106    /*
2107     *  %edx holds class object
2108     */
2109
2110 .LOP_NEW_INSTANCE_resolved:
2111     movzbl      offClassObject_status(%edx), %eax # %eax<- class status
2112     cmp         $CLASS_INITIALIZED, %eax # check if class is initialized
2113     jne         .LOP_NEW_INSTANCE_needinit    # initialize class
2114
2115    /*
2116     *  %edx holds class object
2117     */
2118
2119 .LOP_NEW_INSTANCE_initialized:
2120     testl       $(ACC_INTERFACE|ACC_ABSTRACT), offClassObject_accessFlags(%edx)
2121     mov         $ALLOC_DONT_TRACK, %eax # %eax<- flag for alloc call
2122     je          .LOP_NEW_INSTANCE_finish      # continue
2123     jmp         .LOP_NEW_INSTANCE_abstract    # handle abstract or interface
2124
2125    /*
2126     *  %edx holds class object
2127     *  %eax holds flags for alloc call
2128     */
2129
2130
2131 /* ------------------------------ */
2132     .balign 64
2133 .L_OP_NEW_ARRAY: /* 0x23 */
2134 /* File: x86-atom/OP_NEW_ARRAY.S */
2135    /* Copyright (C) 2008 The Android Open Source Project
2136     *
2137     * Licensed under the Apache License, Version 2.0 (the "License");
2138     * you may not use this file except in compliance with the License.
2139     * You may obtain a copy of the License at
2140     *
2141     * http://www.apache.org/licenses/LICENSE-2.0
2142     *
2143     * Unless required by applicable law or agreed to in writing, software
2144     * distributed under the License is distributed on an "AS IS" BASIS,
2145     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2146     * See the License for the specific language governing permissions and
2147     * limitations under the License.
2148     */
2149
2150    /*
2151     * File: OP_NEW_ARRAY.S
2152     *
2153     * Code: Create a new array. Uses no substitutions.
2154     *
2155     * For: new-array
2156     *
2157     * Description: Construct a new array of the indicated type and size.
2158     *              The type must be an array type.
2159     *
2160     * Format: B|A|op CCCC (22c)
2161     *
2162     * Syntax: op vA, vB, type@CCCC
2163     *         op vA, vB, field@CCCC
2164     */
2165
2166     movl        rGLUE, %eax             # %eax<- pMterpGlue
2167     movl        rINST, %edx             # %edx<- BA
2168     shr         $4, %edx               # %edx<- B
2169     movl        offGlue_methodClassDex(%eax), %eax # %eax<- glue->pDvmDex
2170     FETCH       1, %ecx                 # %ecx<- CCCC
2171     GET_VREG    %edx                    # %edx<- vB
2172     movl        offDvmDex_pResClasses(%eax), %eax # %eax<- glue->pDvmDex->pResClasses
2173     cmp         $0, %edx               # check for negative length
2174     movl        (%eax, %ecx, 4), %eax   # %eax<- resolved class
2175     js          common_errNegativeArraySize # handle negative array length
2176     cmp         $0, %eax               # check for null
2177     EXPORT_PC                           # required for resolve
2178     jne         .LOP_NEW_ARRAY_finish      # already resovled so continue
2179     jmp         .LOP_NEW_ARRAY_resolve     # need to resolve
2180
2181 /* ------------------------------ */
2182     .balign 64
2183 .L_OP_FILLED_NEW_ARRAY: /* 0x24 */
2184 /* File: x86-atom/OP_FILLED_NEW_ARRAY.S */
2185    /* Copyright (C) 2008 The Android Open Source Project
2186     *
2187     * Licensed under the Apache License, Version 2.0 (the "License");
2188     * you may not use this file except in compliance with the License.
2189     * You may obtain a copy of the License at
2190     *
2191     * http://www.apache.org/licenses/LICENSE-2.0
2192     *
2193     * Unless required by applicable law or agreed to in writing, software
2194     * distributed under the License is distributed on an "AS IS" BASIS,
2195     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2196     * See the License for the specific language governing permissions and
2197     * limitations under the License.
2198     */
2199
2200    /*
2201     * File: OP_FILLED_NEW_ARRAY.S
2202     *
2203     * Code: Constructs and fills an array with the given data. Provides
2204     *
2205     * For: float-to-int
2206     *
2207     * Description: Construct an array of the given type and size,
2208     *              filling it with the supplied contents. The type
2209     *              must be an array type. The array's contents
2210     *              must be single-word. The constructed instance
2211     *              is stored as a result in the same way that the
2212     *              method invocation instructions store their results,
2213     *              so the constructed instance must be moved to a
2214     *              register with a subsequent move-result-object
2215     *              instruction.
2216     *
2217     * Format: B|A|op CCCC G|F|E|D (35c)
2218     *         AA|op BBBB CCCC (3rc) (range)
2219     *
2220     * Syntax: [B=5] op {vD, vE, vF, vG, vA}, vtaboff@CCCC
2221     *         [B=4] op {vD, vE, vF, vG}, vtaboff@CCCC
2222     *         [B=3] op {vD, vE, vF}, vtaboff@CCCC
2223     *         [B=2] op {vD, vE}, vtaboff@CCCC
2224     *         [B=1] op {vD}, vtaboff@CCCC
2225     *
2226     *         op {vCCCC .. vNNNN}, meth@BBBB
2227     *         op {vCCCC .. vNNNN}, type@BBBB
2228     */
2229
2230
2231     movl        rGLUE, %edx             # %edx<- MterpGlue pointer
2232     movl        offGlue_methodClassDex(%edx), %edx # %edx<- glue->methodClassDex
2233     movl        offDvmDex_pResClasses(%edx), %edx # %edx<- glue->methodClassDex->pResClasses
2234     FETCH       1, %ecx                 # %ecx<- BBBB
2235     EXPORT_PC
2236     movl (%edx, %ecx, 4), %eax # %eax<- possibly resolved class
2237     cmp         $0, %eax               # %eax<- check if already resolved
2238     jne         .LOP_FILLED_NEW_ARRAY_continue
2239     jmp         .LOP_FILLED_NEW_ARRAY_break
2240
2241 /* ------------------------------ */
2242     .balign 64
2243 .L_OP_FILLED_NEW_ARRAY_RANGE: /* 0x25 */
2244 /* File: x86-atom/OP_FILLED_NEW_ARRAY_RANGE.S */
2245    /* Copyright (C) 2008 The Android Open Source Project
2246     *
2247     * Licensed under the Apache License, Version 2.0 (the "License");
2248     * you may not use this file except in compliance with the License.
2249     * You may obtain a copy of the License at
2250     *
2251     * http://www.apache.org/licenses/LICENSE-2.0
2252     *
2253     * Unless required by applicable law or agreed to in writing, software
2254     * distributed under the License is distributed on an "AS IS" BASIS,
2255     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2256     * See the License for the specific language governing permissions and
2257     * limitations under the License.
2258     */
2259
2260    /*
2261     * File: OP_FILLED_NEW_ARRAY_RANGE.S
2262     */
2263
2264 /* File: x86-atom/OP_FILLED_NEW_ARRAY.S */
2265    /* Copyright (C) 2008 The Android Open Source Project
2266     *
2267     * Licensed under the Apache License, Version 2.0 (the "License");
2268     * you may not use this file except in compliance with the License.
2269     * You may obtain a copy of the License at
2270     *
2271     * http://www.apache.org/licenses/LICENSE-2.0
2272     *
2273     * Unless required by applicable law or agreed to in writing, software
2274     * distributed under the License is distributed on an "AS IS" BASIS,
2275     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2276     * See the License for the specific language governing permissions and
2277     * limitations under the License.
2278     */
2279
2280    /*
2281     * File: OP_FILLED_NEW_ARRAY.S
2282     *
2283     * Code: Constructs and fills an array with the given data. Provides
2284     *
2285     * For: float-to-int
2286     *
2287     * Description: Construct an array of the given type and size,
2288     *              filling it with the supplied contents. The type
2289     *              must be an array type. The array's contents
2290     *              must be single-word. The constructed instance
2291     *              is stored as a result in the same way that the
2292     *              method invocation instructions store their results,
2293     *              so the constructed instance must be moved to a
2294     *              register with a subsequent move-result-object
2295     *              instruction.
2296     *
2297     * Format: B|A|op CCCC G|F|E|D (35c)
2298     *         AA|op BBBB CCCC (3rc) (range)
2299     *
2300     * Syntax: [B=5] op {vD, vE, vF, vG, vA}, vtaboff@CCCC
2301     *         [B=4] op {vD, vE, vF, vG}, vtaboff@CCCC
2302     *         [B=3] op {vD, vE, vF}, vtaboff@CCCC
2303     *         [B=2] op {vD, vE}, vtaboff@CCCC
2304     *         [B=1] op {vD}, vtaboff@CCCC
2305     *
2306     *         op {vCCCC .. vNNNN}, meth@BBBB
2307     *         op {vCCCC .. vNNNN}, type@BBBB
2308     */
2309
2310
2311     movl        rGLUE, %edx             # %edx<- MterpGlue pointer
2312     movl        offGlue_methodClassDex(%edx), %edx # %edx<- glue->methodClassDex
2313     movl        offDvmDex_pResClasses(%edx), %edx # %edx<- glue->methodClassDex->pResClasses
2314     FETCH       1, %ecx                 # %ecx<- BBBB
2315     EXPORT_PC
2316     movl (%edx, %ecx, 4), %eax # %eax<- possibly resolved class
2317     cmp         $0, %eax               # %eax<- check if already resolved
2318     jne         .LOP_FILLED_NEW_ARRAY_RANGE_continue
2319     jmp         .LOP_FILLED_NEW_ARRAY_RANGE_break
2320
2321
2322 /* ------------------------------ */
2323     .balign 64
2324 .L_OP_FILL_ARRAY_DATA: /* 0x26 */
2325 /* File: x86-atom/OP_FILL_ARRAY_DATA.S */
2326    /* Copyright (C) 2008 The Android Open Source Project
2327     *
2328     * Licensed under the Apache License, Version 2.0 (the "License");
2329     * you may not use this file except in compliance with the License.
2330     * You may obtain a copy of the License at
2331     *
2332     * http://www.apache.org/licenses/LICENSE-2.0
2333     *
2334     * Unless required by applicable law or agreed to in writing, software
2335     * distributed under the License is distributed on an "AS IS" BASIS,
2336     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2337     * See the License for the specific language governing permissions and
2338     * limitations under the License.
2339     */
2340
2341    /*
2342     * File: OP_FILL_ARRAY_DATA.S
2343     *
2344     * Code: Fills an array with given data. Uses no substitutions.
2345     *
2346     * For: fill-array-data
2347     *
2348     * Description: Fill the given array with the idicated data. The reference
2349     *              must be an array of primitives, and the data table must
2350     *              match it in type and size
2351     *
2352     * Format: AA|op BBBBlo BBBBhi (31t)
2353     *
2354     * Syntax: op vAA, +BBBBBBBB
2355     */
2356
2357     FETCH       1, %ecx                 # %ecx<- BBBBlo
2358     FETCH       2, %edx                 # %edx<- BBBBhi
2359     shl         $16, %edx              # prepare to create +BBBBBBBB
2360     or          %ecx, %edx              # %edx<- +BBBBBBBB
2361     lea         (rPC, %edx, 2), %edx    # %edx<- PC + +BBBBBBBB; array data location
2362     EXPORT_PC
2363     push        %edx
2364     push        (rFP, rINST, 4)
2365     call        dvmInterpHandleFillArrayData # call: (ArrayObject* arrayObject, const u2* arrayData)
2366                                              # return: bool
2367     FFETCH_ADV  3, %edx                 # %edx<- next instruction hi; fetch, advance
2368     cmp         $0, %eax
2369     lea         8(%esp), %esp
2370     je          common_exceptionThrown
2371     FGETOP_JMP  3, %edx                 # jump to next instruction; getop, jmp
2372
2373 /* ------------------------------ */
2374     .balign 64
2375 .L_OP_THROW: /* 0x27 */
2376 /* File: x86-atom/OP_THROW.S */
2377    /* Copyright (C) 2008 The Android Open Source Project
2378     *
2379     * Licensed under the Apache License, Version 2.0 (the "License");
2380     * you may not use this file except in compliance with the License.
2381     * You may obtain a copy of the License at
2382     *
2383     * http://www.apache.org/licenses/LICENSE-2.0
2384     *
2385     * Unless required by applicable law or agreed to in writing, software
2386     * distributed under the License is distributed on an "AS IS" BASIS,
2387     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2388     * See the License for the specific language governing permissions and
2389     * limitations under the License.
2390     */
2391
2392    /*
2393     * File: OP_THROW.S
2394     *
2395     * Code: Throw an exception
2396     *
2397     * For: throw
2398     *
2399     * Description: Throw an exception object in the current thread.
2400     *
2401     * Format: AA|op (11x)
2402     *
2403     * Syntax: op vAA
2404     */
2405
2406     movl        rGLUE, %eax             # %eax<- pMterpGlue
2407     GET_VREG    rINST                   # rINST<- vAA
2408     cmp         $0, rINST              # check for null
2409     movl        offGlue_self(%eax), %ecx # %ecx<- glue->self
2410     je          common_errNullObject    # handle null object
2411     movl        rINST, offThread_exception(%ecx) # thread->exception<- object
2412     jmp         common_exceptionThrown  # handle exception
2413
2414 /* ------------------------------ */
2415     .balign 64
2416 .L_OP_GOTO: /* 0x28 */
2417 /* File: x86-atom/OP_GOTO.S */
2418    /* Copyright (C) 2008 The Android Open Source Project
2419     *
2420     * Licensed under the Apache License, Version 2.0 (the "License");
2421     * you may not use this file except in compliance with the License.
2422     * You may obtain a copy of the License at
2423     *
2424     * http://www.apache.org/licenses/LICENSE-2.0
2425     *
2426     * Unless required by applicable law or agreed to in writing, software
2427     * distributed under the License is distributed on an "AS IS" BASIS,
2428     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2429     * See the License for the specific language governing permissions and
2430     * limitations under the License.
2431     */
2432
2433    /*
2434     * File: OP_GOTO.S
2435     *
2436     * Code: Do an unconditional branch. Uses no substitutions.
2437     *
2438     * For: goto
2439     *
2440     * Description: Performs an unconditionally jump to the indicated instruction.
2441     *              The branch uses an 8-bit offset that cannot be zero.
2442     *
2443     * Format: AA|op (10t)
2444     *
2445     * Syntax: op +AA
2446     */
2447
2448 LOP_GOTO.S:
2449
2450     movsbl      rINSTbl, %edx           # %edx<- +AA
2451     shl         $1, %edx               # %edx is shifted for byte offset
2452     js          common_periodicChecks2  # do check on backwards branch
2453     FINISH_RB   %edx, %ecx              # jump to next instruction
2454
2455 /* ------------------------------ */
2456     .balign 64
2457 .L_OP_GOTO_16: /* 0x29 */
2458 /* File: x86-atom/OP_GOTO_16.S */
2459    /* Copyright (C) 2008 The Android Open Source Project
2460     *
2461     * Licensed under the Apache License, Version 2.0 (the "License");
2462     * you may not use this file except in compliance with the License.
2463     * You may obtain a copy of the License at
2464     *
2465     * http://www.apache.org/licenses/LICENSE-2.0
2466     *
2467     * Unless required by applicable law or agreed to in writing, software
2468     * distributed under the License is distributed on an "AS IS" BASIS,
2469     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2470     * See the License for the specific language governing permissions and
2471     * limitations under the License.
2472     */
2473
2474    /*
2475     * File: OP_GOTO_16.S
2476     *
2477     * Code: Do an unconditional branch. Uses no substitutions.
2478     *
2479     * For: goto/16
2480     *
2481     * Description: Performs an unconditionally jump to the indicated instruction.
2482     *              The branch uses a 16-bit offset that cannot be zero.
2483     *
2484     * Format: Ã˜Ã˜|op AAAA (20t)
2485     *
2486     * Syntax: op +AAAA
2487     */
2488
2489     FETCHs      1, %edx                 # %edx<- ssssAAAA (sign-extended)
2490     shl         $1, %edx               # %edx is doubled to get the byte offset
2491     js          common_periodicChecks2  # do check on backwards branch
2492     FINISH_RB   %edx, %ecx              # jump to next instruction
2493
2494 /* ------------------------------ */
2495     .balign 64
2496 .L_OP_GOTO_32: /* 0x2a */
2497 /* File: x86-atom/OP_GOTO_32.S */
2498    /* Copyright (C) 2008 The Android Open Source Project
2499     *
2500     * Licensed under the Apache License, Version 2.0 (the "License");
2501     * you may not use this file except in compliance with the License.
2502     * You may obtain a copy of the License at
2503     *
2504     * http://www.apache.org/licenses/LICENSE-2.0
2505     *
2506     * Unless required by applicable law or agreed to in writing, software
2507     * distributed under the License is distributed on an "AS IS" BASIS,
2508     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2509     * See the License for the specific language governing permissions and
2510     * limitations under the License.
2511     */
2512
2513    /*
2514     * File: OP_GOTO_32.S
2515     *
2516     * Code: Do an unconditional branch. Uses no substitutions.
2517     *
2518     * For: goto/32
2519     *
2520     * Description:  Performs an unconditionally jump to the indicated instruction.
2521     *               The branch uses a 32-bit offset that can be zero.
2522     *
2523     * Format: Ã˜Ã˜|op AAAAlo AAAAhi (30t)
2524     *
2525     * Syntax: op +AAAAAAAA
2526     */
2527
2528     FETCH       1, %edx                 # %edx<- AAAAlo
2529     FETCH       2, %ecx                 # %ecx<- AAAAhi
2530     shl         $16, %ecx              # prepare to create +AAAAAAAA
2531     or          %ecx, %edx              # %edx<- +AAAAAAAA
2532     shl         $1, %edx               # %edx is doubled to get the byte offset
2533     jle          common_periodicChecks2  # do check on backwards branch
2534     FINISH_RB   %edx, %ecx              # jump to next instruction
2535
2536 /* ------------------------------ */
2537     .balign 64
2538 .L_OP_PACKED_SWITCH: /* 0x2b */
2539 /* File: x86-atom/OP_PACKED_SWITCH.S */
2540    /* Copyright (C) 2008 The Android Open Source Project
2541     *
2542     * Licensed under the Apache License, Version 2.0 (the "License");
2543     * you may not use this file except in compliance with the License.
2544     * You may obtain a copy of the License at
2545     *
2546     * http://www.apache.org/licenses/LICENSE-2.0
2547     *
2548     * Unless required by applicable law or agreed to in writing, software
2549     * distributed under the License is distributed on an "AS IS" BASIS,
2550     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2551     * See the License for the specific language governing permissions and
2552     * limitations under the License.
2553     */
2554
2555    /*
2556     * File: OP_PACKED_SWITCH.S
2557     *
2558     * Code: Jump to a new instruction using a jump table
2559     *
2560     * For: packed-switch, sparse-switch
2561     *
2562     * Description: Jump to a new instruction based on the value in the given
2563     *              register, using a table of offsets corresponding to each
2564     *              value in a particular integral range, or fall through to
2565     *              the next instruction if there is no match.
2566     *
2567     * Format: AA|op BBBBlo BBBBhi (31t)
2568     *
2569     * Syntax: op vAA, +BBBBBBBB
2570     */
2571
2572
2573     FETCH       1, %ecx                 # %ecx<- BBBBlo
2574     FETCH       2, %edx                 # %edx<- BBBBhi
2575     shl         $16, %edx              # prepare to create +BBBBBBBB
2576     or          %edx, %ecx              # %ecx<- +BBBBBBBB
2577     GET_VREG    rINST                   # rINST<- vAA
2578     movl        rINST, -4(%esp)         # push parameter vAA
2579     lea         (rPC, %ecx, 2), %ecx    # %ecx<- PC + +BBBBBBBB*2
2580     movl        %ecx, -8(%esp)          # push parameter PC + +BBBBBBBB*2
2581     lea         -8(%esp), %esp
2582     call        dvmInterpHandlePackedSwitch                   # call code-unit branch offset
2583     shl         $1, %eax               # shift for byte offset
2584     movl        %eax, %edx              # %edx<- offset
2585     lea         8(%esp), %esp
2586     jle         common_periodicChecks2  # do backward branch
2587     jmp         .LOP_PACKED_SWITCH_finish
2588
2589 /* ------------------------------ */
2590     .balign 64
2591 .L_OP_SPARSE_SWITCH: /* 0x2c */
2592 /* File: x86-atom/OP_SPARSE_SWITCH.S */
2593    /* Copyright (C) 2008 The Android Open Source Project
2594     *
2595     * Licensed under the Apache License, Version 2.0 (the "License");
2596     * you may not use this file except in compliance with the License.
2597     * You may obtain a copy of the License at
2598     *
2599     * http://www.apache.org/licenses/LICENSE-2.0
2600     *
2601     * Unless required by applicable law or agreed to in writing, software
2602     * distributed under the License is distributed on an "AS IS" BASIS,
2603     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2604     * See the License for the specific language governing permissions and
2605     * limitations under the License.
2606     */
2607
2608    /*
2609     * File: OP_SPARSE_SWITCH.S
2610     */
2611
2612 /* File: x86-atom/OP_PACKED_SWITCH.S */
2613    /* Copyright (C) 2008 The Android Open Source Project
2614     *
2615     * Licensed under the Apache License, Version 2.0 (the "License");
2616     * you may not use this file except in compliance with the License.
2617     * You may obtain a copy of the License at
2618     *
2619     * http://www.apache.org/licenses/LICENSE-2.0
2620     *
2621     * Unless required by applicable law or agreed to in writing, software
2622     * distributed under the License is distributed on an "AS IS" BASIS,
2623     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2624     * See the License for the specific language governing permissions and
2625     * limitations under the License.
2626     */
2627
2628    /*
2629     * File: OP_PACKED_SWITCH.S
2630     *
2631     * Code: Jump to a new instruction using a jump table
2632     *
2633     * For: packed-switch, sparse-switch
2634     *
2635     * Description: Jump to a new instruction based on the value in the given
2636     *              register, using a table of offsets corresponding to each
2637     *              value in a particular integral range, or fall through to
2638     *              the next instruction if there is no match.
2639     *
2640     * Format: AA|op BBBBlo BBBBhi (31t)
2641     *
2642     * Syntax: op vAA, +BBBBBBBB
2643     */
2644
2645
2646     FETCH       1, %ecx                 # %ecx<- BBBBlo
2647     FETCH       2, %edx                 # %edx<- BBBBhi
2648     shl         $16, %edx              # prepare to create +BBBBBBBB
2649     or          %edx, %ecx              # %ecx<- +BBBBBBBB
2650     GET_VREG    rINST                   # rINST<- vAA
2651     movl        rINST, -4(%esp)         # push parameter vAA
2652     lea         (rPC, %ecx, 2), %ecx    # %ecx<- PC + +BBBBBBBB*2
2653     movl        %ecx, -8(%esp)          # push parameter PC + +BBBBBBBB*2
2654     lea         -8(%esp), %esp
2655     call        dvmInterpHandleSparseSwitch                   # call code-unit branch offset
2656     shl         $1, %eax               # shift for byte offset
2657     movl        %eax, %edx              # %edx<- offset
2658     lea         8(%esp), %esp
2659     jle         common_periodicChecks2  # do backward branch
2660     jmp         .LOP_SPARSE_SWITCH_finish
2661
2662
2663 /* ------------------------------ */
2664     .balign 64
2665 .L_OP_CMPL_FLOAT: /* 0x2d */
2666 /* File: x86-atom/OP_CMPL_FLOAT.S */
2667    /* Copyright (C) 2008 The Android Open Source Project
2668     *
2669     * Licensed under the Apache License, Version 2.0 (the "License");
2670     * you may not use this file except in compliance with the License.
2671     * You may obtain a copy of the License at
2672     *
2673     * http://www.apache.org/licenses/LICENSE-2.0
2674     *
2675     * Unless required by applicable law or agreed to in writing, software
2676     * distributed under the License is distributed on an "AS IS" BASIS,
2677     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2678     * See the License for the specific language governing permissions and
2679     * limitations under the License.
2680     */
2681
2682    /*
2683     * File: OP_CMPL_FLOAT.S
2684     *
2685     * Code: Provides a "nan" variable to specify the return value for
2686     *       NaN. Provides a variable "sod" which appends a "s" or a "d"
2687     *       to the move and comparison instructions, depending on if we
2688     *       are working with a float or a double. For instructions
2689     *       cmpx-float and cmpx-double, the x will be eiher a g or a l
2690     *       to specify positive or negative bias for NaN.
2691     *
2692     * For: cmpg-double, dmpg-float, cmpl-double, cmpl-float
2693     *
2694     * Description: Perform the indicated floating point or long comparison,
2695     *              storing 0 if the two arguments are equal, 1 if the second
2696     *              argument is larger, or -1 if the first argument is larger.
2697     *
2698     * Format: AA|op CC|BB (23x)
2699     *
2700     * Syntax: op vAA, vBB, vCC
2701     */
2702
2703
2704     FETCH_BB    1, %ecx                 # %ecx<- BB
2705     FETCH_CC    1, %edx                 # %edx<- CC
2706
2707     flds     (rFP, %edx, 4)
2708     flds     (rFP, %ecx, 4)
2709
2710     fucompp
2711     fnstsw      %ax
2712     sahf
2713
2714     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
2715     ja          .LOP_CMPL_FLOAT_greater
2716     jp          .LOP_CMPL_FLOAT_finalNan
2717     jz          .LOP_CMPL_FLOAT_final
2718
2719 .LOP_CMPL_FLOAT_less:
2720     movl        $0xFFFFFFFF, (rFP, rINST, 4) # vAA<- less than
2721     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
2722
2723
2724 /* ------------------------------ */
2725     .balign 64
2726 .L_OP_CMPG_FLOAT: /* 0x2e */
2727 /* File: x86-atom/OP_CMPG_FLOAT.S */
2728    /* Copyright (C) 2008 The Android Open Source Project
2729     *
2730     * Licensed under the Apache License, Version 2.0 (the "License");
2731     * you may not use this file except in compliance with the License.
2732     * You may obtain a copy of the License at
2733     *
2734     * http://www.apache.org/licenses/LICENSE-2.0
2735     *
2736     * Unless required by applicable law or agreed to in writing, software
2737     * distributed under the License is distributed on an "AS IS" BASIS,
2738     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2739     * See the License for the specific language governing permissions and
2740     * limitations under the License.
2741     */
2742
2743    /*
2744     * File: OP_CMPG_FLOAT.S
2745     */
2746
2747 /* File: x86-atom/OP_CMPL_FLOAT.S */
2748    /* Copyright (C) 2008 The Android Open Source Project
2749     *
2750     * Licensed under the Apache License, Version 2.0 (the "License");
2751     * you may not use this file except in compliance with the License.
2752     * You may obtain a copy of the License at
2753     *
2754     * http://www.apache.org/licenses/LICENSE-2.0
2755     *
2756     * Unless required by applicable law or agreed to in writing, software
2757     * distributed under the License is distributed on an "AS IS" BASIS,
2758     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2759     * See the License for the specific language governing permissions and
2760     * limitations under the License.
2761     */
2762
2763    /*
2764     * File: OP_CMPL_FLOAT.S
2765     *
2766     * Code: Provides a "nan" variable to specify the return value for
2767     *       NaN. Provides a variable "sod" which appends a "s" or a "d"
2768     *       to the move and comparison instructions, depending on if we
2769     *       are working with a float or a double. For instructions
2770     *       cmpx-float and cmpx-double, the x will be eiher a g or a l
2771     *       to specify positive or negative bias for NaN.
2772     *
2773     * For: cmpg-double, dmpg-float, cmpl-double, cmpl-float
2774     *
2775     * Description: Perform the indicated floating point or long comparison,
2776     *              storing 0 if the two arguments are equal, 1 if the second
2777     *              argument is larger, or -1 if the first argument is larger.
2778     *
2779     * Format: AA|op CC|BB (23x)
2780     *
2781     * Syntax: op vAA, vBB, vCC
2782     */
2783
2784
2785     FETCH_BB    1, %ecx                 # %ecx<- BB
2786     FETCH_CC    1, %edx                 # %edx<- CC
2787
2788     flds     (rFP, %edx, 4)
2789     flds     (rFP, %ecx, 4)
2790
2791     fucompp
2792     fnstsw      %ax
2793     sahf
2794
2795     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
2796     ja          .LOP_CMPG_FLOAT_greater
2797     jp          .LOP_CMPG_FLOAT_finalNan
2798     jz          .LOP_CMPG_FLOAT_final
2799
2800 .LOP_CMPG_FLOAT_less:
2801     movl        $0xFFFFFFFF, (rFP, rINST, 4) # vAA<- less than
2802     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
2803
2804
2805
2806 /* ------------------------------ */
2807     .balign 64
2808 .L_OP_CMPL_DOUBLE: /* 0x2f */
2809 /* File: x86-atom/OP_CMPL_DOUBLE.S */
2810    /* Copyright (C) 2008 The Android Open Source Project
2811     *
2812     * Licensed under the Apache License, Version 2.0 (the "License");
2813     * you may not use this file except in compliance with the License.
2814     * You may obtain a copy of the License at
2815     *
2816     * http://www.apache.org/licenses/LICENSE-2.0
2817     *
2818     * Unless required by applicable law or agreed to in writing, software
2819     * distributed under the License is distributed on an "AS IS" BASIS,
2820     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2821     * See the License for the specific language governing permissions and
2822     * limitations under the License.
2823     */
2824
2825    /*
2826     * File: OP_CMPL_DOUBLE.S
2827     */
2828
2829 /* File: x86-atom/OP_CMPL_FLOAT.S */
2830    /* Copyright (C) 2008 The Android Open Source Project
2831     *
2832     * Licensed under the Apache License, Version 2.0 (the "License");
2833     * you may not use this file except in compliance with the License.
2834     * You may obtain a copy of the License at
2835     *
2836     * http://www.apache.org/licenses/LICENSE-2.0
2837     *
2838     * Unless required by applicable law or agreed to in writing, software
2839     * distributed under the License is distributed on an "AS IS" BASIS,
2840     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2841     * See the License for the specific language governing permissions and
2842     * limitations under the License.
2843     */
2844
2845    /*
2846     * File: OP_CMPL_FLOAT.S
2847     *
2848     * Code: Provides a "nan" variable to specify the return value for
2849     *       NaN. Provides a variable "sod" which appends a "s" or a "d"
2850     *       to the move and comparison instructions, depending on if we
2851     *       are working with a float or a double. For instructions
2852     *       cmpx-float and cmpx-double, the x will be eiher a g or a l
2853     *       to specify positive or negative bias for NaN.
2854     *
2855     * For: cmpg-double, dmpg-float, cmpl-double, cmpl-float
2856     *
2857     * Description: Perform the indicated floating point or long comparison,
2858     *              storing 0 if the two arguments are equal, 1 if the second
2859     *              argument is larger, or -1 if the first argument is larger.
2860     *
2861     * Format: AA|op CC|BB (23x)
2862     *
2863     * Syntax: op vAA, vBB, vCC
2864     */
2865
2866
2867     FETCH_BB    1, %ecx                 # %ecx<- BB
2868     FETCH_CC    1, %edx                 # %edx<- CC
2869
2870     fldl     (rFP, %edx, 4)
2871     fldl     (rFP, %ecx, 4)
2872
2873     fucompp
2874     fnstsw      %ax
2875     sahf
2876
2877     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
2878     ja          .LOP_CMPL_DOUBLE_greater
2879     jp          .LOP_CMPL_DOUBLE_finalNan
2880     jz          .LOP_CMPL_DOUBLE_final
2881
2882 .LOP_CMPL_DOUBLE_less:
2883     movl        $0xFFFFFFFF, (rFP, rINST, 4) # vAA<- less than
2884     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
2885
2886
2887
2888 /* ------------------------------ */
2889     .balign 64
2890 .L_OP_CMPG_DOUBLE: /* 0x30 */
2891 /* File: x86-atom/OP_CMPG_DOUBLE.S */
2892    /* Copyright (C) 2008 The Android Open Source Project
2893     *
2894     * Licensed under the Apache License, Version 2.0 (the "License");
2895     * you may not use this file except in compliance with the License.
2896     * You may obtain a copy of the License at
2897     *
2898     * http://www.apache.org/licenses/LICENSE-2.0
2899     *
2900     * Unless required by applicable law or agreed to in writing, software
2901     * distributed under the License is distributed on an "AS IS" BASIS,
2902     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2903     * See the License for the specific language governing permissions and
2904     * limitations under the License.
2905     */
2906
2907    /*
2908     * File: OP_CMPG_DOUBLE.S
2909     */
2910
2911 /* File: x86-atom/OP_CMPL_FLOAT.S */
2912    /* Copyright (C) 2008 The Android Open Source Project
2913     *
2914     * Licensed under the Apache License, Version 2.0 (the "License");
2915     * you may not use this file except in compliance with the License.
2916     * You may obtain a copy of the License at
2917     *
2918     * http://www.apache.org/licenses/LICENSE-2.0
2919     *
2920     * Unless required by applicable law or agreed to in writing, software
2921     * distributed under the License is distributed on an "AS IS" BASIS,
2922     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2923     * See the License for the specific language governing permissions and
2924     * limitations under the License.
2925     */
2926
2927    /*
2928     * File: OP_CMPL_FLOAT.S
2929     *
2930     * Code: Provides a "nan" variable to specify the return value for
2931     *       NaN. Provides a variable "sod" which appends a "s" or a "d"
2932     *       to the move and comparison instructions, depending on if we
2933     *       are working with a float or a double. For instructions
2934     *       cmpx-float and cmpx-double, the x will be eiher a g or a l
2935     *       to specify positive or negative bias for NaN.
2936     *
2937     * For: cmpg-double, dmpg-float, cmpl-double, cmpl-float
2938     *
2939     * Description: Perform the indicated floating point or long comparison,
2940     *              storing 0 if the two arguments are equal, 1 if the second
2941     *              argument is larger, or -1 if the first argument is larger.
2942     *
2943     * Format: AA|op CC|BB (23x)
2944     *
2945     * Syntax: op vAA, vBB, vCC
2946     */
2947
2948
2949     FETCH_BB    1, %ecx                 # %ecx<- BB
2950     FETCH_CC    1, %edx                 # %edx<- CC
2951
2952     fldl     (rFP, %edx, 4)
2953     fldl     (rFP, %ecx, 4)
2954
2955     fucompp
2956     fnstsw      %ax
2957     sahf
2958
2959     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
2960     ja          .LOP_CMPG_DOUBLE_greater
2961     jp          .LOP_CMPG_DOUBLE_finalNan
2962     jz          .LOP_CMPG_DOUBLE_final
2963
2964 .LOP_CMPG_DOUBLE_less:
2965     movl        $0xFFFFFFFF, (rFP, rINST, 4) # vAA<- less than
2966     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
2967
2968
2969
2970 /* ------------------------------ */
2971     .balign 64
2972 .L_OP_CMP_LONG: /* 0x31 */
2973 /* File: x86-atom/OP_CMP_LONG.S */
2974    /* Copyright (C) 2008 The Android Open Source Project
2975     *
2976     * Licensed under the Apache License, Version 2.0 (the "License");
2977     * you may not use this file except in compliance with the License.
2978     * You may obtain a copy of the License at
2979     *
2980     * http://www.apache.org/licenses/LICENSE-2.0
2981     *
2982     * Unless required by applicable law or agreed to in writing, software
2983     * distributed under the License is distributed on an "AS IS" BASIS,
2984     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2985     * See the License for the specific language governing permissions and
2986     * limitations under the License.
2987     */
2988
2989    /*
2990     * File: OP_CMP_LONG.S
2991     *
2992     * Code: Compare floating point values. Uses no substitutions.
2993     *
2994     * For: cmp-long
2995     *
2996     * Description: Perform a long comparison, storing 0 if the two
2997     *              arguments are equal, 1 if the second argument is larger
2998     *              or -1 if the first argument is larger.
2999     *
3000     * Format: AA|op CC|BB (23x)
3001     *
3002     * Syntax: op vAA, vBB, vCC
3003     */
3004
3005     FETCH_BB    1, %ecx                 # %ecx<- BB
3006     FETCH_CC    1, %edx                 # %edx<- CC
3007     movl        4(rFP, %ecx, 4), %eax   # %eax<- vBBhi
3008     cmp         4(rFP, %edx, 4), %eax   # compare vCChi and vBBhi
3009     jl          .LOP_CMP_LONG_less
3010     jg          .LOP_CMP_LONG_greater
3011     movl        (rFP, %ecx, 4), %eax    # %eax<- vBBlo
3012     cmp         (rFP, %edx, 4), %eax    # compare vCClo and vBBlo
3013     ja          .LOP_CMP_LONG_greater
3014     jne         .LOP_CMP_LONG_less
3015     jmp         .LOP_CMP_LONG_final
3016
3017 /* ------------------------------ */
3018     .balign 64
3019 .L_OP_IF_EQ: /* 0x32 */
3020 /* File: x86-atom/OP_IF_EQ.S */
3021    /* Copyright (C) 2008 The Android Open Source Project
3022     *
3023     * Licensed under the Apache License, Version 2.0 (the "License");
3024     * you may not use this file except in compliance with the License.
3025     * You may obtain a copy of the License at
3026     *
3027     * http://www.apache.org/licenses/LICENSE-2.0
3028     *
3029     * Unless required by applicable law or agreed to in writing, software
3030     * distributed under the License is distributed on an "AS IS" BASIS,
3031     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3032     * See the License for the specific language governing permissions and
3033     * limitations under the License.
3034     */
3035
3036    /*
3037     * File: OP_IF_EQ.S
3038     */
3039
3040 /* File: x86-atom/bincmp.S */
3041    /* Copyright (C) 2008 The Android Open Source Project
3042     *
3043     * Licensed under the Apache License, Version 2.0 (the "License");
3044     * you may not use this file except in compliance with the License.
3045     * You may obtain a copy of the License at
3046     *
3047     * http://www.apache.org/licenses/LICENSE-2.0
3048     *
3049     * Unless required by applicable law or agreed to in writing, software
3050     * distributed under the License is distributed on an "AS IS" BASIS,
3051     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3052     * See the License for the specific language governing permissions and
3053     * limitations under the License.
3054     */
3055
3056    /*
3057     * File: bincmp.S
3058     *
3059     * Code: Generic 32-bit comparison operation. Provides a "revcmp"
3060     *       variable to specify the reverse comparison to perform.
3061     *
3062     * For: if-eq, if-ge, if-gt, if-le, if-lt, if-ne
3063     *
3064     * Description: Branch to the given destination if the comparison
3065     *              test between the given registers values is true.
3066     *
3067     * Format: B|A|op CCCC (22t)
3068     *
3069     * Syntax: op vA, vB, +CCCC
3070     */
3071
3072     movl        rINST,  %eax            # %eax<- BA
3073     andl        $15, rINST             # rINST<- A
3074     shr         $4, %eax               # %eax<- B
3075     GET_VREG    rINST                   # rINST<- vA
3076     movl        $4, %edx               # %edx<- 4
3077     cmp         (rFP, %eax, 4), rINST   # compare vA and vB
3078     jne  1f                      # goto next instruction if reverse
3079                                         # comparison is true
3080     FETCHs      1, %edx                 # %edx<- +CCCC, Branch offset
3081     sal         $1, %edx
3082     js          common_periodicChecks2
3083 1:
3084     FINISH_RB   %edx, %ecx              # jump to next instruction
3085
3086
3087 /* ------------------------------ */
3088     .balign 64
3089 .L_OP_IF_NE: /* 0x33 */
3090 /* File: x86-atom/OP_IF_NE.S */
3091    /* Copyright (C) 2008 The Android Open Source Project
3092     *
3093     * Licensed under the Apache License, Version 2.0 (the "License");
3094     * you may not use this file except in compliance with the License.
3095     * You may obtain a copy of the License at
3096     *
3097     * http://www.apache.org/licenses/LICENSE-2.0
3098     *
3099     * Unless required by applicable law or agreed to in writing, software
3100     * distributed under the License is distributed on an "AS IS" BASIS,
3101     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3102     * See the License for the specific language governing permissions and
3103     * limitations under the License.
3104     */
3105
3106    /*
3107     * File: OP_IF_NE.S
3108     */
3109
3110 /* File: x86-atom/bincmp.S */
3111    /* Copyright (C) 2008 The Android Open Source Project
3112     *
3113     * Licensed under the Apache License, Version 2.0 (the "License");
3114     * you may not use this file except in compliance with the License.
3115     * You may obtain a copy of the License at
3116     *
3117     * http://www.apache.org/licenses/LICENSE-2.0
3118     *
3119     * Unless required by applicable law or agreed to in writing, software
3120     * distributed under the License is distributed on an "AS IS" BASIS,
3121     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3122     * See the License for the specific language governing permissions and
3123     * limitations under the License.
3124     */
3125
3126    /*
3127     * File: bincmp.S
3128     *
3129     * Code: Generic 32-bit comparison operation. Provides a "revcmp"
3130     *       variable to specify the reverse comparison to perform.
3131     *
3132     * For: if-eq, if-ge, if-gt, if-le, if-lt, if-ne
3133     *
3134     * Description: Branch to the given destination if the comparison
3135     *              test between the given registers values is true.
3136     *
3137     * Format: B|A|op CCCC (22t)
3138     *
3139     * Syntax: op vA, vB, +CCCC
3140     */
3141
3142     movl        rINST,  %eax            # %eax<- BA
3143     andl        $15, rINST             # rINST<- A
3144     shr         $4, %eax               # %eax<- B
3145     GET_VREG    rINST                   # rINST<- vA
3146     movl        $4, %edx               # %edx<- 4
3147     cmp         (rFP, %eax, 4), rINST   # compare vA and vB
3148     je  1f                      # goto next instruction if reverse
3149                                         # comparison is true
3150     FETCHs      1, %edx                 # %edx<- +CCCC, Branch offset
3151     sal         $1, %edx
3152     js          common_periodicChecks2
3153 1:
3154     FINISH_RB   %edx, %ecx              # jump to next instruction
3155
3156
3157 /* ------------------------------ */
3158     .balign 64
3159 .L_OP_IF_LT: /* 0x34 */
3160 /* File: x86-atom/OP_IF_LT.S */
3161    /* Copyright (C) 2008 The Android Open Source Project
3162     *
3163     * Licensed under the Apache License, Version 2.0 (the "License");
3164     * you may not use this file except in compliance with the License.
3165     * You may obtain a copy of the License at
3166     *
3167     * http://www.apache.org/licenses/LICENSE-2.0
3168     *
3169     * Unless required by applicable law or agreed to in writing, software
3170     * distributed under the License is distributed on an "AS IS" BASIS,
3171     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3172     * See the License for the specific language governing permissions and
3173     * limitations under the License.
3174     */
3175
3176    /*
3177     * File: OP_IF_LT.S
3178     */
3179
3180 /* File: x86-atom/bincmp.S */
3181    /* Copyright (C) 2008 The Android Open Source Project
3182     *
3183     * Licensed under the Apache License, Version 2.0 (the "License");
3184     * you may not use this file except in compliance with the License.
3185     * You may obtain a copy of the License at
3186     *
3187     * http://www.apache.org/licenses/LICENSE-2.0
3188     *
3189     * Unless required by applicable law or agreed to in writing, software
3190     * distributed under the License is distributed on an "AS IS" BASIS,
3191     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3192     * See the License for the specific language governing permissions and
3193     * limitations under the License.
3194     */
3195
3196    /*
3197     * File: bincmp.S
3198     *
3199     * Code: Generic 32-bit comparison operation. Provides a "revcmp"
3200     *       variable to specify the reverse comparison to perform.
3201     *
3202     * For: if-eq, if-ge, if-gt, if-le, if-lt, if-ne
3203     *
3204     * Description: Branch to the given destination if the comparison
3205     *              test between the given registers values is true.
3206     *
3207     * Format: B|A|op CCCC (22t)
3208     *
3209     * Syntax: op vA, vB, +CCCC
3210     */
3211
3212     movl        rINST,  %eax            # %eax<- BA
3213     andl        $15, rINST             # rINST<- A
3214     shr         $4, %eax               # %eax<- B
3215     GET_VREG    rINST                   # rINST<- vA
3216     movl        $4, %edx               # %edx<- 4
3217     cmp         (rFP, %eax, 4), rINST   # compare vA and vB
3218     jge  1f                      # goto next instruction if reverse
3219                                         # comparison is true
3220     FETCHs      1, %edx                 # %edx<- +CCCC, Branch offset
3221     sal         $1, %edx
3222     js          common_periodicChecks2
3223 1:
3224     FINISH_RB   %edx, %ecx              # jump to next instruction
3225
3226
3227 /* ------------------------------ */
3228     .balign 64
3229 .L_OP_IF_GE: /* 0x35 */
3230 /* File: x86-atom/OP_IF_GE.S */
3231    /* Copyright (C) 2008 The Android Open Source Project
3232     *
3233     * Licensed under the Apache License, Version 2.0 (the "License");
3234     * you may not use this file except in compliance with the License.
3235     * You may obtain a copy of the License at
3236     *
3237     * http://www.apache.org/licenses/LICENSE-2.0
3238     *
3239     * Unless required by applicable law or agreed to in writing, software
3240     * distributed under the License is distributed on an "AS IS" BASIS,
3241     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3242     * See the License for the specific language governing permissions and
3243     * limitations under the License.
3244     */
3245
3246    /*
3247     * File: OP_IF_GE.S
3248     */
3249
3250 /* File: x86-atom/bincmp.S */
3251    /* Copyright (C) 2008 The Android Open Source Project
3252     *
3253     * Licensed under the Apache License, Version 2.0 (the "License");
3254     * you may not use this file except in compliance with the License.
3255     * You may obtain a copy of the License at
3256     *
3257     * http://www.apache.org/licenses/LICENSE-2.0
3258     *
3259     * Unless required by applicable law or agreed to in writing, software
3260     * distributed under the License is distributed on an "AS IS" BASIS,
3261     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3262     * See the License for the specific language governing permissions and
3263     * limitations under the License.
3264     */
3265
3266    /*
3267     * File: bincmp.S
3268     *
3269     * Code: Generic 32-bit comparison operation. Provides a "revcmp"
3270     *       variable to specify the reverse comparison to perform.
3271     *
3272     * For: if-eq, if-ge, if-gt, if-le, if-lt, if-ne
3273     *
3274     * Description: Branch to the given destination if the comparison
3275     *              test between the given registers values is true.
3276     *
3277     * Format: B|A|op CCCC (22t)
3278     *
3279     * Syntax: op vA, vB, +CCCC
3280     */
3281
3282     movl        rINST,  %eax            # %eax<- BA
3283     andl        $15, rINST             # rINST<- A
3284     shr         $4, %eax               # %eax<- B
3285     GET_VREG    rINST                   # rINST<- vA
3286     movl        $4, %edx               # %edx<- 4
3287     cmp         (rFP, %eax, 4), rINST   # compare vA and vB
3288     jl  1f                      # goto next instruction if reverse
3289                                         # comparison is true
3290     FETCHs      1, %edx                 # %edx<- +CCCC, Branch offset
3291     sal         $1, %edx
3292     js          common_periodicChecks2
3293 1:
3294     FINISH_RB   %edx, %ecx              # jump to next instruction
3295
3296
3297 /* ------------------------------ */
3298     .balign 64
3299 .L_OP_IF_GT: /* 0x36 */
3300 /* File: x86-atom/OP_IF_GT.S */
3301    /* Copyright (C) 2008 The Android Open Source Project
3302     *
3303     * Licensed under the Apache License, Version 2.0 (the "License");
3304     * you may not use this file except in compliance with the License.
3305     * You may obtain a copy of the License at
3306     *
3307     * http://www.apache.org/licenses/LICENSE-2.0
3308     *
3309     * Unless required by applicable law or agreed to in writing, software
3310     * distributed under the License is distributed on an "AS IS" BASIS,
3311     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3312     * See the License for the specific language governing permissions and
3313     * limitations under the License.
3314     */
3315
3316    /*
3317     * File: OP_IF_GT.S
3318     */
3319
3320 /* File: x86-atom/bincmp.S */
3321    /* Copyright (C) 2008 The Android Open Source Project
3322     *
3323     * Licensed under the Apache License, Version 2.0 (the "License");
3324     * you may not use this file except in compliance with the License.
3325     * You may obtain a copy of the License at
3326     *
3327     * http://www.apache.org/licenses/LICENSE-2.0
3328     *
3329     * Unless required by applicable law or agreed to in writing, software
3330     * distributed under the License is distributed on an "AS IS" BASIS,
3331     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3332     * See the License for the specific language governing permissions and
3333     * limitations under the License.
3334     */
3335
3336    /*
3337     * File: bincmp.S
3338     *
3339     * Code: Generic 32-bit comparison operation. Provides a "revcmp"
3340     *       variable to specify the reverse comparison to perform.
3341     *
3342     * For: if-eq, if-ge, if-gt, if-le, if-lt, if-ne
3343     *
3344     * Description: Branch to the given destination if the comparison
3345     *              test between the given registers values is true.
3346     *
3347     * Format: B|A|op CCCC (22t)
3348     *
3349     * Syntax: op vA, vB, +CCCC
3350     */
3351
3352     movl        rINST,  %eax            # %eax<- BA
3353     andl        $15, rINST             # rINST<- A
3354     shr         $4, %eax               # %eax<- B
3355     GET_VREG    rINST                   # rINST<- vA
3356     movl        $4, %edx               # %edx<- 4
3357     cmp         (rFP, %eax, 4), rINST   # compare vA and vB
3358     jle  1f                      # goto next instruction if reverse
3359                                         # comparison is true
3360     FETCHs      1, %edx                 # %edx<- +CCCC, Branch offset
3361     sal         $1, %edx
3362     js          common_periodicChecks2
3363 1:
3364     FINISH_RB   %edx, %ecx              # jump to next instruction
3365
3366
3367 /* ------------------------------ */
3368     .balign 64
3369 .L_OP_IF_LE: /* 0x37 */
3370 /* File: x86-atom/OP_IF_LE.S */
3371    /* Copyright (C) 2008 The Android Open Source Project
3372     *
3373     * Licensed under the Apache License, Version 2.0 (the "License");
3374     * you may not use this file except in compliance with the License.
3375     * You may obtain a copy of the License at
3376     *
3377     * http://www.apache.org/licenses/LICENSE-2.0
3378     *
3379     * Unless required by applicable law or agreed to in writing, software
3380     * distributed under the License is distributed on an "AS IS" BASIS,
3381     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3382     * See the License for the specific language governing permissions and
3383     * limitations under the License.
3384     */
3385
3386    /*
3387     * File: OP_IF_LE.S
3388     */
3389
3390 /* File: x86-atom/bincmp.S */
3391    /* Copyright (C) 2008 The Android Open Source Project
3392     *
3393     * Licensed under the Apache License, Version 2.0 (the "License");
3394     * you may not use this file except in compliance with the License.
3395     * You may obtain a copy of the License at
3396     *
3397     * http://www.apache.org/licenses/LICENSE-2.0
3398     *
3399     * Unless required by applicable law or agreed to in writing, software
3400     * distributed under the License is distributed on an "AS IS" BASIS,
3401     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3402     * See the License for the specific language governing permissions and
3403     * limitations under the License.
3404     */
3405
3406    /*
3407     * File: bincmp.S
3408     *
3409     * Code: Generic 32-bit comparison operation. Provides a "revcmp"
3410     *       variable to specify the reverse comparison to perform.
3411     *
3412     * For: if-eq, if-ge, if-gt, if-le, if-lt, if-ne
3413     *
3414     * Description: Branch to the given destination if the comparison
3415     *              test between the given registers values is true.
3416     *
3417     * Format: B|A|op CCCC (22t)
3418     *
3419     * Syntax: op vA, vB, +CCCC
3420     */
3421
3422     movl        rINST,  %eax            # %eax<- BA
3423     andl        $15, rINST             # rINST<- A
3424     shr         $4, %eax               # %eax<- B
3425     GET_VREG    rINST                   # rINST<- vA
3426     movl        $4, %edx               # %edx<- 4
3427     cmp         (rFP, %eax, 4), rINST   # compare vA and vB
3428     jg  1f                      # goto next instruction if reverse
3429                                         # comparison is true
3430     FETCHs      1, %edx                 # %edx<- +CCCC, Branch offset
3431     sal         $1, %edx
3432     js          common_periodicChecks2
3433 1:
3434     FINISH_RB   %edx, %ecx              # jump to next instruction
3435
3436
3437 /* ------------------------------ */
3438     .balign 64
3439 .L_OP_IF_EQZ: /* 0x38 */
3440 /* File: x86-atom/OP_IF_EQZ.S */
3441    /* Copyright (C) 2008 The Android Open Source Project
3442     *
3443     * Licensed under the Apache License, Version 2.0 (the "License");
3444     * you may not use this file except in compliance with the License.
3445     * You may obtain a copy of the License at
3446     *
3447     * http://www.apache.org/licenses/LICENSE-2.0
3448     *
3449     * Unless required by applicable law or agreed to in writing, software
3450     * distributed under the License is distributed on an "AS IS" BASIS,
3451     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3452     * See the License for the specific language governing permissions and
3453     * limitations under the License.
3454     */
3455
3456    /*
3457     * File: OP_IF_EQZ.S
3458     */
3459
3460 /* File: x86-atom/zcmp.S */
3461    /* Copyright (C) 2008 The Android Open Source Project
3462     *
3463     * Licensed under the Apache License, Version 2.0 (the "License");
3464     * you may not use this file except in compliance with the License.
3465     * You may obtain a copy of the License at
3466     *
3467     * http://www.apache.org/licenses/LICENSE-2.0
3468     *
3469     * Unless required by applicable law or agreed to in writing, software
3470     * distributed under the License is distributed on an "AS IS" BASIS,
3471     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3472     * See the License for the specific language governing permissions and
3473     * limitations under the License.
3474     */
3475
3476    /*
3477     * File: zcmp.S
3478     *
3479     * Code: Generic 32-bit comparison operation. Provides a "revcmp"
3480     *       variable to specify the reverse comparison to perform
3481     *
3482     * For: if-eqz, if-gez, if-gtz, if-lez, if-ltz, if-nez
3483     *
3484     * Description: Branch to the given destination if the given register's
3485     *              value compares with 0 as specified.
3486     *
3487     * Format: AA|op BBBB (21t)
3488     *
3489     * Syntax: op vAA, +BBBB
3490     */
3491
3492     cmp         $0, (rFP, rINST, 4)    # compare vAA with zero
3493     jne  OP_IF_EQZ_2f                    # goto next instruction or branch
3494     FETCHs      1, %edx                 # %edx<- BBBB; branch offset
3495     sal         $1, %edx               # %edx<- adjust byte offset
3496
3497    /*
3498     * Inline common_backwardBranch
3499     */
3500
3501     js          common_periodicChecks2  # jump on backwards branch
3502 1:
3503     FINISH_RB   %edx, %ecx              # jump to next instruction
3504
3505    /*
3506     * FINISH code
3507     */
3508
3509 OP_IF_EQZ_2f:
3510     movzbl      4(rPC), %edx            # grab the next opcode
3511     movzbl      5(rPC), rINST           # update the instruction
3512     addl        $4, rPC                # update the program counter
3513     jmp         *dvmAsmInstructionJmpTable(, %edx, 4) # jump to next instruction
3514
3515
3516 /* ------------------------------ */
3517     .balign 64
3518 .L_OP_IF_NEZ: /* 0x39 */
3519 /* File: x86-atom/OP_IF_NEZ.S */
3520    /* Copyright (C) 2008 The Android Open Source Project
3521     *
3522     * Licensed under the Apache License, Version 2.0 (the "License");
3523     * you may not use this file except in compliance with the License.
3524     * You may obtain a copy of the License at
3525     *
3526     * http://www.apache.org/licenses/LICENSE-2.0
3527     *
3528     * Unless required by applicable law or agreed to in writing, software
3529     * distributed under the License is distributed on an "AS IS" BASIS,
3530     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3531     * See the License for the specific language governing permissions and
3532     * limitations under the License.
3533     */
3534
3535    /*
3536     * File: OP_IF_NEZ.S
3537     */
3538
3539 /* File: x86-atom/zcmp.S */
3540    /* Copyright (C) 2008 The Android Open Source Project
3541     *
3542     * Licensed under the Apache License, Version 2.0 (the "License");
3543     * you may not use this file except in compliance with the License.
3544     * You may obtain a copy of the License at
3545     *
3546     * http://www.apache.org/licenses/LICENSE-2.0
3547     *
3548     * Unless required by applicable law or agreed to in writing, software
3549     * distributed under the License is distributed on an "AS IS" BASIS,
3550     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3551     * See the License for the specific language governing permissions and
3552     * limitations under the License.
3553     */
3554
3555    /*
3556     * File: zcmp.S
3557     *
3558     * Code: Generic 32-bit comparison operation. Provides a "revcmp"
3559     *       variable to specify the reverse comparison to perform
3560     *
3561     * For: if-eqz, if-gez, if-gtz, if-lez, if-ltz, if-nez
3562     *
3563     * Description: Branch to the given destination if the given register's
3564     *              value compares with 0 as specified.
3565     *
3566     * Format: AA|op BBBB (21t)
3567     *
3568     * Syntax: op vAA, +BBBB
3569     */
3570
3571     cmp         $0, (rFP, rINST, 4)    # compare vAA with zero
3572     je  OP_IF_NEZ_2f                    # goto next instruction or branch
3573     FETCHs      1, %edx                 # %edx<- BBBB; branch offset
3574     sal         $1, %edx               # %edx<- adjust byte offset
3575
3576    /*
3577     * Inline common_backwardBranch
3578     */
3579
3580     js          common_periodicChecks2  # jump on backwards branch
3581 1:
3582     FINISH_RB   %edx, %ecx              # jump to next instruction
3583
3584    /*
3585     * FINISH code
3586     */
3587
3588 OP_IF_NEZ_2f:
3589     movzbl      4(rPC), %edx            # grab the next opcode
3590     movzbl      5(rPC), rINST           # update the instruction
3591     addl        $4, rPC                # update the program counter
3592     jmp         *dvmAsmInstructionJmpTable(, %edx, 4) # jump to next instruction
3593
3594
3595 /* ------------------------------ */
3596     .balign 64
3597 .L_OP_IF_LTZ: /* 0x3a */
3598 /* File: x86-atom/OP_IF_LTZ.S */
3599    /* Copyright (C) 2008 The Android Open Source Project
3600     *
3601     * Licensed under the Apache License, Version 2.0 (the "License");
3602     * you may not use this file except in compliance with the License.
3603     * You may obtain a copy of the License at
3604     *
3605     * http://www.apache.org/licenses/LICENSE-2.0
3606     *
3607     * Unless required by applicable law or agreed to in writing, software
3608     * distributed under the License is distributed on an "AS IS" BASIS,
3609     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3610     * See the License for the specific language governing permissions and
3611     * limitations under the License.
3612     */
3613
3614    /*
3615     * File: OP_IF_LTZ.S
3616     */
3617
3618 /* File: x86-atom/zcmp.S */
3619    /* Copyright (C) 2008 The Android Open Source Project
3620     *
3621     * Licensed under the Apache License, Version 2.0 (the "License");
3622     * you may not use this file except in compliance with the License.
3623     * You may obtain a copy of the License at
3624     *
3625     * http://www.apache.org/licenses/LICENSE-2.0
3626     *
3627     * Unless required by applicable law or agreed to in writing, software
3628     * distributed under the License is distributed on an "AS IS" BASIS,
3629     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3630     * See the License for the specific language governing permissions and
3631     * limitations under the License.
3632     */
3633
3634    /*
3635     * File: zcmp.S
3636     *
3637     * Code: Generic 32-bit comparison operation. Provides a "revcmp"
3638     *       variable to specify the reverse comparison to perform
3639     *
3640     * For: if-eqz, if-gez, if-gtz, if-lez, if-ltz, if-nez
3641     *
3642     * Description: Branch to the given destination if the given register's
3643     *              value compares with 0 as specified.
3644     *
3645     * Format: AA|op BBBB (21t)
3646     *
3647     * Syntax: op vAA, +BBBB
3648     */
3649
3650     cmp         $0, (rFP, rINST, 4)    # compare vAA with zero
3651     jge  OP_IF_LTZ_2f                    # goto next instruction or branch
3652     FETCHs      1, %edx                 # %edx<- BBBB; branch offset
3653     sal         $1, %edx               # %edx<- adjust byte offset
3654
3655    /*
3656     * Inline common_backwardBranch
3657     */
3658
3659     js          common_periodicChecks2  # jump on backwards branch
3660 1:
3661     FINISH_RB   %edx, %ecx              # jump to next instruction
3662
3663    /*
3664     * FINISH code
3665     */
3666
3667 OP_IF_LTZ_2f:
3668     movzbl      4(rPC), %edx            # grab the next opcode
3669     movzbl      5(rPC), rINST           # update the instruction
3670     addl        $4, rPC                # update the program counter
3671     jmp         *dvmAsmInstructionJmpTable(, %edx, 4) # jump to next instruction
3672
3673
3674 /* ------------------------------ */
3675     .balign 64
3676 .L_OP_IF_GEZ: /* 0x3b */
3677 /* File: x86-atom/OP_IF_GEZ.S */
3678    /* Copyright (C) 2008 The Android Open Source Project
3679     *
3680     * Licensed under the Apache License, Version 2.0 (the "License");
3681     * you may not use this file except in compliance with the License.
3682     * You may obtain a copy of the License at
3683     *
3684     * http://www.apache.org/licenses/LICENSE-2.0
3685     *
3686     * Unless required by applicable law or agreed to in writing, software
3687     * distributed under the License is distributed on an "AS IS" BASIS,
3688     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3689     * See the License for the specific language governing permissions and
3690     * limitations under the License.
3691     */
3692
3693    /*
3694     * File: OP_IF_GEZ.S
3695     */
3696
3697 /* File: x86-atom/zcmp.S */
3698    /* Copyright (C) 2008 The Android Open Source Project
3699     *
3700     * Licensed under the Apache License, Version 2.0 (the "License");
3701     * you may not use this file except in compliance with the License.
3702     * You may obtain a copy of the License at
3703     *
3704     * http://www.apache.org/licenses/LICENSE-2.0
3705     *
3706     * Unless required by applicable law or agreed to in writing, software
3707     * distributed under the License is distributed on an "AS IS" BASIS,
3708     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3709     * See the License for the specific language governing permissions and
3710     * limitations under the License.
3711     */
3712
3713    /*
3714     * File: zcmp.S
3715     *
3716     * Code: Generic 32-bit comparison operation. Provides a "revcmp"
3717     *       variable to specify the reverse comparison to perform
3718     *
3719     * For: if-eqz, if-gez, if-gtz, if-lez, if-ltz, if-nez
3720     *
3721     * Description: Branch to the given destination if the given register's
3722     *              value compares with 0 as specified.
3723     *
3724     * Format: AA|op BBBB (21t)
3725     *
3726     * Syntax: op vAA, +BBBB
3727     */
3728
3729     cmp         $0, (rFP, rINST, 4)    # compare vAA with zero
3730     jl  OP_IF_GEZ_2f                    # goto next instruction or branch
3731     FETCHs      1, %edx                 # %edx<- BBBB; branch offset
3732     sal         $1, %edx               # %edx<- adjust byte offset
3733
3734    /*
3735     * Inline common_backwardBranch
3736     */
3737
3738     js          common_periodicChecks2  # jump on backwards branch
3739 1:
3740     FINISH_RB   %edx, %ecx              # jump to next instruction
3741
3742    /*
3743     * FINISH code
3744     */
3745
3746 OP_IF_GEZ_2f:
3747     movzbl      4(rPC), %edx            # grab the next opcode
3748     movzbl      5(rPC), rINST           # update the instruction
3749     addl        $4, rPC                # update the program counter
3750     jmp         *dvmAsmInstructionJmpTable(, %edx, 4) # jump to next instruction
3751
3752
3753 /* ------------------------------ */
3754     .balign 64
3755 .L_OP_IF_GTZ: /* 0x3c */
3756 /* File: x86-atom/OP_IF_GTZ.S */
3757    /* Copyright (C) 2008 The Android Open Source Project
3758     *
3759     * Licensed under the Apache License, Version 2.0 (the "License");
3760     * you may not use this file except in compliance with the License.
3761     * You may obtain a copy of the License at
3762     *
3763     * http://www.apache.org/licenses/LICENSE-2.0
3764     *
3765     * Unless required by applicable law or agreed to in writing, software
3766     * distributed under the License is distributed on an "AS IS" BASIS,
3767     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3768     * See the License for the specific language governing permissions and
3769     * limitations under the License.
3770     */
3771
3772    /*
3773     * File: OP_IF_GTZ.S
3774     */
3775
3776 /* File: x86-atom/zcmp.S */
3777    /* Copyright (C) 2008 The Android Open Source Project
3778     *
3779     * Licensed under the Apache License, Version 2.0 (the "License");
3780     * you may not use this file except in compliance with the License.
3781     * You may obtain a copy of the License at
3782     *
3783     * http://www.apache.org/licenses/LICENSE-2.0
3784     *
3785     * Unless required by applicable law or agreed to in writing, software
3786     * distributed under the License is distributed on an "AS IS" BASIS,
3787     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3788     * See the License for the specific language governing permissions and
3789     * limitations under the License.
3790     */
3791
3792    /*
3793     * File: zcmp.S
3794     *
3795     * Code: Generic 32-bit comparison operation. Provides a "revcmp"
3796     *       variable to specify the reverse comparison to perform
3797     *
3798     * For: if-eqz, if-gez, if-gtz, if-lez, if-ltz, if-nez
3799     *
3800     * Description: Branch to the given destination if the given register's
3801     *              value compares with 0 as specified.
3802     *
3803     * Format: AA|op BBBB (21t)
3804     *
3805     * Syntax: op vAA, +BBBB
3806     */
3807
3808     cmp         $0, (rFP, rINST, 4)    # compare vAA with zero
3809     jle  OP_IF_GTZ_2f                    # goto next instruction or branch
3810     FETCHs      1, %edx                 # %edx<- BBBB; branch offset
3811     sal         $1, %edx               # %edx<- adjust byte offset
3812
3813    /*
3814     * Inline common_backwardBranch
3815     */
3816
3817     js          common_periodicChecks2  # jump on backwards branch
3818 1:
3819     FINISH_RB   %edx, %ecx              # jump to next instruction
3820
3821    /*
3822     * FINISH code
3823     */
3824
3825 OP_IF_GTZ_2f:
3826     movzbl      4(rPC), %edx            # grab the next opcode
3827     movzbl      5(rPC), rINST           # update the instruction
3828     addl        $4, rPC                # update the program counter
3829     jmp         *dvmAsmInstructionJmpTable(, %edx, 4) # jump to next instruction
3830
3831
3832 /* ------------------------------ */
3833     .balign 64
3834 .L_OP_IF_LEZ: /* 0x3d */
3835 /* File: x86-atom/OP_IF_LEZ.S */
3836    /* Copyright (C) 2008 The Android Open Source Project
3837     *
3838     * Licensed under the Apache License, Version 2.0 (the "License");
3839     * you may not use this file except in compliance with the License.
3840     * You may obtain a copy of the License at
3841     *
3842     * http://www.apache.org/licenses/LICENSE-2.0
3843     *
3844     * Unless required by applicable law or agreed to in writing, software
3845     * distributed under the License is distributed on an "AS IS" BASIS,
3846     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3847     * See the License for the specific language governing permissions and
3848     * limitations under the License.
3849     */
3850
3851    /*
3852     * File: OP_IF_LEZ.S
3853     */
3854
3855 /* File: x86-atom/zcmp.S */
3856    /* Copyright (C) 2008 The Android Open Source Project
3857     *
3858     * Licensed under the Apache License, Version 2.0 (the "License");
3859     * you may not use this file except in compliance with the License.
3860     * You may obtain a copy of the License at
3861     *
3862     * http://www.apache.org/licenses/LICENSE-2.0
3863     *
3864     * Unless required by applicable law or agreed to in writing, software
3865     * distributed under the License is distributed on an "AS IS" BASIS,
3866     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3867     * See the License for the specific language governing permissions and
3868     * limitations under the License.
3869     */
3870
3871    /*
3872     * File: zcmp.S
3873     *
3874     * Code: Generic 32-bit comparison operation. Provides a "revcmp"
3875     *       variable to specify the reverse comparison to perform
3876     *
3877     * For: if-eqz, if-gez, if-gtz, if-lez, if-ltz, if-nez
3878     *
3879     * Description: Branch to the given destination if the given register's
3880     *              value compares with 0 as specified.
3881     *
3882     * Format: AA|op BBBB (21t)
3883     *
3884     * Syntax: op vAA, +BBBB
3885     */
3886
3887     cmp         $0, (rFP, rINST, 4)    # compare vAA with zero
3888     jg  OP_IF_LEZ_2f                    # goto next instruction or branch
3889     FETCHs      1, %edx                 # %edx<- BBBB; branch offset
3890     sal         $1, %edx               # %edx<- adjust byte offset
3891
3892    /*
3893     * Inline common_backwardBranch
3894     */
3895
3896     js          common_periodicChecks2  # jump on backwards branch
3897 1:
3898     FINISH_RB   %edx, %ecx              # jump to next instruction
3899
3900    /*
3901     * FINISH code
3902     */
3903
3904 OP_IF_LEZ_2f:
3905     movzbl      4(rPC), %edx            # grab the next opcode
3906     movzbl      5(rPC), rINST           # update the instruction
3907     addl        $4, rPC                # update the program counter
3908     jmp         *dvmAsmInstructionJmpTable(, %edx, 4) # jump to next instruction
3909
3910
3911 /* ------------------------------ */
3912     .balign 64
3913 .L_OP_UNUSED_3E: /* 0x3e */
3914 /* File: x86-atom/OP_UNUSED_3E.S */
3915    /* Copyright (C) 2008 The Android Open Source Project
3916     *
3917     * Licensed under the Apache License, Version 2.0 (the "License");
3918     * you may not use this file except in compliance with the License.
3919     * You may obtain a copy of the License at
3920     *
3921     * http://www.apache.org/licenses/LICENSE-2.0
3922     *
3923     * Unless required by applicable law or agreed to in writing, software
3924     * distributed under the License is distributed on an "AS IS" BASIS,
3925     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3926     * See the License for the specific language governing permissions and
3927     * limitations under the License.
3928     */
3929
3930    /*
3931     * File: OP_UNUSED_3E.S
3932     */
3933
3934 /* File: x86-atom/unused.S */
3935    /* Copyright (C) 2008 The Android Open Source Project
3936     *
3937     * Licensed under the Apache License, Version 2.0 (the "License");
3938     * you may not use this file except in compliance with the License.
3939     * You may obtain a copy of the License at
3940     *
3941     * http://www.apache.org/licenses/LICENSE-2.0
3942     *
3943     * Unless required by applicable law or agreed to in writing, software
3944     * distributed under the License is distributed on an "AS IS" BASIS,
3945     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3946     * See the License for the specific language governing permissions and
3947     * limitations under the License.
3948     */
3949
3950    /*
3951     * File: unused.S
3952     *
3953     * Code: Common code for unused bytecodes. Uses no subtitutions.
3954     *
3955     * For: all unused bytecodes
3956     *
3957     * Description: aborts if executed.
3958     *
3959     * Format: Ã˜Ã˜|op (10x)
3960     *
3961     * Syntax: op
3962     */
3963
3964     call        common_abort
3965
3966
3967 /* ------------------------------ */
3968     .balign 64
3969 .L_OP_UNUSED_3F: /* 0x3f */
3970 /* File: x86-atom/OP_UNUSED_3F.S */
3971    /* Copyright (C) 2008 The Android Open Source Project
3972     *
3973     * Licensed under the Apache License, Version 2.0 (the "License");
3974     * you may not use this file except in compliance with the License.
3975     * You may obtain a copy of the License at
3976     *
3977     * http://www.apache.org/licenses/LICENSE-2.0
3978     *
3979     * Unless required by applicable law or agreed to in writing, software
3980     * distributed under the License is distributed on an "AS IS" BASIS,
3981     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3982     * See the License for the specific language governing permissions and
3983     * limitations under the License.
3984     */
3985
3986    /*
3987     * File: OP_UNUSED_3F.S
3988     */
3989
3990 /* File: x86-atom/unused.S */
3991    /* Copyright (C) 2008 The Android Open Source Project
3992     *
3993     * Licensed under the Apache License, Version 2.0 (the "License");
3994     * you may not use this file except in compliance with the License.
3995     * You may obtain a copy of the License at
3996     *
3997     * http://www.apache.org/licenses/LICENSE-2.0
3998     *
3999     * Unless required by applicable law or agreed to in writing, software
4000     * distributed under the License is distributed on an "AS IS" BASIS,
4001     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4002     * See the License for the specific language governing permissions and
4003     * limitations under the License.
4004     */
4005
4006    /*
4007     * File: unused.S
4008     *
4009     * Code: Common code for unused bytecodes. Uses no subtitutions.
4010     *
4011     * For: all unused bytecodes
4012     *
4013     * Description: aborts if executed.
4014     *
4015     * Format: Ã˜Ã˜|op (10x)
4016     *
4017     * Syntax: op
4018     */
4019
4020     call        common_abort
4021
4022
4023 /* ------------------------------ */
4024     .balign 64
4025 .L_OP_UNUSED_40: /* 0x40 */
4026 /* File: x86-atom/OP_UNUSED_40.S */
4027    /* Copyright (C) 2008 The Android Open Source Project
4028     *
4029     * Licensed under the Apache License, Version 2.0 (the "License");
4030     * you may not use this file except in compliance with the License.
4031     * You may obtain a copy of the License at
4032     *
4033     * http://www.apache.org/licenses/LICENSE-2.0
4034     *
4035     * Unless required by applicable law or agreed to in writing, software
4036     * distributed under the License is distributed on an "AS IS" BASIS,
4037     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4038     * See the License for the specific language governing permissions and
4039     * limitations under the License.
4040     */
4041
4042    /*
4043     * File: OP_UNUSED_40.S
4044     */
4045
4046 /* File: x86-atom/unused.S */
4047    /* Copyright (C) 2008 The Android Open Source Project
4048     *
4049     * Licensed under the Apache License, Version 2.0 (the "License");
4050     * you may not use this file except in compliance with the License.
4051     * You may obtain a copy of the License at
4052     *
4053     * http://www.apache.org/licenses/LICENSE-2.0
4054     *
4055     * Unless required by applicable law or agreed to in writing, software
4056     * distributed under the License is distributed on an "AS IS" BASIS,
4057     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4058     * See the License for the specific language governing permissions and
4059     * limitations under the License.
4060     */
4061
4062    /*
4063     * File: unused.S
4064     *
4065     * Code: Common code for unused bytecodes. Uses no subtitutions.
4066     *
4067     * For: all unused bytecodes
4068     *
4069     * Description: aborts if executed.
4070     *
4071     * Format: Ã˜Ã˜|op (10x)
4072     *
4073     * Syntax: op
4074     */
4075
4076     call        common_abort
4077
4078
4079 /* ------------------------------ */
4080     .balign 64
4081 .L_OP_UNUSED_41: /* 0x41 */
4082 /* File: x86-atom/OP_UNUSED_41.S */
4083    /* Copyright (C) 2008 The Android Open Source Project
4084     *
4085     * Licensed under the Apache License, Version 2.0 (the "License");
4086     * you may not use this file except in compliance with the License.
4087     * You may obtain a copy of the License at
4088     *
4089     * http://www.apache.org/licenses/LICENSE-2.0
4090     *
4091     * Unless required by applicable law or agreed to in writing, software
4092     * distributed under the License is distributed on an "AS IS" BASIS,
4093     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4094     * See the License for the specific language governing permissions and
4095     * limitations under the License.
4096     */
4097
4098    /*
4099     * File: OP_UNUSED_41.S
4100     */
4101
4102 /* File: x86-atom/unused.S */
4103    /* Copyright (C) 2008 The Android Open Source Project
4104     *
4105     * Licensed under the Apache License, Version 2.0 (the "License");
4106     * you may not use this file except in compliance with the License.
4107     * You may obtain a copy of the License at
4108     *
4109     * http://www.apache.org/licenses/LICENSE-2.0
4110     *
4111     * Unless required by applicable law or agreed to in writing, software
4112     * distributed under the License is distributed on an "AS IS" BASIS,
4113     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4114     * See the License for the specific language governing permissions and
4115     * limitations under the License.
4116     */
4117
4118    /*
4119     * File: unused.S
4120     *
4121     * Code: Common code for unused bytecodes. Uses no subtitutions.
4122     *
4123     * For: all unused bytecodes
4124     *
4125     * Description: aborts if executed.
4126     *
4127     * Format: Ã˜Ã˜|op (10x)
4128     *
4129     * Syntax: op
4130     */
4131
4132     call        common_abort
4133
4134
4135 /* ------------------------------ */
4136     .balign 64
4137 .L_OP_UNUSED_42: /* 0x42 */
4138 /* File: x86-atom/OP_UNUSED_42.S */
4139    /* Copyright (C) 2008 The Android Open Source Project
4140     *
4141     * Licensed under the Apache License, Version 2.0 (the "License");
4142     * you may not use this file except in compliance with the License.
4143     * You may obtain a copy of the License at
4144     *
4145     * http://www.apache.org/licenses/LICENSE-2.0
4146     *
4147     * Unless required by applicable law or agreed to in writing, software
4148     * distributed under the License is distributed on an "AS IS" BASIS,
4149     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4150     * See the License for the specific language governing permissions and
4151     * limitations under the License.
4152     */
4153
4154    /*
4155     * File: OP_UNUSED_42.S
4156     */
4157
4158 /* File: x86-atom/unused.S */
4159    /* Copyright (C) 2008 The Android Open Source Project
4160     *
4161     * Licensed under the Apache License, Version 2.0 (the "License");
4162     * you may not use this file except in compliance with the License.
4163     * You may obtain a copy of the License at
4164     *
4165     * http://www.apache.org/licenses/LICENSE-2.0
4166     *
4167     * Unless required by applicable law or agreed to in writing, software
4168     * distributed under the License is distributed on an "AS IS" BASIS,
4169     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4170     * See the License for the specific language governing permissions and
4171     * limitations under the License.
4172     */
4173
4174    /*
4175     * File: unused.S
4176     *
4177     * Code: Common code for unused bytecodes. Uses no subtitutions.
4178     *
4179     * For: all unused bytecodes
4180     *
4181     * Description: aborts if executed.
4182     *
4183     * Format: Ã˜Ã˜|op (10x)
4184     *
4185     * Syntax: op
4186     */
4187
4188     call        common_abort
4189
4190
4191 /* ------------------------------ */
4192     .balign 64
4193 .L_OP_UNUSED_43: /* 0x43 */
4194 /* File: x86-atom/OP_UNUSED_43.S */
4195    /* Copyright (C) 2008 The Android Open Source Project
4196     *
4197     * Licensed under the Apache License, Version 2.0 (the "License");
4198     * you may not use this file except in compliance with the License.
4199     * You may obtain a copy of the License at
4200     *
4201     * http://www.apache.org/licenses/LICENSE-2.0
4202     *
4203     * Unless required by applicable law or agreed to in writing, software
4204     * distributed under the License is distributed on an "AS IS" BASIS,
4205     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4206     * See the License for the specific language governing permissions and
4207     * limitations under the License.
4208     */
4209
4210    /*
4211     * File: OP_UNUSED_43.S
4212     */
4213
4214 /* File: x86-atom/unused.S */
4215    /* Copyright (C) 2008 The Android Open Source Project
4216     *
4217     * Licensed under the Apache License, Version 2.0 (the "License");
4218     * you may not use this file except in compliance with the License.
4219     * You may obtain a copy of the License at
4220     *
4221     * http://www.apache.org/licenses/LICENSE-2.0
4222     *
4223     * Unless required by applicable law or agreed to in writing, software
4224     * distributed under the License is distributed on an "AS IS" BASIS,
4225     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4226     * See the License for the specific language governing permissions and
4227     * limitations under the License.
4228     */
4229
4230    /*
4231     * File: unused.S
4232     *
4233     * Code: Common code for unused bytecodes. Uses no subtitutions.
4234     *
4235     * For: all unused bytecodes
4236     *
4237     * Description: aborts if executed.
4238     *
4239     * Format: Ã˜Ã˜|op (10x)
4240     *
4241     * Syntax: op
4242     */
4243
4244     call        common_abort
4245
4246
4247 /* ------------------------------ */
4248     .balign 64
4249 .L_OP_AGET: /* 0x44 */
4250 /* File: x86-atom/OP_AGET.S */
4251    /* Copyright (C) 2008 The Android Open Source Project
4252     *
4253     * Licensed under the Apache License, Version 2.0 (the "License");
4254     * you may not use this file except in compliance with the License.
4255     * You may obtain a copy of the License at
4256     *
4257     * http://www.apache.org/licenses/LICENSE-2.0
4258     *
4259     * Unless required by applicable law or agreed to in writing, software
4260     * distributed under the License is distributed on an "AS IS" BASIS,
4261     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4262     * See the License for the specific language governing permissions and
4263     * limitations under the License.
4264     */
4265
4266    /*
4267     * File: OP_AGET.S
4268     *
4269     * Code: Generic 32-bit array "get" operation.  Provides a "scale" variable
4270     *       to specify a scale value which depends on the width of the array
4271     *       elements. Provides a "mov" variable which determines the type of
4272     *       mov performed also dependent on the type of the array element.
4273     *
4274     * For: aget, aget-boolean, aget-byte, aget-char, aget-object, sget, aget-short
4275     *
4276     * Description: Perform an array get operation at the identified index
4277     *              of a given array; load the array value into the value
4278     *              register. vAA <- vBB[vCC].
4279     *
4280     * Format: AA|op CC|BB (23x)
4281     *
4282     * Syntax: op vAA, vBB, vCC
4283     */
4284
4285
4286     FETCH_BB    1, %ecx                 # %ecx<- BB
4287     FETCH_CC    1, %edx                 # %edx<- CC
4288     GET_VREG    %ecx                    # %ecx<- vBB
4289     GET_VREG    %edx                    # %edx<- vCC
4290     cmp         $0, %ecx               # check for null array object
4291     je          common_errNullObject    # handle null array object
4292     cmp         offArrayObject_length(%ecx), %edx # compare index to arrayObj->length
4293     jnc         common_errArrayIndex    # handle index >= length, bail
4294     lea         (%ecx, %edx, 4), %ecx # %ecx<- &vBB[vCC]
4295                                            # trying: lea (%ecx, %edx, scale), %ecx
4296                                            # to reduce code size
4297     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
4298     movl offArrayObject_contents(%ecx), %edx # %edx<- vBB[vCC]
4299                                                 # doing this and the previous instr
4300                                                 # with one instr was not faster
4301     SET_VREG    %edx  rINST             # vAA<- %edx; value
4302     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
4303 /* ------------------------------ */
4304     .balign 64
4305 .L_OP_AGET_WIDE: /* 0x45 */
4306 /* File: x86-atom/OP_AGET_WIDE.S */
4307    /* Copyright (C) 2008 The Android Open Source Project
4308     *
4309     * Licensed under the Apache License, Version 2.0 (the "License");
4310     * you may not use this file except in compliance with the License.
4311     * You may obtain a copy of the License at
4312     *
4313     * http://www.apache.org/licenses/LICENSE-2.0
4314     *
4315     * Unless required by applicable law or agreed to in writing, software
4316     * distributed under the License is distributed on an "AS IS" BASIS,
4317     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4318     * See the License for the specific language governing permissions and
4319     * limitations under the License.
4320     */
4321
4322    /*
4323     * File: OP_AGET_WIDE.S
4324     *
4325     * Code: 64-bit array get operation.
4326     *
4327     * For: aget-wide
4328     *
4329     * Description: Perform an array get operation at the identified index
4330     *              of a given array; load the array value into the destination
4331     *              register. vAA <- vBB[vCC].
4332     *
4333     * Format: AA|op CC|BB (23x)
4334     *
4335     * Syntax: op vAA, vBB, vCC
4336     */
4337
4338     FETCH_BB    1, %ecx                 # %ecx<- BB
4339     FETCH_CC    1, %edx                 # %edx<- CC
4340     GET_VREG    %ecx                    # %ecx<- vBB
4341     GET_VREG    %edx                    # %edx<- vCC
4342     cmp         $0, %ecx               # check for null array object
4343     je          common_errNullObject    # handle null array object
4344     cmp         offArrayObject_length(%ecx), %edx # compare index to arrayObj->length
4345     jnc         common_errArrayIndex    # handle index >= length, bail
4346     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
4347     movq        offArrayObject_contents(%ecx, %edx, 8), %xmm0 # %xmm0<- vBB[vCC]
4348     movq        %xmm0, (rFP, rINST, 4)  # vAA<- %xmm0; value
4349     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
4350 /* ------------------------------ */
4351     .balign 64
4352 .L_OP_AGET_OBJECT: /* 0x46 */
4353 /* File: x86-atom/OP_AGET_OBJECT.S */
4354    /* Copyright (C) 2008 The Android Open Source Project
4355     *
4356     * Licensed under the Apache License, Version 2.0 (the "License");
4357     * you may not use this file except in compliance with the License.
4358     * You may obtain a copy of the License at
4359     *
4360     * http://www.apache.org/licenses/LICENSE-2.0
4361     *
4362     * Unless required by applicable law or agreed to in writing, software
4363     * distributed under the License is distributed on an "AS IS" BASIS,
4364     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4365     * See the License for the specific language governing permissions and
4366     * limitations under the License.
4367     */
4368
4369    /*
4370     * File: OP_AGET_OBJECT.S
4371     */
4372
4373 /* File: x86-atom/OP_AGET.S */
4374    /* Copyright (C) 2008 The Android Open Source Project
4375     *
4376     * Licensed under the Apache License, Version 2.0 (the "License");
4377     * you may not use this file except in compliance with the License.
4378     * You may obtain a copy of the License at
4379     *
4380     * http://www.apache.org/licenses/LICENSE-2.0
4381     *
4382     * Unless required by applicable law or agreed to in writing, software
4383     * distributed under the License is distributed on an "AS IS" BASIS,
4384     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4385     * See the License for the specific language governing permissions and
4386     * limitations under the License.
4387     */
4388
4389    /*
4390     * File: OP_AGET.S
4391     *
4392     * Code: Generic 32-bit array "get" operation.  Provides a "scale" variable
4393     *       to specify a scale value which depends on the width of the array
4394     *       elements. Provides a "mov" variable which determines the type of
4395     *       mov performed also dependent on the type of the array element.
4396     *
4397     * For: aget, aget-boolean, aget-byte, aget-char, aget-object, sget, aget-short
4398     *
4399     * Description: Perform an array get operation at the identified index
4400     *              of a given array; load the array value into the value
4401     *              register. vAA <- vBB[vCC].
4402     *
4403     * Format: AA|op CC|BB (23x)
4404     *
4405     * Syntax: op vAA, vBB, vCC
4406     */
4407
4408
4409     FETCH_BB    1, %ecx                 # %ecx<- BB
4410     FETCH_CC    1, %edx                 # %edx<- CC
4411     GET_VREG    %ecx                    # %ecx<- vBB
4412     GET_VREG    %edx                    # %edx<- vCC
4413     cmp         $0, %ecx               # check for null array object
4414     je          common_errNullObject    # handle null array object
4415     cmp         offArrayObject_length(%ecx), %edx # compare index to arrayObj->length
4416     jnc         common_errArrayIndex    # handle index >= length, bail
4417     lea         (%ecx, %edx, 4), %ecx # %ecx<- &vBB[vCC]
4418                                            # trying: lea (%ecx, %edx, scale), %ecx
4419                                            # to reduce code size
4420     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
4421     movl offArrayObject_contents(%ecx), %edx # %edx<- vBB[vCC]
4422                                                 # doing this and the previous instr
4423                                                 # with one instr was not faster
4424     SET_VREG    %edx  rINST             # vAA<- %edx; value
4425     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
4426
4427 /* ------------------------------ */
4428     .balign 64
4429 .L_OP_AGET_BOOLEAN: /* 0x47 */
4430 /* File: x86-atom/OP_AGET_BOOLEAN.S */
4431    /* Copyright (C) 2008 The Android Open Source Project
4432     *
4433     * Licensed under the Apache License, Version 2.0 (the "License");
4434     * you may not use this file except in compliance with the License.
4435     * You may obtain a copy of the License at
4436     *
4437     * http://www.apache.org/licenses/LICENSE-2.0
4438     *
4439     * Unless required by applicable law or agreed to in writing, software
4440     * distributed under the License is distributed on an "AS IS" BASIS,
4441     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4442     * See the License for the specific language governing permissions and
4443     * limitations under the License.
4444     */
4445
4446    /*
4447     * File: OP_AGET_BOOLEAN.S
4448     */
4449
4450 /* File: x86-atom/OP_AGET.S */
4451    /* Copyright (C) 2008 The Android Open Source Project
4452     *
4453     * Licensed under the Apache License, Version 2.0 (the "License");
4454     * you may not use this file except in compliance with the License.
4455     * You may obtain a copy of the License at
4456     *
4457     * http://www.apache.org/licenses/LICENSE-2.0
4458     *
4459     * Unless required by applicable law or agreed to in writing, software
4460     * distributed under the License is distributed on an "AS IS" BASIS,
4461     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4462     * See the License for the specific language governing permissions and
4463     * limitations under the License.
4464     */
4465
4466    /*
4467     * File: OP_AGET.S
4468     *
4469     * Code: Generic 32-bit array "get" operation.  Provides a "scale" variable
4470     *       to specify a scale value which depends on the width of the array
4471     *       elements. Provides a "mov" variable which determines the type of
4472     *       mov performed also dependent on the type of the array element.
4473     *
4474     * For: aget, aget-boolean, aget-byte, aget-char, aget-object, sget, aget-short
4475     *
4476     * Description: Perform an array get operation at the identified index
4477     *              of a given array; load the array value into the value
4478     *              register. vAA <- vBB[vCC].
4479     *
4480     * Format: AA|op CC|BB (23x)
4481     *
4482     * Syntax: op vAA, vBB, vCC
4483     */
4484
4485
4486     FETCH_BB    1, %ecx                 # %ecx<- BB
4487     FETCH_CC    1, %edx                 # %edx<- CC
4488     GET_VREG    %ecx                    # %ecx<- vBB
4489     GET_VREG    %edx                    # %edx<- vCC
4490     cmp         $0, %ecx               # check for null array object
4491     je          common_errNullObject    # handle null array object
4492     cmp         offArrayObject_length(%ecx), %edx # compare index to arrayObj->length
4493     jnc         common_errArrayIndex    # handle index >= length, bail
4494     lea         (%ecx, %edx, 1), %ecx # %ecx<- &vBB[vCC]
4495                                            # trying: lea (%ecx, %edx, scale), %ecx
4496                                            # to reduce code size
4497     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
4498     movzbl offArrayObject_contents(%ecx), %edx # %edx<- vBB[vCC]
4499                                                 # doing this and the previous instr
4500                                                 # with one instr was not faster
4501     SET_VREG    %edx  rINST             # vAA<- %edx; value
4502     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
4503
4504 /* ------------------------------ */
4505     .balign 64
4506 .L_OP_AGET_BYTE: /* 0x48 */
4507 /* File: x86-atom/OP_AGET_BYTE.S */
4508    /* Copyright (C) 2008 The Android Open Source Project
4509     *
4510     * Licensed under the Apache License, Version 2.0 (the "License");
4511     * you may not use this file except in compliance with the License.
4512     * You may obtain a copy of the License at
4513     *
4514     * http://www.apache.org/licenses/LICENSE-2.0
4515     *
4516     * Unless required by applicable law or agreed to in writing, software
4517     * distributed under the License is distributed on an "AS IS" BASIS,
4518     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4519     * See the License for the specific language governing permissions and
4520     * limitations under the License.
4521     */
4522
4523    /*
4524     * File: OP_AGET_BYTE.S
4525     */
4526
4527 /* File: x86-atom/OP_AGET.S */
4528    /* Copyright (C) 2008 The Android Open Source Project
4529     *
4530     * Licensed under the Apache License, Version 2.0 (the "License");
4531     * you may not use this file except in compliance with the License.
4532     * You may obtain a copy of the License at
4533     *
4534     * http://www.apache.org/licenses/LICENSE-2.0
4535     *
4536     * Unless required by applicable law or agreed to in writing, software
4537     * distributed under the License is distributed on an "AS IS" BASIS,
4538     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4539     * See the License for the specific language governing permissions and
4540     * limitations under the License.
4541     */
4542
4543    /*
4544     * File: OP_AGET.S
4545     *
4546     * Code: Generic 32-bit array "get" operation.  Provides a "scale" variable
4547     *       to specify a scale value which depends on the width of the array
4548     *       elements. Provides a "mov" variable which determines the type of
4549     *       mov performed also dependent on the type of the array element.
4550     *
4551     * For: aget, aget-boolean, aget-byte, aget-char, aget-object, sget, aget-short
4552     *
4553     * Description: Perform an array get operation at the identified index
4554     *              of a given array; load the array value into the value
4555     *              register. vAA <- vBB[vCC].
4556     *
4557     * Format: AA|op CC|BB (23x)
4558     *
4559     * Syntax: op vAA, vBB, vCC
4560     */
4561
4562
4563     FETCH_BB    1, %ecx                 # %ecx<- BB
4564     FETCH_CC    1, %edx                 # %edx<- CC
4565     GET_VREG    %ecx                    # %ecx<- vBB
4566     GET_VREG    %edx                    # %edx<- vCC
4567     cmp         $0, %ecx               # check for null array object
4568     je          common_errNullObject    # handle null array object
4569     cmp         offArrayObject_length(%ecx), %edx # compare index to arrayObj->length
4570     jnc         common_errArrayIndex    # handle index >= length, bail
4571     lea         (%ecx, %edx, 1), %ecx # %ecx<- &vBB[vCC]
4572                                            # trying: lea (%ecx, %edx, scale), %ecx
4573                                            # to reduce code size
4574     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
4575     movsbl offArrayObject_contents(%ecx), %edx # %edx<- vBB[vCC]
4576                                                 # doing this and the previous instr
4577                                                 # with one instr was not faster
4578     SET_VREG    %edx  rINST             # vAA<- %edx; value
4579     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
4580
4581 /* ------------------------------ */
4582     .balign 64
4583 .L_OP_AGET_CHAR: /* 0x49 */
4584 /* File: x86-atom/OP_AGET_CHAR.S */
4585    /* Copyright (C) 2008 The Android Open Source Project
4586     *
4587     * Licensed under the Apache License, Version 2.0 (the "License");
4588     * you may not use this file except in compliance with the License.
4589     * You may obtain a copy of the License at
4590     *
4591     * http://www.apache.org/licenses/LICENSE-2.0
4592     *
4593     * Unless required by applicable law or agreed to in writing, software
4594     * distributed under the License is distributed on an "AS IS" BASIS,
4595     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4596     * See the License for the specific language governing permissions and
4597     * limitations under the License.
4598     */
4599
4600    /*
4601     * File: OP_AGET_CHAR.S
4602     */
4603
4604 /* File: x86-atom/OP_AGET.S */
4605    /* Copyright (C) 2008 The Android Open Source Project
4606     *
4607     * Licensed under the Apache License, Version 2.0 (the "License");
4608     * you may not use this file except in compliance with the License.
4609     * You may obtain a copy of the License at
4610     *
4611     * http://www.apache.org/licenses/LICENSE-2.0
4612     *
4613     * Unless required by applicable law or agreed to in writing, software
4614     * distributed under the License is distributed on an "AS IS" BASIS,
4615     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4616     * See the License for the specific language governing permissions and
4617     * limitations under the License.
4618     */
4619
4620    /*
4621     * File: OP_AGET.S
4622     *
4623     * Code: Generic 32-bit array "get" operation.  Provides a "scale" variable
4624     *       to specify a scale value which depends on the width of the array
4625     *       elements. Provides a "mov" variable which determines the type of
4626     *       mov performed also dependent on the type of the array element.
4627     *
4628     * For: aget, aget-boolean, aget-byte, aget-char, aget-object, sget, aget-short
4629     *
4630     * Description: Perform an array get operation at the identified index
4631     *              of a given array; load the array value into the value
4632     *              register. vAA <- vBB[vCC].
4633     *
4634     * Format: AA|op CC|BB (23x)
4635     *
4636     * Syntax: op vAA, vBB, vCC
4637     */
4638
4639
4640     FETCH_BB    1, %ecx                 # %ecx<- BB
4641     FETCH_CC    1, %edx                 # %edx<- CC
4642     GET_VREG    %ecx                    # %ecx<- vBB
4643     GET_VREG    %edx                    # %edx<- vCC
4644     cmp         $0, %ecx               # check for null array object
4645     je          common_errNullObject    # handle null array object
4646     cmp         offArrayObject_length(%ecx), %edx # compare index to arrayObj->length
4647     jnc         common_errArrayIndex    # handle index >= length, bail
4648     lea         (%ecx, %edx, 2), %ecx # %ecx<- &vBB[vCC]
4649                                            # trying: lea (%ecx, %edx, scale), %ecx
4650                                            # to reduce code size
4651     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
4652     movzwl offArrayObject_contents(%ecx), %edx # %edx<- vBB[vCC]
4653                                                 # doing this and the previous instr
4654                                                 # with one instr was not faster
4655     SET_VREG    %edx  rINST             # vAA<- %edx; value
4656     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
4657
4658 /* ------------------------------ */
4659     .balign 64
4660 .L_OP_AGET_SHORT: /* 0x4a */
4661 /* File: x86-atom/OP_AGET_SHORT.S */
4662    /* Copyright (C) 2008 The Android Open Source Project
4663     *
4664     * Licensed under the Apache License, Version 2.0 (the "License");
4665     * you may not use this file except in compliance with the License.
4666     * You may obtain a copy of the License at
4667     *
4668     * http://www.apache.org/licenses/LICENSE-2.0
4669     *
4670     * Unless required by applicable law or agreed to in writing, software
4671     * distributed under the License is distributed on an "AS IS" BASIS,
4672     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4673     * See the License for the specific language governing permissions and
4674     * limitations under the License.
4675     */
4676
4677    /*
4678     * File: OP_AGET_SHORT.S
4679     */
4680
4681 /* File: x86-atom/OP_AGET.S */
4682    /* Copyright (C) 2008 The Android Open Source Project
4683     *
4684     * Licensed under the Apache License, Version 2.0 (the "License");
4685     * you may not use this file except in compliance with the License.
4686     * You may obtain a copy of the License at
4687     *
4688     * http://www.apache.org/licenses/LICENSE-2.0
4689     *
4690     * Unless required by applicable law or agreed to in writing, software
4691     * distributed under the License is distributed on an "AS IS" BASIS,
4692     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4693     * See the License for the specific language governing permissions and
4694     * limitations under the License.
4695     */
4696
4697    /*
4698     * File: OP_AGET.S
4699     *
4700     * Code: Generic 32-bit array "get" operation.  Provides a "scale" variable
4701     *       to specify a scale value which depends on the width of the array
4702     *       elements. Provides a "mov" variable which determines the type of
4703     *       mov performed also dependent on the type of the array element.
4704     *
4705     * For: aget, aget-boolean, aget-byte, aget-char, aget-object, sget, aget-short
4706     *
4707     * Description: Perform an array get operation at the identified index
4708     *              of a given array; load the array value into the value
4709     *              register. vAA <- vBB[vCC].
4710     *
4711     * Format: AA|op CC|BB (23x)
4712     *
4713     * Syntax: op vAA, vBB, vCC
4714     */
4715
4716
4717     FETCH_BB    1, %ecx                 # %ecx<- BB
4718     FETCH_CC    1, %edx                 # %edx<- CC
4719     GET_VREG    %ecx                    # %ecx<- vBB
4720     GET_VREG    %edx                    # %edx<- vCC
4721     cmp         $0, %ecx               # check for null array object
4722     je          common_errNullObject    # handle null array object
4723     cmp         offArrayObject_length(%ecx), %edx # compare index to arrayObj->length
4724     jnc         common_errArrayIndex    # handle index >= length, bail
4725     lea         (%ecx, %edx, 2), %ecx # %ecx<- &vBB[vCC]
4726                                            # trying: lea (%ecx, %edx, scale), %ecx
4727                                            # to reduce code size
4728     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
4729     movswl offArrayObject_contents(%ecx), %edx # %edx<- vBB[vCC]
4730                                                 # doing this and the previous instr
4731                                                 # with one instr was not faster
4732     SET_VREG    %edx  rINST             # vAA<- %edx; value
4733     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
4734
4735 /* ------------------------------ */
4736     .balign 64
4737 .L_OP_APUT: /* 0x4b */
4738 /* File: x86-atom/OP_APUT.S */
4739    /* Copyright (C) 2008 The Android Open Source Project
4740     *
4741     * Licensed under the Apache License, Version 2.0 (the "License");
4742     * you may not use this file except in compliance with the License.
4743     * You may obtain a copy of the License at
4744     *
4745     * http://www.apache.org/licenses/LICENSE-2.0
4746     *
4747     * Unless required by applicable law or agreed to in writing, software
4748     * distributed under the License is distributed on an "AS IS" BASIS,
4749     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4750     * See the License for the specific language governing permissions and
4751     * limitations under the License.
4752     */
4753
4754    /*
4755     * File: OP_APUT.S
4756     *
4757     * Code: Generic 32-bit array put operation.  Provides a "scale" variable
4758     *       to specify a scale value which depends on the width of the array
4759     *       elements. Provides a "mov" variable which determines the type of
4760     *       move performed also dependent on the type of the array element.
4761     *       Provides a "value" register to specify the source of the move
4762     *
4763     * For: aput-boolean, aput-byte, aput-char, aput-object, aput-short
4764     *
4765     * Description: Perform an array put operation from the value register;
4766     *              store the value register at the identified index of a
4767     *              given array. vBB[vCC] <- vAA
4768     *
4769     * Format: AA|op CC|BB (23x)
4770     *
4771     * Syntax: op vAA, vBB, vCC
4772     */
4773
4774
4775     FETCH_BB    1, %ecx                 # %ecx<- BB
4776     FETCH_CC    1, %edx                 # %edx<- CC
4777     GET_VREG    %ecx                    # %ecx<- vBB
4778     GET_VREG    %edx                    # %edx<- vCC
4779     cmp         $0, %ecx               # check for null array object
4780     je          common_errNullObject    # handle null array object
4781     cmp         offArrayObject_length(%ecx), %edx # compare index to arrayObj->length
4782     jnc         common_errArrayIndex    # handle index >= length, bail
4783     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
4784     lea         (%ecx, %edx, 4), %ecx # %ecx<- &vBB[vCC]
4785     GET_VREG    rINST                   # rINST<- vAA
4786     movl     rINST, offArrayObject_contents(%ecx) # vBB[vCC]<- rINSTx; value
4787     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
4788 /* ------------------------------ */
4789     .balign 64
4790 .L_OP_APUT_WIDE: /* 0x4c */
4791 /* File: x86-atom/OP_APUT_WIDE.S */
4792    /* Copyright (C) 2008 The Android Open Source Project
4793     *
4794     * Licensed under the Apache License, Version 2.0 (the "License");
4795     * you may not use this file except in compliance with the License.
4796     * You may obtain a copy of the License at
4797     *
4798     * http://www.apache.org/licenses/LICENSE-2.0
4799     *
4800     * Unless required by applicable law or agreed to in writing, software
4801     * distributed under the License is distributed on an "AS IS" BASIS,
4802     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4803     * See the License for the specific language governing permissions and
4804     * limitations under the License.
4805     */
4806
4807    /*
4808     * File: OP_APUT_WIDE.S
4809     *
4810     * Code: 64-bit array put operation.
4811     *
4812     * For: aput-wide
4813     *
4814     * Description: Perform an array put operation from the value register;
4815     *              store the value register at the identified index of a
4816     *              given array. vBB[vCC] <- vAA.
4817     *
4818     * Format: AA|op CC|BB (23x)
4819     *
4820     * Syntax: op vAA, vBB, vCC
4821     */
4822
4823     FETCH_BB    1, %ecx                 # %ecx<- BB
4824     FETCH_CC    1, %edx                 # %edx<- CC
4825     GET_VREG    %ecx                    # %ecx<- vBB
4826     GET_VREG    %edx                    # %edx<- vCC
4827     cmp         $0, %ecx               # check for null array object
4828     je          common_errNullObject    # handle null array object
4829     cmp         offArrayObject_length(%ecx), %edx # compare index to arrayObj->length
4830     jnc         common_errArrayIndex    # handle index >= length, bail
4831     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
4832     movq        (rFP, rINST, 4), %xmm0  # %xmm0<- vAA
4833     movq        %xmm0, offArrayObject_contents(%ecx, %edx, 8) # vBB[vCC]<- %xmm0; value
4834     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
4835 /* ------------------------------ */
4836     .balign 64
4837 .L_OP_APUT_OBJECT: /* 0x4d */
4838 /* File: x86-atom/OP_APUT_OBJECT.S */
4839    /* Copyright (C) 2008 The Android Open Source Project
4840     *
4841     * Licensed under the Apache License, Version 2.0 (the "License");
4842     * you may not use this file except in compliance with the License.
4843     * You may obtain a copy of the License at
4844     *
4845     * http://www.apache.org/licenses/LICENSE-2.0
4846     *
4847     * Unless required by applicable law or agreed to in writing, software
4848     * distributed under the License is distributed on an "AS IS" BASIS,
4849     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4850     * See the License for the specific language governing permissions and
4851     * limitations under the License.
4852     */
4853
4854    /*
4855     * File: OP_APUT_OBJECT.S
4856     *
4857     * Code: 32-bit array put operation.  Provides an "scale" variable
4858     *       specify a scale value which depends on the width of the array
4859     *       elements. Provides a "mov" variable which determines the type of
4860     *       mov performed also dependent on the type of the array element.
4861     *       Provides a "value" register to specify the source of the mov
4862     *
4863     * For: aput-boolean, aput-byte, aput-char, aput-object, aput-short
4864     *
4865     * Description: Perform an array put operation from the value register;
4866     *              store the value register at the identified index of a
4867     *              given array. vBB[vCC] <- vAA
4868     *
4869     * Format: AA|op CC|BB (23x)
4870     *
4871     * Syntax: op vAA, vBB, vCC
4872     */
4873
4874     FETCH_BB    1, %eax                 # %eax<- BB
4875     FETCH_CC    1, %edx                 # %edx<- CC
4876     GET_VREG    %eax                    # %eax<- vBB
4877     GET_VREG    %edx                    # %edx<- vCC
4878     cmp         $0, %eax               # check for null array object
4879     je          common_errNullObject    # handle null array object
4880     cmp         offArrayObject_length(%eax), %edx # compare index to arrayObj->length
4881     jnc         common_errArrayIndex    # handle index >= length, bail
4882     GET_VREG    rINST                   # rINST<- vAA
4883     lea         (%eax, %edx, 4), %edx   # %edx<- &vBB[vCC]
4884     cmp         $0, rINST              # check for null reference
4885     je          .LOP_APUT_OBJECT_skip_check  # reference is null so skip type check
4886     jmp         .LOP_APUT_OBJECT_finish
4887
4888 /* ------------------------------ */
4889     .balign 64
4890 .L_OP_APUT_BOOLEAN: /* 0x4e */
4891 /* File: x86-atom/OP_APUT_BOOLEAN.S */
4892    /* Copyright (C) 2008 The Android Open Source Project
4893     *
4894     * Licensed under the Apache License, Version 2.0 (the "License");
4895     * you may not use this file except in compliance with the License.
4896     * You may obtain a copy of the License at
4897     *
4898     * http://www.apache.org/licenses/LICENSE-2.0
4899     *
4900     * Unless required by applicable law or agreed to in writing, software
4901     * distributed under the License is distributed on an "AS IS" BASIS,
4902     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4903     * See the License for the specific language governing permissions and
4904     * limitations under the License.
4905     */
4906
4907    /*
4908     * File: OP_APUT_BOOLEAN.S
4909     */
4910
4911 /* File: x86-atom/OP_APUT.S */
4912    /* Copyright (C) 2008 The Android Open Source Project
4913     *
4914     * Licensed under the Apache License, Version 2.0 (the "License");
4915     * you may not use this file except in compliance with the License.
4916     * You may obtain a copy of the License at
4917     *
4918     * http://www.apache.org/licenses/LICENSE-2.0
4919     *
4920     * Unless required by applicable law or agreed to in writing, software
4921     * distributed under the License is distributed on an "AS IS" BASIS,
4922     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4923     * See the License for the specific language governing permissions and
4924     * limitations under the License.
4925     */
4926
4927    /*
4928     * File: OP_APUT.S
4929     *
4930     * Code: Generic 32-bit array put operation.  Provides a "scale" variable
4931     *       to specify a scale value which depends on the width of the array
4932     *       elements. Provides a "mov" variable which determines the type of
4933     *       move performed also dependent on the type of the array element.
4934     *       Provides a "value" register to specify the source of the move
4935     *
4936     * For: aput-boolean, aput-byte, aput-char, aput-object, aput-short
4937     *
4938     * Description: Perform an array put operation from the value register;
4939     *              store the value register at the identified index of a
4940     *              given array. vBB[vCC] <- vAA
4941     *
4942     * Format: AA|op CC|BB (23x)
4943     *
4944     * Syntax: op vAA, vBB, vCC
4945     */
4946
4947
4948     FETCH_BB    1, %ecx                 # %ecx<- BB
4949     FETCH_CC    1, %edx                 # %edx<- CC
4950     GET_VREG    %ecx                    # %ecx<- vBB
4951     GET_VREG    %edx                    # %edx<- vCC
4952     cmp         $0, %ecx               # check for null array object
4953     je          common_errNullObject    # handle null array object
4954     cmp         offArrayObject_length(%ecx), %edx # compare index to arrayObj->length
4955     jnc         common_errArrayIndex    # handle index >= length, bail
4956     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
4957     lea         (%ecx, %edx, 1), %ecx # %ecx<- &vBB[vCC]
4958     GET_VREG    rINST                   # rINST<- vAA
4959     movb     rINSTbl, offArrayObject_contents(%ecx) # vBB[vCC]<- rINSTx; value
4960     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
4961
4962 /* ------------------------------ */
4963     .balign 64
4964 .L_OP_APUT_BYTE: /* 0x4f */
4965 /* File: x86-atom/OP_APUT_BYTE.S */
4966    /* Copyright (C) 2008 The Android Open Source Project
4967     *
4968     * Licensed under the Apache License, Version 2.0 (the "License");
4969     * you may not use this file except in compliance with the License.
4970     * You may obtain a copy of the License at
4971     *
4972     * http://www.apache.org/licenses/LICENSE-2.0
4973     *
4974     * Unless required by applicable law or agreed to in writing, software
4975     * distributed under the License is distributed on an "AS IS" BASIS,
4976     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4977     * See the License for the specific language governing permissions and
4978     * limitations under the License.
4979     */
4980
4981    /*
4982     * File: OP_APUT_BYTE.S
4983     */
4984
4985 /* File: x86-atom/OP_APUT.S */
4986    /* Copyright (C) 2008 The Android Open Source Project
4987     *
4988     * Licensed under the Apache License, Version 2.0 (the "License");
4989     * you may not use this file except in compliance with the License.
4990     * You may obtain a copy of the License at
4991     *
4992     * http://www.apache.org/licenses/LICENSE-2.0
4993     *
4994     * Unless required by applicable law or agreed to in writing, software
4995     * distributed under the License is distributed on an "AS IS" BASIS,
4996     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4997     * See the License for the specific language governing permissions and
4998     * limitations under the License.
4999     */
5000
5001    /*
5002     * File: OP_APUT.S
5003     *
5004     * Code: Generic 32-bit array put operation.  Provides a "scale" variable
5005     *       to specify a scale value which depends on the width of the array
5006     *       elements. Provides a "mov" variable which determines the type of
5007     *       move performed also dependent on the type of the array element.
5008     *       Provides a "value" register to specify the source of the move
5009     *
5010     * For: aput-boolean, aput-byte, aput-char, aput-object, aput-short
5011     *
5012     * Description: Perform an array put operation from the value register;
5013     *              store the value register at the identified index of a
5014     *              given array. vBB[vCC] <- vAA
5015     *
5016     * Format: AA|op CC|BB (23x)
5017     *
5018     * Syntax: op vAA, vBB, vCC
5019     */
5020
5021
5022     FETCH_BB    1, %ecx                 # %ecx<- BB
5023     FETCH_CC    1, %edx                 # %edx<- CC
5024     GET_VREG    %ecx                    # %ecx<- vBB
5025     GET_VREG    %edx                    # %edx<- vCC
5026     cmp         $0, %ecx               # check for null array object
5027     je          common_errNullObject    # handle null array object
5028     cmp         offArrayObject_length(%ecx), %edx # compare index to arrayObj->length
5029     jnc         common_errArrayIndex    # handle index >= length, bail
5030     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
5031     lea         (%ecx, %edx, 1), %ecx # %ecx<- &vBB[vCC]
5032     GET_VREG    rINST                   # rINST<- vAA
5033     movb     rINSTbl, offArrayObject_contents(%ecx) # vBB[vCC]<- rINSTx; value
5034     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
5035
5036 /* ------------------------------ */
5037     .balign 64
5038 .L_OP_APUT_CHAR: /* 0x50 */
5039 /* File: x86-atom/OP_APUT_CHAR.S */
5040    /* Copyright (C) 2008 The Android Open Source Project
5041     *
5042     * Licensed under the Apache License, Version 2.0 (the "License");
5043     * you may not use this file except in compliance with the License.
5044     * You may obtain a copy of the License at
5045     *
5046     * http://www.apache.org/licenses/LICENSE-2.0
5047     *
5048     * Unless required by applicable law or agreed to in writing, software
5049     * distributed under the License is distributed on an "AS IS" BASIS,
5050     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5051     * See the License for the specific language governing permissions and
5052     * limitations under the License.
5053     */
5054
5055    /*
5056     * File: OP_APUT_CHAR.S
5057     */
5058
5059 /* File: x86-atom/OP_APUT.S */
5060    /* Copyright (C) 2008 The Android Open Source Project
5061     *
5062     * Licensed under the Apache License, Version 2.0 (the "License");
5063     * you may not use this file except in compliance with the License.
5064     * You may obtain a copy of the License at
5065     *
5066     * http://www.apache.org/licenses/LICENSE-2.0
5067     *
5068     * Unless required by applicable law or agreed to in writing, software
5069     * distributed under the License is distributed on an "AS IS" BASIS,
5070     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5071     * See the License for the specific language governing permissions and
5072     * limitations under the License.
5073     */
5074
5075    /*
5076     * File: OP_APUT.S
5077     *
5078     * Code: Generic 32-bit array put operation.  Provides a "scale" variable
5079     *       to specify a scale value which depends on the width of the array
5080     *       elements. Provides a "mov" variable which determines the type of
5081     *       move performed also dependent on the type of the array element.
5082     *       Provides a "value" register to specify the source of the move
5083     *
5084     * For: aput-boolean, aput-byte, aput-char, aput-object, aput-short
5085     *
5086     * Description: Perform an array put operation from the value register;
5087     *              store the value register at the identified index of a
5088     *              given array. vBB[vCC] <- vAA
5089     *
5090     * Format: AA|op CC|BB (23x)
5091     *
5092     * Syntax: op vAA, vBB, vCC
5093     */
5094
5095
5096     FETCH_BB    1, %ecx                 # %ecx<- BB
5097     FETCH_CC    1, %edx                 # %edx<- CC
5098     GET_VREG    %ecx                    # %ecx<- vBB
5099     GET_VREG    %edx                    # %edx<- vCC
5100     cmp         $0, %ecx               # check for null array object
5101     je          common_errNullObject    # handle null array object
5102     cmp         offArrayObject_length(%ecx), %edx # compare index to arrayObj->length
5103     jnc         common_errArrayIndex    # handle index >= length, bail
5104     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
5105     lea         (%ecx, %edx, 2), %ecx # %ecx<- &vBB[vCC]
5106     GET_VREG    rINST                   # rINST<- vAA
5107     movw     rINSTw, offArrayObject_contents(%ecx) # vBB[vCC]<- rINSTx; value
5108     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
5109
5110 /* ------------------------------ */
5111     .balign 64
5112 .L_OP_APUT_SHORT: /* 0x51 */
5113 /* File: x86-atom/OP_APUT_SHORT.S */
5114    /* Copyright (C) 2008 The Android Open Source Project
5115     *
5116     * Licensed under the Apache License, Version 2.0 (the "License");
5117     * you may not use this file except in compliance with the License.
5118     * You may obtain a copy of the License at
5119     *
5120     * http://www.apache.org/licenses/LICENSE-2.0
5121     *
5122     * Unless required by applicable law or agreed to in writing, software
5123     * distributed under the License is distributed on an "AS IS" BASIS,
5124     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5125     * See the License for the specific language governing permissions and
5126     * limitations under the License.
5127     */
5128
5129    /*
5130     * File: OP_APUT_SHORT.S
5131     */
5132
5133 /* File: x86-atom/OP_APUT.S */
5134    /* Copyright (C) 2008 The Android Open Source Project
5135     *
5136     * Licensed under the Apache License, Version 2.0 (the "License");
5137     * you may not use this file except in compliance with the License.
5138     * You may obtain a copy of the License at
5139     *
5140     * http://www.apache.org/licenses/LICENSE-2.0
5141     *
5142     * Unless required by applicable law or agreed to in writing, software
5143     * distributed under the License is distributed on an "AS IS" BASIS,
5144     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5145     * See the License for the specific language governing permissions and
5146     * limitations under the License.
5147     */
5148
5149    /*
5150     * File: OP_APUT.S
5151     *
5152     * Code: Generic 32-bit array put operation.  Provides a "scale" variable
5153     *       to specify a scale value which depends on the width of the array
5154     *       elements. Provides a "mov" variable which determines the type of
5155     *       move performed also dependent on the type of the array element.
5156     *       Provides a "value" register to specify the source of the move
5157     *
5158     * For: aput-boolean, aput-byte, aput-char, aput-object, aput-short
5159     *
5160     * Description: Perform an array put operation from the value register;
5161     *              store the value register at the identified index of a
5162     *              given array. vBB[vCC] <- vAA
5163     *
5164     * Format: AA|op CC|BB (23x)
5165     *
5166     * Syntax: op vAA, vBB, vCC
5167     */
5168
5169
5170     FETCH_BB    1, %ecx                 # %ecx<- BB
5171     FETCH_CC    1, %edx                 # %edx<- CC
5172     GET_VREG    %ecx                    # %ecx<- vBB
5173     GET_VREG    %edx                    # %edx<- vCC
5174     cmp         $0, %ecx               # check for null array object
5175     je          common_errNullObject    # handle null array object
5176     cmp         offArrayObject_length(%ecx), %edx # compare index to arrayObj->length
5177     jnc         common_errArrayIndex    # handle index >= length, bail
5178     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
5179     lea         (%ecx, %edx, 2), %ecx # %ecx<- &vBB[vCC]
5180     GET_VREG    rINST                   # rINST<- vAA
5181     movw     rINSTw, offArrayObject_contents(%ecx) # vBB[vCC]<- rINSTx; value
5182     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
5183
5184 /* ------------------------------ */
5185     .balign 64
5186 .L_OP_IGET: /* 0x52 */
5187 /* File: x86-atom/OP_IGET.S */
5188    /* Copyright (C) 2008 The Android Open Source Project
5189     *
5190     * Licensed under the Apache License, Version 2.0 (the "License");
5191     * you may not use this file except in compliance with the License.
5192     * You may obtain a copy of the License at
5193     *
5194     * http://www.apache.org/licenses/LICENSE-2.0
5195     *
5196     * Unless required by applicable law or agreed to in writing, software
5197     * distributed under the License is distributed on an "AS IS" BASIS,
5198     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5199     * See the License for the specific language governing permissions and
5200     * limitations under the License.
5201     */
5202
5203    /*
5204     * File: OP_IGET.S
5205     *
5206     * Code: Generic 32-bit instance field "get" operation. Provides a
5207     *       "mov" variable which determines the type of mov performed.
5208     *       Currently, none of the iget's use this variable - may want
5209     *       to change this, but seems ok for now.
5210     *
5211     * For: iget-boolean, iget-byte, iget-char, iget-object, iget
5212     *      iget-short
5213     *
5214     * Description: Perform the object instance field "get" operation
5215     *              with the identified field; load the instance value into
5216     *              the value register.
5217     *
5218     *
5219     * Format: B|A|op CCCC (22c)
5220     *
5221     * Syntax: op vA, vB, type@CCCC
5222     *         op vA, vB, field@CCCC
5223     */
5224
5225
5226     movl        rGLUE, %edx             # %edx<- pMterpGlue
5227     movl        offGlue_methodClassDex(%edx), %edx # %edx<- pDvmDex
5228     FETCH       1, %ecx                 # %ecx<- CCCC
5229     movl        offDvmDex_pResFields(%edx), %edx # %edx<- pDvmDex->pResFields
5230     cmp         $0, (%edx, %ecx, 4)    # check for null ptr; resolved InstField ptr
5231     movl        (%edx, %ecx, 4), %eax   # %eax<- resolved InstField ptr
5232     jne         .LOP_IGET_finish2
5233     movl        rGLUE, %edx             # %edx<- pMterpGlue
5234     movl        offGlue_method(%edx), %edx # %edx <- current method
5235     EXPORT_PC                           # in case an exception is thrown
5236     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
5237     movl        %ecx, -4(%esp)          # push parameter CCCC; field ref
5238     movl        %edx, -8(%esp)          # push parameter method->clazz
5239     lea         -8(%esp), %esp
5240     jmp         .LOP_IGET_finish
5241
5242 /* ------------------------------ */
5243     .balign 64
5244 .L_OP_IGET_WIDE: /* 0x53 */
5245 /* File: x86-atom/OP_IGET_WIDE.S */
5246    /* Copyright (C) 2008 The Android Open Source Project
5247     *
5248     * Licensed under the Apache License, Version 2.0 (the "License");
5249     * you may not use this file except in compliance with the License.
5250     * You may obtain a copy of the License at
5251     *
5252     * http://www.apache.org/licenses/LICENSE-2.0
5253     *
5254     * Unless required by applicable law or agreed to in writing, software
5255     * distributed under the License is distributed on an "AS IS" BASIS,
5256     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5257     * See the License for the specific language governing permissions and
5258     * limitations under the License.
5259     */
5260
5261    /*
5262     * File: OP_IGET_WIDE.S
5263     *
5264     * Code: 64 bit instance field "get" operation. Uses no substitutions.
5265     *
5266     * For: iget-wide
5267     *
5268     * Description: Perform the object instance field "get" operation
5269     *              with the identified field; load the instance value into
5270     *              the value register.
5271     *
5272     * Format:  B|A|op CCCC (22c)
5273     *
5274     * Syntax: op vA, vB, type@CCCC
5275     *         op vA, vB, field@CCCC
5276     */
5277
5278     movl        rGLUE, %eax             # %eax<- MterpGlue pointer
5279     movl        offGlue_methodClassDex(%eax), %ecx # %ecx<- pDvmDex
5280     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- CCCC
5281     FETCH       1, %edx                 # %edx<- pDvmDex->pResFields
5282     movl        (%ecx, %edx, 4), %ecx   # %ecx<- resolved InstField ptr
5283     cmp         $0, %ecx               # check for null ptr; resolved InstField ptr
5284     jne         .LOP_IGET_WIDE_finish
5285     movl        offGlue_method(%eax), %ecx # %ecx <- current method
5286     EXPORT_PC                           # in case an exception is thrown
5287     movl        offMethod_clazz(%ecx), %ecx # %ecx<- method->clazz
5288     movl        %ecx, -8(%esp)          # push parameter CCCC; field ref
5289     movl        %edx, -4(%esp)          # push parameter method->clazz
5290     jmp         .LOP_IGET_WIDE_finish2
5291
5292 /* ------------------------------ */
5293     .balign 64
5294 .L_OP_IGET_OBJECT: /* 0x54 */
5295 /* File: x86-atom/OP_IGET_OBJECT.S */
5296    /* Copyright (C) 2008 The Android Open Source Project
5297     *
5298     * Licensed under the Apache License, Version 2.0 (the "License");
5299     * you may not use this file except in compliance with the License.
5300     * You may obtain a copy of the License at
5301     *
5302     * http://www.apache.org/licenses/LICENSE-2.0
5303     *
5304     * Unless required by applicable law or agreed to in writing, software
5305     * distributed under the License is distributed on an "AS IS" BASIS,
5306     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5307     * See the License for the specific language governing permissions and
5308     * limitations under the License.
5309     */
5310
5311    /*
5312     * File: OP_IGET_OBJECT.S
5313     */
5314
5315 /* File: x86-atom/OP_IGET.S */
5316    /* Copyright (C) 2008 The Android Open Source Project
5317     *
5318     * Licensed under the Apache License, Version 2.0 (the "License");
5319     * you may not use this file except in compliance with the License.
5320     * You may obtain a copy of the License at
5321     *
5322     * http://www.apache.org/licenses/LICENSE-2.0
5323     *
5324     * Unless required by applicable law or agreed to in writing, software
5325     * distributed under the License is distributed on an "AS IS" BASIS,
5326     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5327     * See the License for the specific language governing permissions and
5328     * limitations under the License.
5329     */
5330
5331    /*
5332     * File: OP_IGET.S
5333     *
5334     * Code: Generic 32-bit instance field "get" operation. Provides a
5335     *       "mov" variable which determines the type of mov performed.
5336     *       Currently, none of the iget's use this variable - may want
5337     *       to change this, but seems ok for now.
5338     *
5339     * For: iget-boolean, iget-byte, iget-char, iget-object, iget
5340     *      iget-short
5341     *
5342     * Description: Perform the object instance field "get" operation
5343     *              with the identified field; load the instance value into
5344     *              the value register.
5345     *
5346     *
5347     * Format: B|A|op CCCC (22c)
5348     *
5349     * Syntax: op vA, vB, type@CCCC
5350     *         op vA, vB, field@CCCC
5351     */
5352
5353
5354     movl        rGLUE, %edx             # %edx<- pMterpGlue
5355     movl        offGlue_methodClassDex(%edx), %edx # %edx<- pDvmDex
5356     FETCH       1, %ecx                 # %ecx<- CCCC
5357     movl        offDvmDex_pResFields(%edx), %edx # %edx<- pDvmDex->pResFields
5358     cmp         $0, (%edx, %ecx, 4)    # check for null ptr; resolved InstField ptr
5359     movl        (%edx, %ecx, 4), %eax   # %eax<- resolved InstField ptr
5360     jne         .LOP_IGET_OBJECT_finish2
5361     movl        rGLUE, %edx             # %edx<- pMterpGlue
5362     movl        offGlue_method(%edx), %edx # %edx <- current method
5363     EXPORT_PC                           # in case an exception is thrown
5364     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
5365     movl        %ecx, -4(%esp)          # push parameter CCCC; field ref
5366     movl        %edx, -8(%esp)          # push parameter method->clazz
5367     lea         -8(%esp), %esp
5368     jmp         .LOP_IGET_OBJECT_finish
5369
5370
5371 /* ------------------------------ */
5372     .balign 64
5373 .L_OP_IGET_BOOLEAN: /* 0x55 */
5374 /* File: x86-atom/OP_IGET_BOOLEAN.S */
5375    /* Copyright (C) 2008 The Android Open Source Project
5376     *
5377     * Licensed under the Apache License, Version 2.0 (the "License");
5378     * you may not use this file except in compliance with the License.
5379     * You may obtain a copy of the License at
5380     *
5381     * http://www.apache.org/licenses/LICENSE-2.0
5382     *
5383     * Unless required by applicable law or agreed to in writing, software
5384     * distributed under the License is distributed on an "AS IS" BASIS,
5385     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5386     * See the License for the specific language governing permissions and
5387     * limitations under the License.
5388     */
5389
5390    /*
5391     * File: OP_IGET_BOOLEAN.S
5392     */
5393
5394 /* File: x86-atom/OP_IGET.S */
5395    /* Copyright (C) 2008 The Android Open Source Project
5396     *
5397     * Licensed under the Apache License, Version 2.0 (the "License");
5398     * you may not use this file except in compliance with the License.
5399     * You may obtain a copy of the License at
5400     *
5401     * http://www.apache.org/licenses/LICENSE-2.0
5402     *
5403     * Unless required by applicable law or agreed to in writing, software
5404     * distributed under the License is distributed on an "AS IS" BASIS,
5405     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5406     * See the License for the specific language governing permissions and
5407     * limitations under the License.
5408     */
5409
5410    /*
5411     * File: OP_IGET.S
5412     *
5413     * Code: Generic 32-bit instance field "get" operation. Provides a
5414     *       "mov" variable which determines the type of mov performed.
5415     *       Currently, none of the iget's use this variable - may want
5416     *       to change this, but seems ok for now.
5417     *
5418     * For: iget-boolean, iget-byte, iget-char, iget-object, iget
5419     *      iget-short
5420     *
5421     * Description: Perform the object instance field "get" operation
5422     *              with the identified field; load the instance value into
5423     *              the value register.
5424     *
5425     *
5426     * Format: B|A|op CCCC (22c)
5427     *
5428     * Syntax: op vA, vB, type@CCCC
5429     *         op vA, vB, field@CCCC
5430     */
5431
5432
5433     movl        rGLUE, %edx             # %edx<- pMterpGlue
5434     movl        offGlue_methodClassDex(%edx), %edx # %edx<- pDvmDex
5435     FETCH       1, %ecx                 # %ecx<- CCCC
5436     movl        offDvmDex_pResFields(%edx), %edx # %edx<- pDvmDex->pResFields
5437     cmp         $0, (%edx, %ecx, 4)    # check for null ptr; resolved InstField ptr
5438     movl        (%edx, %ecx, 4), %eax   # %eax<- resolved InstField ptr
5439     jne         .LOP_IGET_BOOLEAN_finish2
5440     movl        rGLUE, %edx             # %edx<- pMterpGlue
5441     movl        offGlue_method(%edx), %edx # %edx <- current method
5442     EXPORT_PC                           # in case an exception is thrown
5443     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
5444     movl        %ecx, -4(%esp)          # push parameter CCCC; field ref
5445     movl        %edx, -8(%esp)          # push parameter method->clazz
5446     lea         -8(%esp), %esp
5447     jmp         .LOP_IGET_BOOLEAN_finish
5448
5449
5450 /* ------------------------------ */
5451     .balign 64
5452 .L_OP_IGET_BYTE: /* 0x56 */
5453 /* File: x86-atom/OP_IGET_BYTE.S */
5454    /* Copyright (C) 2008 The Android Open Source Project
5455     *
5456     * Licensed under the Apache License, Version 2.0 (the "License");
5457     * you may not use this file except in compliance with the License.
5458     * You may obtain a copy of the License at
5459     *
5460     * http://www.apache.org/licenses/LICENSE-2.0
5461     *
5462     * Unless required by applicable law or agreed to in writing, software
5463     * distributed under the License is distributed on an "AS IS" BASIS,
5464     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5465     * See the License for the specific language governing permissions and
5466     * limitations under the License.
5467     */
5468
5469    /*
5470     * File: OP_IGET_BYTE.S
5471     */
5472
5473 /* File: x86-atom/OP_IGET.S */
5474    /* Copyright (C) 2008 The Android Open Source Project
5475     *
5476     * Licensed under the Apache License, Version 2.0 (the "License");
5477     * you may not use this file except in compliance with the License.
5478     * You may obtain a copy of the License at
5479     *
5480     * http://www.apache.org/licenses/LICENSE-2.0
5481     *
5482     * Unless required by applicable law or agreed to in writing, software
5483     * distributed under the License is distributed on an "AS IS" BASIS,
5484     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5485     * See the License for the specific language governing permissions and
5486     * limitations under the License.
5487     */
5488
5489    /*
5490     * File: OP_IGET.S
5491     *
5492     * Code: Generic 32-bit instance field "get" operation. Provides a
5493     *       "mov" variable which determines the type of mov performed.
5494     *       Currently, none of the iget's use this variable - may want
5495     *       to change this, but seems ok for now.
5496     *
5497     * For: iget-boolean, iget-byte, iget-char, iget-object, iget
5498     *      iget-short
5499     *
5500     * Description: Perform the object instance field "get" operation
5501     *              with the identified field; load the instance value into
5502     *              the value register.
5503     *
5504     *
5505     * Format: B|A|op CCCC (22c)
5506     *
5507     * Syntax: op vA, vB, type@CCCC
5508     *         op vA, vB, field@CCCC
5509     */
5510
5511
5512     movl        rGLUE, %edx             # %edx<- pMterpGlue
5513     movl        offGlue_methodClassDex(%edx), %edx # %edx<- pDvmDex
5514     FETCH       1, %ecx                 # %ecx<- CCCC
5515     movl        offDvmDex_pResFields(%edx), %edx # %edx<- pDvmDex->pResFields
5516     cmp         $0, (%edx, %ecx, 4)    # check for null ptr; resolved InstField ptr
5517     movl        (%edx, %ecx, 4), %eax   # %eax<- resolved InstField ptr
5518     jne         .LOP_IGET_BYTE_finish2
5519     movl        rGLUE, %edx             # %edx<- pMterpGlue
5520     movl        offGlue_method(%edx), %edx # %edx <- current method
5521     EXPORT_PC                           # in case an exception is thrown
5522     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
5523     movl        %ecx, -4(%esp)          # push parameter CCCC; field ref
5524     movl        %edx, -8(%esp)          # push parameter method->clazz
5525     lea         -8(%esp), %esp
5526     jmp         .LOP_IGET_BYTE_finish
5527
5528
5529 /* ------------------------------ */
5530     .balign 64
5531 .L_OP_IGET_CHAR: /* 0x57 */
5532 /* File: x86-atom/OP_IGET_CHAR.S */
5533    /* Copyright (C) 2008 The Android Open Source Project
5534     *
5535     * Licensed under the Apache License, Version 2.0 (the "License");
5536     * you may not use this file except in compliance with the License.
5537     * You may obtain a copy of the License at
5538     *
5539     * http://www.apache.org/licenses/LICENSE-2.0
5540     *
5541     * Unless required by applicable law or agreed to in writing, software
5542     * distributed under the License is distributed on an "AS IS" BASIS,
5543     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5544     * See the License for the specific language governing permissions and
5545     * limitations under the License.
5546     */
5547
5548    /*
5549     * File: OP_IGET_CHAR.S
5550     */
5551
5552 /* File: x86-atom/OP_IGET.S */
5553    /* Copyright (C) 2008 The Android Open Source Project
5554     *
5555     * Licensed under the Apache License, Version 2.0 (the "License");
5556     * you may not use this file except in compliance with the License.
5557     * You may obtain a copy of the License at
5558     *
5559     * http://www.apache.org/licenses/LICENSE-2.0
5560     *
5561     * Unless required by applicable law or agreed to in writing, software
5562     * distributed under the License is distributed on an "AS IS" BASIS,
5563     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5564     * See the License for the specific language governing permissions and
5565     * limitations under the License.
5566     */
5567
5568    /*
5569     * File: OP_IGET.S
5570     *
5571     * Code: Generic 32-bit instance field "get" operation. Provides a
5572     *       "mov" variable which determines the type of mov performed.
5573     *       Currently, none of the iget's use this variable - may want
5574     *       to change this, but seems ok for now.
5575     *
5576     * For: iget-boolean, iget-byte, iget-char, iget-object, iget
5577     *      iget-short
5578     *
5579     * Description: Perform the object instance field "get" operation
5580     *              with the identified field; load the instance value into
5581     *              the value register.
5582     *
5583     *
5584     * Format: B|A|op CCCC (22c)
5585     *
5586     * Syntax: op vA, vB, type@CCCC
5587     *         op vA, vB, field@CCCC
5588     */
5589
5590
5591     movl        rGLUE, %edx             # %edx<- pMterpGlue
5592     movl        offGlue_methodClassDex(%edx), %edx # %edx<- pDvmDex
5593     FETCH       1, %ecx                 # %ecx<- CCCC
5594     movl        offDvmDex_pResFields(%edx), %edx # %edx<- pDvmDex->pResFields
5595     cmp         $0, (%edx, %ecx, 4)    # check for null ptr; resolved InstField ptr
5596     movl        (%edx, %ecx, 4), %eax   # %eax<- resolved InstField ptr
5597     jne         .LOP_IGET_CHAR_finish2
5598     movl        rGLUE, %edx             # %edx<- pMterpGlue
5599     movl        offGlue_method(%edx), %edx # %edx <- current method
5600     EXPORT_PC                           # in case an exception is thrown
5601     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
5602     movl        %ecx, -4(%esp)          # push parameter CCCC; field ref
5603     movl        %edx, -8(%esp)          # push parameter method->clazz
5604     lea         -8(%esp), %esp
5605     jmp         .LOP_IGET_CHAR_finish
5606
5607
5608 /* ------------------------------ */
5609     .balign 64
5610 .L_OP_IGET_SHORT: /* 0x58 */
5611 /* File: x86-atom/OP_IGET_SHORT.S */
5612    /* Copyright (C) 2008 The Android Open Source Project
5613     *
5614     * Licensed under the Apache License, Version 2.0 (the "License");
5615     * you may not use this file except in compliance with the License.
5616     * You may obtain a copy of the License at
5617     *
5618     * http://www.apache.org/licenses/LICENSE-2.0
5619     *
5620     * Unless required by applicable law or agreed to in writing, software
5621     * distributed under the License is distributed on an "AS IS" BASIS,
5622     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5623     * See the License for the specific language governing permissions and
5624     * limitations under the License.
5625     */
5626
5627    /*
5628     * File: OP_IGET_SHORT.S
5629     */
5630
5631 /* File: x86-atom/OP_IGET.S */
5632    /* Copyright (C) 2008 The Android Open Source Project
5633     *
5634     * Licensed under the Apache License, Version 2.0 (the "License");
5635     * you may not use this file except in compliance with the License.
5636     * You may obtain a copy of the License at
5637     *
5638     * http://www.apache.org/licenses/LICENSE-2.0
5639     *
5640     * Unless required by applicable law or agreed to in writing, software
5641     * distributed under the License is distributed on an "AS IS" BASIS,
5642     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5643     * See the License for the specific language governing permissions and
5644     * limitations under the License.
5645     */
5646
5647    /*
5648     * File: OP_IGET.S
5649     *
5650     * Code: Generic 32-bit instance field "get" operation. Provides a
5651     *       "mov" variable which determines the type of mov performed.
5652     *       Currently, none of the iget's use this variable - may want
5653     *       to change this, but seems ok for now.
5654     *
5655     * For: iget-boolean, iget-byte, iget-char, iget-object, iget
5656     *      iget-short
5657     *
5658     * Description: Perform the object instance field "get" operation
5659     *              with the identified field; load the instance value into
5660     *              the value register.
5661     *
5662     *
5663     * Format: B|A|op CCCC (22c)
5664     *
5665     * Syntax: op vA, vB, type@CCCC
5666     *         op vA, vB, field@CCCC
5667     */
5668
5669
5670     movl        rGLUE, %edx             # %edx<- pMterpGlue
5671     movl        offGlue_methodClassDex(%edx), %edx # %edx<- pDvmDex
5672     FETCH       1, %ecx                 # %ecx<- CCCC
5673     movl        offDvmDex_pResFields(%edx), %edx # %edx<- pDvmDex->pResFields
5674     cmp         $0, (%edx, %ecx, 4)    # check for null ptr; resolved InstField ptr
5675     movl        (%edx, %ecx, 4), %eax   # %eax<- resolved InstField ptr
5676     jne         .LOP_IGET_SHORT_finish2
5677     movl        rGLUE, %edx             # %edx<- pMterpGlue
5678     movl        offGlue_method(%edx), %edx # %edx <- current method
5679     EXPORT_PC                           # in case an exception is thrown
5680     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
5681     movl        %ecx, -4(%esp)          # push parameter CCCC; field ref
5682     movl        %edx, -8(%esp)          # push parameter method->clazz
5683     lea         -8(%esp), %esp
5684     jmp         .LOP_IGET_SHORT_finish
5685
5686
5687 /* ------------------------------ */
5688     .balign 64
5689 .L_OP_IPUT: /* 0x59 */
5690 /* File: x86-atom/OP_IPUT.S */
5691    /* Copyright (C) 2008 The Android Open Source Project
5692     *
5693     * Licensed under the Apache License, Version 2.0 (the "License");
5694     * you may not use this file except in compliance with the License.
5695     * You may obtain a copy of the License at
5696     *
5697     * http://www.apache.org/licenses/LICENSE-2.0
5698     *
5699     * Unless required by applicable law or agreed to in writing, software
5700     * distributed under the License is distributed on an "AS IS" BASIS,
5701     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5702     * See the License for the specific language governing permissions and
5703     * limitations under the License.
5704     */
5705
5706     /*
5707     * File: OP_IPUT.S
5708     *
5709     * Code: Generic 32-bit instance field "put" operation. Provides a
5710     *       "mov" variable which determines the type of mov performed.
5711     *       Currently, none of the iput's use this variable - may want
5712     *       to change this, but seems ok for now.
5713     *
5714     * For: iput-boolean, iput-byte, iput-char, iput-object, iput
5715     *      iput-short
5716     *
5717     * Description: Perform the object instance field "get" operation
5718     *              with the identified field; load the instance value into
5719     *              the value register.
5720     *
5721     *
5722     * Format: B|A|op CCCC (22c)
5723     *
5724     * Syntax: op vA, vB, type@CCCC
5725     *         op vA, vB, field@CCCC
5726     */
5727
5728
5729     movl        rGLUE, %edx             # %edx<- pMterpGlue
5730     movl        offGlue_methodClassDex(%edx), %edx # %edx<- pDvmDex
5731     FETCH       1, %ecx                 # %ecx<- CCCC
5732     movl        offDvmDex_pResFields(%edx), %edx # %edx<- pDvmDex->pResFields
5733     cmp         $0, (%edx, %ecx, 4)    # check for null ptr; resolved InstField ptr
5734     movl        (%edx, %ecx, 4), %eax   # %eax<- resolved InstField ptr
5735     jne         .LOP_IPUT_finish2
5736     movl        rGLUE, %edx             # %edx<- pMterpGlue
5737     jmp         .LOP_IPUT_finish
5738
5739 /* ------------------------------ */
5740     .balign 64
5741 .L_OP_IPUT_WIDE: /* 0x5a */
5742 /* File: x86-atom/OP_IPUT_WIDE.S */
5743    /* Copyright (C) 2008 The Android Open Source Project
5744     *
5745     * Licensed under the Apache License, Version 2.0 (the "License");
5746     * you may not use this file except in compliance with the License.
5747     * You may obtain a copy of the License at
5748     *
5749     * http://www.apache.org/licenses/LICENSE-2.0
5750     *
5751     * Unless required by applicable law or agreed to in writing, software
5752     * distributed under the License is distributed on an "AS IS" BASIS,
5753     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5754     * See the License for the specific language governing permissions and
5755     * limitations under the License.
5756     */
5757
5758    /*
5759     * File: OP_IPUT_WIDE.S
5760     *
5761     * Code: 64 bit instance field "put" operation. Uses no substitutions.
5762     *
5763     * For: iget-wide
5764     *
5765     * Description: Perform the object instance field "put" operation
5766     *              with the identified field; load the instance value into
5767     *              the value register.
5768     *
5769     * Format:  B|A|op CCCC (22c)
5770     *
5771     * Syntax: op vA, vB, type@CCCC
5772     *         op vA, vB, field@CCCC
5773     */
5774
5775     movl        rGLUE, %eax             # %eax<- MterpGlue pointer
5776     movl        offGlue_methodClassDex(%eax), %ecx # %ecx<- pDvmDex
5777     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- CCCC
5778     FETCH       1, %edx                 # %edx<- pDvmDex->pResFields
5779     movl        (%ecx, %edx, 4), %ecx   # %ecx<- resolved InstField ptr
5780     cmp         $0, %ecx               # check for null ptr; resolved InstField ptr
5781     jne         .LOP_IPUT_WIDE_finish
5782     movl        offGlue_method(%eax), %ecx # %ecx <- current method
5783     EXPORT_PC                           # in case an exception is thrown
5784     movl        offMethod_clazz(%ecx), %ecx # %ecx<- method->clazz
5785     movl        %ecx, -8(%esp)          # push parameter CCCC; field ref
5786     movl        %edx, -4(%esp)          # push parameter method->clazz
5787     jmp         .LOP_IPUT_WIDE_finish2
5788
5789 /* ------------------------------ */
5790     .balign 64
5791 .L_OP_IPUT_OBJECT: /* 0x5b */
5792 /* File: x86-atom/OP_IPUT_OBJECT.S */
5793    /* Copyright (C) 2008 The Android Open Source Project
5794     *
5795     * Licensed under the Apache License, Version 2.0 (the "License");
5796     * you may not use this file except in compliance with the License.
5797     * You may obtain a copy of the License at
5798     *
5799     * http://www.apache.org/licenses/LICENSE-2.0
5800     *
5801     * Unless required by applicable law or agreed to in writing, software
5802     * distributed under the License is distributed on an "AS IS" BASIS,
5803     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5804     * See the License for the specific language governing permissions and
5805     * limitations under the License.
5806     */
5807
5808    /*
5809     * File: OP_IPUT_OBJECT.S
5810     */
5811
5812 /* File: x86-atom/OP_IPUT.S */
5813    /* Copyright (C) 2008 The Android Open Source Project
5814     *
5815     * Licensed under the Apache License, Version 2.0 (the "License");
5816     * you may not use this file except in compliance with the License.
5817     * You may obtain a copy of the License at
5818     *
5819     * http://www.apache.org/licenses/LICENSE-2.0
5820     *
5821     * Unless required by applicable law or agreed to in writing, software
5822     * distributed under the License is distributed on an "AS IS" BASIS,
5823     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5824     * See the License for the specific language governing permissions and
5825     * limitations under the License.
5826     */
5827
5828     /*
5829     * File: OP_IPUT.S
5830     *
5831     * Code: Generic 32-bit instance field "put" operation. Provides a
5832     *       "mov" variable which determines the type of mov performed.
5833     *       Currently, none of the iput's use this variable - may want
5834     *       to change this, but seems ok for now.
5835     *
5836     * For: iput-boolean, iput-byte, iput-char, iput-object, iput
5837     *      iput-short
5838     *
5839     * Description: Perform the object instance field "get" operation
5840     *              with the identified field; load the instance value into
5841     *              the value register.
5842     *
5843     *
5844     * Format: B|A|op CCCC (22c)
5845     *
5846     * Syntax: op vA, vB, type@CCCC
5847     *         op vA, vB, field@CCCC
5848     */
5849
5850
5851     movl        rGLUE, %edx             # %edx<- pMterpGlue
5852     movl        offGlue_methodClassDex(%edx), %edx # %edx<- pDvmDex
5853     FETCH       1, %ecx                 # %ecx<- CCCC
5854     movl        offDvmDex_pResFields(%edx), %edx # %edx<- pDvmDex->pResFields
5855     cmp         $0, (%edx, %ecx, 4)    # check for null ptr; resolved InstField ptr
5856     movl        (%edx, %ecx, 4), %eax   # %eax<- resolved InstField ptr
5857     jne         .LOP_IPUT_OBJECT_finish2
5858     movl        rGLUE, %edx             # %edx<- pMterpGlue
5859     jmp         .LOP_IPUT_OBJECT_finish
5860
5861
5862 /* ------------------------------ */
5863     .balign 64
5864 .L_OP_IPUT_BOOLEAN: /* 0x5c */
5865 /* File: x86-atom/OP_IPUT_BOOLEAN.S */
5866    /* Copyright (C) 2008 The Android Open Source Project
5867     *
5868     * Licensed under the Apache License, Version 2.0 (the "License");
5869     * you may not use this file except in compliance with the License.
5870     * You may obtain a copy of the License at
5871     *
5872     * http://www.apache.org/licenses/LICENSE-2.0
5873     *
5874     * Unless required by applicable law or agreed to in writing, software
5875     * distributed under the License is distributed on an "AS IS" BASIS,
5876     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5877     * See the License for the specific language governing permissions and
5878     * limitations under the License.
5879     */
5880
5881    /*
5882     * File: OP_IPUT_BOOLEAN.S
5883     */
5884
5885 /* File: x86-atom/OP_IPUT.S */
5886    /* Copyright (C) 2008 The Android Open Source Project
5887     *
5888     * Licensed under the Apache License, Version 2.0 (the "License");
5889     * you may not use this file except in compliance with the License.
5890     * You may obtain a copy of the License at
5891     *
5892     * http://www.apache.org/licenses/LICENSE-2.0
5893     *
5894     * Unless required by applicable law or agreed to in writing, software
5895     * distributed under the License is distributed on an "AS IS" BASIS,
5896     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5897     * See the License for the specific language governing permissions and
5898     * limitations under the License.
5899     */
5900
5901     /*
5902     * File: OP_IPUT.S
5903     *
5904     * Code: Generic 32-bit instance field "put" operation. Provides a
5905     *       "mov" variable which determines the type of mov performed.
5906     *       Currently, none of the iput's use this variable - may want
5907     *       to change this, but seems ok for now.
5908     *
5909     * For: iput-boolean, iput-byte, iput-char, iput-object, iput
5910     *      iput-short
5911     *
5912     * Description: Perform the object instance field "get" operation
5913     *              with the identified field; load the instance value into
5914     *              the value register.
5915     *
5916     *
5917     * Format: B|A|op CCCC (22c)
5918     *
5919     * Syntax: op vA, vB, type@CCCC
5920     *         op vA, vB, field@CCCC
5921     */
5922
5923
5924     movl        rGLUE, %edx             # %edx<- pMterpGlue
5925     movl        offGlue_methodClassDex(%edx), %edx # %edx<- pDvmDex
5926     FETCH       1, %ecx                 # %ecx<- CCCC
5927     movl        offDvmDex_pResFields(%edx), %edx # %edx<- pDvmDex->pResFields
5928     cmp         $0, (%edx, %ecx, 4)    # check for null ptr; resolved InstField ptr
5929     movl        (%edx, %ecx, 4), %eax   # %eax<- resolved InstField ptr
5930     jne         .LOP_IPUT_BOOLEAN_finish2
5931     movl        rGLUE, %edx             # %edx<- pMterpGlue
5932     jmp         .LOP_IPUT_BOOLEAN_finish
5933
5934
5935 /* ------------------------------ */
5936     .balign 64
5937 .L_OP_IPUT_BYTE: /* 0x5d */
5938 /* File: x86-atom/OP_IPUT_BYTE.S */
5939    /* Copyright (C) 2008 The Android Open Source Project
5940     *
5941     * Licensed under the Apache License, Version 2.0 (the "License");
5942     * you may not use this file except in compliance with the License.
5943     * You may obtain a copy of the License at
5944     *
5945     * http://www.apache.org/licenses/LICENSE-2.0
5946     *
5947     * Unless required by applicable law or agreed to in writing, software
5948     * distributed under the License is distributed on an "AS IS" BASIS,
5949     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5950     * See the License for the specific language governing permissions and
5951     * limitations under the License.
5952     */
5953
5954    /*
5955     * File: OP_IPUT_BYTE.S
5956     */
5957
5958 /* File: x86-atom/OP_IPUT.S */
5959    /* Copyright (C) 2008 The Android Open Source Project
5960     *
5961     * Licensed under the Apache License, Version 2.0 (the "License");
5962     * you may not use this file except in compliance with the License.
5963     * You may obtain a copy of the License at
5964     *
5965     * http://www.apache.org/licenses/LICENSE-2.0
5966     *
5967     * Unless required by applicable law or agreed to in writing, software
5968     * distributed under the License is distributed on an "AS IS" BASIS,
5969     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5970     * See the License for the specific language governing permissions and
5971     * limitations under the License.
5972     */
5973
5974     /*
5975     * File: OP_IPUT.S
5976     *
5977     * Code: Generic 32-bit instance field "put" operation. Provides a
5978     *       "mov" variable which determines the type of mov performed.
5979     *       Currently, none of the iput's use this variable - may want
5980     *       to change this, but seems ok for now.
5981     *
5982     * For: iput-boolean, iput-byte, iput-char, iput-object, iput
5983     *      iput-short
5984     *
5985     * Description: Perform the object instance field "get" operation
5986     *              with the identified field; load the instance value into
5987     *              the value register.
5988     *
5989     *
5990     * Format: B|A|op CCCC (22c)
5991     *
5992     * Syntax: op vA, vB, type@CCCC
5993     *         op vA, vB, field@CCCC
5994     */
5995
5996
5997     movl        rGLUE, %edx             # %edx<- pMterpGlue
5998     movl        offGlue_methodClassDex(%edx), %edx # %edx<- pDvmDex
5999     FETCH       1, %ecx                 # %ecx<- CCCC
6000     movl        offDvmDex_pResFields(%edx), %edx # %edx<- pDvmDex->pResFields
6001     cmp         $0, (%edx, %ecx, 4)    # check for null ptr; resolved InstField ptr
6002     movl        (%edx, %ecx, 4), %eax   # %eax<- resolved InstField ptr
6003     jne         .LOP_IPUT_BYTE_finish2
6004     movl        rGLUE, %edx             # %edx<- pMterpGlue
6005     jmp         .LOP_IPUT_BYTE_finish
6006
6007
6008 /* ------------------------------ */
6009     .balign 64
6010 .L_OP_IPUT_CHAR: /* 0x5e */
6011 /* File: x86-atom/OP_IPUT_CHAR.S */
6012    /* Copyright (C) 2008 The Android Open Source Project
6013     *
6014     * Licensed under the Apache License, Version 2.0 (the "License");
6015     * you may not use this file except in compliance with the License.
6016     * You may obtain a copy of the License at
6017     *
6018     * http://www.apache.org/licenses/LICENSE-2.0
6019     *
6020     * Unless required by applicable law or agreed to in writing, software
6021     * distributed under the License is distributed on an "AS IS" BASIS,
6022     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6023     * See the License for the specific language governing permissions and
6024     * limitations under the License.
6025     */
6026
6027    /*
6028     * File: OP_IPUT_CHAR.S
6029     */
6030
6031 /* File: x86-atom/OP_IPUT.S */
6032    /* Copyright (C) 2008 The Android Open Source Project
6033     *
6034     * Licensed under the Apache License, Version 2.0 (the "License");
6035     * you may not use this file except in compliance with the License.
6036     * You may obtain a copy of the License at
6037     *
6038     * http://www.apache.org/licenses/LICENSE-2.0
6039     *
6040     * Unless required by applicable law or agreed to in writing, software
6041     * distributed under the License is distributed on an "AS IS" BASIS,
6042     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6043     * See the License for the specific language governing permissions and
6044     * limitations under the License.
6045     */
6046
6047     /*
6048     * File: OP_IPUT.S
6049     *
6050     * Code: Generic 32-bit instance field "put" operation. Provides a
6051     *       "mov" variable which determines the type of mov performed.
6052     *       Currently, none of the iput's use this variable - may want
6053     *       to change this, but seems ok for now.
6054     *
6055     * For: iput-boolean, iput-byte, iput-char, iput-object, iput
6056     *      iput-short
6057     *
6058     * Description: Perform the object instance field "get" operation
6059     *              with the identified field; load the instance value into
6060     *              the value register.
6061     *
6062     *
6063     * Format: B|A|op CCCC (22c)
6064     *
6065     * Syntax: op vA, vB, type@CCCC
6066     *         op vA, vB, field@CCCC
6067     */
6068
6069
6070     movl        rGLUE, %edx             # %edx<- pMterpGlue
6071     movl        offGlue_methodClassDex(%edx), %edx # %edx<- pDvmDex
6072     FETCH       1, %ecx                 # %ecx<- CCCC
6073     movl        offDvmDex_pResFields(%edx), %edx # %edx<- pDvmDex->pResFields
6074     cmp         $0, (%edx, %ecx, 4)    # check for null ptr; resolved InstField ptr
6075     movl        (%edx, %ecx, 4), %eax   # %eax<- resolved InstField ptr
6076     jne         .LOP_IPUT_CHAR_finish2
6077     movl        rGLUE, %edx             # %edx<- pMterpGlue
6078     jmp         .LOP_IPUT_CHAR_finish
6079
6080
6081 /* ------------------------------ */
6082     .balign 64
6083 .L_OP_IPUT_SHORT: /* 0x5f */
6084 /* File: x86-atom/OP_IPUT_SHORT.S */
6085    /* Copyright (C) 2008 The Android Open Source Project
6086     *
6087     * Licensed under the Apache License, Version 2.0 (the "License");
6088     * you may not use this file except in compliance with the License.
6089     * You may obtain a copy of the License at
6090     *
6091     * http://www.apache.org/licenses/LICENSE-2.0
6092     *
6093     * Unless required by applicable law or agreed to in writing, software
6094     * distributed under the License is distributed on an "AS IS" BASIS,
6095     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6096     * See the License for the specific language governing permissions and
6097     * limitations under the License.
6098     */
6099
6100    /*
6101     * File: OP_IPUT_SHORT.S
6102     */
6103
6104 /* File: x86-atom/OP_IPUT.S */
6105    /* Copyright (C) 2008 The Android Open Source Project
6106     *
6107     * Licensed under the Apache License, Version 2.0 (the "License");
6108     * you may not use this file except in compliance with the License.
6109     * You may obtain a copy of the License at
6110     *
6111     * http://www.apache.org/licenses/LICENSE-2.0
6112     *
6113     * Unless required by applicable law or agreed to in writing, software
6114     * distributed under the License is distributed on an "AS IS" BASIS,
6115     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6116     * See the License for the specific language governing permissions and
6117     * limitations under the License.
6118     */
6119
6120     /*
6121     * File: OP_IPUT.S
6122     *
6123     * Code: Generic 32-bit instance field "put" operation. Provides a
6124     *       "mov" variable which determines the type of mov performed.
6125     *       Currently, none of the iput's use this variable - may want
6126     *       to change this, but seems ok for now.
6127     *
6128     * For: iput-boolean, iput-byte, iput-char, iput-object, iput
6129     *      iput-short
6130     *
6131     * Description: Perform the object instance field "get" operation
6132     *              with the identified field; load the instance value into
6133     *              the value register.
6134     *
6135     *
6136     * Format: B|A|op CCCC (22c)
6137     *
6138     * Syntax: op vA, vB, type@CCCC
6139     *         op vA, vB, field@CCCC
6140     */
6141
6142
6143     movl        rGLUE, %edx             # %edx<- pMterpGlue
6144     movl        offGlue_methodClassDex(%edx), %edx # %edx<- pDvmDex
6145     FETCH       1, %ecx                 # %ecx<- CCCC
6146     movl        offDvmDex_pResFields(%edx), %edx # %edx<- pDvmDex->pResFields
6147     cmp         $0, (%edx, %ecx, 4)    # check for null ptr; resolved InstField ptr
6148     movl        (%edx, %ecx, 4), %eax   # %eax<- resolved InstField ptr
6149     jne         .LOP_IPUT_SHORT_finish2
6150     movl        rGLUE, %edx             # %edx<- pMterpGlue
6151     jmp         .LOP_IPUT_SHORT_finish
6152
6153
6154 /* ------------------------------ */
6155     .balign 64
6156 .L_OP_SGET: /* 0x60 */
6157 /* File: x86-atom/OP_SGET.S */
6158    /* Copyright (C) 2008 The Android Open Source Project
6159     *
6160     * Licensed under the Apache License, Version 2.0 (the "License");
6161     * you may not use this file except in compliance with the License.
6162     * You may obtain a copy of the License at
6163     *
6164     * http://www.apache.org/licenses/LICENSE-2.0
6165     *
6166     * Unless required by applicable law or agreed to in writing, software
6167     * distributed under the License is distributed on an "AS IS" BASIS,
6168     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6169     * See the License for the specific language governing permissions and
6170     * limitations under the License.
6171     */
6172
6173    /*
6174     * File: OP_SGET.S
6175     *
6176     * Code: Generic 32-bit static field "get" operation. Uses no substitutions.
6177     *
6178     * For: sget-boolean, sget-byte, sget-char, sget-object, sget, sget-short
6179     *
6180     * Description: Perform the identified object static field operation
6181     *              with the identified static field; load the field value
6182     *              into the value register.
6183     *
6184     * Format: AA|op BBBB (21c)
6185     *
6186     * Syntax: op vAA, string@BBBB
6187     */
6188
6189     movl        rGLUE, %edx             # %edx<- pMterpGlue
6190     movl        offGlue_methodClassDex(%edx), %ecx # %ecx<- glue->pDvmDex
6191     FETCH       1, %eax                 # %eax<- BBBB
6192     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields
6193     cmp         $0, (%ecx, %eax, 4)    # check for null ptr; resolved StaticField ptr
6194     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved StaticField ptr
6195     je          .LOP_SGET_resolve
6196     jmp         .LOP_SGET_finish
6197
6198 /* ------------------------------ */
6199     .balign 64
6200 .L_OP_SGET_WIDE: /* 0x61 */
6201 /* File: x86-atom/OP_SGET_WIDE.S */
6202    /* Copyright (C) 2008 The Android Open Source Project
6203     *
6204     * Licensed under the Apache License, Version 2.0 (the "License");
6205     * you may not use this file except in compliance with the License.
6206     * You may obtain a copy of the License at
6207     *
6208     * http://www.apache.org/licenses/LICENSE-2.0
6209     *
6210     * Unless required by applicable law or agreed to in writing, software
6211     * distributed under the License is distributed on an "AS IS" BASIS,
6212     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6213     * See the License for the specific language governing permissions and
6214     * limitations under the License.
6215     */
6216
6217    /*
6218     * File: OP_SGET_WIDE.S
6219     *
6220     * Code: 64-bit static field "get" operation. Uses no substitutions.
6221     *
6222     * For: sget-wide
6223     *
6224     * Description: Perform the identified object static field operation
6225     *              with the identified static field, loading or storing
6226     *              into the value register.
6227     *
6228     * Format: AA|op BBBB (21c)
6229     *
6230     * Syntax: op vAA, string@BBBB
6231     */
6232
6233     movl        rGLUE, %eax             # %eax<- pMterpGlue
6234     movl        offGlue_methodClassDex(%eax), %ecx # %ecx<- glue->pDvmDex
6235     FETCH       1, %edx                 # %edx<- BBBB
6236     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields
6237     cmp         $0, (%ecx, %edx, 4)    # check for null ptr; resolved StaticField ptr
6238     movl        (%ecx, %edx, 4), %ecx   # %ecx<- resolved StaticField ptr
6239     je          .LOP_SGET_WIDE_resolve
6240
6241 .LOP_SGET_WIDE_finish:
6242     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
6243     movq        offStaticField_value(%ecx), %xmm0 # %xmm0<- field value
6244     movq        %xmm0, (rFP, rINST, 4)  # vAA<- field value
6245     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
6246
6247 /* ------------------------------ */
6248     .balign 64
6249 .L_OP_SGET_OBJECT: /* 0x62 */
6250 /* File: x86-atom/OP_SGET_OBJECT.S */
6251    /* Copyright (C) 2008 The Android Open Source Project
6252     *
6253     * Licensed under the Apache License, Version 2.0 (the "License");
6254     * you may not use this file except in compliance with the License.
6255     * You may obtain a copy of the License at
6256     *
6257     * http://www.apache.org/licenses/LICENSE-2.0
6258     *
6259     * Unless required by applicable law or agreed to in writing, software
6260     * distributed under the License is distributed on an "AS IS" BASIS,
6261     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6262     * See the License for the specific language governing permissions and
6263     * limitations under the License.
6264     */
6265
6266    /*
6267     * File: OP_SGET_OBJECT.S
6268     */
6269
6270 /* File: x86-atom/OP_SGET.S */
6271    /* Copyright (C) 2008 The Android Open Source Project
6272     *
6273     * Licensed under the Apache License, Version 2.0 (the "License");
6274     * you may not use this file except in compliance with the License.
6275     * You may obtain a copy of the License at
6276     *
6277     * http://www.apache.org/licenses/LICENSE-2.0
6278     *
6279     * Unless required by applicable law or agreed to in writing, software
6280     * distributed under the License is distributed on an "AS IS" BASIS,
6281     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6282     * See the License for the specific language governing permissions and
6283     * limitations under the License.
6284     */
6285
6286    /*
6287     * File: OP_SGET.S
6288     *
6289     * Code: Generic 32-bit static field "get" operation. Uses no substitutions.
6290     *
6291     * For: sget-boolean, sget-byte, sget-char, sget-object, sget, sget-short
6292     *
6293     * Description: Perform the identified object static field operation
6294     *              with the identified static field; load the field value
6295     *              into the value register.
6296     *
6297     * Format: AA|op BBBB (21c)
6298     *
6299     * Syntax: op vAA, string@BBBB
6300     */
6301
6302     movl        rGLUE, %edx             # %edx<- pMterpGlue
6303     movl        offGlue_methodClassDex(%edx), %ecx # %ecx<- glue->pDvmDex
6304     FETCH       1, %eax                 # %eax<- BBBB
6305     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields
6306     cmp         $0, (%ecx, %eax, 4)    # check for null ptr; resolved StaticField ptr
6307     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved StaticField ptr
6308     je          .LOP_SGET_OBJECT_resolve
6309     jmp         .LOP_SGET_OBJECT_finish
6310
6311
6312 /* ------------------------------ */
6313     .balign 64
6314 .L_OP_SGET_BOOLEAN: /* 0x63 */
6315 /* File: x86-atom/OP_SGET_BOOLEAN.S */
6316    /* Copyright (C) 2008 The Android Open Source Project
6317     *
6318     * Licensed under the Apache License, Version 2.0 (the "License");
6319     * you may not use this file except in compliance with the License.
6320     * You may obtain a copy of the License at
6321     *
6322     * http://www.apache.org/licenses/LICENSE-2.0
6323     *
6324     * Unless required by applicable law or agreed to in writing, software
6325     * distributed under the License is distributed on an "AS IS" BASIS,
6326     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6327     * See the License for the specific language governing permissions and
6328     * limitations under the License.
6329     */
6330
6331    /*
6332     * File: OP_SGET_BOOLEAN.S
6333     */
6334
6335 /* File: x86-atom/OP_SGET.S */
6336    /* Copyright (C) 2008 The Android Open Source Project
6337     *
6338     * Licensed under the Apache License, Version 2.0 (the "License");
6339     * you may not use this file except in compliance with the License.
6340     * You may obtain a copy of the License at
6341     *
6342     * http://www.apache.org/licenses/LICENSE-2.0
6343     *
6344     * Unless required by applicable law or agreed to in writing, software
6345     * distributed under the License is distributed on an "AS IS" BASIS,
6346     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6347     * See the License for the specific language governing permissions and
6348     * limitations under the License.
6349     */
6350
6351    /*
6352     * File: OP_SGET.S
6353     *
6354     * Code: Generic 32-bit static field "get" operation. Uses no substitutions.
6355     *
6356     * For: sget-boolean, sget-byte, sget-char, sget-object, sget, sget-short
6357     *
6358     * Description: Perform the identified object static field operation
6359     *              with the identified static field; load the field value
6360     *              into the value register.
6361     *
6362     * Format: AA|op BBBB (21c)
6363     *
6364     * Syntax: op vAA, string@BBBB
6365     */
6366
6367     movl        rGLUE, %edx             # %edx<- pMterpGlue
6368     movl        offGlue_methodClassDex(%edx), %ecx # %ecx<- glue->pDvmDex
6369     FETCH       1, %eax                 # %eax<- BBBB
6370     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields
6371     cmp         $0, (%ecx, %eax, 4)    # check for null ptr; resolved StaticField ptr
6372     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved StaticField ptr
6373     je          .LOP_SGET_BOOLEAN_resolve
6374     jmp         .LOP_SGET_BOOLEAN_finish
6375
6376
6377 /* ------------------------------ */
6378     .balign 64
6379 .L_OP_SGET_BYTE: /* 0x64 */
6380 /* File: x86-atom/OP_SGET_BYTE.S */
6381    /* Copyright (C) 2008 The Android Open Source Project
6382     *
6383     * Licensed under the Apache License, Version 2.0 (the "License");
6384     * you may not use this file except in compliance with the License.
6385     * You may obtain a copy of the License at
6386     *
6387     * http://www.apache.org/licenses/LICENSE-2.0
6388     *
6389     * Unless required by applicable law or agreed to in writing, software
6390     * distributed under the License is distributed on an "AS IS" BASIS,
6391     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6392     * See the License for the specific language governing permissions and
6393     * limitations under the License.
6394     */
6395
6396    /*
6397     * File: OP_SGET_BYTE.S
6398     */
6399
6400 /* File: x86-atom/OP_SGET.S */
6401    /* Copyright (C) 2008 The Android Open Source Project
6402     *
6403     * Licensed under the Apache License, Version 2.0 (the "License");
6404     * you may not use this file except in compliance with the License.
6405     * You may obtain a copy of the License at
6406     *
6407     * http://www.apache.org/licenses/LICENSE-2.0
6408     *
6409     * Unless required by applicable law or agreed to in writing, software
6410     * distributed under the License is distributed on an "AS IS" BASIS,
6411     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6412     * See the License for the specific language governing permissions and
6413     * limitations under the License.
6414     */
6415
6416    /*
6417     * File: OP_SGET.S
6418     *
6419     * Code: Generic 32-bit static field "get" operation. Uses no substitutions.
6420     *
6421     * For: sget-boolean, sget-byte, sget-char, sget-object, sget, sget-short
6422     *
6423     * Description: Perform the identified object static field operation
6424     *              with the identified static field; load the field value
6425     *              into the value register.
6426     *
6427     * Format: AA|op BBBB (21c)
6428     *
6429     * Syntax: op vAA, string@BBBB
6430     */
6431
6432     movl        rGLUE, %edx             # %edx<- pMterpGlue
6433     movl        offGlue_methodClassDex(%edx), %ecx # %ecx<- glue->pDvmDex
6434     FETCH       1, %eax                 # %eax<- BBBB
6435     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields
6436     cmp         $0, (%ecx, %eax, 4)    # check for null ptr; resolved StaticField ptr
6437     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved StaticField ptr
6438     je          .LOP_SGET_BYTE_resolve
6439     jmp         .LOP_SGET_BYTE_finish
6440
6441
6442 /* ------------------------------ */
6443     .balign 64
6444 .L_OP_SGET_CHAR: /* 0x65 */
6445 /* File: x86-atom/OP_SGET_CHAR.S */
6446    /* Copyright (C) 2008 The Android Open Source Project
6447     *
6448     * Licensed under the Apache License, Version 2.0 (the "License");
6449     * you may not use this file except in compliance with the License.
6450     * You may obtain a copy of the License at
6451     *
6452     * http://www.apache.org/licenses/LICENSE-2.0
6453     *
6454     * Unless required by applicable law or agreed to in writing, software
6455     * distributed under the License is distributed on an "AS IS" BASIS,
6456     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6457     * See the License for the specific language governing permissions and
6458     * limitations under the License.
6459     */
6460
6461    /*
6462     * File: OP_SGET_CHAR.S
6463     */
6464
6465 /* File: x86-atom/OP_SGET.S */
6466    /* Copyright (C) 2008 The Android Open Source Project
6467     *
6468     * Licensed under the Apache License, Version 2.0 (the "License");
6469     * you may not use this file except in compliance with the License.
6470     * You may obtain a copy of the License at
6471     *
6472     * http://www.apache.org/licenses/LICENSE-2.0
6473     *
6474     * Unless required by applicable law or agreed to in writing, software
6475     * distributed under the License is distributed on an "AS IS" BASIS,
6476     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6477     * See the License for the specific language governing permissions and
6478     * limitations under the License.
6479     */
6480
6481    /*
6482     * File: OP_SGET.S
6483     *
6484     * Code: Generic 32-bit static field "get" operation. Uses no substitutions.
6485     *
6486     * For: sget-boolean, sget-byte, sget-char, sget-object, sget, sget-short
6487     *
6488     * Description: Perform the identified object static field operation
6489     *              with the identified static field; load the field value
6490     *              into the value register.
6491     *
6492     * Format: AA|op BBBB (21c)
6493     *
6494     * Syntax: op vAA, string@BBBB
6495     */
6496
6497     movl        rGLUE, %edx             # %edx<- pMterpGlue
6498     movl        offGlue_methodClassDex(%edx), %ecx # %ecx<- glue->pDvmDex
6499     FETCH       1, %eax                 # %eax<- BBBB
6500     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields
6501     cmp         $0, (%ecx, %eax, 4)    # check for null ptr; resolved StaticField ptr
6502     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved StaticField ptr
6503     je          .LOP_SGET_CHAR_resolve
6504     jmp         .LOP_SGET_CHAR_finish
6505
6506
6507 /* ------------------------------ */
6508     .balign 64
6509 .L_OP_SGET_SHORT: /* 0x66 */
6510 /* File: x86-atom/OP_SGET_SHORT.S */
6511    /* Copyright (C) 2008 The Android Open Source Project
6512     *
6513     * Licensed under the Apache License, Version 2.0 (the "License");
6514     * you may not use this file except in compliance with the License.
6515     * You may obtain a copy of the License at
6516     *
6517     * http://www.apache.org/licenses/LICENSE-2.0
6518     *
6519     * Unless required by applicable law or agreed to in writing, software
6520     * distributed under the License is distributed on an "AS IS" BASIS,
6521     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6522     * See the License for the specific language governing permissions and
6523     * limitations under the License.
6524     */
6525
6526    /*
6527     * File: OP_SGET_SHORT.S
6528     */
6529
6530 /* File: x86-atom/OP_SGET.S */
6531    /* Copyright (C) 2008 The Android Open Source Project
6532     *
6533     * Licensed under the Apache License, Version 2.0 (the "License");
6534     * you may not use this file except in compliance with the License.
6535     * You may obtain a copy of the License at
6536     *
6537     * http://www.apache.org/licenses/LICENSE-2.0
6538     *
6539     * Unless required by applicable law or agreed to in writing, software
6540     * distributed under the License is distributed on an "AS IS" BASIS,
6541     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6542     * See the License for the specific language governing permissions and
6543     * limitations under the License.
6544     */
6545
6546    /*
6547     * File: OP_SGET.S
6548     *
6549     * Code: Generic 32-bit static field "get" operation. Uses no substitutions.
6550     *
6551     * For: sget-boolean, sget-byte, sget-char, sget-object, sget, sget-short
6552     *
6553     * Description: Perform the identified object static field operation
6554     *              with the identified static field; load the field value
6555     *              into the value register.
6556     *
6557     * Format: AA|op BBBB (21c)
6558     *
6559     * Syntax: op vAA, string@BBBB
6560     */
6561
6562     movl        rGLUE, %edx             # %edx<- pMterpGlue
6563     movl        offGlue_methodClassDex(%edx), %ecx # %ecx<- glue->pDvmDex
6564     FETCH       1, %eax                 # %eax<- BBBB
6565     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields
6566     cmp         $0, (%ecx, %eax, 4)    # check for null ptr; resolved StaticField ptr
6567     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved StaticField ptr
6568     je          .LOP_SGET_SHORT_resolve
6569     jmp         .LOP_SGET_SHORT_finish
6570
6571
6572 /* ------------------------------ */
6573     .balign 64
6574 .L_OP_SPUT: /* 0x67 */
6575 /* File: x86-atom/OP_SPUT.S */
6576    /* Copyright (C) 2008 The Android Open Source Project
6577     *
6578     * Licensed under the Apache License, Version 2.0 (the "License");
6579     * you may not use this file except in compliance with the License.
6580     * You may obtain a copy of the License at
6581     *
6582     * http://www.apache.org/licenses/LICENSE-2.0
6583     *
6584     * Unless required by applicable law or agreed to in writing, software
6585     * distributed under the License is distributed on an "AS IS" BASIS,
6586     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6587     * See the License for the specific language governing permissions and
6588     * limitations under the License.
6589     */
6590
6591    /*
6592     * File: OP_SPUT.S
6593     *
6594     * Code: Generic 32-bit static field "put" operation. Uses no substitutions.
6595     *
6596     * For: sput-boolean, sput-byte, sput-char, sput-object, sput, sput-short
6597     *
6598     * Description: Perform the identified object static field operation
6599     *              with the identified static field; store the field value
6600     *              register.
6601     *
6602     * Format: AA|op BBBB (21c)
6603     *
6604     * Syntax: op vAA, string@BBBB
6605     */
6606
6607     movl        rGLUE, %edx             # %edx<- pMterpGlue
6608     movl        offGlue_methodClassDex(%edx), %ecx # %ecx<- pDvmDex
6609     FETCH       1, %eax                 # %eax<- BBBB
6610     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields
6611     cmp         $0, (%ecx, %eax, 4)    # check for null ptr; resolved StaticField ptr
6612     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved StaticField ptr
6613     je          .LOP_SPUT_resolve
6614     jmp         .LOP_SPUT_finish
6615
6616 /* ------------------------------ */
6617     .balign 64
6618 .L_OP_SPUT_WIDE: /* 0x68 */
6619 /* File: x86-atom/OP_SPUT_WIDE.S */
6620    /* Copyright (C) 2008 The Android Open Source Project
6621     *
6622     * Licensed under the Apache License, Version 2.0 (the "License");
6623     * you may not use this file except in compliance with the License.
6624     * You may obtain a copy of the License at
6625     *
6626     * http://www.apache.org/licenses/LICENSE-2.0
6627     *
6628     * Unless required by applicable law or agreed to in writing, software
6629     * distributed under the License is distributed on an "AS IS" BASIS,
6630     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6631     * See the License for the specific language governing permissions and
6632     * limitations under the License.
6633     */
6634
6635    /*
6636     * File: OP_SPUT_WIDE.S
6637     *
6638     * Code: Generic 32-bit static field "put" operation. Uses no substitutions.
6639     *
6640     * For: sput-boolean, sput-byte, sput-char, sput-object, sput, sput-short
6641     *
6642     * Description: Perform the identified object static field operation
6643     *              with the identified static field; store the field value
6644     *              register.
6645     *
6646     * Format: AA|op BBBB (21c)
6647     *
6648     * Syntax: op vAA, string@BBBB
6649     */
6650
6651     movl        rGLUE, %eax             # %eax<- pMterpGlue
6652     movl        offGlue_methodClassDex(%eax), %ecx # %ecx<- glue->pDvmDex
6653     FETCH       1, %edx                 # %edx<- BBBB
6654     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields
6655     cmp         $0, (%ecx, %edx, 4)    # check for null ptr; resolved StaticField ptr
6656     movl        (%ecx, %edx, 4), %ecx   # %ecx<- resolved StaticField ptr
6657     je          .LOP_SPUT_WIDE_resolve
6658
6659 .LOP_SPUT_WIDE_finish:
6660     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
6661     movq        (rFP, rINST, 4), %xmm0  # %xmm0<- vAA
6662     movq        %xmm0, offStaticField_value(%ecx) # field value<- field value
6663     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
6664
6665 /* ------------------------------ */
6666     .balign 64
6667 .L_OP_SPUT_OBJECT: /* 0x69 */
6668 /* File: x86-atom/OP_SPUT_OBJECT.S */
6669    /* Copyright (C) 2008 The Android Open Source Project
6670     *
6671     * Licensed under the Apache License, Version 2.0 (the "License");
6672     * you may not use this file except in compliance with the License.
6673     * You may obtain a copy of the License at
6674     *
6675     * http://www.apache.org/licenses/LICENSE-2.0
6676     *
6677     * Unless required by applicable law or agreed to in writing, software
6678     * distributed under the License is distributed on an "AS IS" BASIS,
6679     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6680     * See the License for the specific language governing permissions and
6681     * limitations under the License.
6682     */
6683
6684    /*
6685     * File: OP_SPUT_OBJECT.S
6686     */
6687
6688 /* File: x86-atom/OP_SPUT.S */
6689    /* Copyright (C) 2008 The Android Open Source Project
6690     *
6691     * Licensed under the Apache License, Version 2.0 (the "License");
6692     * you may not use this file except in compliance with the License.
6693     * You may obtain a copy of the License at
6694     *
6695     * http://www.apache.org/licenses/LICENSE-2.0
6696     *
6697     * Unless required by applicable law or agreed to in writing, software
6698     * distributed under the License is distributed on an "AS IS" BASIS,
6699     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6700     * See the License for the specific language governing permissions and
6701     * limitations under the License.
6702     */
6703
6704    /*
6705     * File: OP_SPUT.S
6706     *
6707     * Code: Generic 32-bit static field "put" operation. Uses no substitutions.
6708     *
6709     * For: sput-boolean, sput-byte, sput-char, sput-object, sput, sput-short
6710     *
6711     * Description: Perform the identified object static field operation
6712     *              with the identified static field; store the field value
6713     *              register.
6714     *
6715     * Format: AA|op BBBB (21c)
6716     *
6717     * Syntax: op vAA, string@BBBB
6718     */
6719
6720     movl        rGLUE, %edx             # %edx<- pMterpGlue
6721     movl        offGlue_methodClassDex(%edx), %ecx # %ecx<- pDvmDex
6722     FETCH       1, %eax                 # %eax<- BBBB
6723     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields
6724     cmp         $0, (%ecx, %eax, 4)    # check for null ptr; resolved StaticField ptr
6725     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved StaticField ptr
6726     je          .LOP_SPUT_OBJECT_resolve
6727     jmp         .LOP_SPUT_OBJECT_finish
6728
6729
6730 /* ------------------------------ */
6731     .balign 64
6732 .L_OP_SPUT_BOOLEAN: /* 0x6a */
6733 /* File: x86-atom/OP_SPUT_BOOLEAN.S */
6734    /* Copyright (C) 2008 The Android Open Source Project
6735     *
6736     * Licensed under the Apache License, Version 2.0 (the "License");
6737     * you may not use this file except in compliance with the License.
6738     * You may obtain a copy of the License at
6739     *
6740     * http://www.apache.org/licenses/LICENSE-2.0
6741     *
6742     * Unless required by applicable law or agreed to in writing, software
6743     * distributed under the License is distributed on an "AS IS" BASIS,
6744     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6745     * See the License for the specific language governing permissions and
6746     * limitations under the License.
6747     */
6748
6749    /*
6750     * File: OP_SPUT_BOOLEAN.S
6751     */
6752
6753 /* File: x86-atom/OP_SPUT.S */
6754    /* Copyright (C) 2008 The Android Open Source Project
6755     *
6756     * Licensed under the Apache License, Version 2.0 (the "License");
6757     * you may not use this file except in compliance with the License.
6758     * You may obtain a copy of the License at
6759     *
6760     * http://www.apache.org/licenses/LICENSE-2.0
6761     *
6762     * Unless required by applicable law or agreed to in writing, software
6763     * distributed under the License is distributed on an "AS IS" BASIS,
6764     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6765     * See the License for the specific language governing permissions and
6766     * limitations under the License.
6767     */
6768
6769    /*
6770     * File: OP_SPUT.S
6771     *
6772     * Code: Generic 32-bit static field "put" operation. Uses no substitutions.
6773     *
6774     * For: sput-boolean, sput-byte, sput-char, sput-object, sput, sput-short
6775     *
6776     * Description: Perform the identified object static field operation
6777     *              with the identified static field; store the field value
6778     *              register.
6779     *
6780     * Format: AA|op BBBB (21c)
6781     *
6782     * Syntax: op vAA, string@BBBB
6783     */
6784
6785     movl        rGLUE, %edx             # %edx<- pMterpGlue
6786     movl        offGlue_methodClassDex(%edx), %ecx # %ecx<- pDvmDex
6787     FETCH       1, %eax                 # %eax<- BBBB
6788     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields
6789     cmp         $0, (%ecx, %eax, 4)    # check for null ptr; resolved StaticField ptr
6790     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved StaticField ptr
6791     je          .LOP_SPUT_BOOLEAN_resolve
6792     jmp         .LOP_SPUT_BOOLEAN_finish
6793
6794
6795 /* ------------------------------ */
6796     .balign 64
6797 .L_OP_SPUT_BYTE: /* 0x6b */
6798 /* File: x86-atom/OP_SPUT_BYTE.S */
6799    /* Copyright (C) 2008 The Android Open Source Project
6800     *
6801     * Licensed under the Apache License, Version 2.0 (the "License");
6802     * you may not use this file except in compliance with the License.
6803     * You may obtain a copy of the License at
6804     *
6805     * http://www.apache.org/licenses/LICENSE-2.0
6806     *
6807     * Unless required by applicable law or agreed to in writing, software
6808     * distributed under the License is distributed on an "AS IS" BASIS,
6809     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6810     * See the License for the specific language governing permissions and
6811     * limitations under the License.
6812     */
6813
6814    /*
6815     * File: OP_SPUT_BYTE.S
6816     */
6817
6818 /* File: x86-atom/OP_SPUT.S */
6819    /* Copyright (C) 2008 The Android Open Source Project
6820     *
6821     * Licensed under the Apache License, Version 2.0 (the "License");
6822     * you may not use this file except in compliance with the License.
6823     * You may obtain a copy of the License at
6824     *
6825     * http://www.apache.org/licenses/LICENSE-2.0
6826     *
6827     * Unless required by applicable law or agreed to in writing, software
6828     * distributed under the License is distributed on an "AS IS" BASIS,
6829     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6830     * See the License for the specific language governing permissions and
6831     * limitations under the License.
6832     */
6833
6834    /*
6835     * File: OP_SPUT.S
6836     *
6837     * Code: Generic 32-bit static field "put" operation. Uses no substitutions.
6838     *
6839     * For: sput-boolean, sput-byte, sput-char, sput-object, sput, sput-short
6840     *
6841     * Description: Perform the identified object static field operation
6842     *              with the identified static field; store the field value
6843     *              register.
6844     *
6845     * Format: AA|op BBBB (21c)
6846     *
6847     * Syntax: op vAA, string@BBBB
6848     */
6849
6850     movl        rGLUE, %edx             # %edx<- pMterpGlue
6851     movl        offGlue_methodClassDex(%edx), %ecx # %ecx<- pDvmDex
6852     FETCH       1, %eax                 # %eax<- BBBB
6853     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields
6854     cmp         $0, (%ecx, %eax, 4)    # check for null ptr; resolved StaticField ptr
6855     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved StaticField ptr
6856     je          .LOP_SPUT_BYTE_resolve
6857     jmp         .LOP_SPUT_BYTE_finish
6858
6859
6860 /* ------------------------------ */
6861     .balign 64
6862 .L_OP_SPUT_CHAR: /* 0x6c */
6863 /* File: x86-atom/OP_SPUT_CHAR.S */
6864    /* Copyright (C) 2008 The Android Open Source Project
6865     *
6866     * Licensed under the Apache License, Version 2.0 (the "License");
6867     * you may not use this file except in compliance with the License.
6868     * You may obtain a copy of the License at
6869     *
6870     * http://www.apache.org/licenses/LICENSE-2.0
6871     *
6872     * Unless required by applicable law or agreed to in writing, software
6873     * distributed under the License is distributed on an "AS IS" BASIS,
6874     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6875     * See the License for the specific language governing permissions and
6876     * limitations under the License.
6877     */
6878
6879    /*
6880     * File: OP_SPUT_CHAR.S
6881     */
6882
6883 /* File: x86-atom/OP_SPUT.S */
6884    /* Copyright (C) 2008 The Android Open Source Project
6885     *
6886     * Licensed under the Apache License, Version 2.0 (the "License");
6887     * you may not use this file except in compliance with the License.
6888     * You may obtain a copy of the License at
6889     *
6890     * http://www.apache.org/licenses/LICENSE-2.0
6891     *
6892     * Unless required by applicable law or agreed to in writing, software
6893     * distributed under the License is distributed on an "AS IS" BASIS,
6894     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6895     * See the License for the specific language governing permissions and
6896     * limitations under the License.
6897     */
6898
6899    /*
6900     * File: OP_SPUT.S
6901     *
6902     * Code: Generic 32-bit static field "put" operation. Uses no substitutions.
6903     *
6904     * For: sput-boolean, sput-byte, sput-char, sput-object, sput, sput-short
6905     *
6906     * Description: Perform the identified object static field operation
6907     *              with the identified static field; store the field value
6908     *              register.
6909     *
6910     * Format: AA|op BBBB (21c)
6911     *
6912     * Syntax: op vAA, string@BBBB
6913     */
6914
6915     movl        rGLUE, %edx             # %edx<- pMterpGlue
6916     movl        offGlue_methodClassDex(%edx), %ecx # %ecx<- pDvmDex
6917     FETCH       1, %eax                 # %eax<- BBBB
6918     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields
6919     cmp         $0, (%ecx, %eax, 4)    # check for null ptr; resolved StaticField ptr
6920     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved StaticField ptr
6921     je          .LOP_SPUT_CHAR_resolve
6922     jmp         .LOP_SPUT_CHAR_finish
6923
6924
6925 /* ------------------------------ */
6926     .balign 64
6927 .L_OP_SPUT_SHORT: /* 0x6d */
6928 /* File: x86-atom/OP_SPUT_SHORT.S */
6929    /* Copyright (C) 2008 The Android Open Source Project
6930     *
6931     * Licensed under the Apache License, Version 2.0 (the "License");
6932     * you may not use this file except in compliance with the License.
6933     * You may obtain a copy of the License at
6934     *
6935     * http://www.apache.org/licenses/LICENSE-2.0
6936     *
6937     * Unless required by applicable law or agreed to in writing, software
6938     * distributed under the License is distributed on an "AS IS" BASIS,
6939     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6940     * See the License for the specific language governing permissions and
6941     * limitations under the License.
6942     */
6943
6944    /*
6945     * File: OP_SPUT_SHORT.S
6946     */
6947
6948 /* File: x86-atom/OP_SPUT.S */
6949    /* Copyright (C) 2008 The Android Open Source Project
6950     *
6951     * Licensed under the Apache License, Version 2.0 (the "License");
6952     * you may not use this file except in compliance with the License.
6953     * You may obtain a copy of the License at
6954     *
6955     * http://www.apache.org/licenses/LICENSE-2.0
6956     *
6957     * Unless required by applicable law or agreed to in writing, software
6958     * distributed under the License is distributed on an "AS IS" BASIS,
6959     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6960     * See the License for the specific language governing permissions and
6961     * limitations under the License.
6962     */
6963
6964    /*
6965     * File: OP_SPUT.S
6966     *
6967     * Code: Generic 32-bit static field "put" operation. Uses no substitutions.
6968     *
6969     * For: sput-boolean, sput-byte, sput-char, sput-object, sput, sput-short
6970     *
6971     * Description: Perform the identified object static field operation
6972     *              with the identified static field; store the field value
6973     *              register.
6974     *
6975     * Format: AA|op BBBB (21c)
6976     *
6977     * Syntax: op vAA, string@BBBB
6978     */
6979
6980     movl        rGLUE, %edx             # %edx<- pMterpGlue
6981     movl        offGlue_methodClassDex(%edx), %ecx # %ecx<- pDvmDex
6982     FETCH       1, %eax                 # %eax<- BBBB
6983     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields
6984     cmp         $0, (%ecx, %eax, 4)    # check for null ptr; resolved StaticField ptr
6985     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved StaticField ptr
6986     je          .LOP_SPUT_SHORT_resolve
6987     jmp         .LOP_SPUT_SHORT_finish
6988
6989
6990 /* ------------------------------ */
6991     .balign 64
6992 .L_OP_INVOKE_VIRTUAL: /* 0x6e */
6993 /* File: x86-atom/OP_INVOKE_VIRTUAL.S */
6994    /* Copyright (C) 2008 The Android Open Source Project
6995     *
6996     * Licensed under the Apache License, Version 2.0 (the "License");
6997     * you may not use this file except in compliance with the License.
6998     * You may obtain a copy of the License at
6999     *
7000     * http://www.apache.org/licenses/LICENSE-2.0
7001     *
7002     * Unless required by applicable law or agreed to in writing, software
7003     * distributed under the License is distributed on an "AS IS" BASIS,
7004     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7005     * See the License for the specific language governing permissions and
7006     * limitations under the License.
7007     */
7008
7009    /*
7010     * File: OP_INVOKE_VIRTUAL.S
7011     *
7012     * Code: Call a virtual method. Provides an "isrange" variable and
7013     *       a "routine" variable to specify this is the "range" version of
7014     *       invoke_direct that allows up to 255 arguments.
7015     *
7016     * For: invoke-virtual, invoke-virtual/range
7017     *
7018     * Description: invoke-virtual is used to invoke a normal virtual method;
7019     *              a method that is not static or final, and is not a constructor.
7020     *
7021     * Format: B|A|op CCCC G|F|E|D (35c)
7022     *         AA|op BBBB CCCC (3rc)
7023     *
7024     * Syntax: [B=5] op {vD, vE, vF, vG, vA}, meth@CCCC (35c)
7025     *         [B=5] op {vD, vE, vF, vG, vA}, type@CCCC (35c)
7026     *         [B=4] op {vD, vE, vF, vG}, kind@CCCC (35c)
7027     *         [B=3] op {vD, vE, vF}, kind@CCCC (35c)
7028     *         [B=2] op {vD, vE}, kind@CCCC (35c)
7029     *         [B=1] op {vD}, kind@CCCC (35c)
7030     *         [B=0] op {}, kind@CCCC (35c)
7031     *
7032     *         op {vCCCC .. vNNNN}, meth@BBBB (3rc) (where NNNN = CCCC+AA-1, that
7033     *         op {vCCCC .. vNNNN}, type@BBBB (3rc) is A determines the count 0..255,
7034     *                                              and C determines the first register)
7035     */
7036
7037
7038     movl        rGLUE, %eax             # %eax<- pMterpGlue
7039     EXPORT_PC                           # must export pc for invoke
7040     movl        offGlue_methodClassDex(%eax), %eax # %eax<- pDvmDex
7041     FETCH       1, %ecx                 # %ecx<- method index
7042     movl        offDvmDex_pResMethods(%eax), %eax # %eax<- pDvmDex->pResMethods
7043     FETCH       2, %edx                 # %edx<- GFED or CCCC
7044     .if         (!0)
7045     and         $15, %edx              # %edx<- D if not range
7046     .endif
7047     cmp         $0, (%eax, %ecx, 4)    # check if already resolved
7048     je          .LOP_INVOKE_VIRTUAL_break
7049     movl        (%eax, %ecx, 4), %eax   # %eax<- resolved base method
7050     jmp         .LOP_INVOKE_VIRTUAL_continue
7051
7052 /* ------------------------------ */
7053     .balign 64
7054 .L_OP_INVOKE_SUPER: /* 0x6f */
7055 /* File: x86-atom/OP_INVOKE_SUPER.S */
7056    /* Copyright (C) 2008 The Android Open Source Project
7057     *
7058     * Licensed under the Apache License, Version 2.0 (the "License");
7059     * you may not use this file except in compliance with the License.
7060     * You may obtain a copy of the License at
7061     *
7062     * http://www.apache.org/licenses/LICENSE-2.0
7063     *
7064     * Unless required by applicable law or agreed to in writing, software
7065     * distributed under the License is distributed on an "AS IS" BASIS,
7066     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7067     * See the License for the specific language governing permissions and
7068     * limitations under the License.
7069     */
7070
7071    /*
7072     * File: OP_INVOKE_SUPER.S
7073     *
7074     * Code: Call super method.
7075     *
7076     * For: invoke-super, invoke-super/range
7077     *
7078     * Description: invoke-super is used to invoke the closest superclass's virtual
7079     *              method (as opposed to the one with the same method_id in the
7080     *              calling class).
7081     *
7082     * Format: B|A|op CCCC G|F|E|D (35c)
7083     *         AA|op BBBB CCCC (3rc)
7084     *
7085     * Syntax: [B=5] op {vD, vE, vF, vG, vA}, meth@CCCC (35c)
7086     *         [B=5] op {vD, vE, vF, vG, vA}, type@CCCC (35c)
7087     *         [B=4] op {vD, vE, vF, vG}, kind@CCCC (35c)
7088     *         [B=3] op {vD, vE, vF}, kind@CCCC (35c)
7089     *         [B=2] op {vD, vE}, kind@CCCC (35c)
7090     *         [B=1] op {vD}, kind@CCCC (35c)
7091     *         [B=0] op {}, kind@CCCC (35c)
7092     *
7093     *         op {vCCCC .. vNNNN}, meth@BBBB (3rc) (where NNNN = CCCC+AA-1, that
7094     *         op {vCCCC .. vNNNN}, type@BBBB (3rc) is A determines the count 0..255,
7095     *                                              and C determines the first register)
7096     */
7097
7098
7099     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
7100     FETCH       2, %eax                 # %eax<- GFED or CCCC
7101     movl        offGlue_methodClassDex(%ecx), %ecx # %ecx<- pDvmDex
7102     .if         (!0)
7103     and         $15, %eax              # %eax<- D if not range
7104     .endif
7105     FETCH       1, %edx                 # %edx<- method index
7106     movl        offDvmDex_pResMethods(%ecx), %ecx # %ecx<- pDvmDex->pResMethods
7107     cmp         $0, (rFP, %eax, 4)     # check for null object
7108     movl        (%ecx, %edx, 4), %ecx   # %ecx<- resolved base method
7109     je          common_errNullObject    # handle null object
7110     jmp         .LOP_INVOKE_SUPER_continue2
7111
7112 /* ------------------------------ */
7113     .balign 64
7114 .L_OP_INVOKE_DIRECT: /* 0x70 */
7115 /* File: x86-atom/OP_INVOKE_DIRECT.S */
7116    /* Copyright (C) 2008 The Android Open Source Project
7117     *
7118     * Licensed under the Apache License, Version 2.0 (the "License");
7119     * you may not use this file except in compliance with the License.
7120     * You may obtain a copy of the License at
7121     *
7122     * http://www.apache.org/licenses/LICENSE-2.0
7123     *
7124     * Unless required by applicable law or agreed to in writing, software
7125     * distributed under the License is distributed on an "AS IS" BASIS,
7126     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7127     * See the License for the specific language governing permissions and
7128     * limitations under the License.
7129     */
7130
7131    /*
7132     * File: OP_INVOKE_DIRECT.S
7133     *
7134     * Code: Call a non-static direct method. Provides an "isrange" variable and
7135     *       a "routine" variable to specify this is the "range" version of
7136     *       invoke_direct that allows up to 255 arguments.
7137     *
7138     * For: invoke-direct, invoke-direct/range
7139     *
7140     * Description: invoke-direct is used to invoke a non-static direct method;
7141     *              an instance method that is non-overridable, for example,
7142     *              either a private instance method or a constructor.
7143     *
7144     * Format: B|A|op CCCC G|F|E|D (35c)
7145     *         AA|op BBBB CCCC (3rc)
7146     *
7147     * Syntax: [B=5] op {vD, vE, vF, vG, vA}, meth@CCCC (35c)
7148     *         [B=5] op {vD, vE, vF, vG, vA}, type@CCCC (35c)
7149     *         [B=4] op {vD, vE, vF, vG}, kind@CCCC (35c)
7150     *         [B=3] op {vD, vE, vF}, kind@CCCC (35c)
7151     *         [B=2] op {vD, vE}, kind@CCCC (35c)
7152     *         [B=1] op {vD}, kind@CCCC (35c)
7153     *         [B=0] op {}, kind@CCCC (35c)
7154     *
7155     *         op {vCCCC .. vNNNN}, meth@BBBB (3rc) (where NNNN = CCCC+AA-1, that
7156     *         op {vCCCC .. vNNNN}, type@BBBB (3rc) is A determines the count 0..255,
7157     *                                              and C determines the first register)
7158     */
7159
7160
7161     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
7162     movl        offGlue_methodClassDex(%ecx), %ecx # %ecx<- pDvmDex
7163     FETCH       1, %eax                 # %eax<- method index
7164     movl        offDvmDex_pResMethods(%ecx), %ecx # %ecx<- pDvmDex->pResMethods
7165     FETCH       2, %edx                 # %edx<- GFED or CCCC
7166     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved method to call
7167     .if         (!0)
7168     andl        $15, %edx              # %edx<- D if not range
7169     .endif
7170     EXPORT_PC                           # must export for invoke
7171     movl        %edx, -4(%esp)          # save "this" pointer register
7172     cmp         $0, %ecx               # check if already resolved
7173     GET_VREG    %edx                    # %edx<- "this" pointer
7174     je          .LOP_INVOKE_DIRECT_resolve     # handle resolve
7175
7176 .LOP_INVOKE_DIRECT_finish:
7177     cmp         $0, %edx               # check for null "this"
7178     jne         common_invokeMethodNoRange # invoke method common code
7179     jmp         common_errNullObject
7180
7181 /* ------------------------------ */
7182     .balign 64
7183 .L_OP_INVOKE_STATIC: /* 0x71 */
7184 /* File: x86-atom/OP_INVOKE_STATIC.S */
7185    /* Copyright (C) 2008 The Android Open Source Project
7186     *
7187     * Licensed under the Apache License, Version 2.0 (the "License");
7188     * you may not use this file except in compliance with the License.
7189     * You may obtain a copy of the License at
7190     *
7191     * http://www.apache.org/licenses/LICENSE-2.0
7192     *
7193     * Unless required by applicable law or agreed to in writing, software
7194     * distributed under the License is distributed on an "AS IS" BASIS,
7195     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7196     * See the License for the specific language governing permissions and
7197     * limitations under the License.
7198     */
7199
7200    /*
7201     * File: OP_INVOKE_STATIC.S
7202     *
7203     * Code: Call static direct method. Provides an "isrange" variable and
7204     *       a "routine" variable to specify this is the "range" version of
7205     *       invoke_static that allows up to 255 arguments.
7206     *
7207     * For: invoke-static, invoke-static/range
7208     *
7209     * Description: invoke-static is used to invoke static direct method.
7210     *
7211     * Format: B|A|op CCCC G|F|E|D (35c)
7212     *         AA|op BBBB CCCC (3rc)
7213     *
7214     * Syntax: [B=5] op {vD, vE, vF, vG, vA}, meth@CCCC (35c)
7215     *         [B=5] op {vD, vE, vF, vG, vA}, type@CCCC (35c)
7216     *         [B=4] op {vD, vE, vF, vG}, kind@CCCC (35c)
7217     *         [B=3] op {vD, vE, vF}, kind@CCCC (35c)
7218     *         [B=2] op {vD, vE}, kind@CCCC (35c)
7219     *         [B=1] op {vD}, kind@CCCC (35c)
7220     *         [B=0] op {}, kind@CCCC (35c)
7221     *
7222     *         op {vCCCC .. vNNNN}, meth@BBBB (3rc) (where NNNN = CCCC+AA-1, that
7223     *         op {vCCCC .. vNNNN}, type@BBBB (3rc) is A determines the count 0..255,
7224     *                                              and C determines the first register)
7225     */
7226
7227
7228     movl        rGLUE, %edx             # %edx<- pMterpGlue
7229     movl        offGlue_methodClassDex(%edx), %ecx # %edx<- pDvmDex
7230     FETCH       1, %eax                 # %eax<- method index
7231     movl        offDvmDex_pResMethods(%ecx), %ecx # %edx<- pDvmDex->pResMethods
7232     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved method to call
7233     cmp         $0, %ecx               # check if already resolved
7234     EXPORT_PC                           # must export for invoke
7235     jne         common_invokeMethodNoRange # invoke method common code
7236     jmp         .LOP_INVOKE_STATIC_break
7237
7238 /* ------------------------------ */
7239     .balign 64
7240 .L_OP_INVOKE_INTERFACE: /* 0x72 */
7241 /* File: x86-atom/OP_INVOKE_INTERFACE.S */
7242    /* Copyright (C) 2008 The Android Open Source Project
7243     *
7244     * Licensed under the Apache License, Version 2.0 (the "License");
7245     * you may not use this file except in compliance with the License.
7246     * You may obtain a copy of the License at
7247     *
7248     * http://www.apache.org/licenses/LICENSE-2.0
7249     *
7250     * Unless required by applicable law or agreed to in writing, software
7251     * distributed under the License is distributed on an "AS IS" BASIS,
7252     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7253     * See the License for the specific language governing permissions and
7254     * limitations under the License.
7255     */
7256
7257    /*
7258     * File: OP_INVOKE_INTERFACE.S
7259     *
7260     * Code: Call at method. Provides an "isrange" variable and
7261     *       a "routine" variable to specify this is the "range" version of
7262     *       invoke_interface that allows up to 255 arguments.
7263     *
7264     * For: invoke-interface, invoke-interface-range
7265     *
7266     * Description: invoke-interface is used to invoke an interface method; on an
7267     *              object whose concrete class isn't known, using a method_id that
7268     *              refers to an interface.
7269     *
7270     * Format: B|A|op CCCC G|F|E|D (35c)
7271     *         AA|op BBBB CCCC (3rc)
7272     *
7273     * Syntax: [B=5] op {vD, vE, vF, vG, vA}, meth@CCCC (35c)
7274     *         [B=5] op {vD, vE, vF, vG, vA}, type@CCCC (35c)
7275     *         [B=4] op {vD, vE, vF, vG}, kind@CCCC (35c)
7276     *         [B=3] op {vD, vE, vF}, kind@CCCC (35c)
7277     *         [B=2] op {vD, vE}, kind@CCCC (35c)
7278     *         [B=1] op {vD}, kind@CCCC (35c)
7279     *         [B=0] op {}, kind@CCCC (35c)
7280     *
7281     *         op {vCCCC .. vNNNN}, meth@BBBB (3rc) (where NNNN = CCCC+AA-1, that
7282     *         op {vCCCC .. vNNNN}, type@BBBB (3rc) is A determines the count 0..255,
7283     *                                              and C determines the first register)
7284     */
7285
7286
7287     FETCH       2, %edx                 # %edx<- GFED or CCCC
7288     FETCH       1, %ecx                 # %ecx<- method index
7289     movl        %ecx, -12(%esp)         # push argument method index
7290     .if         (!0)
7291     and         $15, %edx              # %edx<- D if not range
7292     .endif
7293     EXPORT_PC                           # must export for invoke
7294     GET_VREG    %edx                    # %edx<- first arg "this pointer"
7295     movl        rGLUE, %eax             # %eax<- pMterpGlue
7296     movl        offGlue_methodClassDex(%eax), %eax # %eax<- glue->pDvmDex
7297     movl        %eax, -4(%esp)          # push parameter class
7298     cmp         $0, %edx               # check for null object
7299     je          common_errNullObject    # handle null object
7300     jmp         .LOP_INVOKE_INTERFACE_break
7301
7302 /* ------------------------------ */
7303     .balign 64
7304 .L_OP_UNUSED_73: /* 0x73 */
7305 /* File: x86-atom/OP_UNUSED_73.S */
7306    /* Copyright (C) 2008 The Android Open Source Project
7307     *
7308     * Licensed under the Apache License, Version 2.0 (the "License");
7309     * you may not use this file except in compliance with the License.
7310     * You may obtain a copy of the License at
7311     *
7312     * http://www.apache.org/licenses/LICENSE-2.0
7313     *
7314     * Unless required by applicable law or agreed to in writing, software
7315     * distributed under the License is distributed on an "AS IS" BASIS,
7316     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7317     * See the License for the specific language governing permissions and
7318     * limitations under the License.
7319     */
7320
7321    /*
7322     * File: OP_UNUSED_73.S
7323     */
7324
7325 /* File: x86-atom/unused.S */
7326    /* Copyright (C) 2008 The Android Open Source Project
7327     *
7328     * Licensed under the Apache License, Version 2.0 (the "License");
7329     * you may not use this file except in compliance with the License.
7330     * You may obtain a copy of the License at
7331     *
7332     * http://www.apache.org/licenses/LICENSE-2.0
7333     *
7334     * Unless required by applicable law or agreed to in writing, software
7335     * distributed under the License is distributed on an "AS IS" BASIS,
7336     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7337     * See the License for the specific language governing permissions and
7338     * limitations under the License.
7339     */
7340
7341    /*
7342     * File: unused.S
7343     *
7344     * Code: Common code for unused bytecodes. Uses no subtitutions.
7345     *
7346     * For: all unused bytecodes
7347     *
7348     * Description: aborts if executed.
7349     *
7350     * Format: Ã˜Ã˜|op (10x)
7351     *
7352     * Syntax: op
7353     */
7354
7355     call        common_abort
7356
7357
7358 /* ------------------------------ */
7359     .balign 64
7360 .L_OP_INVOKE_VIRTUAL_RANGE: /* 0x74 */
7361 /* File: x86-atom/OP_INVOKE_VIRTUAL_RANGE.S */
7362    /* Copyright (C) 2008 The Android Open Source Project
7363     *
7364     * Licensed under the Apache License, Version 2.0 (the "License");
7365     * you may not use this file except in compliance with the License.
7366     * You may obtain a copy of the License at
7367     *
7368     * http://www.apache.org/licenses/LICENSE-2.0
7369     *
7370     * Unless required by applicable law or agreed to in writing, software
7371     * distributed under the License is distributed on an "AS IS" BASIS,
7372     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7373     * See the License for the specific language governing permissions and
7374     * limitations under the License.
7375     */
7376
7377    /*
7378     * File: OP_INVOKE_VIRTUAL_RANGE.S
7379     */
7380
7381 /* File: x86-atom/OP_INVOKE_VIRTUAL.S */
7382    /* Copyright (C) 2008 The Android Open Source Project
7383     *
7384     * Licensed under the Apache License, Version 2.0 (the "License");
7385     * you may not use this file except in compliance with the License.
7386     * You may obtain a copy of the License at
7387     *
7388     * http://www.apache.org/licenses/LICENSE-2.0
7389     *
7390     * Unless required by applicable law or agreed to in writing, software
7391     * distributed under the License is distributed on an "AS IS" BASIS,
7392     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7393     * See the License for the specific language governing permissions and
7394     * limitations under the License.
7395     */
7396
7397    /*
7398     * File: OP_INVOKE_VIRTUAL.S
7399     *
7400     * Code: Call a virtual method. Provides an "isrange" variable and
7401     *       a "routine" variable to specify this is the "range" version of
7402     *       invoke_direct that allows up to 255 arguments.
7403     *
7404     * For: invoke-virtual, invoke-virtual/range
7405     *
7406     * Description: invoke-virtual is used to invoke a normal virtual method;
7407     *              a method that is not static or final, and is not a constructor.
7408     *
7409     * Format: B|A|op CCCC G|F|E|D (35c)
7410     *         AA|op BBBB CCCC (3rc)
7411     *
7412     * Syntax: [B=5] op {vD, vE, vF, vG, vA}, meth@CCCC (35c)
7413     *         [B=5] op {vD, vE, vF, vG, vA}, type@CCCC (35c)
7414     *         [B=4] op {vD, vE, vF, vG}, kind@CCCC (35c)
7415     *         [B=3] op {vD, vE, vF}, kind@CCCC (35c)
7416     *         [B=2] op {vD, vE}, kind@CCCC (35c)
7417     *         [B=1] op {vD}, kind@CCCC (35c)
7418     *         [B=0] op {}, kind@CCCC (35c)
7419     *
7420     *         op {vCCCC .. vNNNN}, meth@BBBB (3rc) (where NNNN = CCCC+AA-1, that
7421     *         op {vCCCC .. vNNNN}, type@BBBB (3rc) is A determines the count 0..255,
7422     *                                              and C determines the first register)
7423     */
7424
7425
7426     movl        rGLUE, %eax             # %eax<- pMterpGlue
7427     EXPORT_PC                           # must export pc for invoke
7428     movl        offGlue_methodClassDex(%eax), %eax # %eax<- pDvmDex
7429     FETCH       1, %ecx                 # %ecx<- method index
7430     movl        offDvmDex_pResMethods(%eax), %eax # %eax<- pDvmDex->pResMethods
7431     FETCH       2, %edx                 # %edx<- GFED or CCCC
7432     .if         (!1)
7433     and         $15, %edx              # %edx<- D if not range
7434     .endif
7435     cmp         $0, (%eax, %ecx, 4)    # check if already resolved
7436     je          .LOP_INVOKE_VIRTUAL_RANGE_break
7437     movl        (%eax, %ecx, 4), %eax   # %eax<- resolved base method
7438     jmp         .LOP_INVOKE_VIRTUAL_RANGE_continue
7439
7440
7441 /* ------------------------------ */
7442     .balign 64
7443 .L_OP_INVOKE_SUPER_RANGE: /* 0x75 */
7444 /* File: x86-atom/OP_INVOKE_SUPER_RANGE.S */
7445    /* Copyright (C) 2008 The Android Open Source Project
7446     *
7447     * Licensed under the Apache License, Version 2.0 (the "License");
7448     * you may not use this file except in compliance with the License.
7449     * You may obtain a copy of the License at
7450     *
7451     * http://www.apache.org/licenses/LICENSE-2.0
7452     *
7453     * Unless required by applicable law or agreed to in writing, software
7454     * distributed under the License is distributed on an "AS IS" BASIS,
7455     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7456     * See the License for the specific language governing permissions and
7457     * limitations under the License.
7458     */
7459
7460    /*
7461     * File: OP_INVOKE_SUPER_RANGE.S
7462     */
7463
7464 /* File: x86-atom/OP_INVOKE_SUPER.S */
7465    /* Copyright (C) 2008 The Android Open Source Project
7466     *
7467     * Licensed under the Apache License, Version 2.0 (the "License");
7468     * you may not use this file except in compliance with the License.
7469     * You may obtain a copy of the License at
7470     *
7471     * http://www.apache.org/licenses/LICENSE-2.0
7472     *
7473     * Unless required by applicable law or agreed to in writing, software
7474     * distributed under the License is distributed on an "AS IS" BASIS,
7475     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7476     * See the License for the specific language governing permissions and
7477     * limitations under the License.
7478     */
7479
7480    /*
7481     * File: OP_INVOKE_SUPER.S
7482     *
7483     * Code: Call super method.
7484     *
7485     * For: invoke-super, invoke-super/range
7486     *
7487     * Description: invoke-super is used to invoke the closest superclass's virtual
7488     *              method (as opposed to the one with the same method_id in the
7489     *              calling class).
7490     *
7491     * Format: B|A|op CCCC G|F|E|D (35c)
7492     *         AA|op BBBB CCCC (3rc)
7493     *
7494     * Syntax: [B=5] op {vD, vE, vF, vG, vA}, meth@CCCC (35c)
7495     *         [B=5] op {vD, vE, vF, vG, vA}, type@CCCC (35c)
7496     *         [B=4] op {vD, vE, vF, vG}, kind@CCCC (35c)
7497     *         [B=3] op {vD, vE, vF}, kind@CCCC (35c)
7498     *         [B=2] op {vD, vE}, kind@CCCC (35c)
7499     *         [B=1] op {vD}, kind@CCCC (35c)
7500     *         [B=0] op {}, kind@CCCC (35c)
7501     *
7502     *         op {vCCCC .. vNNNN}, meth@BBBB (3rc) (where NNNN = CCCC+AA-1, that
7503     *         op {vCCCC .. vNNNN}, type@BBBB (3rc) is A determines the count 0..255,
7504     *                                              and C determines the first register)
7505     */
7506
7507
7508     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
7509     FETCH       2, %eax                 # %eax<- GFED or CCCC
7510     movl        offGlue_methodClassDex(%ecx), %ecx # %ecx<- pDvmDex
7511     .if         (!1)
7512     and         $15, %eax              # %eax<- D if not range
7513     .endif
7514     FETCH       1, %edx                 # %edx<- method index
7515     movl        offDvmDex_pResMethods(%ecx), %ecx # %ecx<- pDvmDex->pResMethods
7516     cmp         $0, (rFP, %eax, 4)     # check for null object
7517     movl        (%ecx, %edx, 4), %ecx   # %ecx<- resolved base method
7518     je          common_errNullObject    # handle null object
7519     jmp         .LOP_INVOKE_SUPER_RANGE_continue2
7520
7521
7522 /* ------------------------------ */
7523     .balign 64
7524 .L_OP_INVOKE_DIRECT_RANGE: /* 0x76 */
7525 /* File: x86-atom/OP_INVOKE_DIRECT_RANGE.S */
7526    /* Copyright (C) 2008 The Android Open Source Project
7527     *
7528     * Licensed under the Apache License, Version 2.0 (the "License");
7529     * you may not use this file except in compliance with the License.
7530     * You may obtain a copy of the License at
7531     *
7532     * http://www.apache.org/licenses/LICENSE-2.0
7533     *
7534     * Unless required by applicable law or agreed to in writing, software
7535     * distributed under the License is distributed on an "AS IS" BASIS,
7536     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7537     * See the License for the specific language governing permissions and
7538     * limitations under the License.
7539     */
7540
7541    /*
7542     * File: OP_INVOKE_DIRECT_RANGE.S
7543     */
7544
7545 /* File: x86-atom/OP_INVOKE_DIRECT.S */
7546    /* Copyright (C) 2008 The Android Open Source Project
7547     *
7548     * Licensed under the Apache License, Version 2.0 (the "License");
7549     * you may not use this file except in compliance with the License.
7550     * You may obtain a copy of the License at
7551     *
7552     * http://www.apache.org/licenses/LICENSE-2.0
7553     *
7554     * Unless required by applicable law or agreed to in writing, software
7555     * distributed under the License is distributed on an "AS IS" BASIS,
7556     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7557     * See the License for the specific language governing permissions and
7558     * limitations under the License.
7559     */
7560
7561    /*
7562     * File: OP_INVOKE_DIRECT.S
7563     *
7564     * Code: Call a non-static direct method. Provides an "isrange" variable and
7565     *       a "routine" variable to specify this is the "range" version of
7566     *       invoke_direct that allows up to 255 arguments.
7567     *
7568     * For: invoke-direct, invoke-direct/range
7569     *
7570     * Description: invoke-direct is used to invoke a non-static direct method;
7571     *              an instance method that is non-overridable, for example,
7572     *              either a private instance method or a constructor.
7573     *
7574     * Format: B|A|op CCCC G|F|E|D (35c)
7575     *         AA|op BBBB CCCC (3rc)
7576     *
7577     * Syntax: [B=5] op {vD, vE, vF, vG, vA}, meth@CCCC (35c)
7578     *         [B=5] op {vD, vE, vF, vG, vA}, type@CCCC (35c)
7579     *         [B=4] op {vD, vE, vF, vG}, kind@CCCC (35c)
7580     *         [B=3] op {vD, vE, vF}, kind@CCCC (35c)
7581     *         [B=2] op {vD, vE}, kind@CCCC (35c)
7582     *         [B=1] op {vD}, kind@CCCC (35c)
7583     *         [B=0] op {}, kind@CCCC (35c)
7584     *
7585     *         op {vCCCC .. vNNNN}, meth@BBBB (3rc) (where NNNN = CCCC+AA-1, that
7586     *         op {vCCCC .. vNNNN}, type@BBBB (3rc) is A determines the count 0..255,
7587     *                                              and C determines the first register)
7588     */
7589
7590
7591     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
7592     movl        offGlue_methodClassDex(%ecx), %ecx # %ecx<- pDvmDex
7593     FETCH       1, %eax                 # %eax<- method index
7594     movl        offDvmDex_pResMethods(%ecx), %ecx # %ecx<- pDvmDex->pResMethods
7595     FETCH       2, %edx                 # %edx<- GFED or CCCC
7596     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved method to call
7597     .if         (!1)
7598     andl        $15, %edx              # %edx<- D if not range
7599     .endif
7600     EXPORT_PC                           # must export for invoke
7601     movl        %edx, -4(%esp)          # save "this" pointer register
7602     cmp         $0, %ecx               # check if already resolved
7603     GET_VREG    %edx                    # %edx<- "this" pointer
7604     je          .LOP_INVOKE_DIRECT_RANGE_resolve     # handle resolve
7605
7606 .LOP_INVOKE_DIRECT_RANGE_finish:
7607     cmp         $0, %edx               # check for null "this"
7608     jne         common_invokeMethodRange # invoke method common code
7609     jmp         common_errNullObject
7610
7611
7612 /* ------------------------------ */
7613     .balign 64
7614 .L_OP_INVOKE_STATIC_RANGE: /* 0x77 */
7615 /* File: x86-atom/OP_INVOKE_STATIC_RANGE.S */
7616    /* Copyright (C) 2008 The Android Open Source Project
7617     *
7618     * Licensed under the Apache License, Version 2.0 (the "License");
7619     * you may not use this file except in compliance with the License.
7620     * You may obtain a copy of the License at
7621     *
7622     * http://www.apache.org/licenses/LICENSE-2.0
7623     *
7624     * Unless required by applicable law or agreed to in writing, software
7625     * distributed under the License is distributed on an "AS IS" BASIS,
7626     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7627     * See the License for the specific language governing permissions and
7628     * limitations under the License.
7629     */
7630
7631    /*
7632     * File: OP_INVOKE_STATIC_RANGE.S
7633     */
7634
7635 /* File: x86-atom/OP_INVOKE_STATIC.S */
7636    /* Copyright (C) 2008 The Android Open Source Project
7637     *
7638     * Licensed under the Apache License, Version 2.0 (the "License");
7639     * you may not use this file except in compliance with the License.
7640     * You may obtain a copy of the License at
7641     *
7642     * http://www.apache.org/licenses/LICENSE-2.0
7643     *
7644     * Unless required by applicable law or agreed to in writing, software
7645     * distributed under the License is distributed on an "AS IS" BASIS,
7646     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7647     * See the License for the specific language governing permissions and
7648     * limitations under the License.
7649     */
7650
7651    /*
7652     * File: OP_INVOKE_STATIC.S
7653     *
7654     * Code: Call static direct method. Provides an "isrange" variable and
7655     *       a "routine" variable to specify this is the "range" version of
7656     *       invoke_static that allows up to 255 arguments.
7657     *
7658     * For: invoke-static, invoke-static/range
7659     *
7660     * Description: invoke-static is used to invoke static direct method.
7661     *
7662     * Format: B|A|op CCCC G|F|E|D (35c)
7663     *         AA|op BBBB CCCC (3rc)
7664     *
7665     * Syntax: [B=5] op {vD, vE, vF, vG, vA}, meth@CCCC (35c)
7666     *         [B=5] op {vD, vE, vF, vG, vA}, type@CCCC (35c)
7667     *         [B=4] op {vD, vE, vF, vG}, kind@CCCC (35c)
7668     *         [B=3] op {vD, vE, vF}, kind@CCCC (35c)
7669     *         [B=2] op {vD, vE}, kind@CCCC (35c)
7670     *         [B=1] op {vD}, kind@CCCC (35c)
7671     *         [B=0] op {}, kind@CCCC (35c)
7672     *
7673     *         op {vCCCC .. vNNNN}, meth@BBBB (3rc) (where NNNN = CCCC+AA-1, that
7674     *         op {vCCCC .. vNNNN}, type@BBBB (3rc) is A determines the count 0..255,
7675     *                                              and C determines the first register)
7676     */
7677
7678
7679     movl        rGLUE, %edx             # %edx<- pMterpGlue
7680     movl        offGlue_methodClassDex(%edx), %ecx # %edx<- pDvmDex
7681     FETCH       1, %eax                 # %eax<- method index
7682     movl        offDvmDex_pResMethods(%ecx), %ecx # %edx<- pDvmDex->pResMethods
7683     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved method to call
7684     cmp         $0, %ecx               # check if already resolved
7685     EXPORT_PC                           # must export for invoke
7686     jne         common_invokeMethodRange # invoke method common code
7687     jmp         .LOP_INVOKE_STATIC_RANGE_break
7688
7689
7690 /* ------------------------------ */
7691     .balign 64
7692 .L_OP_INVOKE_INTERFACE_RANGE: /* 0x78 */
7693 /* File: x86-atom/OP_INVOKE_INTERFACE_RANGE.S */
7694    /* Copyright (C) 2008 The Android Open Source Project
7695     *
7696     * Licensed under the Apache License, Version 2.0 (the "License");
7697     * you may not use this file except in compliance with the License.
7698     * You may obtain a copy of the License at
7699     *
7700     * http://www.apache.org/licenses/LICENSE-2.0
7701     *
7702     * Unless required by applicable law or agreed to in writing, software
7703     * distributed under the License is distributed on an "AS IS" BASIS,
7704     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7705     * See the License for the specific language governing permissions and
7706     * limitations under the License.
7707     */
7708
7709    /*
7710     * File: OP_INVOKE_INTERFACE_RANGE.S
7711     */
7712
7713 /* File: x86-atom/OP_INVOKE_INTERFACE.S */
7714    /* Copyright (C) 2008 The Android Open Source Project
7715     *
7716     * Licensed under the Apache License, Version 2.0 (the "License");
7717     * you may not use this file except in compliance with the License.
7718     * You may obtain a copy of the License at
7719     *
7720     * http://www.apache.org/licenses/LICENSE-2.0
7721     *
7722     * Unless required by applicable law or agreed to in writing, software
7723     * distributed under the License is distributed on an "AS IS" BASIS,
7724     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7725     * See the License for the specific language governing permissions and
7726     * limitations under the License.
7727     */
7728
7729    /*
7730     * File: OP_INVOKE_INTERFACE.S
7731     *
7732     * Code: Call at method. Provides an "isrange" variable and
7733     *       a "routine" variable to specify this is the "range" version of
7734     *       invoke_interface that allows up to 255 arguments.
7735     *
7736     * For: invoke-interface, invoke-interface-range
7737     *
7738     * Description: invoke-interface is used to invoke an interface method; on an
7739     *              object whose concrete class isn't known, using a method_id that
7740     *              refers to an interface.
7741     *
7742     * Format: B|A|op CCCC G|F|E|D (35c)
7743     *         AA|op BBBB CCCC (3rc)
7744     *
7745     * Syntax: [B=5] op {vD, vE, vF, vG, vA}, meth@CCCC (35c)
7746     *         [B=5] op {vD, vE, vF, vG, vA}, type@CCCC (35c)
7747     *         [B=4] op {vD, vE, vF, vG}, kind@CCCC (35c)
7748     *         [B=3] op {vD, vE, vF}, kind@CCCC (35c)
7749     *         [B=2] op {vD, vE}, kind@CCCC (35c)
7750     *         [B=1] op {vD}, kind@CCCC (35c)
7751     *         [B=0] op {}, kind@CCCC (35c)
7752     *
7753     *         op {vCCCC .. vNNNN}, meth@BBBB (3rc) (where NNNN = CCCC+AA-1, that
7754     *         op {vCCCC .. vNNNN}, type@BBBB (3rc) is A determines the count 0..255,
7755     *                                              and C determines the first register)
7756     */
7757
7758
7759     FETCH       2, %edx                 # %edx<- GFED or CCCC
7760     FETCH       1, %ecx                 # %ecx<- method index
7761     movl        %ecx, -12(%esp)         # push argument method index
7762     .if         (!1)
7763     and         $15, %edx              # %edx<- D if not range
7764     .endif
7765     EXPORT_PC                           # must export for invoke
7766     GET_VREG    %edx                    # %edx<- first arg "this pointer"
7767     movl        rGLUE, %eax             # %eax<- pMterpGlue
7768     movl        offGlue_methodClassDex(%eax), %eax # %eax<- glue->pDvmDex
7769     movl        %eax, -4(%esp)          # push parameter class
7770     cmp         $0, %edx               # check for null object
7771     je          common_errNullObject    # handle null object
7772     jmp         .LOP_INVOKE_INTERFACE_RANGE_break
7773
7774
7775 /* ------------------------------ */
7776     .balign 64
7777 .L_OP_UNUSED_79: /* 0x79 */
7778 /* File: x86-atom/OP_UNUSED_79.S */
7779    /* Copyright (C) 2008 The Android Open Source Project
7780     *
7781     * Licensed under the Apache License, Version 2.0 (the "License");
7782     * you may not use this file except in compliance with the License.
7783     * You may obtain a copy of the License at
7784     *
7785     * http://www.apache.org/licenses/LICENSE-2.0
7786     *
7787     * Unless required by applicable law or agreed to in writing, software
7788     * distributed under the License is distributed on an "AS IS" BASIS,
7789     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7790     * See the License for the specific language governing permissions and
7791     * limitations under the License.
7792     */
7793
7794    /*
7795     * File: OP_UNUSED_79.S
7796     */
7797
7798 /* File: x86-atom/unused.S */
7799    /* Copyright (C) 2008 The Android Open Source Project
7800     *
7801     * Licensed under the Apache License, Version 2.0 (the "License");
7802     * you may not use this file except in compliance with the License.
7803     * You may obtain a copy of the License at
7804     *
7805     * http://www.apache.org/licenses/LICENSE-2.0
7806     *
7807     * Unless required by applicable law or agreed to in writing, software
7808     * distributed under the License is distributed on an "AS IS" BASIS,
7809     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7810     * See the License for the specific language governing permissions and
7811     * limitations under the License.
7812     */
7813
7814    /*
7815     * File: unused.S
7816     *
7817     * Code: Common code for unused bytecodes. Uses no subtitutions.
7818     *
7819     * For: all unused bytecodes
7820     *
7821     * Description: aborts if executed.
7822     *
7823     * Format: Ã˜Ã˜|op (10x)
7824     *
7825     * Syntax: op
7826     */
7827
7828     call        common_abort
7829
7830
7831 /* ------------------------------ */
7832     .balign 64
7833 .L_OP_UNUSED_7A: /* 0x7a */
7834 /* File: x86-atom/OP_UNUSED_7A.S */
7835    /* Copyright (C) 2008 The Android Open Source Project
7836     *
7837     * Licensed under the Apache License, Version 2.0 (the "License");
7838     * you may not use this file except in compliance with the License.
7839     * You may obtain a copy of the License at
7840     *
7841     * http://www.apache.org/licenses/LICENSE-2.0
7842     *
7843     * Unless required by applicable law or agreed to in writing, software
7844     * distributed under the License is distributed on an "AS IS" BASIS,
7845     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7846     * See the License for the specific language governing permissions and
7847     * limitations under the License.
7848     */
7849
7850    /*
7851     * File: OP_UNUSED_7A.S
7852     */
7853
7854 /* File: x86-atom/unused.S */
7855    /* Copyright (C) 2008 The Android Open Source Project
7856     *
7857     * Licensed under the Apache License, Version 2.0 (the "License");
7858     * you may not use this file except in compliance with the License.
7859     * You may obtain a copy of the License at
7860     *
7861     * http://www.apache.org/licenses/LICENSE-2.0
7862     *
7863     * Unless required by applicable law or agreed to in writing, software
7864     * distributed under the License is distributed on an "AS IS" BASIS,
7865     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7866     * See the License for the specific language governing permissions and
7867     * limitations under the License.
7868     */
7869
7870    /*
7871     * File: unused.S
7872     *
7873     * Code: Common code for unused bytecodes. Uses no subtitutions.
7874     *
7875     * For: all unused bytecodes
7876     *
7877     * Description: aborts if executed.
7878     *
7879     * Format: Ã˜Ã˜|op (10x)
7880     *
7881     * Syntax: op
7882     */
7883
7884     call        common_abort
7885
7886
7887 /* ------------------------------ */
7888     .balign 64
7889 .L_OP_NEG_INT: /* 0x7b */
7890 /* File: x86-atom/OP_NEG_INT.S */
7891    /* Copyright (C) 2008 The Android Open Source Project
7892     *
7893     * Licensed under the Apache License, Version 2.0 (the "License");
7894     * you may not use this file except in compliance with the License.
7895     * You may obtain a copy of the License at
7896     *
7897     * http://www.apache.org/licenses/LICENSE-2.0
7898     *
7899     * Unless required by applicable law or agreed to in writing, software
7900     * distributed under the License is distributed on an "AS IS" BASIS,
7901     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7902     * See the License for the specific language governing permissions and
7903     * limitations under the License.
7904     */
7905
7906    /*
7907     * File: OP_NEG_INT.S
7908     */
7909
7910 /* File: x86-atom/unop.S */
7911    /* Copyright (C) 2008 The Android Open Source Project
7912     *
7913     * Licensed under the Apache License, Version 2.0 (the "License");
7914     * you may not use this file except in compliance with the License.
7915     * You may obtain a copy of the License at
7916     *
7917     * http://www.apache.org/licenses/LICENSE-2.0
7918     *
7919     * Unless required by applicable law or agreed to in writing, software
7920     * distributed under the License is distributed on an "AS IS" BASIS,
7921     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7922     * See the License for the specific language governing permissions and
7923     * limitations under the License.
7924     */
7925
7926    /*
7927     * File: unop.S
7928     *
7929     * Code: Generic 32-bit unary operation. Provide an "instr" variable and a
7930     *       preinstr variable that together specify an instruction that
7931     *       performs, for example, "%ecx = op %edx".
7932     *
7933     * For: int-to-byte, int-to-char, int-to-short, neg-float, neg-int, not-int
7934     *
7935     * Description: Perform the identified unary operation on the source
7936     *              register, storing the result in the destination register
7937     *
7938     * Format: B|A|op (12x)
7939     *
7940     * Syntax: op vA, vB
7941     */
7942
7943
7944     movl        rINST, %ecx             # %ecx<- BA+
7945     shr         $4, %ecx               # %ecx<- B
7946     and         $15, rINST             # rINST<- A
7947     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
7948     GET_VREG    %ecx                    # %ecx<- vB
7949                                # do operation part 1
7950     neg        %ecx                              # do operation part 2
7951     SET_VREG    %ecx, rINST             # vA<- result
7952     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
7953
7954 /* ------------------------------ */
7955     .balign 64
7956 .L_OP_NOT_INT: /* 0x7c */
7957 /* File: x86-atom/OP_NOT_INT.S */
7958    /* Copyright (C) 2008 The Android Open Source Project
7959     *
7960     * Licensed under the Apache License, Version 2.0 (the "License");
7961     * you may not use this file except in compliance with the License.
7962     * You may obtain a copy of the License at
7963     *
7964     * http://www.apache.org/licenses/LICENSE-2.0
7965     *
7966     * Unless required by applicable law or agreed to in writing, software
7967     * distributed under the License is distributed on an "AS IS" BASIS,
7968     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7969     * See the License for the specific language governing permissions and
7970     * limitations under the License.
7971     */
7972
7973    /*
7974     * File: OP_NOT_INT.S
7975     */
7976
7977 /* File: x86-atom/unop.S */
7978    /* Copyright (C) 2008 The Android Open Source Project
7979     *
7980     * Licensed under the Apache License, Version 2.0 (the "License");
7981     * you may not use this file except in compliance with the License.
7982     * You may obtain a copy of the License at
7983     *
7984     * http://www.apache.org/licenses/LICENSE-2.0
7985     *
7986     * Unless required by applicable law or agreed to in writing, software
7987     * distributed under the License is distributed on an "AS IS" BASIS,
7988     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7989     * See the License for the specific language governing permissions and
7990     * limitations under the License.
7991     */
7992
7993    /*
7994     * File: unop.S
7995     *
7996     * Code: Generic 32-bit unary operation. Provide an "instr" variable and a
7997     *       preinstr variable that together specify an instruction that
7998     *       performs, for example, "%ecx = op %edx".
7999     *
8000     * For: int-to-byte, int-to-char, int-to-short, neg-float, neg-int, not-int
8001     *
8002     * Description: Perform the identified unary operation on the source
8003     *              register, storing the result in the destination register
8004     *
8005     * Format: B|A|op (12x)
8006     *
8007     * Syntax: op vA, vB
8008     */
8009
8010
8011     movl        rINST, %ecx             # %ecx<- BA+
8012     shr         $4, %ecx               # %ecx<- B
8013     and         $15, rINST             # rINST<- A
8014     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
8015     GET_VREG    %ecx                    # %ecx<- vB
8016                                # do operation part 1
8017     not        %ecx                              # do operation part 2
8018     SET_VREG    %ecx, rINST             # vA<- result
8019     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
8020
8021 /* ------------------------------ */
8022     .balign 64
8023 .L_OP_NEG_LONG: /* 0x7d */
8024 /* File: x86-atom/OP_NEG_LONG.S */
8025    /* Copyright (C) 2008 The Android Open Source Project
8026     *
8027     * Licensed under the Apache License, Version 2.0 (the "License");
8028     * you may not use this file except in compliance with the License.
8029     * You may obtain a copy of the License at
8030     *
8031     * http://www.apache.org/licenses/LICENSE-2.0
8032     *
8033     * Unless required by applicable law or agreed to in writing, software
8034     * distributed under the License is distributed on an "AS IS" BASIS,
8035     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8036     * See the License for the specific language governing permissions and
8037     * limitations under the License.
8038     */
8039
8040    /*
8041     * File: OP_NEG_LONG.S
8042     */
8043
8044 /* File: x86-atom/unopWide.S */
8045    /* Copyright (C) 2008 The Android Open Source Project
8046     *
8047     * Licensed under the Apache License, Version 2.0 (the "License");
8048     * you may not use this file except in compliance with the License.
8049     * You may obtain a copy of the License at
8050     *
8051     * http://www.apache.org/licenses/LICENSE-2.0
8052     *
8053     * Unless required by applicable law or agreed to in writing, software
8054     * distributed under the License is distributed on an "AS IS" BASIS,
8055     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8056     * See the License for the specific language governing permissions and
8057     * limitations under the License.
8058     */
8059
8060    /*
8061     * File: unopWide.S
8062     *
8063     * Code: Generic 64-bit unary operation. Provide an "instr" variable and a
8064     *       preinstr variable that together specify an instruction that
8065     *       performs, for example, "%xmm0 = op %xmm1".
8066     *
8067     * For:  neg-double, neg-long, not-long
8068     *
8069     * Description: Perform the identified unary operation on the source
8070     *              register, storing the result in the destination register
8071     *
8072     * Format: B|A|op (12x)
8073     *
8074     * Syntax: op vA, vB
8075     */
8076
8077
8078     movl        rINST, %ecx             # %ecx<- BA+
8079     shr         $4, rINST              # rINST<- B
8080     and         $15, %ecx              # %ecx<- A
8081     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
8082     movq        (rFP, rINST, 4), %xmm0  # %xmm0<- vB
8083     xorps %xmm1, %xmm1                           # do operation part 1
8084     psubq %xmm0, %xmm1                              # do operation part 2
8085     movq        %xmm1, (rFP, %ecx, 4) # vA<- result
8086     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
8087
8088
8089 /* ------------------------------ */
8090     .balign 64
8091 .L_OP_NOT_LONG: /* 0x7e */
8092 /* File: x86-atom/OP_NOT_LONG.S */
8093    /* Copyright (C) 2008 The Android Open Source Project
8094     *
8095     * Licensed under the Apache License, Version 2.0 (the "License");
8096     * you may not use this file except in compliance with the License.
8097     * You may obtain a copy of the License at
8098     *
8099     * http://www.apache.org/licenses/LICENSE-2.0
8100     *
8101     * Unless required by applicable law or agreed to in writing, software
8102     * distributed under the License is distributed on an "AS IS" BASIS,
8103     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8104     * See the License for the specific language governing permissions and
8105     * limitations under the License.
8106     */
8107
8108    /*
8109     * File: OP_NOT_LONG.S
8110     */
8111
8112 /* File: x86-atom/unopWide.S */
8113    /* Copyright (C) 2008 The Android Open Source Project
8114     *
8115     * Licensed under the Apache License, Version 2.0 (the "License");
8116     * you may not use this file except in compliance with the License.
8117     * You may obtain a copy of the License at
8118     *
8119     * http://www.apache.org/licenses/LICENSE-2.0
8120     *
8121     * Unless required by applicable law or agreed to in writing, software
8122     * distributed under the License is distributed on an "AS IS" BASIS,
8123     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8124     * See the License for the specific language governing permissions and
8125     * limitations under the License.
8126     */
8127
8128    /*
8129     * File: unopWide.S
8130     *
8131     * Code: Generic 64-bit unary operation. Provide an "instr" variable and a
8132     *       preinstr variable that together specify an instruction that
8133     *       performs, for example, "%xmm0 = op %xmm1".
8134     *
8135     * For:  neg-double, neg-long, not-long
8136     *
8137     * Description: Perform the identified unary operation on the source
8138     *              register, storing the result in the destination register
8139     *
8140     * Format: B|A|op (12x)
8141     *
8142     * Syntax: op vA, vB
8143     */
8144
8145
8146     movl        rINST, %ecx             # %ecx<- BA+
8147     shr         $4, rINST              # rINST<- B
8148     and         $15, %ecx              # %ecx<- A
8149     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
8150     movq        (rFP, rINST, 4), %xmm0  # %xmm0<- vB
8151                                # do operation part 1
8152     pandn  0xFFFFFFFF, %xmm0                              # do operation part 2
8153     movq        %xmm0, (rFP, %ecx, 4) # vA<- result
8154     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
8155
8156
8157 /* ------------------------------ */
8158     .balign 64
8159 .L_OP_NEG_FLOAT: /* 0x7f */
8160 /* File: x86-atom/OP_NEG_FLOAT.S */
8161    /* Copyright (C) 2008 The Android Open Source Project
8162     *
8163     * Licensed under the Apache License, Version 2.0 (the "License");
8164     * you may not use this file except in compliance with the License.
8165     * You may obtain a copy of the License at
8166     *
8167     * http://www.apache.org/licenses/LICENSE-2.0
8168     *
8169     * Unless required by applicable law or agreed to in writing, software
8170     * distributed under the License is distributed on an "AS IS" BASIS,
8171     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8172     * See the License for the specific language governing permissions and
8173     * limitations under the License.
8174     */
8175
8176    /*
8177     * File: OP_NEG_FLOAT.S
8178     */
8179
8180 /* File: x86-atom/unop.S */
8181    /* Copyright (C) 2008 The Android Open Source Project
8182     *
8183     * Licensed under the Apache License, Version 2.0 (the "License");
8184     * you may not use this file except in compliance with the License.
8185     * You may obtain a copy of the License at
8186     *
8187     * http://www.apache.org/licenses/LICENSE-2.0
8188     *
8189     * Unless required by applicable law or agreed to in writing, software
8190     * distributed under the License is distributed on an "AS IS" BASIS,
8191     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8192     * See the License for the specific language governing permissions and
8193     * limitations under the License.
8194     */
8195
8196    /*
8197     * File: unop.S
8198     *
8199     * Code: Generic 32-bit unary operation. Provide an "instr" variable and a
8200     *       preinstr variable that together specify an instruction that
8201     *       performs, for example, "%ecx = op %edx".
8202     *
8203     * For: int-to-byte, int-to-char, int-to-short, neg-float, neg-int, not-int
8204     *
8205     * Description: Perform the identified unary operation on the source
8206     *              register, storing the result in the destination register
8207     *
8208     * Format: B|A|op (12x)
8209     *
8210     * Syntax: op vA, vB
8211     */
8212
8213
8214     movl        rINST, %ecx             # %ecx<- BA+
8215     shr         $4, %ecx               # %ecx<- B
8216     and         $15, rINST             # rINST<- A
8217     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
8218     GET_VREG    %ecx                    # %ecx<- vB
8219                                # do operation part 1
8220     addl      $0x80000000, %ecx                              # do operation part 2
8221     SET_VREG    %ecx, rINST             # vA<- result
8222     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
8223
8224 /* ------------------------------ */
8225     .balign 64
8226 .L_OP_NEG_DOUBLE: /* 0x80 */
8227 /* File: x86-atom/OP_NEG_DOUBLE.S */
8228    /* Copyright (C) 2008 The Android Open Source Project
8229     *
8230     * Licensed under the Apache License, Version 2.0 (the "License");
8231     * you may not use this file except in compliance with the License.
8232     * You may obtain a copy of the License at
8233     *
8234     * http://www.apache.org/licenses/LICENSE-2.0
8235     *
8236     * Unless required by applicable law or agreed to in writing, software
8237     * distributed under the License is distributed on an "AS IS" BASIS,
8238     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8239     * See the License for the specific language governing permissions and
8240     * limitations under the License.
8241     */
8242
8243    /*
8244     * File: OP_NEG_DOUBLE.S
8245     */
8246
8247 /* File: x86-atom/unopWide.S */
8248    /* Copyright (C) 2008 The Android Open Source Project
8249     *
8250     * Licensed under the Apache License, Version 2.0 (the "License");
8251     * you may not use this file except in compliance with the License.
8252     * You may obtain a copy of the License at
8253     *
8254     * http://www.apache.org/licenses/LICENSE-2.0
8255     *
8256     * Unless required by applicable law or agreed to in writing, software
8257     * distributed under the License is distributed on an "AS IS" BASIS,
8258     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8259     * See the License for the specific language governing permissions and
8260     * limitations under the License.
8261     */
8262
8263    /*
8264     * File: unopWide.S
8265     *
8266     * Code: Generic 64-bit unary operation. Provide an "instr" variable and a
8267     *       preinstr variable that together specify an instruction that
8268     *       performs, for example, "%xmm0 = op %xmm1".
8269     *
8270     * For:  neg-double, neg-long, not-long
8271     *
8272     * Description: Perform the identified unary operation on the source
8273     *              register, storing the result in the destination register
8274     *
8275     * Format: B|A|op (12x)
8276     *
8277     * Syntax: op vA, vB
8278     */
8279
8280
8281     movl        rINST, %ecx             # %ecx<- BA+
8282     shr         $4, rINST              # rINST<- B
8283     and         $15, %ecx              # %ecx<- A
8284     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
8285     movq        (rFP, rINST, 4), %xmm0  # %xmm0<- vB
8286     movq .LdoubNeg, %xmm1                           # do operation part 1
8287     pxor %xmm1, %xmm0                              # do operation part 2
8288     movq        %xmm0, (rFP, %ecx, 4) # vA<- result
8289     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
8290
8291
8292 /* ------------------------------ */
8293     .balign 64
8294 .L_OP_INT_TO_LONG: /* 0x81 */
8295 /* File: x86-atom/OP_INT_TO_LONG.S */
8296    /* Copyright (C) 2008 The Android Open Source Project
8297     *
8298     * Licensed under the Apache License, Version 2.0 (the "License");
8299     * you may not use this file except in compliance with the License.
8300     * You may obtain a copy of the License at
8301     *
8302     * http://www.apache.org/licenses/LICENSE-2.0
8303     *
8304     * Unless required by applicable law or agreed to in writing, software
8305     * distributed under the License is distributed on an "AS IS" BASIS,
8306     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8307     * See the License for the specific language governing permissions and
8308     * limitations under the License.
8309     */
8310
8311    /*
8312     * File: OP_INT_TO_LONG.S
8313     *
8314     * Code:  Convert an int to a long. Uses no substitutions.
8315     *
8316     * For:
8317     *
8318     * Description: Convert an int in the source register, to a long, and
8319     *              stores the result in the destintation register. vA<- (long) vB
8320     *
8321     *
8322     * Format: B|A|op (12x)
8323     *
8324     * Syntax: op vA, vB
8325     */
8326
8327     movl        rINST, %eax             # %eax<- BA+
8328     movl        rINST, %ecx             # %ecx<- BA+
8329     shr         $4, %eax               # %eax<- B
8330     andl        $15, %ecx              # %ecx<- A
8331     GET_VREG    %eax                    # %eax<- vB
8332     cdq                                 # %edx:%eax<- sign-extend of %eax
8333     movl        %eax, (rFP, %ecx, 4)    # vA<- lo part
8334     movl        %edx, 4(rFP, %ecx, 4)   # vA+1<- hi part
8335     FINISH      1                       # jump to next instruction
8336
8337 /* ------------------------------ */
8338     .balign 64
8339 .L_OP_INT_TO_FLOAT: /* 0x82 */
8340 /* File: x86-atom/OP_INT_TO_FLOAT.S */
8341    /* Copyright (C) 2008 The Android Open Source Project
8342     *
8343     * Licensed under the Apache License, Version 2.0 (the "License");
8344     * you may not use this file except in compliance with the License.
8345     * You may obtain a copy of the License at
8346     *
8347     * http://www.apache.org/licenses/LICENSE-2.0
8348     *
8349     * Unless required by applicable law or agreed to in writing, software
8350     * distributed under the License is distributed on an "AS IS" BASIS,
8351     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8352     * See the License for the specific language governing permissions and
8353     * limitations under the License.
8354     */
8355
8356    /*
8357     * File: OP_INT_TO_FLOAT.S
8358     *
8359     * Code: Convert an int to a float. Uses no substitutions.
8360     *
8361     * For: int-to-float
8362     *
8363     * Description: Convert an int in the source register, to a float, and
8364     *              stores the result in the destintation register. vA<- (float) vB
8365     *
8366     * Format: B|A|op (12x)
8367     *
8368     * Syntax: op vA, vB
8369     */
8370
8371     movl        rINST, %eax             # %eax<- BA+
8372     shr         $4, %eax               # %eax<- B
8373     andl        $15,  rINST            # rINST<- A
8374     cvtsi2ss    (rFP,%eax,4), %xmm0     # %xmm0<- vB
8375     movss       %xmm0, (rFP, rINST, 4)  # vA<- %xmm0
8376     FINISH      1                       # jump to next instruction
8377
8378 /* ------------------------------ */
8379     .balign 64
8380 .L_OP_INT_TO_DOUBLE: /* 0x83 */
8381 /* File: x86-atom/OP_INT_TO_DOUBLE.S */
8382    /* Copyright (C) 2008 The Android Open Source Project
8383     *
8384     * Licensed under the Apache License, Version 2.0 (the "License");
8385     * you may not use this file except in compliance with the License.
8386     * You may obtain a copy of the License at
8387     *
8388     * http://www.apache.org/licenses/LICENSE-2.0
8389     *
8390     * Unless required by applicable law or agreed to in writing, software
8391     * distributed under the License is distributed on an "AS IS" BASIS,
8392     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8393     * See the License for the specific language governing permissions and
8394     * limitations under the License.
8395     */
8396
8397    /*
8398     * File: OP_INT_TO_DOUBLE.S
8399     *
8400     * Code: Convert an int to a double. Uses no substitutions.
8401     *
8402     * For: int-to-double
8403     *
8404     * Description: Converts an int in the source register, to a double, and
8405     *              stores the result in the destination register. vA<- (double) vB
8406     *
8407     * Format: B|A|op (12x)
8408     *
8409     * Syntax: op vA, vB
8410     */
8411
8412     movl        rINST, %eax             # %eax<- BA+
8413     shr         $4, %eax               # %eax<- B
8414     andl        $15, rINST             # rINST<- A
8415     cvtsi2sd    (rFP, %eax, 4), %xmm0   # %xmm0<- vB
8416     movq        %xmm0, (rFP, rINST, 4)  # vA<- %xmm0; (double) vB
8417     FFETCH_ADV  1, %edx                 # %edx<- next instruction hi; fetch, advance
8418     FGETOP_JMP  1, %edx                 # jump to next instruction; getop, jmp
8419
8420 /* ------------------------------ */
8421     .balign 64
8422 .L_OP_LONG_TO_INT: /* 0x84 */
8423 /* File: x86-atom/OP_LONG_TO_INT.S */
8424    /* Copyright (C) 2008 The Android Open Source Project
8425     *
8426     * Licensed under the Apache License, Version 2.0 (the "License");
8427     * you may not use this file except in compliance with the License.
8428     * You may obtain a copy of the License at
8429     *
8430     * http://www.apache.org/licenses/LICENSE-2.0
8431     *
8432     * Unless required by applicable law or agreed to in writing, software
8433     * distributed under the License is distributed on an "AS IS" BASIS,
8434     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8435     * See the License for the specific language governing permissions and
8436     * limitations under the License.
8437     */
8438
8439    /*
8440     * File: OP_LONG_TO_INT.S
8441     */
8442
8443 /* File: x86-atom/OP_MOVE.S */
8444    /* Copyright (C) 2008 The Android Open Source Project
8445     *
8446     * Licensed under the Apache License, Version 2.0 (the "License");
8447     * you may not use this file except in compliance with the License.
8448     * You may obtain a copy of the License at
8449     *
8450     * http://www.apache.org/licenses/LICENSE-2.0
8451     *
8452     * Unless required by applicable law or agreed to in writing, software
8453     * distributed under the License is distributed on an "AS IS" BASIS,
8454     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8455     * See the License for the specific language governing permissions and
8456     * limitations under the License.
8457     */
8458
8459    /*
8460     * File: OP_MOVE.S
8461     *
8462     * Code: Copies contents from one register to another. Uses no
8463     *       substitutions.
8464     *
8465     * For: move, move-object, long-to-int
8466     *
8467     * Description: Copies contents from one non-object register to another.
8468     *              vA<- vB; fp[A]<- fp[B]
8469     *
8470     * Format: B|A|op (12x)
8471     *
8472     * Syntax: op vA, vB
8473     */
8474
8475     movl        rINST, %ecx             # %ecx<- BA
8476     shr         $4, rINST              # rINST<- B
8477     and         $15, %ecx              # %ecx<- A
8478     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
8479     GET_VREG    rINST                   # rINST<- vB
8480     SET_VREG    rINST, %ecx             # vA<- vB; %edx
8481     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
8482
8483 /* ------------------------------ */
8484     .balign 64
8485 .L_OP_LONG_TO_FLOAT: /* 0x85 */
8486 /* File: x86-atom/OP_LONG_TO_FLOAT.S */
8487    /* Copyright (C) 2008 The Android Open Source Project
8488     *
8489     * Licensed under the Apache License, Version 2.0 (the "License");
8490     * you may not use this file except in compliance with the License.
8491     * You may obtain a copy of the License at
8492     *
8493     * http://www.apache.org/licenses/LICENSE-2.0
8494     *
8495     * Unless required by applicable law or agreed to in writing, software
8496     * distributed under the License is distributed on an "AS IS" BASIS,
8497     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8498     * See the License for the specific language governing permissions and
8499     * limitations under the License.
8500     */
8501
8502    /*
8503     * File: OP_LONG_TO_FLOAT.S
8504     *
8505     * Code: Convert a long to a float. Uses no substitutions.
8506     *
8507     * For: int-to-float
8508     *
8509     * Description: Converts a float in the source register, to a float, and
8510     *              stores the result in the destination register. vA<- (double) vB
8511     *
8512     * Format: B|A|op (12x)
8513     *
8514     * Syntax: op vA, vB
8515     */
8516
8517     movl        rINST, %ecx             # %ecx<- BA+
8518     shr         $4, rINST              # rINST<- B
8519     and         $15, %ecx              # %ecx<- A
8520     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
8521     fildll      (rFP, rINST, 4)         # FPU<- vB
8522     fstps       (rFP, %ecx, 4)          # vA<- FPU; (float) vB
8523     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
8524
8525 /* ------------------------------ */
8526     .balign 64
8527 .L_OP_LONG_TO_DOUBLE: /* 0x86 */
8528 /* File: x86-atom/OP_LONG_TO_DOUBLE.S */
8529    /* Copyright (C) 2008 The Android Open Source Project
8530     *
8531     * Licensed under the Apache License, Version 2.0 (the "License");
8532     * you may not use this file except in compliance with the License.
8533     * You may obtain a copy of the License at
8534     *
8535     * http://www.apache.org/licenses/LICENSE-2.0
8536     *
8537     * Unless required by applicable law or agreed to in writing, software
8538     * distributed under the License is distributed on an "AS IS" BASIS,
8539     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8540     * See the License for the specific language governing permissions and
8541     * limitations under the License.
8542     */
8543
8544    /*
8545     * File: OP_LONG_TO_DOUBLE.S
8546     *
8547     * Code: Convert a long to a dobule. Uses no substitutions.
8548     *
8549     * For: long-to-double
8550     *
8551     * Description: Converts a long in the source register to a double, and
8552     *              stores the result in the destination register. vA<- (double) vB
8553     *
8554     * Format: B|A|op (12x)
8555     *
8556     * Syntax: op vA, vB
8557     */
8558
8559     movl        rINST, %ecx             # %ecx<- BA+
8560     shr         $4, rINST              # rINST<- B
8561     and         $15, %ecx              # %ecx<- A
8562     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
8563     fildll      (rFP, rINST, 4)         # FPU<- vB
8564     fstpl       (rFP, %ecx, 4)          # vA<- FPU; (double) vB
8565     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
8566
8567 /* ------------------------------ */
8568     .balign 64
8569 .L_OP_FLOAT_TO_INT: /* 0x87 */
8570 /* File: x86-atom/OP_FLOAT_TO_INT.S */
8571    /* Copyright (C) 2008 The Android Open Source Project
8572     *
8573     * Licensed under the Apache License, Version 2.0 (the "License");
8574     * you may not use this file except in compliance with the License.
8575     * You may obtain a copy of the License at
8576     *
8577     * http://www.apache.org/licenses/LICENSE-2.0
8578     *
8579     * Unless required by applicable law or agreed to in writing, software
8580     * distributed under the License is distributed on an "AS IS" BASIS,
8581     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8582     * See the License for the specific language governing permissions and
8583     * limitations under the License.
8584     */
8585
8586    /*
8587     * File: OP_FLOAT_TO_INT.S
8588     *
8589     * Code: Converts a float to a int. Uses no substitutions.
8590     *
8591     * For: float-to-int
8592     *
8593     * Description: Convert the float in source register to a int
8594     *              and store the result in the destintation register
8595     *
8596     * Format: B|A|op (12x)
8597     *
8598     * Syntax: op vA, vB
8599     */
8600
8601     movl        rINST, %edx             # %edx<- BA
8602     shr         $4, rINST              # rINST<- B
8603     and         $15, %edx              # %edx<- A
8604     flds        (rFP, rINST, 4)         # push vB to floating point stack
8605     fildl       .LintMax                # push max int value
8606     fildl       .LintMin                # push min int value
8607     fucomip     %st(2), %st(0)          # check for negInf
8608     jae         .LOP_FLOAT_TO_INT_negInf      # handle negInf
8609     fucomip     %st(1), %st(0)          # check for posInf or NaN
8610     jc          .LOP_FLOAT_TO_INT_nanInf      # handle posInf or NaN
8611     jmp         .LOP_FLOAT_TO_INT_break       # do conversion
8612
8613 /* ------------------------------ */
8614     .balign 64
8615 .L_OP_FLOAT_TO_LONG: /* 0x88 */
8616 /* File: x86-atom/OP_FLOAT_TO_LONG.S */
8617    /* Copyright (C) 2008 The Android Open Source Project
8618     *
8619     * Licensed under the Apache License, Version 2.0 (the "License");
8620     * you may not use this file except in compliance with the License.
8621     * You may obtain a copy of the License at
8622     *
8623     * http://www.apache.org/licenses/LICENSE-2.0
8624     *
8625     * Unless required by applicable law or agreed to in writing, software
8626     * distributed under the License is distributed on an "AS IS" BASIS,
8627     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8628     * See the License for the specific language governing permissions and
8629     * limitations under the License.
8630     */
8631
8632    /*
8633     * File: OP_FLOAT_TO_LONG.S
8634     *
8635     * Code: Converts a float to a long. Uses no substitutions.
8636     *
8637     * For: float-to-long
8638     *
8639     * Description: Convert the float in source register to a long
8640     *              and store the result in the destintation register
8641     *
8642     * Format: B|A|op (12x)
8643     *
8644     * Syntax: op vA, vB
8645     */
8646
8647     movl        rINST, %edx             # %edx<- BA
8648     shr         $4, rINST              # rINST<- B
8649     and         $15, %edx              # %edx<- A
8650     flds        (rFP, rINST, 4)         # push vB to floating point stack
8651     fildll      .LvaluePosInfLong       # push max int value
8652     fildll      .LvalueNegInfLong       # push min int value
8653     fucomip     %st(2), %st(0)          # check for negInf
8654     jae         .LOP_FLOAT_TO_LONG_negInf      # handle negInf
8655     fucomip     %st(1), %st(0)          # check for posInf or NaN
8656     jc          .LOP_FLOAT_TO_LONG_nanInf      # handle posInf or NaN
8657     jmp         .LOP_FLOAT_TO_LONG_break       # do conversion
8658
8659 /* ------------------------------ */
8660     .balign 64
8661 .L_OP_FLOAT_TO_DOUBLE: /* 0x89 */
8662 /* File: x86-atom/OP_FLOAT_TO_DOUBLE.S */
8663    /* Copyright (C) 2008 The Android Open Source Project
8664     *
8665     * Licensed under the Apache License, Version 2.0 (the "License");
8666     * you may not use this file except in compliance with the License.
8667     * You may obtain a copy of the License at
8668     *
8669     * http://www.apache.org/licenses/LICENSE-2.0
8670     *
8671     * Unless required by applicable law or agreed to in writing, software
8672     * distributed under the License is distributed on an "AS IS" BASIS,
8673     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8674     * See the License for the specific language governing permissions and
8675     * limitations under the License.
8676     */
8677
8678    /*
8679     * File: OP_FLOAT_TO_DOUBLE.S
8680     *
8681     * Code: Converts a float to a double. Uses no substitutions.
8682     *
8683     * For: float-to-double
8684     *
8685     * Description: Convert the float in source register to a double
8686     *              and store the result in the destintation register
8687     *
8688     * Format: B|A|op (12x)
8689     *
8690     * Syntax: op vA, vB
8691     */
8692
8693     movl        rINST, %edx             # %edx<- BA
8694     shr         $4, rINST              # rINST<- B
8695     and         $15, %edx              # %edx<- A
8696     flds        (rFP, rINST, 4)         # load float
8697     fstpl       (rFP, %edx, 4)          # store double
8698     FINISH      1                       # jump to next instruction
8699
8700 /* ------------------------------ */
8701     .balign 64
8702 .L_OP_DOUBLE_TO_INT: /* 0x8a */
8703 /* File: x86-atom/OP_DOUBLE_TO_INT.S */
8704    /* Copyright (C) 2008 The Android Open Source Project
8705     *
8706     * Licensed under the Apache License, Version 2.0 (the "License");
8707     * you may not use this file except in compliance with the License.
8708     * You may obtain a copy of the License at
8709     *
8710     * http://www.apache.org/licenses/LICENSE-2.0
8711     *
8712     * Unless required by applicable law or agreed to in writing, software
8713     * distributed under the License is distributed on an "AS IS" BASIS,
8714     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8715     * See the License for the specific language governing permissions and
8716     * limitations under the License.
8717     */
8718
8719    /*
8720     * File: OP_DOUBLE_TO_INT.S
8721     *
8722     * Code: Converts a double to an integer. Uses no substitutions.
8723     *
8724     * For: double-to-int
8725     *
8726     * Description: Convert the source register (a double) to an integer
8727     *              and store the result in the destination register
8728     *
8729     * Format: B|A|op (12x)
8730     *
8731     * Syntax: op vA, vB
8732     */
8733
8734     movl        rINST, %edx             # %edx<- BA
8735     shr         $4, rINST              # rINST<- B
8736     and         $15, %edx              # %edx<- A
8737     fldl        (rFP, rINST, 4)         # load &vB
8738     fildl       .LintMax                # push max int value
8739     fildl       .LintMin                # push min int value
8740     fucomip     %st(2), %st(0)          # check for negInf
8741     jae         .LOP_DOUBLE_TO_INT_negInf      # handle negInf
8742     fucomip     %st(1), %st(0)          # check for posInf or NaN
8743     jc          .LOP_DOUBLE_TO_INT_nanInf      # handle posInf or NaN
8744     jmp         .LOP_DOUBLE_TO_INT_break       # do conversion
8745
8746 /* ------------------------------ */
8747     .balign 64
8748 .L_OP_DOUBLE_TO_LONG: /* 0x8b */
8749 /* File: x86-atom/OP_DOUBLE_TO_LONG.S */
8750    /* Copyright (C) 2008 The Android Open Source Project
8751     *
8752     * Licensed under the Apache License, Version 2.0 (the "License");
8753     * you may not use this file except in compliance with the License.
8754     * You may obtain a copy of the License at
8755     *
8756     * http://www.apache.org/licenses/LICENSE-2.0
8757     *
8758     * Unless required by applicable law or agreed to in writing, software
8759     * distributed under the License is distributed on an "AS IS" BASIS,
8760     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8761     * See the License for the specific language governing permissions and
8762     * limitations under the License.
8763     */
8764
8765    /*
8766     * File: OP_DOUBLE_TO_LONG.S
8767     *
8768     * Code: Converts a double to a long. Uses no substitutions.
8769     *
8770     * For: double-to-long
8771     *
8772     * Description: Convert the double in source register to a long
8773     *              and store in the destintation register
8774     *
8775     * Format: B|A|op (12x)
8776     *
8777     * Syntax: op vA, vB
8778     */
8779
8780     movl        rINST, %edx             # %ecx<- BA
8781     shr         $4, rINST              # rINST<- B
8782     and         $15, %edx              # %ecx<- A
8783     fldl        (rFP, rINST, 4)         # push vB to floating point stack
8784     fildll      .LvaluePosInfLong       # push max int value
8785     fildll      .LvalueNegInfLong       # push min int value
8786     fucomip     %st(2), %st(0)          # check for negInf
8787     jae         .LOP_DOUBLE_TO_LONG_negInf      # handle negInf
8788     fucomip     %st(1), %st(0)          # check for posInf or NaN
8789     jc          .LOP_DOUBLE_TO_LONG_nanInf      # handle posInf or NaN
8790     jmp         .LOP_DOUBLE_TO_LONG_break       # do conversion
8791
8792 /* ------------------------------ */
8793     .balign 64
8794 .L_OP_DOUBLE_TO_FLOAT: /* 0x8c */
8795 /* File: x86-atom/OP_DOUBLE_TO_FLOAT.S */
8796    /* Copyright (C) 2008 The Android Open Source Project
8797     *
8798     * Licensed under the Apache License, Version 2.0 (the "License");
8799     * you may not use this file except in compliance with the License.
8800     * You may obtain a copy of the License at
8801     *
8802     * http://www.apache.org/licenses/LICENSE-2.0
8803     *
8804     * Unless required by applicable law or agreed to in writing, software
8805     * distributed under the License is distributed on an "AS IS" BASIS,
8806     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8807     * See the License for the specific language governing permissions and
8808     * limitations under the License.
8809     */
8810
8811    /*
8812     * File: OP_DOUBLE_TO_FLOAT.S
8813     *
8814     * Code: Converts a double to a float. Uses no substitutions.
8815     *
8816     * For: double-to-float
8817     *
8818     * Description: Convert the source register (a double) to a float
8819     *              and store the result in the destination register
8820     *
8821     * Format: B|A|op (12x)
8822     *
8823     * Syntax: op vA, vB
8824     */
8825
8826     movl        rINST, %edx             # %edx<- BA
8827     shr         $4, rINST              # rINST<- B
8828     and         $15, %edx              # %edx<- A
8829     fldl        (rFP, rINST, 4)         # load &vB
8830     fstps       (rFP, %edx, 4)          # store float
8831     FINISH      1                       # jump to next instruction
8832
8833 /* ------------------------------ */
8834     .balign 64
8835 .L_OP_INT_TO_BYTE: /* 0x8d */
8836 /* File: x86-atom/OP_INT_TO_BYTE.S */
8837    /* Copyright (C) 2008 The Android Open Source Project
8838     *
8839     * Licensed under the Apache License, Version 2.0 (the "License");
8840     * you may not use this file except in compliance with the License.
8841     * You may obtain a copy of the License at
8842     *
8843     * http://www.apache.org/licenses/LICENSE-2.0
8844     *
8845     * Unless required by applicable law or agreed to in writing, software
8846     * distributed under the License is distributed on an "AS IS" BASIS,
8847     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8848     * See the License for the specific language governing permissions and
8849     * limitations under the License.
8850     */
8851
8852    /*
8853     * File: OP_INT_TO_BYTE.S
8854     */
8855
8856 /* File: x86-atom/unop.S */
8857    /* Copyright (C) 2008 The Android Open Source Project
8858     *
8859     * Licensed under the Apache License, Version 2.0 (the "License");
8860     * you may not use this file except in compliance with the License.
8861     * You may obtain a copy of the License at
8862     *
8863     * http://www.apache.org/licenses/LICENSE-2.0
8864     *
8865     * Unless required by applicable law or agreed to in writing, software
8866     * distributed under the License is distributed on an "AS IS" BASIS,
8867     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8868     * See the License for the specific language governing permissions and
8869     * limitations under the License.
8870     */
8871
8872    /*
8873     * File: unop.S
8874     *
8875     * Code: Generic 32-bit unary operation. Provide an "instr" variable and a
8876     *       preinstr variable that together specify an instruction that
8877     *       performs, for example, "%ecx = op %edx".
8878     *
8879     * For: int-to-byte, int-to-char, int-to-short, neg-float, neg-int, not-int
8880     *
8881     * Description: Perform the identified unary operation on the source
8882     *              register, storing the result in the destination register
8883     *
8884     * Format: B|A|op (12x)
8885     *
8886     * Syntax: op vA, vB
8887     */
8888
8889
8890     movl        rINST, %ecx             # %ecx<- BA+
8891     shr         $4, %ecx               # %ecx<- B
8892     and         $15, rINST             # rINST<- A
8893     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
8894     GET_VREG    %ecx                    # %ecx<- vB
8895     sal $24, %ecx                           # do operation part 1
8896     sar $24, %ecx                              # do operation part 2
8897     SET_VREG    %ecx, rINST             # vA<- result
8898     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
8899
8900 /* ------------------------------ */
8901     .balign 64
8902 .L_OP_INT_TO_CHAR: /* 0x8e */
8903 /* File: x86-atom/OP_INT_TO_CHAR.S */
8904    /* Copyright (C) 2008 The Android Open Source Project
8905     *
8906     * Licensed under the Apache License, Version 2.0 (the "License");
8907     * you may not use this file except in compliance with the License.
8908     * You may obtain a copy of the License at
8909     *
8910     * http://www.apache.org/licenses/LICENSE-2.0
8911     *
8912     * Unless required by applicable law or agreed to in writing, software
8913     * distributed under the License is distributed on an "AS IS" BASIS,
8914     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8915     * See the License for the specific language governing permissions and
8916     * limitations under the License.
8917     */
8918
8919    /*
8920     * File: OP_INT_TO_CHAR.S
8921     */
8922
8923 /* File: x86-atom/unop.S */
8924    /* Copyright (C) 2008 The Android Open Source Project
8925     *
8926     * Licensed under the Apache License, Version 2.0 (the "License");
8927     * you may not use this file except in compliance with the License.
8928     * You may obtain a copy of the License at
8929     *
8930     * http://www.apache.org/licenses/LICENSE-2.0
8931     *
8932     * Unless required by applicable law or agreed to in writing, software
8933     * distributed under the License is distributed on an "AS IS" BASIS,
8934     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8935     * See the License for the specific language governing permissions and
8936     * limitations under the License.
8937     */
8938
8939    /*
8940     * File: unop.S
8941     *
8942     * Code: Generic 32-bit unary operation. Provide an "instr" variable and a
8943     *       preinstr variable that together specify an instruction that
8944     *       performs, for example, "%ecx = op %edx".
8945     *
8946     * For: int-to-byte, int-to-char, int-to-short, neg-float, neg-int, not-int
8947     *
8948     * Description: Perform the identified unary operation on the source
8949     *              register, storing the result in the destination register
8950     *
8951     * Format: B|A|op (12x)
8952     *
8953     * Syntax: op vA, vB
8954     */
8955
8956
8957     movl        rINST, %ecx             # %ecx<- BA+
8958     shr         $4, %ecx               # %ecx<- B
8959     and         $15, rINST             # rINST<- A
8960     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
8961     GET_VREG    %ecx                    # %ecx<- vB
8962     sal $16, %ecx                           # do operation part 1
8963     shr $16, %ecx                              # do operation part 2
8964     SET_VREG    %ecx, rINST             # vA<- result
8965     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
8966
8967 /* ------------------------------ */
8968     .balign 64
8969 .L_OP_INT_TO_SHORT: /* 0x8f */
8970 /* File: x86-atom/OP_INT_TO_SHORT.S */
8971    /* Copyright (C) 2008 The Android Open Source Project
8972     *
8973     * Licensed under the Apache License, Version 2.0 (the "License");
8974     * you may not use this file except in compliance with the License.
8975     * You may obtain a copy of the License at
8976     *
8977     * http://www.apache.org/licenses/LICENSE-2.0
8978     *
8979     * Unless required by applicable law or agreed to in writing, software
8980     * distributed under the License is distributed on an "AS IS" BASIS,
8981     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8982     * See the License for the specific language governing permissions and
8983     * limitations under the License.
8984     */
8985
8986    /*
8987     * File: OP_INT_TO_SHORT.S
8988     */
8989
8990 /* File: x86-atom/unop.S */
8991    /* Copyright (C) 2008 The Android Open Source Project
8992     *
8993     * Licensed under the Apache License, Version 2.0 (the "License");
8994     * you may not use this file except in compliance with the License.
8995     * You may obtain a copy of the License at
8996     *
8997     * http://www.apache.org/licenses/LICENSE-2.0
8998     *
8999     * Unless required by applicable law or agreed to in writing, software
9000     * distributed under the License is distributed on an "AS IS" BASIS,
9001     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9002     * See the License for the specific language governing permissions and
9003     * limitations under the License.
9004     */
9005
9006    /*
9007     * File: unop.S
9008     *
9009     * Code: Generic 32-bit unary operation. Provide an "instr" variable and a
9010     *       preinstr variable that together specify an instruction that
9011     *       performs, for example, "%ecx = op %edx".
9012     *
9013     * For: int-to-byte, int-to-char, int-to-short, neg-float, neg-int, not-int
9014     *
9015     * Description: Perform the identified unary operation on the source
9016     *              register, storing the result in the destination register
9017     *
9018     * Format: B|A|op (12x)
9019     *
9020     * Syntax: op vA, vB
9021     */
9022
9023
9024     movl        rINST, %ecx             # %ecx<- BA+
9025     shr         $4, %ecx               # %ecx<- B
9026     and         $15, rINST             # rINST<- A
9027     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
9028     GET_VREG    %ecx                    # %ecx<- vB
9029     sal $16, %ecx                           # do operation part 1
9030     sar $16, %ecx                              # do operation part 2
9031     SET_VREG    %ecx, rINST             # vA<- result
9032     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
9033
9034 /* ------------------------------ */
9035     .balign 64
9036 .L_OP_ADD_INT: /* 0x90 */
9037 /* File: x86-atom/OP_ADD_INT.S */
9038    /* Copyright (C) 2008 The Android Open Source Project
9039     *
9040     * Licensed under the Apache License, Version 2.0 (the "License");
9041     * you may not use this file except in compliance with the License.
9042     * You may obtain a copy of the License at
9043     *
9044     * http://www.apache.org/licenses/LICENSE-2.0
9045     *
9046     * Unless required by applicable law or agreed to in writing, software
9047     * distributed under the License is distributed on an "AS IS" BASIS,
9048     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9049     * See the License for the specific language governing permissions and
9050     * limitations under the License.
9051     */
9052
9053    /*
9054     * File: OP_ADD_INT.S
9055     */
9056
9057 /* File: x86-atom/binop.S */
9058    /* Copyright (C) 2008 The Android Open Source Project
9059     *
9060     * Licensed under the Apache License, Version 2.0 (the "License");
9061     * you may not use this file except in compliance with the License.
9062     * You may obtain a copy of the License at
9063     *
9064     * http://www.apache.org/licenses/LICENSE-2.0
9065     *
9066     * Unless required by applicable law or agreed to in writing, software
9067     * distributed under the License is distributed on an "AS IS" BASIS,
9068     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9069     * See the License for the specific language governing permissions and
9070     * limitations under the License.
9071     */
9072
9073    /*
9074     * File: binop.S
9075     *
9076     * Code: Generic 32-bit binary operation.  Provides an "instr" line to
9077     *       specify an instruction that performs "%ecx = %ecx op %edx"
9078     *
9079     * For: add-int, and-int, mul-int, or-int, sub-int, xor-int
9080     *
9081     * Description: Perform a binary operation on two source registers
9082     *              and store the result in a destination register.
9083     *
9084     * Format: AA|op CC|BB (23x)
9085     *
9086     * Syntax: op vAA, vBB, vCC
9087     */
9088
9089
9090
9091     FETCH_BB    1, %ecx                 # %ecx<- BB
9092     OLD_JMP_1   2, %eax
9093     OLD_JMP_2   %eax
9094     FETCH_CC    1, %edx                 # %edx<- CC
9095     OLD_JMP_3   2
9096     GET_VREG    %ecx                    # %ecx<- vBB
9097     addl     (rFP, %edx, 4), %ecx                              # %ecx<- vBB op vCC
9098     SET_VREG    %ecx, rINST             # vAA<- %ecx; result
9099     OLD_JMP_4   %eax
9100
9101
9102 /* ------------------------------ */
9103     .balign 64
9104 .L_OP_SUB_INT: /* 0x91 */
9105 /* File: x86-atom/OP_SUB_INT.S */
9106    /* Copyright (C) 2008 The Android Open Source Project
9107     *
9108     * Licensed under the Apache License, Version 2.0 (the "License");
9109     * you may not use this file except in compliance with the License.
9110     * You may obtain a copy of the License at
9111     *
9112     * http://www.apache.org/licenses/LICENSE-2.0
9113     *
9114     * Unless required by applicable law or agreed to in writing, software
9115     * distributed under the License is distributed on an "AS IS" BASIS,
9116     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9117     * See the License for the specific language governing permissions and
9118     * limitations under the License.
9119     */
9120
9121    /*
9122     * File: OP_SUB_INT.S
9123     */
9124
9125 /* File: x86-atom/binop.S */
9126    /* Copyright (C) 2008 The Android Open Source Project
9127     *
9128     * Licensed under the Apache License, Version 2.0 (the "License");
9129     * you may not use this file except in compliance with the License.
9130     * You may obtain a copy of the License at
9131     *
9132     * http://www.apache.org/licenses/LICENSE-2.0
9133     *
9134     * Unless required by applicable law or agreed to in writing, software
9135     * distributed under the License is distributed on an "AS IS" BASIS,
9136     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9137     * See the License for the specific language governing permissions and
9138     * limitations under the License.
9139     */
9140
9141    /*
9142     * File: binop.S
9143     *
9144     * Code: Generic 32-bit binary operation.  Provides an "instr" line to
9145     *       specify an instruction that performs "%ecx = %ecx op %edx"
9146     *
9147     * For: add-int, and-int, mul-int, or-int, sub-int, xor-int
9148     *
9149     * Description: Perform a binary operation on two source registers
9150     *              and store the result in a destination register.
9151     *
9152     * Format: AA|op CC|BB (23x)
9153     *
9154     * Syntax: op vAA, vBB, vCC
9155     */
9156
9157
9158
9159     FETCH_BB    1, %ecx                 # %ecx<- BB
9160     OLD_JMP_1   2, %eax
9161     OLD_JMP_2   %eax
9162     FETCH_CC    1, %edx                 # %edx<- CC
9163     OLD_JMP_3   2
9164     GET_VREG    %ecx                    # %ecx<- vBB
9165     subl     (rFP, %edx, 4), %ecx                              # %ecx<- vBB op vCC
9166     SET_VREG    %ecx, rINST             # vAA<- %ecx; result
9167     OLD_JMP_4   %eax
9168
9169
9170 /* ------------------------------ */
9171     .balign 64
9172 .L_OP_MUL_INT: /* 0x92 */
9173 /* File: x86-atom/OP_MUL_INT.S */
9174    /* Copyright (C) 2008 The Android Open Source Project
9175     *
9176     * Licensed under the Apache License, Version 2.0 (the "License");
9177     * you may not use this file except in compliance with the License.
9178     * You may obtain a copy of the License at
9179     *
9180     * http://www.apache.org/licenses/LICENSE-2.0
9181     *
9182     * Unless required by applicable law or agreed to in writing, software
9183     * distributed under the License is distributed on an "AS IS" BASIS,
9184     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9185     * See the License for the specific language governing permissions and
9186     * limitations under the License.
9187     */
9188
9189    /*
9190     * File: OP_MUL_INT.S
9191     *
9192     * Code: 32-bit multiply operation.  Performs "%ecx = %ecx * %edx"
9193     *
9194     * Description: Perform a multiplication operation on two source registers
9195     *              and store the result in a destination register.
9196     *
9197     * Format: AA|op CC|BB (23x)
9198     *
9199     * Syntax: op vAA, vBB, vCC
9200     */
9201
9202     FETCH_BB    1, %ecx                 # %ecx<- BB
9203     FETCH_CC    1, %edx                 # %edx<- CC
9204     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
9205     GET_VREG    %ecx                    # %ecx<- vBB
9206     addl        $4, rPC                  # update PC
9207     imul        (rFP, %edx, 4), %ecx    # %ecx<- vBB * vCC
9208     SET_VREG    %ecx, rINST             # vAA<- %ecx; result
9209     FGETOP_JMP2 %eax                    # jump to next instruction; getop, jmp
9210
9211 /* ------------------------------ */
9212     .balign 64
9213 .L_OP_DIV_INT: /* 0x93 */
9214 /* File: x86-atom/OP_DIV_INT.S */
9215    /* Copyright (C) 2008 The Android Open Source Project
9216     *
9217     * Licensed under the Apache License, Version 2.0 (the "License");
9218     * you may not use this file except in compliance with the License.
9219     * You may obtain a copy of the License at
9220     *
9221     * http://www.apache.org/licenses/LICENSE-2.0
9222     *
9223     * Unless required by applicable law or agreed to in writing, software
9224     * distributed under the License is distributed on an "AS IS" BASIS,
9225     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9226     * See the License for the specific language governing permissions and
9227     * limitations under the License.
9228     */
9229
9230    /*
9231     * File: OP_DIV_INT.S
9232     */
9233
9234 /* File: x86-atom/binopD.S */
9235    /* Copyright (C) 2008 The Android Open Source Project
9236     *
9237     * Licensed under the Apache License, Version 2.0 (the "License");
9238     * you may not use this file except in compliance with the License.
9239     * You may obtain a copy of the License at
9240     *
9241     * http://www.apache.org/licenses/LICENSE-2.0
9242     *
9243     * Unless required by applicable law or agreed to in writing, software
9244     * distributed under the License is distributed on an "AS IS" BASIS,
9245     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9246     * See the License for the specific language governing permissions and
9247     * limitations under the License.
9248     */
9249
9250    /*
9251     * File: binopD.S
9252     *
9253     * Code: 32-bit integer divide operation. If "div" is set, the code
9254     *       returns the quotient, else it returns the remainder.
9255     *       Also, a divide-by-zero check is done.
9256     *
9257     * For: div-int, rem-int
9258     *
9259     * Description: Perform a binary operation on two source
9260     *
9261     * Format: AA|op CC|BB (23x)
9262     *
9263     * Syntax: op vAA, vBB, vCC
9264     */
9265
9266
9267
9268     FETCH_CC    1, %ecx                 # %ecx<- CC
9269     FETCH_BB    1, %eax                 # %eax<- BB
9270     GET_VREG    %ecx                    # %ecx<- vCC
9271     testl       %ecx, %ecx
9272     GET_VREG    %eax                    # %eax<- vBB
9273     je          common_errDivideByZero  # handle divide by zero
9274     cmpl        $-1, %ecx              # handle -1 special case divide error
9275     jnz         .LOP_DIV_INT_continue
9276     cmpl        $0x80000000,%eax       # handle min int special case divide error
9277     je         .LOP_DIV_INT_break
9278 .LOP_DIV_INT_continue:
9279     cdq                                 # sign-extend %eax to %edx
9280     idiv        %ecx                    # divide %edx:%eax by %ecx
9281     .if  1
9282     FFETCH_ADV 2 %edx
9283     SET_VREG    %eax rINST              # vAA<- %eax (quotient)
9284     FGETOP_JMP  2 %edx
9285     .else
9286     FFETCH_ADV  2 %eax
9287     SET_VREG %edx rINST  # vAA<- %edx (remainder)
9288     FGETOP_JMP  2 %eax
9289     .endif
9290
9291
9292 /* ------------------------------ */
9293     .balign 64
9294 .L_OP_REM_INT: /* 0x94 */
9295 /* File: x86-atom/OP_REM_INT.S */
9296    /* Copyright (C) 2008 The Android Open Source Project
9297     *
9298     * Licensed under the Apache License, Version 2.0 (the "License");
9299     * you may not use this file except in compliance with the License.
9300     * You may obtain a copy of the License at
9301     *
9302     * http://www.apache.org/licenses/LICENSE-2.0
9303     *
9304     * Unless required by applicable law or agreed to in writing, software
9305     * distributed under the License is distributed on an "AS IS" BASIS,
9306     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9307     * See the License for the specific language governing permissions and
9308     * limitations under the License.
9309     */
9310
9311    /*
9312     * File: OP_REM_INT.S
9313     */
9314
9315 /* File: x86-atom/binopD.S */
9316    /* Copyright (C) 2008 The Android Open Source Project
9317     *
9318     * Licensed under the Apache License, Version 2.0 (the "License");
9319     * you may not use this file except in compliance with the License.
9320     * You may obtain a copy of the License at
9321     *
9322     * http://www.apache.org/licenses/LICENSE-2.0
9323     *
9324     * Unless required by applicable law or agreed to in writing, software
9325     * distributed under the License is distributed on an "AS IS" BASIS,
9326     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9327     * See the License for the specific language governing permissions and
9328     * limitations under the License.
9329     */
9330
9331    /*
9332     * File: binopD.S
9333     *
9334     * Code: 32-bit integer divide operation. If "div" is set, the code
9335     *       returns the quotient, else it returns the remainder.
9336     *       Also, a divide-by-zero check is done.
9337     *
9338     * For: div-int, rem-int
9339     *
9340     * Description: Perform a binary operation on two source
9341     *
9342     * Format: AA|op CC|BB (23x)
9343     *
9344     * Syntax: op vAA, vBB, vCC
9345     */
9346
9347
9348
9349     FETCH_CC    1, %ecx                 # %ecx<- CC
9350     FETCH_BB    1, %eax                 # %eax<- BB
9351     GET_VREG    %ecx                    # %ecx<- vCC
9352     testl       %ecx, %ecx
9353     GET_VREG    %eax                    # %eax<- vBB
9354     je          common_errDivideByZero  # handle divide by zero
9355     cmpl        $-1, %ecx              # handle -1 special case divide error
9356     jnz         .LOP_REM_INT_continue
9357     cmpl        $0x80000000,%eax       # handle min int special case divide error
9358     je         .LOP_REM_INT_break
9359 .LOP_REM_INT_continue:
9360     cdq                                 # sign-extend %eax to %edx
9361     idiv        %ecx                    # divide %edx:%eax by %ecx
9362     .if  0
9363     FFETCH_ADV 2 %edx
9364     SET_VREG    %eax rINST              # vAA<- %eax (quotient)
9365     FGETOP_JMP  2 %edx
9366     .else
9367     FFETCH_ADV  2 %eax
9368     SET_VREG %edx rINST  # vAA<- %edx (remainder)
9369     FGETOP_JMP  2 %eax
9370     .endif
9371
9372
9373 /* ------------------------------ */
9374     .balign 64
9375 .L_OP_AND_INT: /* 0x95 */
9376 /* File: x86-atom/OP_AND_INT.S */
9377    /* Copyright (C) 2008 The Android Open Source Project
9378     *
9379     * Licensed under the Apache License, Version 2.0 (the "License");
9380     * you may not use this file except in compliance with the License.
9381     * You may obtain a copy of the License at
9382     *
9383     * http://www.apache.org/licenses/LICENSE-2.0
9384     *
9385     * Unless required by applicable law or agreed to in writing, software
9386     * distributed under the License is distributed on an "AS IS" BASIS,
9387     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9388     * See the License for the specific language governing permissions and
9389     * limitations under the License.
9390     */
9391
9392    /*
9393     * File: OP_AND_INT.S
9394     */
9395
9396 /* File: x86-atom/binop.S */
9397    /* Copyright (C) 2008 The Android Open Source Project
9398     *
9399     * Licensed under the Apache License, Version 2.0 (the "License");
9400     * you may not use this file except in compliance with the License.
9401     * You may obtain a copy of the License at
9402     *
9403     * http://www.apache.org/licenses/LICENSE-2.0
9404     *
9405     * Unless required by applicable law or agreed to in writing, software
9406     * distributed under the License is distributed on an "AS IS" BASIS,
9407     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9408     * See the License for the specific language governing permissions and
9409     * limitations under the License.
9410     */
9411
9412    /*
9413     * File: binop.S
9414     *
9415     * Code: Generic 32-bit binary operation.  Provides an "instr" line to
9416     *       specify an instruction that performs "%ecx = %ecx op %edx"
9417     *
9418     * For: add-int, and-int, mul-int, or-int, sub-int, xor-int
9419     *
9420     * Description: Perform a binary operation on two source registers
9421     *              and store the result in a destination register.
9422     *
9423     * Format: AA|op CC|BB (23x)
9424     *
9425     * Syntax: op vAA, vBB, vCC
9426     */
9427
9428
9429
9430     FETCH_BB    1, %ecx                 # %ecx<- BB
9431     OLD_JMP_1   2, %eax
9432     OLD_JMP_2   %eax
9433     FETCH_CC    1, %edx                 # %edx<- CC
9434     OLD_JMP_3   2
9435     GET_VREG    %ecx                    # %ecx<- vBB
9436     andl     (rFP, %edx, 4), %ecx                              # %ecx<- vBB op vCC
9437     SET_VREG    %ecx, rINST             # vAA<- %ecx; result
9438     OLD_JMP_4   %eax
9439
9440
9441 /* ------------------------------ */
9442     .balign 64
9443 .L_OP_OR_INT: /* 0x96 */
9444 /* File: x86-atom/OP_OR_INT.S */
9445    /* Copyright (C) 2008 The Android Open Source Project
9446     *
9447     * Licensed under the Apache License, Version 2.0 (the "License");
9448     * you may not use this file except in compliance with the License.
9449     * You may obtain a copy of the License at
9450     *
9451     * http://www.apache.org/licenses/LICENSE-2.0
9452     *
9453     * Unless required by applicable law or agreed to in writing, software
9454     * distributed under the License is distributed on an "AS IS" BASIS,
9455     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9456     * See the License for the specific language governing permissions and
9457     * limitations under the License.
9458     */
9459
9460    /*
9461     * File: OP_OR_INT.S
9462     */
9463
9464 /* File: x86-atom/binop.S */
9465    /* Copyright (C) 2008 The Android Open Source Project
9466     *
9467     * Licensed under the Apache License, Version 2.0 (the "License");
9468     * you may not use this file except in compliance with the License.
9469     * You may obtain a copy of the License at
9470     *
9471     * http://www.apache.org/licenses/LICENSE-2.0
9472     *
9473     * Unless required by applicable law or agreed to in writing, software
9474     * distributed under the License is distributed on an "AS IS" BASIS,
9475     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9476     * See the License for the specific language governing permissions and
9477     * limitations under the License.
9478     */
9479
9480    /*
9481     * File: binop.S
9482     *
9483     * Code: Generic 32-bit binary operation.  Provides an "instr" line to
9484     *       specify an instruction that performs "%ecx = %ecx op %edx"
9485     *
9486     * For: add-int, and-int, mul-int, or-int, sub-int, xor-int
9487     *
9488     * Description: Perform a binary operation on two source registers
9489     *              and store the result in a destination register.
9490     *
9491     * Format: AA|op CC|BB (23x)
9492     *
9493     * Syntax: op vAA, vBB, vCC
9494     */
9495
9496
9497
9498     FETCH_BB    1, %ecx                 # %ecx<- BB
9499     OLD_JMP_1   2, %eax
9500     OLD_JMP_2   %eax
9501     FETCH_CC    1, %edx                 # %edx<- CC
9502     OLD_JMP_3   2
9503     GET_VREG    %ecx                    # %ecx<- vBB
9504     or (rFP, %edx, 4), %ecx                              # %ecx<- vBB op vCC
9505     SET_VREG    %ecx, rINST             # vAA<- %ecx; result
9506     OLD_JMP_4   %eax
9507
9508
9509 /* ------------------------------ */
9510     .balign 64
9511 .L_OP_XOR_INT: /* 0x97 */
9512 /* File: x86-atom/OP_XOR_INT.S */
9513    /* Copyright (C) 2008 The Android Open Source Project
9514     *
9515     * Licensed under the Apache License, Version 2.0 (the "License");
9516     * you may not use this file except in compliance with the License.
9517     * You may obtain a copy of the License at
9518     *
9519     * http://www.apache.org/licenses/LICENSE-2.0
9520     *
9521     * Unless required by applicable law or agreed to in writing, software
9522     * distributed under the License is distributed on an "AS IS" BASIS,
9523     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9524     * See the License for the specific language governing permissions and
9525     * limitations under the License.
9526     */
9527
9528    /*
9529     * File: OP_XOR_INT.S
9530     */
9531
9532 /* File: x86-atom/binop.S */
9533    /* Copyright (C) 2008 The Android Open Source Project
9534     *
9535     * Licensed under the Apache License, Version 2.0 (the "License");
9536     * you may not use this file except in compliance with the License.
9537     * You may obtain a copy of the License at
9538     *
9539     * http://www.apache.org/licenses/LICENSE-2.0
9540     *
9541     * Unless required by applicable law or agreed to in writing, software
9542     * distributed under the License is distributed on an "AS IS" BASIS,
9543     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9544     * See the License for the specific language governing permissions and
9545     * limitations under the License.
9546     */
9547
9548    /*
9549     * File: binop.S
9550     *
9551     * Code: Generic 32-bit binary operation.  Provides an "instr" line to
9552     *       specify an instruction that performs "%ecx = %ecx op %edx"
9553     *
9554     * For: add-int, and-int, mul-int, or-int, sub-int, xor-int
9555     *
9556     * Description: Perform a binary operation on two source registers
9557     *              and store the result in a destination register.
9558     *
9559     * Format: AA|op CC|BB (23x)
9560     *
9561     * Syntax: op vAA, vBB, vCC
9562     */
9563
9564
9565
9566     FETCH_BB    1, %ecx                 # %ecx<- BB
9567     OLD_JMP_1   2, %eax
9568     OLD_JMP_2   %eax
9569     FETCH_CC    1, %edx                 # %edx<- CC
9570     OLD_JMP_3   2
9571     GET_VREG    %ecx                    # %ecx<- vBB
9572     xor     (rFP, %edx, 4), %ecx                              # %ecx<- vBB op vCC
9573     SET_VREG    %ecx, rINST             # vAA<- %ecx; result
9574     OLD_JMP_4   %eax
9575
9576
9577 /* ------------------------------ */
9578     .balign 64
9579 .L_OP_SHL_INT: /* 0x98 */
9580 /* File: x86-atom/OP_SHL_INT.S */
9581    /* Copyright (C) 2008 The Android Open Source Project
9582     *
9583     * Licensed under the Apache License, Version 2.0 (the "License");
9584     * you may not use this file except in compliance with the License.
9585     * You may obtain a copy of the License at
9586     *
9587     * http://www.apache.org/licenses/LICENSE-2.0
9588     *
9589     * Unless required by applicable law or agreed to in writing, software
9590     * distributed under the License is distributed on an "AS IS" BASIS,
9591     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9592     * See the License for the specific language governing permissions and
9593     * limitations under the License.
9594     */
9595
9596    /*
9597     * File: OP_SHL_INT.S
9598     */
9599
9600 /* File: x86-atom/binopS.S */
9601    /* Copyright (C) 2008 The Android Open Source Project
9602     *
9603     * Licensed under the Apache License, Version 2.0 (the "License");
9604     * you may not use this file except in compliance with the License.
9605     * You may obtain a copy of the License at
9606     *
9607     * http://www.apache.org/licenses/LICENSE-2.0
9608     *
9609     * Unless required by applicable law or agreed to in writing, software
9610     * distributed under the License is distributed on an "AS IS" BASIS,
9611     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9612     * See the License for the specific language governing permissions and
9613     * limitations under the License.
9614     */
9615
9616    /*
9617     * File: binopS.S
9618     *
9619     * Code: Generic 32-bit binary operation.  Provides an "instr" line to
9620     *       specify an instruction that performs "%edx = %edx op %cl"
9621     *
9622     * For: shl-int, shr-int, ushr-int
9623     *
9624     * Description: Perform a binary operation on two source registers
9625     *              and store the result in a destination register.
9626     *
9627     * Format: AA|op CC|BB (23x)
9628     *
9629     * Syntax: op vAA, vBB, vCC
9630     */
9631
9632     FETCH_CC    1, %ecx                 # %ecx<- CC
9633     FETCH_BB    1, %edx                 # %edx<- BB
9634     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
9635     addl        $4, rPC                  # update PC
9636     GET_VREG    %ecx                    # %ecx<- vCC
9637     GET_VREG    %edx                    # %edx<- vBB
9638     sal     %cl, %edx                              # %edx<- vBB op +CC
9639     SET_VREG    %edx, rINST             # vAA<- %edx; result
9640     FGETOP_JMP2 %eax                    # jump to next instruction; getop, jmp
9641
9642 /* ------------------------------ */
9643     .balign 64
9644 .L_OP_SHR_INT: /* 0x99 */
9645 /* File: x86-atom/OP_SHR_INT.S */
9646    /* Copyright (C) 2008 The Android Open Source Project
9647     *
9648     * Licensed under the Apache License, Version 2.0 (the "License");
9649     * you may not use this file except in compliance with the License.
9650     * You may obtain a copy of the License at
9651     *
9652     * http://www.apache.org/licenses/LICENSE-2.0
9653     *
9654     * Unless required by applicable law or agreed to in writing, software
9655     * distributed under the License is distributed on an "AS IS" BASIS,
9656     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9657     * See the License for the specific language governing permissions and
9658     * limitations under the License.
9659     */
9660
9661    /*
9662     * File: OP_SHR_INT.S
9663     */
9664
9665 /* File: x86-atom/binopS.S */
9666    /* Copyright (C) 2008 The Android Open Source Project
9667     *
9668     * Licensed under the Apache License, Version 2.0 (the "License");
9669     * you may not use this file except in compliance with the License.
9670     * You may obtain a copy of the License at
9671     *
9672     * http://www.apache.org/licenses/LICENSE-2.0
9673     *
9674     * Unless required by applicable law or agreed to in writing, software
9675     * distributed under the License is distributed on an "AS IS" BASIS,
9676     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9677     * See the License for the specific language governing permissions and
9678     * limitations under the License.
9679     */
9680
9681    /*
9682     * File: binopS.S
9683     *
9684     * Code: Generic 32-bit binary operation.  Provides an "instr" line to
9685     *       specify an instruction that performs "%edx = %edx op %cl"
9686     *
9687     * For: shl-int, shr-int, ushr-int
9688     *
9689     * Description: Perform a binary operation on two source registers
9690     *              and store the result in a destination register.
9691     *
9692     * Format: AA|op CC|BB (23x)
9693     *
9694     * Syntax: op vAA, vBB, vCC
9695     */
9696
9697     FETCH_CC    1, %ecx                 # %ecx<- CC
9698     FETCH_BB    1, %edx                 # %edx<- BB
9699     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
9700     addl        $4, rPC                  # update PC
9701     GET_VREG    %ecx                    # %ecx<- vCC
9702     GET_VREG    %edx                    # %edx<- vBB
9703     sar     %cl, %edx                              # %edx<- vBB op +CC
9704     SET_VREG    %edx, rINST             # vAA<- %edx; result
9705     FGETOP_JMP2 %eax                    # jump to next instruction; getop, jmp
9706
9707 /* ------------------------------ */
9708     .balign 64
9709 .L_OP_USHR_INT: /* 0x9a */
9710 /* File: x86-atom/OP_USHR_INT.S */
9711    /* Copyright (C) 2008 The Android Open Source Project
9712     *
9713     * Licensed under the Apache License, Version 2.0 (the "License");
9714     * you may not use this file except in compliance with the License.
9715     * You may obtain a copy of the License at
9716     *
9717     * http://www.apache.org/licenses/LICENSE-2.0
9718     *
9719     * Unless required by applicable law or agreed to in writing, software
9720     * distributed under the License is distributed on an "AS IS" BASIS,
9721     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9722     * See the License for the specific language governing permissions and
9723     * limitations under the License.
9724     */
9725
9726    /*
9727     * File: OP_USHR_INT.S
9728     */
9729
9730 /* File: x86-atom/binopS.S */
9731    /* Copyright (C) 2008 The Android Open Source Project
9732     *
9733     * Licensed under the Apache License, Version 2.0 (the "License");
9734     * you may not use this file except in compliance with the License.
9735     * You may obtain a copy of the License at
9736     *
9737     * http://www.apache.org/licenses/LICENSE-2.0
9738     *
9739     * Unless required by applicable law or agreed to in writing, software
9740     * distributed under the License is distributed on an "AS IS" BASIS,
9741     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9742     * See the License for the specific language governing permissions and
9743     * limitations under the License.
9744     */
9745
9746    /*
9747     * File: binopS.S
9748     *
9749     * Code: Generic 32-bit binary operation.  Provides an "instr" line to
9750     *       specify an instruction that performs "%edx = %edx op %cl"
9751     *
9752     * For: shl-int, shr-int, ushr-int
9753     *
9754     * Description: Perform a binary operation on two source registers
9755     *              and store the result in a destination register.
9756     *
9757     * Format: AA|op CC|BB (23x)
9758     *
9759     * Syntax: op vAA, vBB, vCC
9760     */
9761
9762     FETCH_CC    1, %ecx                 # %ecx<- CC
9763     FETCH_BB    1, %edx                 # %edx<- BB
9764     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
9765     addl        $4, rPC                  # update PC
9766     GET_VREG    %ecx                    # %ecx<- vCC
9767     GET_VREG    %edx                    # %edx<- vBB
9768     shr     %cl, %edx                              # %edx<- vBB op +CC
9769     SET_VREG    %edx, rINST             # vAA<- %edx; result
9770     FGETOP_JMP2 %eax                    # jump to next instruction; getop, jmp
9771
9772 /* ------------------------------ */
9773     .balign 64
9774 .L_OP_ADD_LONG: /* 0x9b */
9775 /* File: x86-atom/OP_ADD_LONG.S */
9776    /* Copyright (C) 2008 The Android Open Source Project
9777     *
9778     * Licensed under the Apache License, Version 2.0 (the "License");
9779     * you may not use this file except in compliance with the License.
9780     * You may obtain a copy of the License at
9781     *
9782     * http://www.apache.org/licenses/LICENSE-2.0
9783     *
9784     * Unless required by applicable law or agreed to in writing, software
9785     * distributed under the License is distributed on an "AS IS" BASIS,
9786     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9787     * See the License for the specific language governing permissions and
9788     * limitations under the License.
9789     */
9790
9791    /*
9792     * File: OP_ADD_LONG.S
9793     */
9794
9795 /* File: x86-atom/binopWide.S */
9796    /* Copyright (C) 2008 The Android Open Source Project
9797     *
9798     * Licensed under the Apache License, Version 2.0 (the "License");
9799     * you may not use this file except in compliance with the License.
9800     * You may obtain a copy of the License at
9801     *
9802     * http://www.apache.org/licenses/LICENSE-2.0
9803     *
9804     * Unless required by applicable law or agreed to in writing, software
9805     * distributed under the License is distributed on an "AS IS" BASIS,
9806     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9807     * See the License for the specific language governing permissions and
9808     * limitations under the License.
9809     */
9810
9811    /*
9812     * File: binopWide.S
9813     *
9814     * Code: Generic 64-bit binary operation.  Provides an "instr" variable to
9815     *       specify an instruction that performs "%xmm0 = %xmm0 op %xmm1"
9816     *
9817     * For: add-double, add-long, and-long, mul-double, or-long,
9818     *      sub-double, sub-long, xor-long
9819     *
9820     * Description: Perform a binary operation on two source registers
9821     *              and store the result in a destination register.
9822     *
9823     * Format: AA|op CC|BB (23x)
9824     *
9825     * Syntax: op vAA, vBB, vCC
9826     */
9827
9828     FETCH_BB    1, %ecx                 # %ecx<- BB
9829     FETCH_CC    1, %edx                 # %edx<- CC
9830     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
9831     movq        (rFP, %ecx, 4), %xmm0   # %xmm0<- vBB
9832     movq        (rFP, %edx, 4), %xmm1   # %xmm1<- vCC
9833     paddq   %xmm1, %xmm0                              # %xmm0<- vBB op vCC
9834     movq        %xmm0, (rFP, rINST, 4)  # vAA<- %ecx
9835     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
9836
9837 /* ------------------------------ */
9838     .balign 64
9839 .L_OP_SUB_LONG: /* 0x9c */
9840 /* File: x86-atom/OP_SUB_LONG.S */
9841    /* Copyright (C) 2008 The Android Open Source Project
9842     *
9843     * Licensed under the Apache License, Version 2.0 (the "License");
9844     * you may not use this file except in compliance with the License.
9845     * You may obtain a copy of the License at
9846     *
9847     * http://www.apache.org/licenses/LICENSE-2.0
9848     *
9849     * Unless required by applicable law or agreed to in writing, software
9850     * distributed under the License is distributed on an "AS IS" BASIS,
9851     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9852     * See the License for the specific language governing permissions and
9853     * limitations under the License.
9854     */
9855
9856    /*
9857     * File: OP_SUB_LONG.S
9858     */
9859
9860 /* File: x86-atom/binopWide.S */
9861    /* Copyright (C) 2008 The Android Open Source Project
9862     *
9863     * Licensed under the Apache License, Version 2.0 (the "License");
9864     * you may not use this file except in compliance with the License.
9865     * You may obtain a copy of the License at
9866     *
9867     * http://www.apache.org/licenses/LICENSE-2.0
9868     *
9869     * Unless required by applicable law or agreed to in writing, software
9870     * distributed under the License is distributed on an "AS IS" BASIS,
9871     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9872     * See the License for the specific language governing permissions and
9873     * limitations under the License.
9874     */
9875
9876    /*
9877     * File: binopWide.S
9878     *
9879     * Code: Generic 64-bit binary operation.  Provides an "instr" variable to
9880     *       specify an instruction that performs "%xmm0 = %xmm0 op %xmm1"
9881     *
9882     * For: add-double, add-long, and-long, mul-double, or-long,
9883     *      sub-double, sub-long, xor-long
9884     *
9885     * Description: Perform a binary operation on two source registers
9886     *              and store the result in a destination register.
9887     *
9888     * Format: AA|op CC|BB (23x)
9889     *
9890     * Syntax: op vAA, vBB, vCC
9891     */
9892
9893     FETCH_BB    1, %ecx                 # %ecx<- BB
9894     FETCH_CC    1, %edx                 # %edx<- CC
9895     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
9896     movq        (rFP, %ecx, 4), %xmm0   # %xmm0<- vBB
9897     movq        (rFP, %edx, 4), %xmm1   # %xmm1<- vCC
9898     psubq    %xmm1, %xmm0                              # %xmm0<- vBB op vCC
9899     movq        %xmm0, (rFP, rINST, 4)  # vAA<- %ecx
9900     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
9901
9902 /* ------------------------------ */
9903     .balign 64
9904 .L_OP_MUL_LONG: /* 0x9d */
9905 /* File: x86-atom/OP_MUL_LONG.S */
9906    /* Copyright (C) 2008 The Android Open Source Project
9907     *
9908     * Licensed under the Apache License, Version 2.0 (the "License");
9909     * you may not use this file except in compliance with the License.
9910     * You may obtain a copy of the License at
9911     *
9912     * http://www.apache.org/licenses/LICENSE-2.0
9913     *
9914     * Unless required by applicable law or agreed to in writing, software
9915     * distributed under the License is distributed on an "AS IS" BASIS,
9916     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9917     * See the License for the specific language governing permissions and
9918     * limitations under the License.
9919     */
9920
9921    /*
9922     * File: OP_MUL_LONG.S
9923     *
9924     * Code: 64-bit integer multiply
9925     *
9926     * For: mul-long
9927     *
9928     * Description: Multiply two source registers and store the
9929     *              result in a destination register.
9930     *
9931     * Format: AA|op CC|BB (23x)
9932     *
9933     * Syntax: op vAA, vBB, vCC
9934     */
9935
9936    /*
9937     * Signed 64-bit integer multiply.
9938     *
9939     * Consider WXxYZ (r1r0 x r3r2) with a long multiply:
9940     *        WX
9941     *      x YZ
9942     *  --------
9943     *     ZW ZX
9944     *  YW YX
9945     *
9946     * The low word of the result holds ZX, the high word holds
9947     * (ZW+YX) + (the high overflow from ZX).  YW doesn't matter because
9948     * it doesn't fit in the low 64 bits.
9949     */
9950
9951     movl        rINST, -4(%esp)         # -4(%esp)<- AA+
9952     FETCH_BB    1, rINST                # rINST<- BB
9953     FETCH_CC    1, %edx                 # %edx<- CC
9954     jmp         .LOP_MUL_LONG_finish
9955
9956 /* ------------------------------ */
9957     .balign 64
9958 .L_OP_DIV_LONG: /* 0x9e */
9959 /* File: x86-atom/OP_DIV_LONG.S */
9960    /* Copyright (C) 2008 The Android Open Source Project
9961     *
9962     * Licensed under the Apache License, Version 2.0 (the "License");
9963     * you may not use this file except in compliance with the License.
9964     * You may obtain a copy of the License at
9965     *
9966     * http://www.apache.org/licenses/LICENSE-2.0
9967     *
9968     * Unless required by applicable law or agreed to in writing, software
9969     * distributed under the License is distributed on an "AS IS" BASIS,
9970     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9971     * See the License for the specific language governing permissions and
9972     * limitations under the License.
9973     */
9974
9975    /*
9976     * File: OP_DIV_LONG.S
9977     */
9978
9979 /* File: x86-atom/binopDivRemLong.S */
9980    /* Copyright (C) 2008 The Android Open Source Project
9981     *
9982     * Licensed under the Apache License, Version 2.0 (the "License");
9983     * you may not use this file except in compliance with the License.
9984     * You may obtain a copy of the License at
9985     *
9986     * http://www.apache.org/licenses/LICENSE-2.0
9987     *
9988     * Unless required by applicable law or agreed to in writing, software
9989     * distributed under the License is distributed on an "AS IS" BASIS,
9990     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9991     * See the License for the specific language governing permissions and
9992     * limitations under the License.
9993     */
9994
9995    /*
9996     * File: binopDivRemLong.S
9997     *
9998     * Code: 64-bit long divide operation. Variable
9999     *       "func" defines the function called to do the operation.
10000     *
10001     * For: div-long, rem-long
10002     *
10003     * Description: Perform a binary operation on two source registers
10004     *              and store the result in a destination register.
10005     *
10006     * Format: AA|op CC|BB (23x)
10007     *
10008     * Syntax: op vAA, vBB, vCC
10009     */
10010
10011
10012     FETCH_CC    1, %edx                 # %edx<- CC
10013     movl        (rFP, %edx, 4), %eax    # %eax<- vCC
10014     movl        4(rFP, %edx, 4), %ecx   # %ecx<- vCC+1
10015     movl        %eax, -8(%esp)          # push arg vCC
10016     or          %ecx, %eax              # check for divide by zero
10017     je          common_errDivideByZero  # handle divide by zero
10018     FETCH_BB    1, %edx                 # %edx<- BB
10019     movl        %ecx, -4(%esp)          # push arg vCC+1
10020     movq        (rFP, %edx, 4), %xmm0   # %xmm0<- vBB,vBB+1
10021     jmp         .LOP_DIV_LONG_finish
10022
10023
10024 /* ------------------------------ */
10025     .balign 64
10026 .L_OP_REM_LONG: /* 0x9f */
10027 /* File: x86-atom/OP_REM_LONG.S */
10028    /* Copyright (C) 2008 The Android Open Source Project
10029     *
10030     * Licensed under the Apache License, Version 2.0 (the "License");
10031     * you may not use this file except in compliance with the License.
10032     * You may obtain a copy of the License at
10033     *
10034     * http://www.apache.org/licenses/LICENSE-2.0
10035     *
10036     * Unless required by applicable law or agreed to in writing, software
10037     * distributed under the License is distributed on an "AS IS" BASIS,
10038     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10039     * See the License for the specific language governing permissions and
10040     * limitations under the License.
10041     */
10042
10043    /*
10044     * File: OP_REM_LONG.S
10045     */
10046
10047 /* File: x86-atom/binopDivRemLong.S */
10048    /* Copyright (C) 2008 The Android Open Source Project
10049     *
10050     * Licensed under the Apache License, Version 2.0 (the "License");
10051     * you may not use this file except in compliance with the License.
10052     * You may obtain a copy of the License at
10053     *
10054     * http://www.apache.org/licenses/LICENSE-2.0
10055     *
10056     * Unless required by applicable law or agreed to in writing, software
10057     * distributed under the License is distributed on an "AS IS" BASIS,
10058     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10059     * See the License for the specific language governing permissions and
10060     * limitations under the License.
10061     */
10062
10063    /*
10064     * File: binopDivRemLong.S
10065     *
10066     * Code: 64-bit long divide operation. Variable
10067     *       "func" defines the function called to do the operation.
10068     *
10069     * For: div-long, rem-long
10070     *
10071     * Description: Perform a binary operation on two source registers
10072     *              and store the result in a destination register.
10073     *
10074     * Format: AA|op CC|BB (23x)
10075     *
10076     * Syntax: op vAA, vBB, vCC
10077     */
10078
10079
10080     FETCH_CC    1, %edx                 # %edx<- CC
10081     movl        (rFP, %edx, 4), %eax    # %eax<- vCC
10082     movl        4(rFP, %edx, 4), %ecx   # %ecx<- vCC+1
10083     movl        %eax, -8(%esp)          # push arg vCC
10084     or          %ecx, %eax              # check for divide by zero
10085     je          common_errDivideByZero  # handle divide by zero
10086     FETCH_BB    1, %edx                 # %edx<- BB
10087     movl        %ecx, -4(%esp)          # push arg vCC+1
10088     movq        (rFP, %edx, 4), %xmm0   # %xmm0<- vBB,vBB+1
10089     jmp         .LOP_REM_LONG_finish
10090
10091
10092 /* ------------------------------ */
10093     .balign 64
10094 .L_OP_AND_LONG: /* 0xa0 */
10095 /* File: x86-atom/OP_AND_LONG.S */
10096    /* Copyright (C) 2008 The Android Open Source Project
10097     *
10098     * Licensed under the Apache License, Version 2.0 (the "License");
10099     * you may not use this file except in compliance with the License.
10100     * You may obtain a copy of the License at
10101     *
10102     * http://www.apache.org/licenses/LICENSE-2.0
10103     *
10104     * Unless required by applicable law or agreed to in writing, software
10105     * distributed under the License is distributed on an "AS IS" BASIS,
10106     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10107     * See the License for the specific language governing permissions and
10108     * limitations under the License.
10109     */
10110
10111    /*
10112     * File: OP_AND_LONG.S
10113     */
10114
10115 /* File: x86-atom/binopWide.S */
10116    /* Copyright (C) 2008 The Android Open Source Project
10117     *
10118     * Licensed under the Apache License, Version 2.0 (the "License");
10119     * you may not use this file except in compliance with the License.
10120     * You may obtain a copy of the License at
10121     *
10122     * http://www.apache.org/licenses/LICENSE-2.0
10123     *
10124     * Unless required by applicable law or agreed to in writing, software
10125     * distributed under the License is distributed on an "AS IS" BASIS,
10126     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10127     * See the License for the specific language governing permissions and
10128     * limitations under the License.
10129     */
10130
10131    /*
10132     * File: binopWide.S
10133     *
10134     * Code: Generic 64-bit binary operation.  Provides an "instr" variable to
10135     *       specify an instruction that performs "%xmm0 = %xmm0 op %xmm1"
10136     *
10137     * For: add-double, add-long, and-long, mul-double, or-long,
10138     *      sub-double, sub-long, xor-long
10139     *
10140     * Description: Perform a binary operation on two source registers
10141     *              and store the result in a destination register.
10142     *
10143     * Format: AA|op CC|BB (23x)
10144     *
10145     * Syntax: op vAA, vBB, vCC
10146     */
10147
10148     FETCH_BB    1, %ecx                 # %ecx<- BB
10149     FETCH_CC    1, %edx                 # %edx<- CC
10150     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
10151     movq        (rFP, %ecx, 4), %xmm0   # %xmm0<- vBB
10152     movq        (rFP, %edx, 4), %xmm1   # %xmm1<- vCC
10153     pand   %xmm1, %xmm0                              # %xmm0<- vBB op vCC
10154     movq        %xmm0, (rFP, rINST, 4)  # vAA<- %ecx
10155     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
10156
10157 /* ------------------------------ */
10158     .balign 64
10159 .L_OP_OR_LONG: /* 0xa1 */
10160 /* File: x86-atom/OP_OR_LONG.S */
10161    /* Copyright (C) 2008 The Android Open Source Project
10162     *
10163     * Licensed under the Apache License, Version 2.0 (the "License");
10164     * you may not use this file except in compliance with the License.
10165     * You may obtain a copy of the License at
10166     *
10167     * http://www.apache.org/licenses/LICENSE-2.0
10168     *
10169     * Unless required by applicable law or agreed to in writing, software
10170     * distributed under the License is distributed on an "AS IS" BASIS,
10171     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10172     * See the License for the specific language governing permissions and
10173     * limitations under the License.
10174     */
10175
10176    /*
10177     * File: OP_OR_LONG.S
10178     */
10179
10180 /* File: x86-atom/binopWide.S */
10181    /* Copyright (C) 2008 The Android Open Source Project
10182     *
10183     * Licensed under the Apache License, Version 2.0 (the "License");
10184     * you may not use this file except in compliance with the License.
10185     * You may obtain a copy of the License at
10186     *
10187     * http://www.apache.org/licenses/LICENSE-2.0
10188     *
10189     * Unless required by applicable law or agreed to in writing, software
10190     * distributed under the License is distributed on an "AS IS" BASIS,
10191     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10192     * See the License for the specific language governing permissions and
10193     * limitations under the License.
10194     */
10195
10196    /*
10197     * File: binopWide.S
10198     *
10199     * Code: Generic 64-bit binary operation.  Provides an "instr" variable to
10200     *       specify an instruction that performs "%xmm0 = %xmm0 op %xmm1"
10201     *
10202     * For: add-double, add-long, and-long, mul-double, or-long,
10203     *      sub-double, sub-long, xor-long
10204     *
10205     * Description: Perform a binary operation on two source registers
10206     *              and store the result in a destination register.
10207     *
10208     * Format: AA|op CC|BB (23x)
10209     *
10210     * Syntax: op vAA, vBB, vCC
10211     */
10212
10213     FETCH_BB    1, %ecx                 # %ecx<- BB
10214     FETCH_CC    1, %edx                 # %edx<- CC
10215     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
10216     movq        (rFP, %ecx, 4), %xmm0   # %xmm0<- vBB
10217     movq        (rFP, %edx, 4), %xmm1   # %xmm1<- vCC
10218     por %xmm1, %xmm0                              # %xmm0<- vBB op vCC
10219     movq        %xmm0, (rFP, rINST, 4)  # vAA<- %ecx
10220     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
10221
10222 /* ------------------------------ */
10223     .balign 64
10224 .L_OP_XOR_LONG: /* 0xa2 */
10225 /* File: x86-atom/OP_XOR_LONG.S */
10226    /* Copyright (C) 2008 The Android Open Source Project
10227     *
10228     * Licensed under the Apache License, Version 2.0 (the "License");
10229     * you may not use this file except in compliance with the License.
10230     * You may obtain a copy of the License at
10231     *
10232     * http://www.apache.org/licenses/LICENSE-2.0
10233     *
10234     * Unless required by applicable law or agreed to in writing, software
10235     * distributed under the License is distributed on an "AS IS" BASIS,
10236     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10237     * See the License for the specific language governing permissions and
10238     * limitations under the License.
10239     */
10240
10241    /*
10242     * File: OP_XOR_LONG.S
10243     */
10244
10245 /* File: x86-atom/binopWide.S */
10246    /* Copyright (C) 2008 The Android Open Source Project
10247     *
10248     * Licensed under the Apache License, Version 2.0 (the "License");
10249     * you may not use this file except in compliance with the License.
10250     * You may obtain a copy of the License at
10251     *
10252     * http://www.apache.org/licenses/LICENSE-2.0
10253     *
10254     * Unless required by applicable law or agreed to in writing, software
10255     * distributed under the License is distributed on an "AS IS" BASIS,
10256     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10257     * See the License for the specific language governing permissions and
10258     * limitations under the License.
10259     */
10260
10261    /*
10262     * File: binopWide.S
10263     *
10264     * Code: Generic 64-bit binary operation.  Provides an "instr" variable to
10265     *       specify an instruction that performs "%xmm0 = %xmm0 op %xmm1"
10266     *
10267     * For: add-double, add-long, and-long, mul-double, or-long,
10268     *      sub-double, sub-long, xor-long
10269     *
10270     * Description: Perform a binary operation on two source registers
10271     *              and store the result in a destination register.
10272     *
10273     * Format: AA|op CC|BB (23x)
10274     *
10275     * Syntax: op vAA, vBB, vCC
10276     */
10277
10278     FETCH_BB    1, %ecx                 # %ecx<- BB
10279     FETCH_CC    1, %edx                 # %edx<- CC
10280     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
10281     movq        (rFP, %ecx, 4), %xmm0   # %xmm0<- vBB
10282     movq        (rFP, %edx, 4), %xmm1   # %xmm1<- vCC
10283     pxor   %xmm1, %xmm0                              # %xmm0<- vBB op vCC
10284     movq        %xmm0, (rFP, rINST, 4)  # vAA<- %ecx
10285     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
10286
10287 /* ------------------------------ */
10288     .balign 64
10289 .L_OP_SHL_LONG: /* 0xa3 */
10290 /* File: x86-atom/OP_SHL_LONG.S */
10291    /* Copyright (C) 2008 The Android Open Source Project
10292     *
10293     * Licensed under the Apache License, Version 2.0 (the "License");
10294     * you may not use this file except in compliance with the License.
10295     * You may obtain a copy of the License at
10296     *
10297     * http://www.apache.org/licenses/LICENSE-2.0
10298     *
10299     * Unless required by applicable law or agreed to in writing, software
10300     * distributed under the License is distributed on an "AS IS" BASIS,
10301     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10302     * See the License for the specific language governing permissions and
10303     * limitations under the License.
10304     */
10305
10306    /*
10307     * File: OP_SHL_LONG.S
10308     *
10309     * Code: Performs a shift left long. Uses no substitutions.
10310     *
10311     * For: shl-long
10312     *
10313     * Description: Perform a binary shift operation using two source registers
10314     *              where one is the shift amount and the other is the value to shift.
10315     *              Store the result in a destination register.
10316     *
10317     * Format: AA|op CC|BB (23x)
10318     *
10319     * Syntax: op vAA, vBB, vCC
10320     */
10321
10322     FETCH_CC    1, %eax                 # %eax<- CC
10323     FETCH_BB    1, %edx                 # %edx<- BB
10324     movq        .LshiftMask, %xmm2      # %xmm2<- mask for the shift bits
10325     movss       (rFP, %eax, 4), %xmm0   # %xmm0<- vCC
10326     pand        %xmm2, %xmm0            # %xmm0<- masked shift bits
10327     movq        (rFP, %edx, 4), %xmm1   # %xmm1<- vBB
10328     psllq       %xmm0, %xmm1            # %xmm1<- shifted vBB
10329     movq        %xmm1, (rFP, rINST, 4)  # vAA<- shifted vBB
10330     FINISH      2                       # jump to next instruction
10331
10332 /* ------------------------------ */
10333     .balign 64
10334 .L_OP_SHR_LONG: /* 0xa4 */
10335 /* File: x86-atom/OP_SHR_LONG.S */
10336    /* Copyright (C) 2008 The Android Open Source Project
10337     *
10338     * Licensed under the Apache License, Version 2.0 (the "License");
10339     * you may not use this file except in compliance with the License.
10340     * You may obtain a copy of the License at
10341     *
10342     * http://www.apache.org/licenses/LICENSE-2.0
10343     *
10344     * Unless required by applicable law or agreed to in writing, software
10345     * distributed under the License is distributed on an "AS IS" BASIS,
10346     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10347     * See the License for the specific language governing permissions and
10348     * limitations under the License.
10349     */
10350
10351    /*
10352     * File: OP_SHR_LONG.S
10353     *
10354     * Code: Performs a shift right long
10355     *
10356     * For: shl-long
10357     *
10358     * Description: Perform a binary shift operation using two source registers
10359     *              where one is the shift amount and the other is the value to shift.
10360     *              Store the result in a destination register.
10361     *
10362     * Format: AA|op CC|BB (23x)
10363     *
10364     * Syntax: op vAA, vBB, vCC
10365     */
10366
10367     FETCH_BB    1, %edx                 # %edx<- BB
10368     FETCH_CC    1, %eax                 # %eax<- CC
10369     movq        (rFP, %edx, 4), %xmm1   # %xmm1<- vBB
10370     movss       (rFP, %eax, 4), %xmm0   # %xmm0<- vCC
10371     movq        .LshiftMask, %xmm2
10372     pand        %xmm2, %xmm0            # %xmm0<- masked for the shift bits
10373     psrlq       %xmm0, %xmm1            # %xmm1<- shifted vBB
10374     cmpl        $0, 4(rFP, %edx, 4)    # check if we need to consider sign
10375     jl          .LOP_SHR_LONG_finish      # consider sign
10376     jmp         .LOP_SHR_LONG_final       # sign is fine, finish
10377
10378 /* ------------------------------ */
10379     .balign 64
10380 .L_OP_USHR_LONG: /* 0xa5 */
10381 /* File: x86-atom/OP_USHR_LONG.S */
10382    /* Copyright (C) 2008 The Android Open Source Project
10383     *
10384     * Licensed under the Apache License, Version 2.0 (the "License");
10385     * you may not use this file except in compliance with the License.
10386     * You may obtain a copy of the License at
10387     *
10388     * http://www.apache.org/licenses/LICENSE-2.0
10389     *
10390     * Unless required by applicable law or agreed to in writing, software
10391     * distributed under the License is distributed on an "AS IS" BASIS,
10392     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10393     * See the License for the specific language governing permissions and
10394     * limitations under the License.
10395     */
10396
10397    /*
10398     * File: OP_USHR_LONG.S
10399     *
10400     * Code: Performs an unsigned shift right long operation. Uses no substitutions.
10401     *
10402     * For: ushr-long
10403     *
10404     * Description: Perform a binary shift operation using two source registers
10405     *              where one is the shift amount and the other is the value to shift.
10406     *
10407     * Format: AA|op CC|BB (23x)
10408     *
10409     * Syntax: op vAA, vBB, vCC
10410     */
10411
10412     FETCH_CC    1, %eax                 # %eax<- CC
10413     FETCH_BB    1, %edx                 # %edx<- BB
10414     movsd        .LshiftMask, %xmm2     # %xmm2<- mask for the shift bits
10415     movss       (rFP, %eax, 4), %xmm0   # %xmm0<- vCC
10416     pand        %xmm2, %xmm0            # %xmm0<- masked shift bits
10417     movsd       (rFP, %edx, 4), %xmm1   # %xmm1<- vBB
10418     psrlq       %xmm0, %xmm1            # %xmm1<- shifted vBB
10419     movsd       %xmm1, (rFP, rINST, 4)  # vAA<- shifted vBB
10420     FINISH      2                       # jump to next instruction
10421
10422 /* ------------------------------ */
10423     .balign 64
10424 .L_OP_ADD_FLOAT: /* 0xa6 */
10425 /* File: x86-atom/OP_ADD_FLOAT.S */
10426    /* Copyright (C) 2008 The Android Open Source Project
10427     *
10428     * Licensed under the Apache License, Version 2.0 (the "License");
10429     * you may not use this file except in compliance with the License.
10430     * You may obtain a copy of the License at
10431     *
10432     * http://www.apache.org/licenses/LICENSE-2.0
10433     *
10434     * Unless required by applicable law or agreed to in writing, software
10435     * distributed under the License is distributed on an "AS IS" BASIS,
10436     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10437     * See the License for the specific language governing permissions and
10438     * limitations under the License.
10439     */
10440
10441    /*
10442     * File: OP_ADD_FLOAT.S
10443     */
10444
10445 /* File: x86-atom/binopF.S */
10446    /* Copyright (C) 2008 The Android Open Source Project
10447     *
10448     * Licensed under the Apache License, Version 2.0 (the "License");
10449     * you may not use this file except in compliance with the License.
10450     * You may obtain a copy of the License at
10451     *
10452     * http://www.apache.org/licenses/LICENSE-2.0
10453     *
10454     * Unless required by applicable law or agreed to in writing, software
10455     * distributed under the License is distributed on an "AS IS" BASIS,
10456     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10457     * See the License for the specific language governing permissions and
10458     * limitations under the License.
10459     */
10460
10461    /*
10462     * File: binopF.S
10463     *
10464     * Code: Generic 32-bit binary operation.  Provides an "instr" line to
10465     *       specify an instruction that performs "%xmm0 = %xmm0 op %xmm1"
10466     *
10467     * For: add-float, mul-float, sub-float
10468     *
10469     * Description: Perform a binary operation on two source registers
10470     *              and store the result in a destination register.
10471     *
10472     * Format: AA|op CC|BB (23x)
10473     *
10474     * Syntax: op vAA, vBB, vCC
10475     */
10476
10477     FETCH_BB    1, %ecx                 # %ecx<- BB
10478     FETCH_CC    1, %edx                 # %edx<- CC
10479     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
10480     movss       (rFP, %ecx, 4), %xmm0   # %xmm0<-vBB
10481     movss       (rFP, %edx, 4), %xmm1   # %xmm1<- vCC
10482     addss     %xmm1, %xmm0                              # %xmm0<- vBB op vCC
10483     movss       %xmm0, (rFP, rINST, 4)  # vAA<- %xmm0; result
10484     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
10485
10486 /* ------------------------------ */
10487     .balign 64
10488 .L_OP_SUB_FLOAT: /* 0xa7 */
10489 /* File: x86-atom/OP_SUB_FLOAT.S */
10490    /* Copyright (C) 2008 The Android Open Source Project
10491     *
10492     * Licensed under the Apache License, Version 2.0 (the "License");
10493     * you may not use this file except in compliance with the License.
10494     * You may obtain a copy of the License at
10495     *
10496     * http://www.apache.org/licenses/LICENSE-2.0
10497     *
10498     * Unless required by applicable law or agreed to in writing, software
10499     * distributed under the License is distributed on an "AS IS" BASIS,
10500     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10501     * See the License for the specific language governing permissions and
10502     * limitations under the License.
10503     */
10504
10505    /*
10506     * File: OP_SUB_FLOAT.S
10507     */
10508
10509 /* File: x86-atom/binopF.S */
10510    /* Copyright (C) 2008 The Android Open Source Project
10511     *
10512     * Licensed under the Apache License, Version 2.0 (the "License");
10513     * you may not use this file except in compliance with the License.
10514     * You may obtain a copy of the License at
10515     *
10516     * http://www.apache.org/licenses/LICENSE-2.0
10517     *
10518     * Unless required by applicable law or agreed to in writing, software
10519     * distributed under the License is distributed on an "AS IS" BASIS,
10520     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10521     * See the License for the specific language governing permissions and
10522     * limitations under the License.
10523     */
10524
10525    /*
10526     * File: binopF.S
10527     *
10528     * Code: Generic 32-bit binary operation.  Provides an "instr" line to
10529     *       specify an instruction that performs "%xmm0 = %xmm0 op %xmm1"
10530     *
10531     * For: add-float, mul-float, sub-float
10532     *
10533     * Description: Perform a binary operation on two source registers
10534     *              and store the result in a destination register.
10535     *
10536     * Format: AA|op CC|BB (23x)
10537     *
10538     * Syntax: op vAA, vBB, vCC
10539     */
10540
10541     FETCH_BB    1, %ecx                 # %ecx<- BB
10542     FETCH_CC    1, %edx                 # %edx<- CC
10543     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
10544     movss       (rFP, %ecx, 4), %xmm0   # %xmm0<-vBB
10545     movss       (rFP, %edx, 4), %xmm1   # %xmm1<- vCC
10546     subss     %xmm1, %xmm0                              # %xmm0<- vBB op vCC
10547     movss       %xmm0, (rFP, rINST, 4)  # vAA<- %xmm0; result
10548     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
10549
10550 /* ------------------------------ */
10551     .balign 64
10552 .L_OP_MUL_FLOAT: /* 0xa8 */
10553 /* File: x86-atom/OP_MUL_FLOAT.S */
10554    /* Copyright (C) 2008 The Android Open Source Project
10555     *
10556     * Licensed under the Apache License, Version 2.0 (the "License");
10557     * you may not use this file except in compliance with the License.
10558     * You may obtain a copy of the License at
10559     *
10560     * http://www.apache.org/licenses/LICENSE-2.0
10561     *
10562     * Unless required by applicable law or agreed to in writing, software
10563     * distributed under the License is distributed on an "AS IS" BASIS,
10564     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10565     * See the License for the specific language governing permissions and
10566     * limitations under the License.
10567     */
10568
10569    /*
10570     * File: OP_MUL_FLOAT.S
10571     */
10572
10573 /* File: x86-atom/binopF.S */
10574    /* Copyright (C) 2008 The Android Open Source Project
10575     *
10576     * Licensed under the Apache License, Version 2.0 (the "License");
10577     * you may not use this file except in compliance with the License.
10578     * You may obtain a copy of the License at
10579     *
10580     * http://www.apache.org/licenses/LICENSE-2.0
10581     *
10582     * Unless required by applicable law or agreed to in writing, software
10583     * distributed under the License is distributed on an "AS IS" BASIS,
10584     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10585     * See the License for the specific language governing permissions and
10586     * limitations under the License.
10587     */
10588
10589    /*
10590     * File: binopF.S
10591     *
10592     * Code: Generic 32-bit binary operation.  Provides an "instr" line to
10593     *       specify an instruction that performs "%xmm0 = %xmm0 op %xmm1"
10594     *
10595     * For: add-float, mul-float, sub-float
10596     *
10597     * Description: Perform a binary operation on two source registers
10598     *              and store the result in a destination register.
10599     *
10600     * Format: AA|op CC|BB (23x)
10601     *
10602     * Syntax: op vAA, vBB, vCC
10603     */
10604
10605     FETCH_BB    1, %ecx                 # %ecx<- BB
10606     FETCH_CC    1, %edx                 # %edx<- CC
10607     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
10608     movss       (rFP, %ecx, 4), %xmm0   # %xmm0<-vBB
10609     movss       (rFP, %edx, 4), %xmm1   # %xmm1<- vCC
10610     mulss %xmm1, %xmm0                              # %xmm0<- vBB op vCC
10611     movss       %xmm0, (rFP, rINST, 4)  # vAA<- %xmm0; result
10612     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
10613
10614 /* ------------------------------ */
10615     .balign 64
10616 .L_OP_DIV_FLOAT: /* 0xa9 */
10617 /* File: x86-atom/OP_DIV_FLOAT.S */
10618    /* Copyright (C) 2008 The Android Open Source Project
10619     *
10620     * Licensed under the Apache License, Version 2.0 (the "License");
10621     * you may not use this file except in compliance with the License.
10622     * You may obtain a copy of the License at
10623     *
10624     * http://www.apache.org/licenses/LICENSE-2.0
10625     *
10626     * Unless required by applicable law or agreed to in writing, software
10627     * distributed under the License is distributed on an "AS IS" BASIS,
10628     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10629     * See the License for the specific language governing permissions and
10630     * limitations under the License.
10631     */
10632
10633    /*
10634     * File: OP_DIV_FLOAT.S
10635     *
10636     * Code: Divides floats. Uses no substitutions.
10637     *
10638     * For: div-float
10639     *
10640     * Description: Divide operation on two source registers, storing
10641     *              the result in a destiniation register
10642     *
10643     * Format: AA|op CC|BB (23x)
10644     *
10645     * Syntax: op vAA, vBB, vCC
10646     */
10647
10648     FETCH_BB    1, %eax                 # %eax<- BB
10649     FETCH_CC    1, %ecx                 # %ecx<- CC
10650     flds        (rFP, %eax, 4)          # floating point stack vBB
10651     fdivs       (rFP, %ecx, 4)          # divide double; vBB/vCC
10652     fstps       (rFP, rINST, 4)         # vAA<- result
10653     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
10654     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
10655
10656 /* ------------------------------ */
10657     .balign 64
10658 .L_OP_REM_FLOAT: /* 0xaa */
10659 /* File: x86-atom/OP_REM_FLOAT.S */
10660    /* Copyright (C) 2008 The Android Open Source Project
10661     *
10662     * Licensed under the Apache License, Version 2.0 (the "License");
10663     * you may not use this file except in compliance with the License.
10664     * You may obtain a copy of the License at
10665     *
10666     * http://www.apache.org/licenses/LICENSE-2.0
10667     *
10668     * Unless required by applicable law or agreed to in writing, software
10669     * distributed under the License is distributed on an "AS IS" BASIS,
10670     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10671     * See the License for the specific language governing permissions and
10672     * limitations under the License.
10673     */
10674
10675    /*
10676     * File: OP_REM_FLOAT.S
10677     *
10678     * Code: Computes the remainder of a division. Performs no substitutions.
10679     *
10680     * For: rem-float
10681     *
10682     * Description: Calls fmod to compute the remainder of the result of dividing a
10683     *              source register by a second, and stores the result in a
10684     *              destination register.
10685     *
10686     * Format: AA|op CC|BB (23x)
10687     *
10688     * Syntax: op vAA, vBB, vCC
10689     */
10690
10691     FETCH_BB    1, %ecx                 # %ecx<- BB
10692     FETCH_CC    1, %edx                 # %edx<- CC
10693     GET_VREG    %ecx                    # %ecx<- vBB
10694     GET_VREG    %edx                    # %edx<- vCC
10695     movl        %ecx, -8(%esp)          # push parameter float
10696     movl        %edx, -4(%esp)          # push parameter float
10697     lea         -8(%esp), %esp
10698     call        fmodf                   # call: (float x, float y)
10699                                         # return: float
10700     lea         8(%esp), %esp
10701     fstps       (rFP, rINST, 4)         # vAA<- remainder; return of fmod
10702     FINISH      2                       # jump to next instruction
10703
10704 /* ------------------------------ */
10705     .balign 64
10706 .L_OP_ADD_DOUBLE: /* 0xab */
10707 /* File: x86-atom/OP_ADD_DOUBLE.S */
10708    /* Copyright (C) 2008 The Android Open Source Project
10709     *
10710     * Licensed under the Apache License, Version 2.0 (the "License");
10711     * you may not use this file except in compliance with the License.
10712     * You may obtain a copy of the License at
10713     *
10714     * http://www.apache.org/licenses/LICENSE-2.0
10715     *
10716     * Unless required by applicable law or agreed to in writing, software
10717     * distributed under the License is distributed on an "AS IS" BASIS,
10718     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10719     * See the License for the specific language governing permissions and
10720     * limitations under the License.
10721     */
10722
10723    /*
10724     * File: OP_ADD_DOUBLE.S
10725     */
10726
10727 /* File: x86-atom/binopWide.S */
10728    /* Copyright (C) 2008 The Android Open Source Project
10729     *
10730     * Licensed under the Apache License, Version 2.0 (the "License");
10731     * you may not use this file except in compliance with the License.
10732     * You may obtain a copy of the License at
10733     *
10734     * http://www.apache.org/licenses/LICENSE-2.0
10735     *
10736     * Unless required by applicable law or agreed to in writing, software
10737     * distributed under the License is distributed on an "AS IS" BASIS,
10738     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10739     * See the License for the specific language governing permissions and
10740     * limitations under the License.
10741     */
10742
10743    /*
10744     * File: binopWide.S
10745     *
10746     * Code: Generic 64-bit binary operation.  Provides an "instr" variable to
10747     *       specify an instruction that performs "%xmm0 = %xmm0 op %xmm1"
10748     *
10749     * For: add-double, add-long, and-long, mul-double, or-long,
10750     *      sub-double, sub-long, xor-long
10751     *
10752     * Description: Perform a binary operation on two source registers
10753     *              and store the result in a destination register.
10754     *
10755     * Format: AA|op CC|BB (23x)
10756     *
10757     * Syntax: op vAA, vBB, vCC
10758     */
10759
10760     FETCH_BB    1, %ecx                 # %ecx<- BB
10761     FETCH_CC    1, %edx                 # %edx<- CC
10762     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
10763     movq        (rFP, %ecx, 4), %xmm0   # %xmm0<- vBB
10764     movq        (rFP, %edx, 4), %xmm1   # %xmm1<- vCC
10765     addsd   %xmm1, %xmm0                              # %xmm0<- vBB op vCC
10766     movq        %xmm0, (rFP, rINST, 4)  # vAA<- %ecx
10767     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
10768
10769 /* ------------------------------ */
10770     .balign 64
10771 .L_OP_SUB_DOUBLE: /* 0xac */
10772 /* File: x86-atom/OP_SUB_DOUBLE.S */
10773    /* Copyright (C) 2008 The Android Open Source Project
10774     *
10775     * Licensed under the Apache License, Version 2.0 (the "License");
10776     * you may not use this file except in compliance with the License.
10777     * You may obtain a copy of the License at
10778     *
10779     * http://www.apache.org/licenses/LICENSE-2.0
10780     *
10781     * Unless required by applicable law or agreed to in writing, software
10782     * distributed under the License is distributed on an "AS IS" BASIS,
10783     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10784     * See the License for the specific language governing permissions and
10785     * limitations under the License.
10786     */
10787
10788    /*
10789     * File: OP_SUB_DOUBLE.S
10790     */
10791
10792 /* File: x86-atom/binopWide.S */
10793    /* Copyright (C) 2008 The Android Open Source Project
10794     *
10795     * Licensed under the Apache License, Version 2.0 (the "License");
10796     * you may not use this file except in compliance with the License.
10797     * You may obtain a copy of the License at
10798     *
10799     * http://www.apache.org/licenses/LICENSE-2.0
10800     *
10801     * Unless required by applicable law or agreed to in writing, software
10802     * distributed under the License is distributed on an "AS IS" BASIS,
10803     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10804     * See the License for the specific language governing permissions and
10805     * limitations under the License.
10806     */
10807
10808    /*
10809     * File: binopWide.S
10810     *
10811     * Code: Generic 64-bit binary operation.  Provides an "instr" variable to
10812     *       specify an instruction that performs "%xmm0 = %xmm0 op %xmm1"
10813     *
10814     * For: add-double, add-long, and-long, mul-double, or-long,
10815     *      sub-double, sub-long, xor-long
10816     *
10817     * Description: Perform a binary operation on two source registers
10818     *              and store the result in a destination register.
10819     *
10820     * Format: AA|op CC|BB (23x)
10821     *
10822     * Syntax: op vAA, vBB, vCC
10823     */
10824
10825     FETCH_BB    1, %ecx                 # %ecx<- BB
10826     FETCH_CC    1, %edx                 # %edx<- CC
10827     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
10828     movq        (rFP, %ecx, 4), %xmm0   # %xmm0<- vBB
10829     movq        (rFP, %edx, 4), %xmm1   # %xmm1<- vCC
10830     subsd   %xmm1, %xmm0                              # %xmm0<- vBB op vCC
10831     movq        %xmm0, (rFP, rINST, 4)  # vAA<- %ecx
10832     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
10833
10834 /* ------------------------------ */
10835     .balign 64
10836 .L_OP_MUL_DOUBLE: /* 0xad */
10837 /* File: x86-atom/OP_MUL_DOUBLE.S */
10838    /* Copyright (C) 2008 The Android Open Source Project
10839     *
10840     * Licensed under the Apache License, Version 2.0 (the "License");
10841     * you may not use this file except in compliance with the License.
10842     * You may obtain a copy of the License at
10843     *
10844     * http://www.apache.org/licenses/LICENSE-2.0
10845     *
10846     * Unless required by applicable law or agreed to in writing, software
10847     * distributed under the License is distributed on an "AS IS" BASIS,
10848     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10849     * See the License for the specific language governing permissions and
10850     * limitations under the License.
10851     */
10852
10853    /*
10854     * File: OP_MUL_DOUBLE.S
10855     */
10856
10857 /* File: x86-atom/binopWide.S */
10858    /* Copyright (C) 2008 The Android Open Source Project
10859     *
10860     * Licensed under the Apache License, Version 2.0 (the "License");
10861     * you may not use this file except in compliance with the License.
10862     * You may obtain a copy of the License at
10863     *
10864     * http://www.apache.org/licenses/LICENSE-2.0
10865     *
10866     * Unless required by applicable law or agreed to in writing, software
10867     * distributed under the License is distributed on an "AS IS" BASIS,
10868     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10869     * See the License for the specific language governing permissions and
10870     * limitations under the License.
10871     */
10872
10873    /*
10874     * File: binopWide.S
10875     *
10876     * Code: Generic 64-bit binary operation.  Provides an "instr" variable to
10877     *       specify an instruction that performs "%xmm0 = %xmm0 op %xmm1"
10878     *
10879     * For: add-double, add-long, and-long, mul-double, or-long,
10880     *      sub-double, sub-long, xor-long
10881     *
10882     * Description: Perform a binary operation on two source registers
10883     *              and store the result in a destination register.
10884     *
10885     * Format: AA|op CC|BB (23x)
10886     *
10887     * Syntax: op vAA, vBB, vCC
10888     */
10889
10890     FETCH_BB    1, %ecx                 # %ecx<- BB
10891     FETCH_CC    1, %edx                 # %edx<- CC
10892     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
10893     movq        (rFP, %ecx, 4), %xmm0   # %xmm0<- vBB
10894     movq        (rFP, %edx, 4), %xmm1   # %xmm1<- vCC
10895     mulsd   %xmm1, %xmm0                              # %xmm0<- vBB op vCC
10896     movq        %xmm0, (rFP, rINST, 4)  # vAA<- %ecx
10897     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
10898
10899 /* ------------------------------ */
10900     .balign 64
10901 .L_OP_DIV_DOUBLE: /* 0xae */
10902 /* File: x86-atom/OP_DIV_DOUBLE.S */
10903    /* Copyright (C) 2008 The Android Open Source Project
10904     *
10905     * Licensed under the Apache License, Version 2.0 (the "License");
10906     * you may not use this file except in compliance with the License.
10907     * You may obtain a copy of the License at
10908     *
10909     * http://www.apache.org/licenses/LICENSE-2.0
10910     *
10911     * Unless required by applicable law or agreed to in writing, software
10912     * distributed under the License is distributed on an "AS IS" BASIS,
10913     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10914     * See the License for the specific language governing permissions and
10915     * limitations under the License.
10916     */
10917
10918    /*
10919     * File: OP_DIV_DOUBLE.S
10920     *
10921     * Code: Divides doubles. Uses no substitutions.
10922     *
10923     * For: div-double
10924     *
10925     * Description: Divide operation on two source registers, storing
10926     *              the result in a destination register
10927     *
10928     * Format: AA|op CC|BB (23x)
10929     *
10930     * Syntax: op vAA, vBB, vCC
10931     */
10932
10933     FETCH_BB    1, %ecx                 # %ecx<- BB
10934     FETCH_CC    1, %edx                 # %edx<- CC
10935     fldl        (rFP, %ecx, 4)          # floating point stack vBB
10936     fdivl       (rFP, %edx, 4)          # divide double; vBB/vCC
10937     fstpl       (rFP, rINST, 4)         # vAA<- result
10938     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
10939     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
10940
10941 /* ------------------------------ */
10942     .balign 64
10943 .L_OP_REM_DOUBLE: /* 0xaf */
10944 /* File: x86-atom/OP_REM_DOUBLE.S */
10945    /* Copyright (C) 2008 The Android Open Source Project
10946     *
10947     * Licensed under the Apache License, Version 2.0 (the "License");
10948     * you may not use this file except in compliance with the License.
10949     * You may obtain a copy of the License at
10950     *
10951     * http://www.apache.org/licenses/LICENSE-2.0
10952     *
10953     * Unless required by applicable law or agreed to in writing, software
10954     * distributed under the License is distributed on an "AS IS" BASIS,
10955     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10956     * See the License for the specific language governing permissions and
10957     * limitations under the License.
10958     */
10959
10960    /*
10961     * File: OP_REM_DOUBLE.S
10962     *
10963     * Code: Computes the remainder of a division. Performs no substitutions.
10964     *
10965     * For: rem-double
10966     *
10967     * Description: Calls fmod to compute the remainder of the result of dividing a
10968     *              source register by a second, and stores the result in a
10969     *              destination register.
10970     *
10971     * Format: AA|op CC|BB (23x)
10972     *
10973     * Syntax: op vAA, vBB, vCC
10974     */
10975
10976     FETCH_BB    1, %ecx                 # %ecx<- BB
10977     FETCH_CC    1, %edx                 # %edx<- CC
10978     movl        (rFP, %ecx, 4), %eax    # %eax<- vBBlo
10979     movl        %eax, -16(%esp)         # push parameter double lo
10980     movl        4(rFP, %ecx, 4), %eax   # %eax<- vBBhi
10981     movl        %eax, -12(%esp)         # push parameter double hi
10982     movl        (rFP, %edx, 4), %eax    # %eax<- vCClo
10983     movl        %eax, -8(%esp)          # push parameter double lo
10984     movl        4(rFP, %edx, 4), %eax   # %eax<- vCChi
10985     movl        %eax, -4(%esp)          # push parameter double hi
10986     lea         -16(%esp), %esp
10987     jmp         .LOP_REM_DOUBLE_break
10988
10989 /* ------------------------------ */
10990     .balign 64
10991 .L_OP_ADD_INT_2ADDR: /* 0xb0 */
10992 /* File: x86-atom/OP_ADD_INT_2ADDR.S */
10993    /* Copyright (C) 2008 The Android Open Source Project
10994     *
10995     * Licensed under the Apache License, Version 2.0 (the "License");
10996     * you may not use this file except in compliance with the License.
10997     * You may obtain a copy of the License at
10998     *
10999     * http://www.apache.org/licenses/LICENSE-2.0
11000     *
11001     * Unless required by applicable law or agreed to in writing, software
11002     * distributed under the License is distributed on an "AS IS" BASIS,
11003     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11004     * See the License for the specific language governing permissions and
11005     * limitations under the License.
11006     */
11007
11008    /*
11009     * File: OP_ADD_INT_2ADDR.S
11010     */
11011
11012 /* File: x86-atom/binop2addr.S */
11013    /* Copyright (C) 2008 The Android Open Source Project
11014     *
11015     * Licensed under the Apache License, Version 2.0 (the "License");
11016     * you may not use this file except in compliance with the License.
11017     * You may obtain a copy of the License at
11018     *
11019     * http://www.apache.org/licenses/LICENSE-2.0
11020     *
11021     * Unless required by applicable law or agreed to in writing, software
11022     * distributed under the License is distributed on an "AS IS" BASIS,
11023     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11024     * See the License for the specific language governing permissions and
11025     * limitations under the License.
11026     */
11027
11028    /*
11029     * File: binop2addr.S
11030     *
11031     * Code: Generic 32-bit "/2addr" binary operation.  Provides an
11032     *       "instr" line to specify an instruction that performs
11033     *       "%ecx = %ecx op %edx".
11034     *
11035     * For: add-int/2addr, and-int/2addr, mul-int/2addr, or-int/2addr,
11036     *      sub-int/2addr, xor-int/2addr
11037     *
11038     * Description: Perform a binary operation on two sources registers
11039     *              and store the result in the first source register
11040     *
11041     * Format: B|A|op (12x)
11042     *
11043     * Syntax: op vA, vB
11044     */
11045
11046     movl        rINST, %edx             # %edx<- BA
11047     shr         $4, %edx               # %edx<- B
11048     #FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
11049     OLD_JMP_1   1, %eax
11050     andl $15, rINST  # rINST<- A
11051     OLD_JMP_2  %eax
11052     GET_VREG    %edx                    # %edx<- vB
11053     OLD_JMP_3   1
11054     addl     %edx,  (rFP, rINST, 4)    # %ecx<- vA op vB
11055     #FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
11056     OLD_JMP_4   %eax
11057
11058
11059 /* ------------------------------ */
11060     .balign 64
11061 .L_OP_SUB_INT_2ADDR: /* 0xb1 */
11062 /* File: x86-atom/OP_SUB_INT_2ADDR.S */
11063    /* Copyright (C) 2008 The Android Open Source Project
11064     *
11065     * Licensed under the Apache License, Version 2.0 (the "License");
11066     * you may not use this file except in compliance with the License.
11067     * You may obtain a copy of the License at
11068     *
11069     * http://www.apache.org/licenses/LICENSE-2.0
11070     *
11071     * Unless required by applicable law or agreed to in writing, software
11072     * distributed under the License is distributed on an "AS IS" BASIS,
11073     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11074     * See the License for the specific language governing permissions and
11075     * limitations under the License.
11076     */
11077
11078    /*
11079     * File: OP_SUB_INT_2ADDR.S
11080     */
11081
11082 /* File: x86-atom/binop2addr.S */
11083    /* Copyright (C) 2008 The Android Open Source Project
11084     *
11085     * Licensed under the Apache License, Version 2.0 (the "License");
11086     * you may not use this file except in compliance with the License.
11087     * You may obtain a copy of the License at
11088     *
11089     * http://www.apache.org/licenses/LICENSE-2.0
11090     *
11091     * Unless required by applicable law or agreed to in writing, software
11092     * distributed under the License is distributed on an "AS IS" BASIS,
11093     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11094     * See the License for the specific language governing permissions and
11095     * limitations under the License.
11096     */
11097
11098    /*
11099     * File: binop2addr.S
11100     *
11101     * Code: Generic 32-bit "/2addr" binary operation.  Provides an
11102     *       "instr" line to specify an instruction that performs
11103     *       "%ecx = %ecx op %edx".
11104     *
11105     * For: add-int/2addr, and-int/2addr, mul-int/2addr, or-int/2addr,
11106     *      sub-int/2addr, xor-int/2addr
11107     *
11108     * Description: Perform a binary operation on two sources registers
11109     *              and store the result in the first source register
11110     *
11111     * Format: B|A|op (12x)
11112     *
11113     * Syntax: op vA, vB
11114     */
11115
11116     movl        rINST, %edx             # %edx<- BA
11117     shr         $4, %edx               # %edx<- B
11118     #FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
11119     OLD_JMP_1   1, %eax
11120     andl $15, rINST  # rINST<- A
11121     OLD_JMP_2  %eax
11122     GET_VREG    %edx                    # %edx<- vB
11123     OLD_JMP_3   1
11124     subl     %edx, (rFP, rINST, 4)    # %ecx<- vA op vB
11125     #FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
11126     OLD_JMP_4   %eax
11127
11128
11129 /* ------------------------------ */
11130     .balign 64
11131 .L_OP_MUL_INT_2ADDR: /* 0xb2 */
11132 /* File: x86-atom/OP_MUL_INT_2ADDR.S */
11133    /* Copyright (C) 2008 The Android Open Source Project
11134     *
11135     * Licensed under the Apache License, Version 2.0 (the "License");
11136     * you may not use this file except in compliance with the License.
11137     * You may obtain a copy of the License at
11138     *
11139     * http://www.apache.org/licenses/LICENSE-2.0
11140     *
11141     * Unless required by applicable law or agreed to in writing, software
11142     * distributed under the License is distributed on an "AS IS" BASIS,
11143     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11144     * See the License for the specific language governing permissions and
11145     * limitations under the License.
11146     */
11147
11148    /*
11149     * File: OP_MUL_INT_2ADDR.S
11150     */
11151
11152     movl        rINST, %edx             # %edx<- BA
11153     shr         $4, %edx               # %edx<- B
11154     andl        $15, rINST             # rINST<- A
11155     movl        rINST, %ecx             # %ecx<- A
11156     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
11157     GET_VREG    %ecx                    # %ecx<- vA
11158     imul        (rFP, %edx, 4), %ecx    # %ecx<- vA * vB
11159     addl        $2, rPC                  # update PC
11160     SET_VREG    %ecx, rINST             # vAA<- %ecx; result
11161     FGETOP_JMP2 %eax                    # jump to next instruction; getop, jmp
11162
11163 /* ------------------------------ */
11164     .balign 64
11165 .L_OP_DIV_INT_2ADDR: /* 0xb3 */
11166 /* File: x86-atom/OP_DIV_INT_2ADDR.S */
11167    /* Copyright (C) 2008 The Android Open Source Project
11168     *
11169     * Licensed under the Apache License, Version 2.0 (the "License");
11170     * you may not use this file except in compliance with the License.
11171     * You may obtain a copy of the License at
11172     *
11173     * http://www.apache.org/licenses/LICENSE-2.0
11174     *
11175     * Unless required by applicable law or agreed to in writing, software
11176     * distributed under the License is distributed on an "AS IS" BASIS,
11177     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11178     * See the License for the specific language governing permissions and
11179     * limitations under the License.
11180     */
11181
11182    /*
11183     * File: OP_DIV_INT_2ADDR.S
11184     */
11185
11186 /* File: x86-atom/binopD2addr.S */
11187    /* Copyright (C) 2008 The Android Open Source Project
11188     *
11189     * Licensed under the Apache License, Version 2.0 (the "License");
11190     * you may not use this file except in compliance with the License.
11191     * You may obtain a copy of the License at
11192     *
11193     * http://www.apache.org/licenses/LICENSE-2.0
11194     *
11195     * Unless required by applicable law or agreed to in writing, software
11196     * distributed under the License is distributed on an "AS IS" BASIS,
11197     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11198     * See the License for the specific language governing permissions and
11199     * limitations under the License.
11200     */
11201
11202    /*
11203     * File: binopD2addr.S
11204     *
11205     * Code: 32-bit "/2addr" integer divde operation. If "div"
11206     *       is set, the code returns the quotient, else it returns
11207     *       the remainder. Also, a divide-by-zero check is done.
11208     *
11209     * For: div-int/2addr, rem-int/2addr
11210     *
11211     * Description: Perform a binary operation on two sources registers
11212     *              and store the result in the first source register
11213     *
11214     * Format: B|A|op (12x)
11215     *
11216     * Syntax: op vA, vB
11217     */
11218
11219     movl        rINST, %ecx             # %ecx<- BA
11220     shr         $4, %ecx               # %ecx<- B
11221     andl        $15, rINST             # rINST<- A, to be used as dest
11222     movl        rINST, %eax             # %eax<- A
11223     GET_VREG    %ecx                    # %edx<- vB
11224     testl       %ecx, %ecx               # check for divide by zero
11225     GET_VREG    %eax                    # %eax<- vA
11226     jz          common_errDivideByZero  # handle divide by zero
11227     cmpl        $-1, %ecx              # handle -1 special case divide error
11228     jnz         .LOP_DIV_INT_2ADDR_continue
11229     cmpl        $0x80000000, %eax       # handle min int special case divide error
11230     je         .LOP_DIV_INT_2ADDR_break
11231
11232 .LOP_DIV_INT_2ADDR_continue:
11233     cdq                                 # sign-extend %eax to %edx
11234     idiv        %ecx                    # divide %edx:%eax by %ecx
11235      .if  1
11236     FFETCH_ADV  1, %edx                 # %ecx<- next instruction hi; fetch, advance
11237     SET_VREG    %eax rINST              # vAA<- %eax (quotient)
11238     FGETOP_JMP  1, %edx                 # jump to next instruction; getop, jmp
11239     .else
11240     FFETCH_ADV  1, %eax                 # %ecx<- next instruction hi; fetch, advance
11241     SET_VREG    %edx rINST              # vAA<- %edx (remainder)
11242     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
11243     .endif
11244
11245
11246
11247 /* ------------------------------ */
11248     .balign 64
11249 .L_OP_REM_INT_2ADDR: /* 0xb4 */
11250 /* File: x86-atom/OP_REM_INT_2ADDR.S */
11251    /* Copyright (C) 2008 The Android Open Source Project
11252     *
11253     * Licensed under the Apache License, Version 2.0 (the "License");
11254     * you may not use this file except in compliance with the License.
11255     * You may obtain a copy of the License at
11256     *
11257     * http://www.apache.org/licenses/LICENSE-2.0
11258     *
11259     * Unless required by applicable law or agreed to in writing, software
11260     * distributed under the License is distributed on an "AS IS" BASIS,
11261     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11262     * See the License for the specific language governing permissions and
11263     * limitations under the License.
11264     */
11265
11266    /*
11267     * File: OP_REM_INT_2ADDR.S
11268     */
11269
11270 /* File: x86-atom/binopD2addr.S */
11271    /* Copyright (C) 2008 The Android Open Source Project
11272     *
11273     * Licensed under the Apache License, Version 2.0 (the "License");
11274     * you may not use this file except in compliance with the License.
11275     * You may obtain a copy of the License at
11276     *
11277     * http://www.apache.org/licenses/LICENSE-2.0
11278     *
11279     * Unless required by applicable law or agreed to in writing, software
11280     * distributed under the License is distributed on an "AS IS" BASIS,
11281     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11282     * See the License for the specific language governing permissions and
11283     * limitations under the License.
11284     */
11285
11286    /*
11287     * File: binopD2addr.S
11288     *
11289     * Code: 32-bit "/2addr" integer divde operation. If "div"
11290     *       is set, the code returns the quotient, else it returns
11291     *       the remainder. Also, a divide-by-zero check is done.
11292     *
11293     * For: div-int/2addr, rem-int/2addr
11294     *
11295     * Description: Perform a binary operation on two sources registers
11296     *              and store the result in the first source register
11297     *
11298     * Format: B|A|op (12x)
11299     *
11300     * Syntax: op vA, vB
11301     */
11302
11303     movl        rINST, %ecx             # %ecx<- BA
11304     shr         $4, %ecx               # %ecx<- B
11305     andl        $15, rINST             # rINST<- A, to be used as dest
11306     movl        rINST, %eax             # %eax<- A
11307     GET_VREG    %ecx                    # %edx<- vB
11308     testl       %ecx, %ecx               # check for divide by zero
11309     GET_VREG    %eax                    # %eax<- vA
11310     jz          common_errDivideByZero  # handle divide by zero
11311     cmpl        $-1, %ecx              # handle -1 special case divide error
11312     jnz         .LOP_REM_INT_2ADDR_continue
11313     cmpl        $0x80000000, %eax       # handle min int special case divide error
11314     je         .LOP_REM_INT_2ADDR_break
11315
11316 .LOP_REM_INT_2ADDR_continue:
11317     cdq                                 # sign-extend %eax to %edx
11318     idiv        %ecx                    # divide %edx:%eax by %ecx
11319      .if  0
11320     FFETCH_ADV  1, %edx                 # %ecx<- next instruction hi; fetch, advance
11321     SET_VREG    %eax rINST              # vAA<- %eax (quotient)
11322     FGETOP_JMP  1, %edx                 # jump to next instruction; getop, jmp
11323     .else
11324     FFETCH_ADV  1, %eax                 # %ecx<- next instruction hi; fetch, advance
11325     SET_VREG    %edx rINST              # vAA<- %edx (remainder)
11326     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
11327     .endif
11328
11329
11330
11331 /* ------------------------------ */
11332     .balign 64
11333 .L_OP_AND_INT_2ADDR: /* 0xb5 */
11334 /* File: x86-atom/OP_AND_INT_2ADDR.S */
11335    /* Copyright (C) 2008 The Android Open Source Project
11336     *
11337     * Licensed under the Apache License, Version 2.0 (the "License");
11338     * you may not use this file except in compliance with the License.
11339     * You may obtain a copy of the License at
11340     *
11341     * http://www.apache.org/licenses/LICENSE-2.0
11342     *
11343     * Unless required by applicable law or agreed to in writing, software
11344     * distributed under the License is distributed on an "AS IS" BASIS,
11345     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11346     * See the License for the specific language governing permissions and
11347     * limitations under the License.
11348     */
11349
11350    /*
11351     * File: OP_AND_INT_2ADDR.S
11352     */
11353
11354 /* File: x86-atom/binop2addr.S */
11355    /* Copyright (C) 2008 The Android Open Source Project
11356     *
11357     * Licensed under the Apache License, Version 2.0 (the "License");
11358     * you may not use this file except in compliance with the License.
11359     * You may obtain a copy of the License at
11360     *
11361     * http://www.apache.org/licenses/LICENSE-2.0
11362     *
11363     * Unless required by applicable law or agreed to in writing, software
11364     * distributed under the License is distributed on an "AS IS" BASIS,
11365     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11366     * See the License for the specific language governing permissions and
11367     * limitations under the License.
11368     */
11369
11370    /*
11371     * File: binop2addr.S
11372     *
11373     * Code: Generic 32-bit "/2addr" binary operation.  Provides an
11374     *       "instr" line to specify an instruction that performs
11375     *       "%ecx = %ecx op %edx".
11376     *
11377     * For: add-int/2addr, and-int/2addr, mul-int/2addr, or-int/2addr,
11378     *      sub-int/2addr, xor-int/2addr
11379     *
11380     * Description: Perform a binary operation on two sources registers
11381     *              and store the result in the first source register
11382     *
11383     * Format: B|A|op (12x)
11384     *
11385     * Syntax: op vA, vB
11386     */
11387
11388     movl        rINST, %edx             # %edx<- BA
11389     shr         $4, %edx               # %edx<- B
11390     #FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
11391     OLD_JMP_1   1, %eax
11392     andl $15, rINST  # rINST<- A
11393     OLD_JMP_2  %eax
11394     GET_VREG    %edx                    # %edx<- vB
11395     OLD_JMP_3   1
11396     andl     %edx, (rFP, rINST, 4)    # %ecx<- vA op vB
11397     #FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
11398     OLD_JMP_4   %eax
11399
11400
11401 /* ------------------------------ */
11402     .balign 64
11403 .L_OP_OR_INT_2ADDR: /* 0xb6 */
11404 /* File: x86-atom/OP_OR_INT_2ADDR.S */
11405    /* Copyright (C) 2008 The Android Open Source Project
11406     *
11407     * Licensed under the Apache License, Version 2.0 (the "License");
11408     * you may not use this file except in compliance with the License.
11409     * You may obtain a copy of the License at
11410     *
11411     * http://www.apache.org/licenses/LICENSE-2.0
11412     *
11413     * Unless required by applicable law or agreed to in writing, software
11414     * distributed under the License is distributed on an "AS IS" BASIS,
11415     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11416     * See the License for the specific language governing permissions and
11417     * limitations under the License.
11418     */
11419
11420    /*
11421     * File: OP_OR_INT_2ADDR.S
11422     */
11423
11424 /* File: x86-atom/binop2addr.S */
11425    /* Copyright (C) 2008 The Android Open Source Project
11426     *
11427     * Licensed under the Apache License, Version 2.0 (the "License");
11428     * you may not use this file except in compliance with the License.
11429     * You may obtain a copy of the License at
11430     *
11431     * http://www.apache.org/licenses/LICENSE-2.0
11432     *
11433     * Unless required by applicable law or agreed to in writing, software
11434     * distributed under the License is distributed on an "AS IS" BASIS,
11435     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11436     * See the License for the specific language governing permissions and
11437     * limitations under the License.
11438     */
11439
11440    /*
11441     * File: binop2addr.S
11442     *
11443     * Code: Generic 32-bit "/2addr" binary operation.  Provides an
11444     *       "instr" line to specify an instruction that performs
11445     *       "%ecx = %ecx op %edx".
11446     *
11447     * For: add-int/2addr, and-int/2addr, mul-int/2addr, or-int/2addr,
11448     *      sub-int/2addr, xor-int/2addr
11449     *
11450     * Description: Perform a binary operation on two sources registers
11451     *              and store the result in the first source register
11452     *
11453     * Format: B|A|op (12x)
11454     *
11455     * Syntax: op vA, vB
11456     */
11457
11458     movl        rINST, %edx             # %edx<- BA
11459     shr         $4, %edx               # %edx<- B
11460     #FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
11461     OLD_JMP_1   1, %eax
11462     andl $15, rINST  # rINST<- A
11463     OLD_JMP_2  %eax
11464     GET_VREG    %edx                    # %edx<- vB
11465     OLD_JMP_3   1
11466     or %edx, (rFP, rINST, 4)    # %ecx<- vA op vB
11467     #FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
11468     OLD_JMP_4   %eax
11469
11470
11471 /* ------------------------------ */
11472     .balign 64
11473 .L_OP_XOR_INT_2ADDR: /* 0xb7 */
11474 /* File: x86-atom/OP_XOR_INT_2ADDR.S */
11475    /* Copyright (C) 2008 The Android Open Source Project
11476     *
11477     * Licensed under the Apache License, Version 2.0 (the "License");
11478     * you may not use this file except in compliance with the License.
11479     * You may obtain a copy of the License at
11480     *
11481     * http://www.apache.org/licenses/LICENSE-2.0
11482     *
11483     * Unless required by applicable law or agreed to in writing, software
11484     * distributed under the License is distributed on an "AS IS" BASIS,
11485     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11486     * See the License for the specific language governing permissions and
11487     * limitations under the License.
11488     */
11489
11490    /*
11491     * File: OP_XOR_INT_2ADDR.S
11492     */
11493
11494 /* File: x86-atom/binop2addr.S */
11495    /* Copyright (C) 2008 The Android Open Source Project
11496     *
11497     * Licensed under the Apache License, Version 2.0 (the "License");
11498     * you may not use this file except in compliance with the License.
11499     * You may obtain a copy of the License at
11500     *
11501     * http://www.apache.org/licenses/LICENSE-2.0
11502     *
11503     * Unless required by applicable law or agreed to in writing, software
11504     * distributed under the License is distributed on an "AS IS" BASIS,
11505     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11506     * See the License for the specific language governing permissions and
11507     * limitations under the License.
11508     */
11509
11510    /*
11511     * File: binop2addr.S
11512     *
11513     * Code: Generic 32-bit "/2addr" binary operation.  Provides an
11514     *       "instr" line to specify an instruction that performs
11515     *       "%ecx = %ecx op %edx".
11516     *
11517     * For: add-int/2addr, and-int/2addr, mul-int/2addr, or-int/2addr,
11518     *      sub-int/2addr, xor-int/2addr
11519     *
11520     * Description: Perform a binary operation on two sources registers
11521     *              and store the result in the first source register
11522     *
11523     * Format: B|A|op (12x)
11524     *
11525     * Syntax: op vA, vB
11526     */
11527
11528     movl        rINST, %edx             # %edx<- BA
11529     shr         $4, %edx               # %edx<- B
11530     #FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
11531     OLD_JMP_1   1, %eax
11532     andl $15, rINST  # rINST<- A
11533     OLD_JMP_2  %eax
11534     GET_VREG    %edx                    # %edx<- vB
11535     OLD_JMP_3   1
11536     xor     %edx, (rFP, rINST, 4)    # %ecx<- vA op vB
11537     #FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
11538     OLD_JMP_4   %eax
11539
11540
11541 /* ------------------------------ */
11542     .balign 64
11543 .L_OP_SHL_INT_2ADDR: /* 0xb8 */
11544 /* File: x86-atom/OP_SHL_INT_2ADDR.S */
11545    /* Copyright (C) 2008 The Android Open Source Project
11546     *
11547     * Licensed under the Apache License, Version 2.0 (the "License");
11548     * you may not use this file except in compliance with the License.
11549     * You may obtain a copy of the License at
11550     *
11551     * http://www.apache.org/licenses/LICENSE-2.0
11552     *
11553     * Unless required by applicable law or agreed to in writing, software
11554     * distributed under the License is distributed on an "AS IS" BASIS,
11555     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11556     * See the License for the specific language governing permissions and
11557     * limitations under the License.
11558     */
11559
11560    /*
11561     * File: OP_SHL_INT_2ADDR.S
11562     */
11563
11564 /* File: x86-atom/binopS2addr.S */
11565    /* Copyright (C) 2008 The Android Open Source Project
11566     *
11567     * Licensed under the Apache License, Version 2.0 (the "License");
11568     * you may not use this file except in compliance with the License.
11569     * You may obtain a copy of the License at
11570     *
11571     * http://www.apache.org/licenses/LICENSE-2.0
11572     *
11573     * Unless required by applicable law or agreed to in writing, software
11574     * distributed under the License is distributed on an "AS IS" BASIS,
11575     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11576     * See the License for the specific language governing permissions and
11577     * limitations under the License.
11578     */
11579
11580    /*
11581     * File: binopS2addr.S
11582     *
11583     * Code: Generic 32-bit "/2addr" binary operation.  Provides an
11584     *       "instr" line to specify an instruction that performs
11585     *       "%edx = %edx op %cl".
11586     *
11587     * For: shl-int/2addr, shr-int/2addr, ushr-int/2addr
11588     *
11589     * Description: Perform a binary operation on two sources registers
11590     *              and store the result in the first source register
11591     *
11592     * Format: B|A|op (12x)
11593     *
11594     * Syntax: op vA, vB
11595     */
11596
11597     movl        rINST, %ecx             # %ecx<- BA
11598     shr         $4, %ecx               # %ecx<- B
11599     FFETCH_ADV  1, %eax                 # %ecx<- next i nstruction hi; fetch, advance
11600     andl        $15, rINST             # rINST<- A
11601     addl        $2, rPC                  # update PC
11602     movl        rINST, %edx             # %edx<- A
11603     GET_VREG    %ecx                    # %ecx<- vB
11604     GET_VREG    %edx                    # %edx<- vA
11605     sal     %cl, %edx                              # %edx<- vA op vB
11606     SET_VREG    %edx, rINST             # vAA<- %edx; result
11607     FGETOP_JMP2 %eax                    # jump to next instruction; getop, jmp
11608
11609 /* ------------------------------ */
11610     .balign 64
11611 .L_OP_SHR_INT_2ADDR: /* 0xb9 */
11612 /* File: x86-atom/OP_SHR_INT_2ADDR.S */
11613    /* Copyright (C) 2008 The Android Open Source Project
11614     *
11615     * Licensed under the Apache License, Version 2.0 (the "License");
11616     * you may not use this file except in compliance with the License.
11617     * You may obtain a copy of the License at
11618     *
11619     * http://www.apache.org/licenses/LICENSE-2.0
11620     *
11621     * Unless required by applicable law or agreed to in writing, software
11622     * distributed under the License is distributed on an "AS IS" BASIS,
11623     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11624     * See the License for the specific language governing permissions and
11625     * limitations under the License.
11626     */
11627
11628    /*
11629     * File: OP_SHR_INT_2ADDR.S
11630     */
11631
11632 /* File: x86-atom/binopS2addr.S */
11633    /* Copyright (C) 2008 The Android Open Source Project
11634     *
11635     * Licensed under the Apache License, Version 2.0 (the "License");
11636     * you may not use this file except in compliance with the License.
11637     * You may obtain a copy of the License at
11638     *
11639     * http://www.apache.org/licenses/LICENSE-2.0
11640     *
11641     * Unless required by applicable law or agreed to in writing, software
11642     * distributed under the License is distributed on an "AS IS" BASIS,
11643     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11644     * See the License for the specific language governing permissions and
11645     * limitations under the License.
11646     */
11647
11648    /*
11649     * File: binopS2addr.S
11650     *
11651     * Code: Generic 32-bit "/2addr" binary operation.  Provides an
11652     *       "instr" line to specify an instruction that performs
11653     *       "%edx = %edx op %cl".
11654     *
11655     * For: shl-int/2addr, shr-int/2addr, ushr-int/2addr
11656     *
11657     * Description: Perform a binary operation on two sources registers
11658     *              and store the result in the first source register
11659     *
11660     * Format: B|A|op (12x)
11661     *
11662     * Syntax: op vA, vB
11663     */
11664
11665     movl        rINST, %ecx             # %ecx<- BA
11666     shr         $4, %ecx               # %ecx<- B
11667     FFETCH_ADV  1, %eax                 # %ecx<- next i nstruction hi; fetch, advance
11668     andl        $15, rINST             # rINST<- A
11669     addl        $2, rPC                  # update PC
11670     movl        rINST, %edx             # %edx<- A
11671     GET_VREG    %ecx                    # %ecx<- vB
11672     GET_VREG    %edx                    # %edx<- vA
11673     sar     %cl, %edx                              # %edx<- vA op vB
11674     SET_VREG    %edx, rINST             # vAA<- %edx; result
11675     FGETOP_JMP2 %eax                    # jump to next instruction; getop, jmp
11676
11677 /* ------------------------------ */
11678     .balign 64
11679 .L_OP_USHR_INT_2ADDR: /* 0xba */
11680 /* File: x86-atom/OP_USHR_INT_2ADDR.S */
11681    /* Copyright (C) 2008 The Android Open Source Project
11682     *
11683     * Licensed under the Apache License, Version 2.0 (the "License");
11684     * you may not use this file except in compliance with the License.
11685     * You may obtain a copy of the License at
11686     *
11687     * http://www.apache.org/licenses/LICENSE-2.0
11688     *
11689     * Unless required by applicable law or agreed to in writing, software
11690     * distributed under the License is distributed on an "AS IS" BASIS,
11691     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11692     * See the License for the specific language governing permissions and
11693     * limitations under the License.
11694     */
11695
11696    /*
11697     * File: OP_USHR_INT_2ADDR.S
11698     */
11699
11700 /* File: x86-atom/binopS2addr.S */
11701    /* Copyright (C) 2008 The Android Open Source Project
11702     *
11703     * Licensed under the Apache License, Version 2.0 (the "License");
11704     * you may not use this file except in compliance with the License.
11705     * You may obtain a copy of the License at
11706     *
11707     * http://www.apache.org/licenses/LICENSE-2.0
11708     *
11709     * Unless required by applicable law or agreed to in writing, software
11710     * distributed under the License is distributed on an "AS IS" BASIS,
11711     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11712     * See the License for the specific language governing permissions and
11713     * limitations under the License.
11714     */
11715
11716    /*
11717     * File: binopS2addr.S
11718     *
11719     * Code: Generic 32-bit "/2addr" binary operation.  Provides an
11720     *       "instr" line to specify an instruction that performs
11721     *       "%edx = %edx op %cl".
11722     *
11723     * For: shl-int/2addr, shr-int/2addr, ushr-int/2addr
11724     *
11725     * Description: Perform a binary operation on two sources registers
11726     *              and store the result in the first source register
11727     *
11728     * Format: B|A|op (12x)
11729     *
11730     * Syntax: op vA, vB
11731     */
11732
11733     movl        rINST, %ecx             # %ecx<- BA
11734     shr         $4, %ecx               # %ecx<- B
11735     FFETCH_ADV  1, %eax                 # %ecx<- next i nstruction hi; fetch, advance
11736     andl        $15, rINST             # rINST<- A
11737     addl        $2, rPC                  # update PC
11738     movl        rINST, %edx             # %edx<- A
11739     GET_VREG    %ecx                    # %ecx<- vB
11740     GET_VREG    %edx                    # %edx<- vA
11741     shr     %cl, %edx                              # %edx<- vA op vB
11742     SET_VREG    %edx, rINST             # vAA<- %edx; result
11743     FGETOP_JMP2 %eax                    # jump to next instruction; getop, jmp
11744
11745 /* ------------------------------ */
11746     .balign 64
11747 .L_OP_ADD_LONG_2ADDR: /* 0xbb */
11748 /* File: x86-atom/OP_ADD_LONG_2ADDR.S */
11749    /* Copyright (C) 2008 The Android Open Source Project
11750     *
11751     * Licensed under the Apache License, Version 2.0 (the "License");
11752     * you may not use this file except in compliance with the License.
11753     * You may obtain a copy of the License at
11754     *
11755     * http://www.apache.org/licenses/LICENSE-2.0
11756     *
11757     * Unless required by applicable law or agreed to in writing, software
11758     * distributed under the License is distributed on an "AS IS" BASIS,
11759     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11760     * See the License for the specific language governing permissions and
11761     * limitations under the License.
11762     */
11763
11764    /*
11765     * File: OP_ADD_LONG_2ADDR.S
11766     */
11767
11768 /* File: x86-atom/binopWide2addr.S */
11769    /* Copyright (C) 2008 The Android Open Source Project
11770     *
11771     * Licensed under the Apache License, Version 2.0 (the "License");
11772     * you may not use this file except in compliance with the License.
11773     * You may obtain a copy of the License at
11774     *
11775     * http://www.apache.org/licenses/LICENSE-2.0
11776     *
11777     * Unless required by applicable law or agreed to in writing, software
11778     * distributed under the License is distributed on an "AS IS" BASIS,
11779     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11780     * See the License for the specific language governing permissions and
11781     * limitations under the License.
11782     */
11783
11784    /*
11785     * File: binopWide2addr.S
11786     *
11787     * Code: Generic 64-bit "/2addr" binary operation.  Provides an
11788     *       "instr" line to specify an instruction that performs
11789     *       "%xmm0= %xmm0 op %xmm1".
11790     *
11791     * For: add-double/2addr, add-long/2addr, and-long/2addr, mul-long/2addr,
11792     *      or-long/2addr, sub-double/2addr, sub-long/2addr, xor-long/2addr
11793     *
11794     * Description: Perform a binary operation on two sources registers
11795     *              and store the result in the first source register
11796     *
11797     * Format: B|A|op (12x)
11798     *
11799     * Syntax: op vA, vB
11800     */
11801
11802     movl        rINST, %edx             # %edx<- BA
11803     shr         $4, rINST              # rINST<- B
11804     andl        $15, %edx              # %edx<- A
11805     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
11806     movq        (rFP, rINST, 4), %xmm1  # %xmm1<- vB
11807     movq        (rFP, %edx, 4), %xmm0   # %xmm0<- vA
11808     paddq   %xmm1, %xmm0                              # %xmm0<- vA op vB
11809     movq        %xmm0, (rFP, %edx, 4)   # vA<- %xmm0; result
11810     #FINISH      1                      # jump to next instruction
11811     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
11812
11813 /* ------------------------------ */
11814     .balign 64
11815 .L_OP_SUB_LONG_2ADDR: /* 0xbc */
11816 /* File: x86-atom/OP_SUB_LONG_2ADDR.S */
11817    /* Copyright (C) 2008 The Android Open Source Project
11818     *
11819     * Licensed under the Apache License, Version 2.0 (the "License");
11820     * you may not use this file except in compliance with the License.
11821     * You may obtain a copy of the License at
11822     *
11823     * http://www.apache.org/licenses/LICENSE-2.0
11824     *
11825     * Unless required by applicable law or agreed to in writing, software
11826     * distributed under the License is distributed on an "AS IS" BASIS,
11827     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11828     * See the License for the specific language governing permissions and
11829     * limitations under the License.
11830     */
11831
11832    /*
11833     * File: OP_SUB_LONG_2ADDR.S
11834     */
11835
11836 /* File: x86-atom/binopWide2addr.S */
11837    /* Copyright (C) 2008 The Android Open Source Project
11838     *
11839     * Licensed under the Apache License, Version 2.0 (the "License");
11840     * you may not use this file except in compliance with the License.
11841     * You may obtain a copy of the License at
11842     *
11843     * http://www.apache.org/licenses/LICENSE-2.0
11844     *
11845     * Unless required by applicable law or agreed to in writing, software
11846     * distributed under the License is distributed on an "AS IS" BASIS,
11847     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11848     * See the License for the specific language governing permissions and
11849     * limitations under the License.
11850     */
11851
11852    /*
11853     * File: binopWide2addr.S
11854     *
11855     * Code: Generic 64-bit "/2addr" binary operation.  Provides an
11856     *       "instr" line to specify an instruction that performs
11857     *       "%xmm0= %xmm0 op %xmm1".
11858     *
11859     * For: add-double/2addr, add-long/2addr, and-long/2addr, mul-long/2addr,
11860     *      or-long/2addr, sub-double/2addr, sub-long/2addr, xor-long/2addr
11861     *
11862     * Description: Perform a binary operation on two sources registers
11863     *              and store the result in the first source register
11864     *
11865     * Format: B|A|op (12x)
11866     *
11867     * Syntax: op vA, vB
11868     */
11869
11870     movl        rINST, %edx             # %edx<- BA
11871     shr         $4, rINST              # rINST<- B
11872     andl        $15, %edx              # %edx<- A
11873     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
11874     movq        (rFP, rINST, 4), %xmm1  # %xmm1<- vB
11875     movq        (rFP, %edx, 4), %xmm0   # %xmm0<- vA
11876     psubq    %xmm1, %xmm0                              # %xmm0<- vA op vB
11877     movq        %xmm0, (rFP, %edx, 4)   # vA<- %xmm0; result
11878     #FINISH      1                      # jump to next instruction
11879     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
11880
11881 /* ------------------------------ */
11882     .balign 64
11883 .L_OP_MUL_LONG_2ADDR: /* 0xbd */
11884 /* File: x86-atom/OP_MUL_LONG_2ADDR.S */
11885    /* Copyright (C) 2008 The Android Open Source Project
11886     *
11887     * Licensed under the Apache License, Version 2.0 (the "License");
11888     * you may not use this file except in compliance with the License.
11889     * You may obtain a copy of the License at
11890     *
11891     * http://www.apache.org/licenses/LICENSE-2.0
11892     *
11893     * Unless required by applicable law or agreed to in writing, software
11894     * distributed under the License is distributed on an "AS IS" BASIS,
11895     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11896     * See the License for the specific language governing permissions and
11897     * limitations under the License.
11898     */
11899
11900    /*
11901     * File: OP_MUL_LONG_2ADDR.S
11902     *
11903     * Code:  64-bit integer multiply
11904     *
11905     * For: mul-long/2addr
11906     *
11907     * Description: Multiply two sources registers and store the result
11908     *              in the first source register.
11909     *
11910     * Format: B|A|op (12x)
11911     *
11912     * Syntax: op vA, vB
11913     */
11914
11915    /*
11916     * Signed 64-bit integer multiply.
11917     *
11918     * Consider WXxYZ (r1r0 x r3r2) with a long multiply:
11919     *        WX
11920     *      x YZ
11921     *  --------
11922     *     ZW ZX
11923     *  YW YX
11924     *
11925     * The low word of the result holds ZX, the high word holds
11926     * (ZW+YX) + (the high overflow from ZX).  YW doesn't matter because
11927     * it doesn't fit in the low 64 bits.
11928     */
11929
11930     movl        rINST, %edx             # %edx<- BA+
11931     shr         $4, rINST              # rINST<- B
11932     andl        $15, %edx              # %edx<- A
11933     movl        %edx, sReg0             # sReg0<- A
11934     jmp         .LOP_MUL_LONG_2ADDR_finish
11935
11936 /* ------------------------------ */
11937     .balign 64
11938 .L_OP_DIV_LONG_2ADDR: /* 0xbe */
11939 /* File: x86-atom/OP_DIV_LONG_2ADDR.S */
11940    /* Copyright (C) 2008 The Android Open Source Project
11941     *
11942     * Licensed under the Apache License, Version 2.0 (the "License");
11943     * you may not use this file except in compliance with the License.
11944     * You may obtain a copy of the License at
11945     *
11946     * http://www.apache.org/licenses/LICENSE-2.0
11947     *
11948     * Unless required by applicable law or agreed to in writing, software
11949     * distributed under the License is distributed on an "AS IS" BASIS,
11950     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11951     * See the License for the specific language governing permissions and
11952     * limitations under the License.
11953     */
11954
11955    /*
11956     * File: OP_DIV_LONG_2ADDR.S
11957     */
11958
11959 /* File: x86-atom/binopDivRemLong2Addr.S */
11960    /* Copyright (C) 2008 The Android Open Source Project
11961     *
11962     * Licensed under the Apache License, Version 2.0 (the "License");
11963     * you may not use this file except in compliance with the License.
11964     * You may obtain a copy of the License at
11965     *
11966     * http://www.apache.org/licenses/LICENSE-2.0
11967     *
11968     * Unless required by applicable law or agreed to in writing, software
11969     * distributed under the License is distributed on an "AS IS" BASIS,
11970     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11971     * See the License for the specific language governing permissions and
11972     * limitations under the License.
11973     */
11974
11975    /*
11976     * File: binopDivRemLong2Addr.S
11977     *
11978     * Code: 64-bit "/2addr" long divide operation. Variable
11979     *       "func" defines the function called to do the operation.
11980     *
11981     * For: div-long/2addr, rem-long/2addr
11982     *
11983     * Description: Perform a binary operation on two sources registers
11984     *              and store the result in the first source register.
11985     *
11986     * Format: B|A|op (12x)
11987     *
11988     * Syntax: op vA, vB
11989     */
11990
11991
11992     movl        rINST, %edx             # %edx<- BA
11993     shr         $4, %edx               # %edx<- B
11994     and         $15, rINST             # rINST<- A
11995     movl        (rFP, %edx, 4), %eax    # %eax<- vB
11996     movl        %eax, -12(%esp)         # push arg vB
11997     movl        4(rFP, %edx, 4), %ecx   # %ecx<- vB+1
11998     or          %ecx, %eax              # check for divide by zero
11999     je          common_errDivideByZero  # handle divide by zero
12000     movl        %ecx, -8(%esp)          # push arg vB+1
12001     movq        (rFP, rINST, 4), %xmm0  # %xmm0<- vA,vA+1
12002     jmp         .LOP_DIV_LONG_2ADDR_break
12003
12004
12005 /* ------------------------------ */
12006     .balign 64
12007 .L_OP_REM_LONG_2ADDR: /* 0xbf */
12008 /* File: x86-atom/OP_REM_LONG_2ADDR.S */
12009    /* Copyright (C) 2008 The Android Open Source Project
12010     *
12011     * Licensed under the Apache License, Version 2.0 (the "License");
12012     * you may not use this file except in compliance with the License.
12013     * You may obtain a copy of the License at
12014     *
12015     * http://www.apache.org/licenses/LICENSE-2.0
12016     *
12017     * Unless required by applicable law or agreed to in writing, software
12018     * distributed under the License is distributed on an "AS IS" BASIS,
12019     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12020     * See the License for the specific language governing permissions and
12021     * limitations under the License.
12022     */
12023
12024    /*
12025     * File: OP_REM_LONG_2ADDR.S
12026     */
12027
12028 /* File: x86-atom/binopDivRemLong2Addr.S */
12029    /* Copyright (C) 2008 The Android Open Source Project
12030     *
12031     * Licensed under the Apache License, Version 2.0 (the "License");
12032     * you may not use this file except in compliance with the License.
12033     * You may obtain a copy of the License at
12034     *
12035     * http://www.apache.org/licenses/LICENSE-2.0
12036     *
12037     * Unless required by applicable law or agreed to in writing, software
12038     * distributed under the License is distributed on an "AS IS" BASIS,
12039     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12040     * See the License for the specific language governing permissions and
12041     * limitations under the License.
12042     */
12043
12044    /*
12045     * File: binopDivRemLong2Addr.S
12046     *
12047     * Code: 64-bit "/2addr" long divide operation. Variable
12048     *       "func" defines the function called to do the operation.
12049     *
12050     * For: div-long/2addr, rem-long/2addr
12051     *
12052     * Description: Perform a binary operation on two sources registers
12053     *              and store the result in the first source register.
12054     *
12055     * Format: B|A|op (12x)
12056     *
12057     * Syntax: op vA, vB
12058     */
12059
12060
12061     movl        rINST, %edx             # %edx<- BA
12062     shr         $4, %edx               # %edx<- B
12063     and         $15, rINST             # rINST<- A
12064     movl        (rFP, %edx, 4), %eax    # %eax<- vB
12065     movl        %eax, -12(%esp)         # push arg vB
12066     movl        4(rFP, %edx, 4), %ecx   # %ecx<- vB+1
12067     or          %ecx, %eax              # check for divide by zero
12068     je          common_errDivideByZero  # handle divide by zero
12069     movl        %ecx, -8(%esp)          # push arg vB+1
12070     movq        (rFP, rINST, 4), %xmm0  # %xmm0<- vA,vA+1
12071     jmp         .LOP_REM_LONG_2ADDR_break
12072
12073
12074 /* ------------------------------ */
12075     .balign 64
12076 .L_OP_AND_LONG_2ADDR: /* 0xc0 */
12077 /* File: x86-atom/OP_AND_LONG_2ADDR.S */
12078    /* Copyright (C) 2008 The Android Open Source Project
12079     *
12080     * Licensed under the Apache License, Version 2.0 (the "License");
12081     * you may not use this file except in compliance with the License.
12082     * You may obtain a copy of the License at
12083     *
12084     * http://www.apache.org/licenses/LICENSE-2.0
12085     *
12086     * Unless required by applicable law or agreed to in writing, software
12087     * distributed under the License is distributed on an "AS IS" BASIS,
12088     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12089     * See the License for the specific language governing permissions and
12090     * limitations under the License.
12091     */
12092
12093    /*
12094     * File: OP_AND_LONG_2ADDR.S
12095     */
12096
12097 /* File: x86-atom/binopWide2addr.S */
12098    /* Copyright (C) 2008 The Android Open Source Project
12099     *
12100     * Licensed under the Apache License, Version 2.0 (the "License");
12101     * you may not use this file except in compliance with the License.
12102     * You may obtain a copy of the License at
12103     *
12104     * http://www.apache.org/licenses/LICENSE-2.0
12105     *
12106     * Unless required by applicable law or agreed to in writing, software
12107     * distributed under the License is distributed on an "AS IS" BASIS,
12108     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12109     * See the License for the specific language governing permissions and
12110     * limitations under the License.
12111     */
12112
12113    /*
12114     * File: binopWide2addr.S
12115     *
12116     * Code: Generic 64-bit "/2addr" binary operation.  Provides an
12117     *       "instr" line to specify an instruction that performs
12118     *       "%xmm0= %xmm0 op %xmm1".
12119     *
12120     * For: add-double/2addr, add-long/2addr, and-long/2addr, mul-long/2addr,
12121     *      or-long/2addr, sub-double/2addr, sub-long/2addr, xor-long/2addr
12122     *
12123     * Description: Perform a binary operation on two sources registers
12124     *              and store the result in the first source register
12125     *
12126     * Format: B|A|op (12x)
12127     *
12128     * Syntax: op vA, vB
12129     */
12130
12131     movl        rINST, %edx             # %edx<- BA
12132     shr         $4, rINST              # rINST<- B
12133     andl        $15, %edx              # %edx<- A
12134     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
12135     movq        (rFP, rINST, 4), %xmm1  # %xmm1<- vB
12136     movq        (rFP, %edx, 4), %xmm0   # %xmm0<- vA
12137     pand   %xmm1, %xmm0                              # %xmm0<- vA op vB
12138     movq        %xmm0, (rFP, %edx, 4)   # vA<- %xmm0; result
12139     #FINISH      1                      # jump to next instruction
12140     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
12141
12142 /* ------------------------------ */
12143     .balign 64
12144 .L_OP_OR_LONG_2ADDR: /* 0xc1 */
12145 /* File: x86-atom/OP_OR_LONG_2ADDR.S */
12146    /* Copyright (C) 2008 The Android Open Source Project
12147     *
12148     * Licensed under the Apache License, Version 2.0 (the "License");
12149     * you may not use this file except in compliance with the License.
12150     * You may obtain a copy of the License at
12151     *
12152     * http://www.apache.org/licenses/LICENSE-2.0
12153     *
12154     * Unless required by applicable law or agreed to in writing, software
12155     * distributed under the License is distributed on an "AS IS" BASIS,
12156     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12157     * See the License for the specific language governing permissions and
12158     * limitations under the License.
12159     */
12160
12161    /*
12162     * File: OP_OR_LONG_2ADDR.S
12163     */
12164
12165 /* File: x86-atom/binopWide2addr.S */
12166    /* Copyright (C) 2008 The Android Open Source Project
12167     *
12168     * Licensed under the Apache License, Version 2.0 (the "License");
12169     * you may not use this file except in compliance with the License.
12170     * You may obtain a copy of the License at
12171     *
12172     * http://www.apache.org/licenses/LICENSE-2.0
12173     *
12174     * Unless required by applicable law or agreed to in writing, software
12175     * distributed under the License is distributed on an "AS IS" BASIS,
12176     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12177     * See the License for the specific language governing permissions and
12178     * limitations under the License.
12179     */
12180
12181    /*
12182     * File: binopWide2addr.S
12183     *
12184     * Code: Generic 64-bit "/2addr" binary operation.  Provides an
12185     *       "instr" line to specify an instruction that performs
12186     *       "%xmm0= %xmm0 op %xmm1".
12187     *
12188     * For: add-double/2addr, add-long/2addr, and-long/2addr, mul-long/2addr,
12189     *      or-long/2addr, sub-double/2addr, sub-long/2addr, xor-long/2addr
12190     *
12191     * Description: Perform a binary operation on two sources registers
12192     *              and store the result in the first source register
12193     *
12194     * Format: B|A|op (12x)
12195     *
12196     * Syntax: op vA, vB
12197     */
12198
12199     movl        rINST, %edx             # %edx<- BA
12200     shr         $4, rINST              # rINST<- B
12201     andl        $15, %edx              # %edx<- A
12202     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
12203     movq        (rFP, rINST, 4), %xmm1  # %xmm1<- vB
12204     movq        (rFP, %edx, 4), %xmm0   # %xmm0<- vA
12205     por %xmm1, %xmm0                              # %xmm0<- vA op vB
12206     movq        %xmm0, (rFP, %edx, 4)   # vA<- %xmm0; result
12207     #FINISH      1                      # jump to next instruction
12208     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
12209
12210 /* ------------------------------ */
12211     .balign 64
12212 .L_OP_XOR_LONG_2ADDR: /* 0xc2 */
12213 /* File: x86-atom/OP_XOR_LONG_2ADDR.S */
12214    /* Copyright (C) 2008 The Android Open Source Project
12215     *
12216     * Licensed under the Apache License, Version 2.0 (the "License");
12217     * you may not use this file except in compliance with the License.
12218     * You may obtain a copy of the License at
12219     *
12220     * http://www.apache.org/licenses/LICENSE-2.0
12221     *
12222     * Unless required by applicable law or agreed to in writing, software
12223     * distributed under the License is distributed on an "AS IS" BASIS,
12224     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12225     * See the License for the specific language governing permissions and
12226     * limitations under the License.
12227     */
12228
12229    /*
12230     * File: OP_XOR_LONG_2ADDR.S
12231     */
12232
12233 /* File: x86-atom/binopWide2addr.S */
12234    /* Copyright (C) 2008 The Android Open Source Project
12235     *
12236     * Licensed under the Apache License, Version 2.0 (the "License");
12237     * you may not use this file except in compliance with the License.
12238     * You may obtain a copy of the License at
12239     *
12240     * http://www.apache.org/licenses/LICENSE-2.0
12241     *
12242     * Unless required by applicable law or agreed to in writing, software
12243     * distributed under the License is distributed on an "AS IS" BASIS,
12244     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12245     * See the License for the specific language governing permissions and
12246     * limitations under the License.
12247     */
12248
12249    /*
12250     * File: binopWide2addr.S
12251     *
12252     * Code: Generic 64-bit "/2addr" binary operation.  Provides an
12253     *       "instr" line to specify an instruction that performs
12254     *       "%xmm0= %xmm0 op %xmm1".
12255     *
12256     * For: add-double/2addr, add-long/2addr, and-long/2addr, mul-long/2addr,
12257     *      or-long/2addr, sub-double/2addr, sub-long/2addr, xor-long/2addr
12258     *
12259     * Description: Perform a binary operation on two sources registers
12260     *              and store the result in the first source register
12261     *
12262     * Format: B|A|op (12x)
12263     *
12264     * Syntax: op vA, vB
12265     */
12266
12267     movl        rINST, %edx             # %edx<- BA
12268     shr         $4, rINST              # rINST<- B
12269     andl        $15, %edx              # %edx<- A
12270     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
12271     movq        (rFP, rINST, 4), %xmm1  # %xmm1<- vB
12272     movq        (rFP, %edx, 4), %xmm0   # %xmm0<- vA
12273     pxor   %xmm1, %xmm0                              # %xmm0<- vA op vB
12274     movq        %xmm0, (rFP, %edx, 4)   # vA<- %xmm0; result
12275     #FINISH      1                      # jump to next instruction
12276     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
12277
12278 /* ------------------------------ */
12279     .balign 64
12280 .L_OP_SHL_LONG_2ADDR: /* 0xc3 */
12281 /* File: x86-atom/OP_SHL_LONG_2ADDR.S */
12282    /* Copyright (C) 2008 The Android Open Source Project
12283     *
12284     * Licensed under the Apache License, Version 2.0 (the "License");
12285     * you may not use this file except in compliance with the License.
12286     * You may obtain a copy of the License at
12287     *
12288     * http://www.apache.org/licenses/LICENSE-2.0
12289     *
12290     * Unless required by applicable law or agreed to in writing, software
12291     * distributed under the License is distributed on an "AS IS" BASIS,
12292     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12293     * See the License for the specific language governing permissions and
12294     * limitations under the License.
12295     */
12296
12297    /*
12298     * File: OP_SHL_LONG_2ADDR.S
12299     *
12300     * Code: Performs a shift left long. Uses no substitutions.
12301     *
12302     * For: shl-long/2addr
12303     *
12304     * Description: Perform a binary shift operation using two source registers
12305     *              where the fist is the value to shift and the second is the
12306     *              shift amount. Store the result in the first source register.
12307     *
12308     * Format: B|A|op (12x)
12309     *
12310     * Syntax: op vA, vB
12311     */
12312
12313     movl        rINST, %edx             # %edx<- BA
12314     shr         $4, %edx               # %edx<- B
12315     andl        $15, rINST             # rINST<- A
12316     movss       (rFP, %edx, 4),  %xmm0  # %xmm0<- vB
12317     movq        (rFP, rINST, 4), %xmm1  # %xmm1<- vA
12318     movq        .LshiftMask, %xmm2      # %xmm2<- mask for the shift bits
12319     pand        %xmm2, %xmm0            # %xmm0<- masked shift bits
12320     psllq       %xmm0, %xmm1            # %xmm1<- shifted vA
12321     movq        %xmm1, (rFP, rINST, 4)  # vA<- shifted vA
12322     FINISH      1                       # jump to next instruction
12323
12324 /* ------------------------------ */
12325     .balign 64
12326 .L_OP_SHR_LONG_2ADDR: /* 0xc4 */
12327 /* File: x86-atom/OP_SHR_LONG_2ADDR.S */
12328    /* Copyright (C) 2008 The Android Open Source Project
12329     *
12330     * Licensed under the Apache License, Version 2.0 (the "License");
12331     * you may not use this file except in compliance with the License.
12332     * You may obtain a copy of the License at
12333     *
12334     * http://www.apache.org/licenses/LICENSE-2.0
12335     *
12336     * Unless required by applicable law or agreed to in writing, software
12337     * distributed under the License is distributed on an "AS IS" BASIS,
12338     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12339     * See the License for the specific language governing permissions and
12340     * limitations under the License.
12341     */
12342
12343    /*
12344     * File: OP_SHR_LONG_2ADDR.S
12345     *
12346     * Code: Performs a shift left long
12347     *
12348     * For: shl-long/2addr
12349     *
12350     * Description: Perform a binary shift operation using two source registers
12351     *              where the fist is the value to shift and the second is the
12352     *              shift amount. Store the result in the first source register.
12353     *
12354     * Format: B|A|op (12x)
12355     *
12356     * Syntax: op vA, vB
12357     */
12358
12359     movl        rINST, %edx             # %edx<- BA
12360     shr         $4, %edx               # %edx<- B
12361     andl        $15, rINST             # rINST<- BA
12362     movss       (rFP, %edx, 4),  %xmm0  # %xmm0<- vB
12363     movq        (rFP, rINST, 4), %xmm1  # %xmm1<- vA
12364     movq        .LshiftMask, %xmm2
12365     pand        %xmm2, %xmm0            # %xmm0<- masked for the shift bits
12366     psrlq       %xmm0, %xmm1            # %xmm1<- shifted vBB
12367     cmpl        $0, 4(rFP, rINST, 4)   # check if we need to consider sign
12368     jl          .LOP_SHR_LONG_2ADDR_finish      # consider sign
12369     jmp         .LOP_SHR_LONG_2ADDR_final       # sign is fine, finish
12370
12371 /* ------------------------------ */
12372     .balign 64
12373 .L_OP_USHR_LONG_2ADDR: /* 0xc5 */
12374 /* File: x86-atom/OP_USHR_LONG_2ADDR.S */
12375    /* Copyright (C) 2008 The Android Open Source Project
12376     *
12377     * Licensed under the Apache License, Version 2.0 (the "License");
12378     * you may not use this file except in compliance with the License.
12379     * You may obtain a copy of the License at
12380     *
12381     * http://www.apache.org/licenses/LICENSE-2.0
12382     *
12383     * Unless required by applicable law or agreed to in writing, software
12384     * distributed under the License is distributed on an "AS IS" BASIS,
12385     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12386     * See the License for the specific language governing permissions and
12387     * limitations under the License.
12388     */
12389
12390    /*
12391     * File: OP_USHR_LONG_2ADDR.S
12392     *
12393     * Code: Performs an unsigned shift right long operation. Uses no substiutions.
12394     *
12395     * For: ushr-long/2addr
12396     *
12397     * Description: Perform a binary shift operation using two source registers
12398     *              where the fist is the value to shift and the second is the
12399     *              shift amount. Store the result in the first source register.
12400     *
12401     * Format: B|A|op (12x)
12402     *
12403     * Syntax: op vA, vB
12404     */
12405
12406     movl        rINST, %edx             # %edx<- BA
12407     shr         $4, %edx               # %edx<- B
12408     andl        $15, rINST             # rINST<- A
12409     movq        .LshiftMask, %xmm2      # %xmm2<- mask for the shift bits
12410     movss       (rFP, %edx, 4),  %xmm0  # %xmm0<- vB
12411     movq        (rFP, rINST, 4), %xmm1  # %xmm1<- vA
12412     pand        %xmm2, %xmm0            # %xmm0<- masked shift bits
12413     psrlq       %xmm0, %xmm1            # %xmm1<- shifted vA
12414     movq        %xmm1, (rFP, rINST, 4)  # vA<- shifted vA
12415     FINISH      1                       # jump to next instruction
12416
12417 /* ------------------------------ */
12418     .balign 64
12419 .L_OP_ADD_FLOAT_2ADDR: /* 0xc6 */
12420 /* File: x86-atom/OP_ADD_FLOAT_2ADDR.S */
12421    /* Copyright (C) 2008 The Android Open Source Project
12422     *
12423     * Licensed under the Apache License, Version 2.0 (the "License");
12424     * you may not use this file except in compliance with the License.
12425     * You may obtain a copy of the License at
12426     *
12427     * http://www.apache.org/licenses/LICENSE-2.0
12428     *
12429     * Unless required by applicable law or agreed to in writing, software
12430     * distributed under the License is distributed on an "AS IS" BASIS,
12431     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12432     * See the License for the specific language governing permissions and
12433     * limitations under the License.
12434     */
12435
12436    /*
12437     * File: OP_ADD_FLOAT_2ADDR.S
12438     */
12439
12440 /* File: x86-atom/binopF2addr.S */
12441    /* Copyright (C) 2008 The Android Open Source Project
12442     *
12443     * Licensed under the Apache License, Version 2.0 (the "License");
12444     * you may not use this file except in compliance with the License.
12445     * You may obtain a copy of the License at
12446     *
12447     * http://www.apache.org/licenses/LICENSE-2.0
12448     *
12449     * Unless required by applicable law or agreed to in writing, software
12450     * distributed under the License is distributed on an "AS IS" BASIS,
12451     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12452     * See the License for the specific language governing permissions and
12453     * limitations under the License.
12454     */
12455
12456    /*
12457     * File: binopF2addr.S
12458     *
12459     * Code: Generic 32-bit "/2addr" binary operation.  Provides an
12460     *       "instr" line to specify an instruction that performs
12461     *       "%xmm0 = %xmm0 op %xmm1".
12462     *
12463     * For: add-float/2addr, mul-float/2addr, sub-float/2addr
12464     *
12465     * Description: Perform a binary operation on two sources registers
12466     *              and store the result in the first source register
12467     *
12468     * Format: B|A|op (12x)
12469     *
12470     * Syntax: op vA, vB
12471     */
12472
12473     movl        rINST, %ecx             # %ecx<- BA
12474     andl        $15, %ecx              # %ecx<- A
12475     shr         $4, rINST              # rINST<- B
12476     FFETCH_ADV  1, %edx                 # %ecx<- next instruction hi; fetch, advance
12477     movss       (rFP, %ecx, 4), %xmm0   # %xmm0<- vA
12478     movss       (rFP, rINST, 4), %xmm1  # %xmm1<- vB
12479     addss     %xmm1, %xmm0                              # %xmm0<- vA op vB
12480     movss       %xmm0, (rFP, %ecx, 4)   # vA<- %xmm0; result
12481     FGETOP_JMP  1, %edx                 # jump to next instruction; getop, jmp
12482
12483 /* ------------------------------ */
12484     .balign 64
12485 .L_OP_SUB_FLOAT_2ADDR: /* 0xc7 */
12486 /* File: x86-atom/OP_SUB_FLOAT_2ADDR.S */
12487    /* Copyright (C) 2008 The Android Open Source Project
12488     *
12489     * Licensed under the Apache License, Version 2.0 (the "License");
12490     * you may not use this file except in compliance with the License.
12491     * You may obtain a copy of the License at
12492     *
12493     * http://www.apache.org/licenses/LICENSE-2.0
12494     *
12495     * Unless required by applicable law or agreed to in writing, software
12496     * distributed under the License is distributed on an "AS IS" BASIS,
12497     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12498     * See the License for the specific language governing permissions and
12499     * limitations under the License.
12500     */
12501
12502    /*
12503     * File: OP_SUB_FLOAT_2ADDR.S
12504     */
12505
12506 /* File: x86-atom/binopF2addr.S */
12507    /* Copyright (C) 2008 The Android Open Source Project
12508     *
12509     * Licensed under the Apache License, Version 2.0 (the "License");
12510     * you may not use this file except in compliance with the License.
12511     * You may obtain a copy of the License at
12512     *
12513     * http://www.apache.org/licenses/LICENSE-2.0
12514     *
12515     * Unless required by applicable law or agreed to in writing, software
12516     * distributed under the License is distributed on an "AS IS" BASIS,
12517     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12518     * See the License for the specific language governing permissions and
12519     * limitations under the License.
12520     */
12521
12522    /*
12523     * File: binopF2addr.S
12524     *
12525     * Code: Generic 32-bit "/2addr" binary operation.  Provides an
12526     *       "instr" line to specify an instruction that performs
12527     *       "%xmm0 = %xmm0 op %xmm1".
12528     *
12529     * For: add-float/2addr, mul-float/2addr, sub-float/2addr
12530     *
12531     * Description: Perform a binary operation on two sources registers
12532     *              and store the result in the first source register
12533     *
12534     * Format: B|A|op (12x)
12535     *
12536     * Syntax: op vA, vB
12537     */
12538
12539     movl        rINST, %ecx             # %ecx<- BA
12540     andl        $15, %ecx              # %ecx<- A
12541     shr         $4, rINST              # rINST<- B
12542     FFETCH_ADV  1, %edx                 # %ecx<- next instruction hi; fetch, advance
12543     movss       (rFP, %ecx, 4), %xmm0   # %xmm0<- vA
12544     movss       (rFP, rINST, 4), %xmm1  # %xmm1<- vB
12545     subss     %xmm1, %xmm0                              # %xmm0<- vA op vB
12546     movss       %xmm0, (rFP, %ecx, 4)   # vA<- %xmm0; result
12547     FGETOP_JMP  1, %edx                 # jump to next instruction; getop, jmp
12548
12549 /* ------------------------------ */
12550     .balign 64
12551 .L_OP_MUL_FLOAT_2ADDR: /* 0xc8 */
12552 /* File: x86-atom/OP_MUL_FLOAT_2ADDR.S */
12553    /* Copyright (C) 2008 The Android Open Source Project
12554     *
12555     * Licensed under the Apache License, Version 2.0 (the "License");
12556     * you may not use this file except in compliance with the License.
12557     * You may obtain a copy of the License at
12558     *
12559     * http://www.apache.org/licenses/LICENSE-2.0
12560     *
12561     * Unless required by applicable law or agreed to in writing, software
12562     * distributed under the License is distributed on an "AS IS" BASIS,
12563     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12564     * See the License for the specific language governing permissions and
12565     * limitations under the License.
12566     */
12567
12568    /*
12569     * File: OP_MUL_FLOAT_2ADDR.S
12570     */
12571
12572 /* File: x86-atom/binopF2addr.S */
12573    /* Copyright (C) 2008 The Android Open Source Project
12574     *
12575     * Licensed under the Apache License, Version 2.0 (the "License");
12576     * you may not use this file except in compliance with the License.
12577     * You may obtain a copy of the License at
12578     *
12579     * http://www.apache.org/licenses/LICENSE-2.0
12580     *
12581     * Unless required by applicable law or agreed to in writing, software
12582     * distributed under the License is distributed on an "AS IS" BASIS,
12583     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12584     * See the License for the specific language governing permissions and
12585     * limitations under the License.
12586     */
12587
12588    /*
12589     * File: binopF2addr.S
12590     *
12591     * Code: Generic 32-bit "/2addr" binary operation.  Provides an
12592     *       "instr" line to specify an instruction that performs
12593     *       "%xmm0 = %xmm0 op %xmm1".
12594     *
12595     * For: add-float/2addr, mul-float/2addr, sub-float/2addr
12596     *
12597     * Description: Perform a binary operation on two sources registers
12598     *              and store the result in the first source register
12599     *
12600     * Format: B|A|op (12x)
12601     *
12602     * Syntax: op vA, vB
12603     */
12604
12605     movl        rINST, %ecx             # %ecx<- BA
12606     andl        $15, %ecx              # %ecx<- A
12607     shr         $4, rINST              # rINST<- B
12608     FFETCH_ADV  1, %edx                 # %ecx<- next instruction hi; fetch, advance
12609     movss       (rFP, %ecx, 4), %xmm0   # %xmm0<- vA
12610     movss       (rFP, rINST, 4), %xmm1  # %xmm1<- vB
12611     mulss %xmm1, %xmm0                              # %xmm0<- vA op vB
12612     movss       %xmm0, (rFP, %ecx, 4)   # vA<- %xmm0; result
12613     FGETOP_JMP  1, %edx                 # jump to next instruction; getop, jmp
12614
12615 /* ------------------------------ */
12616     .balign 64
12617 .L_OP_DIV_FLOAT_2ADDR: /* 0xc9 */
12618 /* File: x86-atom/OP_DIV_FLOAT_2ADDR.S */
12619    /* Copyright (C) 2008 The Android Open Source Project
12620     *
12621     * Licensed under the Apache License, Version 2.0 (the "License");
12622     * you may not use this file except in compliance with the License.
12623     * You may obtain a copy of the License at
12624     *
12625     * http://www.apache.org/licenses/LICENSE-2.0
12626     *
12627     * Unless required by applicable law or agreed to in writing, software
12628     * distributed under the License is distributed on an "AS IS" BASIS,
12629     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12630     * See the License for the specific language governing permissions and
12631     * limitations under the License.
12632     */
12633
12634    /*
12635     * File: OP_DIV_FLOAT_2ADDR.S
12636     *
12637     * Code: Divides floats. Uses no substitutions.
12638     *
12639     * For: div-float/2addr
12640     *
12641     * Description: Divide operation on two source registers, storing
12642     *              the result in the first source reigster
12643     *
12644     * Format: B|A|op (12x)
12645     *
12646     * Syntax: op vA, vB
12647     */
12648
12649     movl        rINST, %ecx             # %ecx<- BA
12650     andl        $15, %ecx              # %ecx<- A
12651     shr         $4, rINST              # rINST<- B
12652     flds        (rFP, %ecx, 4)          # %xmm0<- vA
12653     fdivs       (rFP, rINST, 4)         # divide double; vA/vB
12654     fstps       (rFP, %ecx, 4)          # vAA<- result
12655     FINISH      1                       # jump to next instruction
12656
12657 /* ------------------------------ */
12658     .balign 64
12659 .L_OP_REM_FLOAT_2ADDR: /* 0xca */
12660 /* File: x86-atom/OP_REM_FLOAT_2ADDR.S */
12661    /* Copyright (C) 2008 The Android Open Source Project
12662     *
12663     * Licensed under the Apache License, Version 2.0 (the "License");
12664     * you may not use this file except in compliance with the License.
12665     * You may obtain a copy of the License at
12666     *
12667     * http://www.apache.org/licenses/LICENSE-2.0
12668     *
12669     * Unless required by applicable law or agreed to in writing, software
12670     * distributed under the License is distributed on an "AS IS" BASIS,
12671     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12672     * See the License for the specific language governing permissions and
12673     * limitations under the License.
12674     */
12675
12676    /*
12677     * File: OP_REM_FLOAT_2ADDR.S
12678     *
12679     * Code: Computes the remainder of a division. Performs no substitutions.
12680     *
12681     * For: rem-float/2addr
12682     *
12683     * Description: Calls fmod to compute the remainder of the result of dividing a
12684     *              source register by a second, and stores the result in the first
12685     *              source register.
12686     *
12687     * Format: B|A|op (12x)
12688     *
12689     * Syntax: op vA, vB
12690     */
12691
12692     movl        rINST, %edx             # %edx<- BA
12693     shr         $4, %edx               # %edx<- B
12694     andl        $15, rINST             # rINST<- A
12695     GET_VREG    %edx                    # %edx<- vB
12696     movl        (rFP, rINST, 4), %ecx   # %ecx<- vA
12697     movl        %ecx, -8(%esp)          # push parameter vA
12698     movl        %edx, -4(%esp)          # push parameter vB
12699     lea         -8(%esp), %esp
12700     call        fmodf                   # call: (float x, float y)
12701                                         # return: float
12702     lea         8(%esp), %esp
12703     fstps       (rFP, rINST, 4)
12704     FINISH      1                       # jump to next instruction
12705
12706 /* ------------------------------ */
12707     .balign 64
12708 .L_OP_ADD_DOUBLE_2ADDR: /* 0xcb */
12709 /* File: x86-atom/OP_ADD_DOUBLE_2ADDR.S */
12710    /* Copyright (C) 2008 The Android Open Source Project
12711     *
12712     * Licensed under the Apache License, Version 2.0 (the "License");
12713     * you may not use this file except in compliance with the License.
12714     * You may obtain a copy of the License at
12715     *
12716     * http://www.apache.org/licenses/LICENSE-2.0
12717     *
12718     * Unless required by applicable law or agreed to in writing, software
12719     * distributed under the License is distributed on an "AS IS" BASIS,
12720     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12721     * See the License for the specific language governing permissions and
12722     * limitations under the License.
12723     */
12724
12725    /*
12726     * File: OP_ADD_DOUBLE_2ADDR.S
12727     */
12728
12729 /* File: x86-atom/binopWide2addr.S */
12730    /* Copyright (C) 2008 The Android Open Source Project
12731     *
12732     * Licensed under the Apache License, Version 2.0 (the "License");
12733     * you may not use this file except in compliance with the License.
12734     * You may obtain a copy of the License at
12735     *
12736     * http://www.apache.org/licenses/LICENSE-2.0
12737     *
12738     * Unless required by applicable law or agreed to in writing, software
12739     * distributed under the License is distributed on an "AS IS" BASIS,
12740     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12741     * See the License for the specific language governing permissions and
12742     * limitations under the License.
12743     */
12744
12745    /*
12746     * File: binopWide2addr.S
12747     *
12748     * Code: Generic 64-bit "/2addr" binary operation.  Provides an
12749     *       "instr" line to specify an instruction that performs
12750     *       "%xmm0= %xmm0 op %xmm1".
12751     *
12752     * For: add-double/2addr, add-long/2addr, and-long/2addr, mul-long/2addr,
12753     *      or-long/2addr, sub-double/2addr, sub-long/2addr, xor-long/2addr
12754     *
12755     * Description: Perform a binary operation on two sources registers
12756     *              and store the result in the first source register
12757     *
12758     * Format: B|A|op (12x)
12759     *
12760     * Syntax: op vA, vB
12761     */
12762
12763     movl        rINST, %edx             # %edx<- BA
12764     shr         $4, rINST              # rINST<- B
12765     andl        $15, %edx              # %edx<- A
12766     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
12767     movq        (rFP, rINST, 4), %xmm1  # %xmm1<- vB
12768     movq        (rFP, %edx, 4), %xmm0   # %xmm0<- vA
12769     addsd   %xmm1, %xmm0                              # %xmm0<- vA op vB
12770     movq        %xmm0, (rFP, %edx, 4)   # vA<- %xmm0; result
12771     #FINISH      1                      # jump to next instruction
12772     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
12773
12774 /* ------------------------------ */
12775     .balign 64
12776 .L_OP_SUB_DOUBLE_2ADDR: /* 0xcc */
12777 /* File: x86-atom/OP_SUB_DOUBLE_2ADDR.S */
12778    /* Copyright (C) 2008 The Android Open Source Project
12779     *
12780     * Licensed under the Apache License, Version 2.0 (the "License");
12781     * you may not use this file except in compliance with the License.
12782     * You may obtain a copy of the License at
12783     *
12784     * http://www.apache.org/licenses/LICENSE-2.0
12785     *
12786     * Unless required by applicable law or agreed to in writing, software
12787     * distributed under the License is distributed on an "AS IS" BASIS,
12788     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12789     * See the License for the specific language governing permissions and
12790     * limitations under the License.
12791     */
12792
12793    /*
12794     * File: OP_SUB_DOUBLE_2ADDR.S
12795     */
12796
12797 /* File: x86-atom/binopWide2addr.S */
12798    /* Copyright (C) 2008 The Android Open Source Project
12799     *
12800     * Licensed under the Apache License, Version 2.0 (the "License");
12801     * you may not use this file except in compliance with the License.
12802     * You may obtain a copy of the License at
12803     *
12804     * http://www.apache.org/licenses/LICENSE-2.0
12805     *
12806     * Unless required by applicable law or agreed to in writing, software
12807     * distributed under the License is distributed on an "AS IS" BASIS,
12808     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12809     * See the License for the specific language governing permissions and
12810     * limitations under the License.
12811     */
12812
12813    /*
12814     * File: binopWide2addr.S
12815     *
12816     * Code: Generic 64-bit "/2addr" binary operation.  Provides an
12817     *       "instr" line to specify an instruction that performs
12818     *       "%xmm0= %xmm0 op %xmm1".
12819     *
12820     * For: add-double/2addr, add-long/2addr, and-long/2addr, mul-long/2addr,
12821     *      or-long/2addr, sub-double/2addr, sub-long/2addr, xor-long/2addr
12822     *
12823     * Description: Perform a binary operation on two sources registers
12824     *              and store the result in the first source register
12825     *
12826     * Format: B|A|op (12x)
12827     *
12828     * Syntax: op vA, vB
12829     */
12830
12831     movl        rINST, %edx             # %edx<- BA
12832     shr         $4, rINST              # rINST<- B
12833     andl        $15, %edx              # %edx<- A
12834     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
12835     movq        (rFP, rINST, 4), %xmm1  # %xmm1<- vB
12836     movq        (rFP, %edx, 4), %xmm0   # %xmm0<- vA
12837     subsd   %xmm1, %xmm0                              # %xmm0<- vA op vB
12838     movq        %xmm0, (rFP, %edx, 4)   # vA<- %xmm0; result
12839     #FINISH      1                      # jump to next instruction
12840     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
12841
12842 /* ------------------------------ */
12843     .balign 64
12844 .L_OP_MUL_DOUBLE_2ADDR: /* 0xcd */
12845 /* File: x86-atom/OP_MUL_DOUBLE_2ADDR.S */
12846    /* Copyright (C) 2008 The Android Open Source Project
12847     *
12848     * Licensed under the Apache License, Version 2.0 (the "License");
12849     * you may not use this file except in compliance with the License.
12850     * You may obtain a copy of the License at
12851     *
12852     * http://www.apache.org/licenses/LICENSE-2.0
12853     *
12854     * Unless required by applicable law or agreed to in writing, software
12855     * distributed under the License is distributed on an "AS IS" BASIS,
12856     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12857     * See the License for the specific language governing permissions and
12858     * limitations under the License.
12859     */
12860
12861    /*
12862     * File: OP_MUL_DOUBLE_2ADDR.S
12863     */
12864
12865 /* File: x86-atom/binopWide2addr.S */
12866    /* Copyright (C) 2008 The Android Open Source Project
12867     *
12868     * Licensed under the Apache License, Version 2.0 (the "License");
12869     * you may not use this file except in compliance with the License.
12870     * You may obtain a copy of the License at
12871     *
12872     * http://www.apache.org/licenses/LICENSE-2.0
12873     *
12874     * Unless required by applicable law or agreed to in writing, software
12875     * distributed under the License is distributed on an "AS IS" BASIS,
12876     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12877     * See the License for the specific language governing permissions and
12878     * limitations under the License.
12879     */
12880
12881    /*
12882     * File: binopWide2addr.S
12883     *
12884     * Code: Generic 64-bit "/2addr" binary operation.  Provides an
12885     *       "instr" line to specify an instruction that performs
12886     *       "%xmm0= %xmm0 op %xmm1".
12887     *
12888     * For: add-double/2addr, add-long/2addr, and-long/2addr, mul-long/2addr,
12889     *      or-long/2addr, sub-double/2addr, sub-long/2addr, xor-long/2addr
12890     *
12891     * Description: Perform a binary operation on two sources registers
12892     *              and store the result in the first source register
12893     *
12894     * Format: B|A|op (12x)
12895     *
12896     * Syntax: op vA, vB
12897     */
12898
12899     movl        rINST, %edx             # %edx<- BA
12900     shr         $4, rINST              # rINST<- B
12901     andl        $15, %edx              # %edx<- A
12902     FFETCH_ADV  1, %eax                 # %eax<- next instruction hi; fetch, advance
12903     movq        (rFP, rINST, 4), %xmm1  # %xmm1<- vB
12904     movq        (rFP, %edx, 4), %xmm0   # %xmm0<- vA
12905     mulsd   %xmm1, %xmm0                              # %xmm0<- vA op vB
12906     movq        %xmm0, (rFP, %edx, 4)   # vA<- %xmm0; result
12907     #FINISH      1                      # jump to next instruction
12908     FGETOP_JMP  1, %eax                 # jump to next instruction; getop, jmp
12909
12910 /* ------------------------------ */
12911     .balign 64
12912 .L_OP_DIV_DOUBLE_2ADDR: /* 0xce */
12913 /* File: x86-atom/OP_DIV_DOUBLE_2ADDR.S */
12914    /* Copyright (C) 2008 The Android Open Source Project
12915     *
12916     * Licensed under the Apache License, Version 2.0 (the "License");
12917     * you may not use this file except in compliance with the License.
12918     * You may obtain a copy of the License at
12919     *
12920     * http://www.apache.org/licenses/LICENSE-2.0
12921     *
12922     * Unless required by applicable law or agreed to in writing, software
12923     * distributed under the License is distributed on an "AS IS" BASIS,
12924     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12925     * See the License for the specific language governing permissions and
12926     * limitations under the License.
12927     */
12928
12929    /*
12930     * File: OP_DIV_DOUBLE_2ADDR.S
12931     *
12932     * Code: Divides doubles. Uses no substitutions.
12933     *
12934     * For: div-double/2addr
12935     *
12936     * Description: Divide operation on two source registers, storing
12937     *              the result in the first source reigster
12938     *
12939     * Format: B|A|op (12x)
12940     *
12941     * Syntax: op vA, vB
12942     */
12943
12944     movl        rINST, %edx             # %edx<- BA
12945     andl        $15, %edx              # %edx<- A
12946     shr         $4, rINST              # rINST<- B
12947     fldl        (rFP, %edx, 4)          # %xmm0<- vA
12948     fdivl       (rFP, rINST, 4)         # divide double; vA/vB
12949     fstpl       (rFP, %edx, 4)          # vAA<- result
12950     FINISH      1                       # jump to next instruction
12951
12952 /* ------------------------------ */
12953     .balign 64
12954 .L_OP_REM_DOUBLE_2ADDR: /* 0xcf */
12955 /* File: x86-atom/OP_REM_DOUBLE_2ADDR.S */
12956    /* Copyright (C) 2008 The Android Open Source Project
12957     *
12958     * Licensed under the Apache License, Version 2.0 (the "License");
12959     * you may not use this file except in compliance with the License.
12960     * You may obtain a copy of the License at
12961     *
12962     * http://www.apache.org/licenses/LICENSE-2.0
12963     *
12964     * Unless required by applicable law or agreed to in writing, software
12965     * distributed under the License is distributed on an "AS IS" BASIS,
12966     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12967     * See the License for the specific language governing permissions and
12968     * limitations under the License.
12969     */
12970
12971    /*
12972     * File: OP_REM_DOUBLE_2ADDR.S
12973     *
12974     * Code: Computes the remainder of a division. Performs no substitutions.
12975     *
12976     * For: rem-double/2addr
12977     *
12978     * Description: Calls fmod to compute the remainder of the result of dividing a
12979     *              source register by a second, and stores the result in the first
12980     *              source register.
12981     *
12982     * Format: B|A|op (12x)
12983     *
12984     * Syntax: op vA, vB
12985     */
12986
12987     movl        rINST, %edx             # %edx<- BA
12988     and         $15, rINST             # rINST<- A
12989     shr         $4, %edx               # %edx<- B
12990     movl        (rFP, rINST, 4), %eax   # %eax<- vAlo
12991     movl        %eax, -20(%esp)         # push parameter vAAlo
12992     movl        4(rFP, rINST, 4), %eax  # %eax<- vAhi
12993     movl        %eax, -16(%esp)         # push parameter vAAhi
12994     movl        (rFP, %edx, 4), %eax    # %eax<- vBlo
12995     movl        %eax, -12(%esp)         # push parameter vBBlo
12996     movl        4(rFP, %edx, 4), %eax   # %eax<- vBhi
12997     movl        %eax, -8(%esp)          # push parameter vBBhi
12998     lea         -20(%esp), %esp
12999     jmp         .LOP_REM_DOUBLE_2ADDR_break
13000
13001 /* ------------------------------ */
13002     .balign 64
13003 .L_OP_ADD_INT_LIT16: /* 0xd0 */
13004 /* File: x86-atom/OP_ADD_INT_LIT16.S */
13005    /* Copyright (C) 2008 The Android Open Source Project
13006     *
13007     * Licensed under the Apache License, Version 2.0 (the "License");
13008     * you may not use this file except in compliance with the License.
13009     * You may obtain a copy of the License at
13010     *
13011     * http://www.apache.org/licenses/LICENSE-2.0
13012     *
13013     * Unless required by applicable law or agreed to in writing, software
13014     * distributed under the License is distributed on an "AS IS" BASIS,
13015     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13016     * See the License for the specific language governing permissions and
13017     * limitations under the License.
13018     */
13019
13020    /*
13021     * File: OP_ADD_INT_LIT16.S
13022     */
13023
13024 /* File: x86-atom/binopLit16.S */
13025    /* Copyright (C) 2008 The Android Open Source Project
13026     *
13027     * Licensed under the Apache License, Version 2.0 (the "License");
13028     * you may not use this file except in compliance with the License.
13029     * You may obtain a copy of the License at
13030     *
13031     * http://www.apache.org/licenses/LICENSE-2.0
13032     *
13033     * Unless required by applicable law or agreed to in writing, software
13034     * distributed under the License is distributed on an "AS IS" BASIS,
13035     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13036     * See the License for the specific language governing permissions and
13037     * limitations under the License.
13038     */
13039
13040    /*
13041     * File: binopLit16.S
13042     *
13043     * Code: 32-bit "lit16" operation. Provides an "instr" line to
13044     *       specify an instruction that performs "%ecx = %ecx op %edx"
13045     *
13046     *
13047     * For: add-int/lit16, and-int/lit16, mul-int/lit16, or-int/lit16
13048     *      xor-int/lit16
13049     *
13050     * Description: Perform a binary operation on a register and a
13051     *              sign extended 16-bit literal value and store the
13052     *              result in a destination register.
13053     *
13054     * Format: B|A|op CCCC (22s)
13055     *
13056     * Syntax: op vA, vB, #+CCCC
13057     */
13058
13059     movl        rINST, %ecx             # %ecx<- BA
13060     shr         $4, %ecx               # %ecx<- B
13061     andl        $15, rINST             # rINST<- A
13062     FETCHs      1, %edx                 # %edx<- +CCCC, sign-extended literal
13063     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
13064     GET_VREG    %ecx                    # %ecx<- vB
13065     addl     %edx, %ecx                              # %ecx<- vA op vB
13066     SET_VREG    %ecx, rINST             # vA<- %ecx; result
13067     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
13068
13069 /* ------------------------------ */
13070     .balign 64
13071 .L_OP_RSUB_INT: /* 0xd1 */
13072 /* File: x86-atom/OP_RSUB_INT.S */
13073    /* Copyright (C) 2008 The Android Open Source Project
13074     *
13075     * Licensed under the Apache License, Version 2.0 (the "License");
13076     * you may not use this file except in compliance with the License.
13077     * You may obtain a copy of the License at
13078     *
13079     * http://www.apache.org/licenses/LICENSE-2.0
13080     *
13081     * Unless required by applicable law or agreed to in writing, software
13082     * distributed under the License is distributed on an "AS IS" BASIS,
13083     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13084     * See the License for the specific language governing permissions and
13085     * limitations under the License.
13086     */
13087
13088    /*
13089     * File: OP_RSUB_INT.S
13090     *
13091     * Code: 32-bit reverse-subtraction. Uses no substitutions.
13092     *
13093     * For: rsub-int
13094     *
13095     * Description: Perform a reverse subtraction on a register and a
13096     *              signed extended 16-bit literal value and store the
13097     *              result in a destination register.
13098     *
13099     * Format: B|A|op CCCC (22s)
13100     *
13101     * Syntax: op vA, vB, #+CCCC
13102     */
13103
13104     movl        rINST, %ecx             # %ecx<- BA
13105     shr         $4, %ecx               # %ecx<- B
13106     andl        $15, rINST             # rINST<- A
13107     FETCHs      1, %edx                 # %edx<- +CCCC, sign-extended literal
13108     GET_VREG    %ecx                    # %ecx<- vB
13109     subl        %ecx, %edx              # %edx<- +CCCC sub vB
13110     SET_VREG    %edx, rINST             # vA<- %edx; result
13111     FINISH      2                       # jump to next instruction
13112 /* ------------------------------ */
13113     .balign 64
13114 .L_OP_MUL_INT_LIT16: /* 0xd2 */
13115 /* File: x86-atom/OP_MUL_INT_LIT16.S */
13116    /* Copyright (C) 2008 The Android Open Source Project
13117     *
13118     * Licensed under the Apache License, Version 2.0 (the "License");
13119     * you may not use this file except in compliance with the License.
13120     * You may obtain a copy of the License at
13121     *
13122     * http://www.apache.org/licenses/LICENSE-2.0
13123     *
13124     * Unless required by applicable law or agreed to in writing, software
13125     * distributed under the License is distributed on an "AS IS" BASIS,
13126     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13127     * See the License for the specific language governing permissions and
13128     * limitations under the License.
13129     */
13130
13131    /*
13132     * File: OP_MUL_INT_LIT16.S
13133     */
13134
13135 /* File: x86-atom/binopLit16.S */
13136    /* Copyright (C) 2008 The Android Open Source Project
13137     *
13138     * Licensed under the Apache License, Version 2.0 (the "License");
13139     * you may not use this file except in compliance with the License.
13140     * You may obtain a copy of the License at
13141     *
13142     * http://www.apache.org/licenses/LICENSE-2.0
13143     *
13144     * Unless required by applicable law or agreed to in writing, software
13145     * distributed under the License is distributed on an "AS IS" BASIS,
13146     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13147     * See the License for the specific language governing permissions and
13148     * limitations under the License.
13149     */
13150
13151    /*
13152     * File: binopLit16.S
13153     *
13154     * Code: 32-bit "lit16" operation. Provides an "instr" line to
13155     *       specify an instruction that performs "%ecx = %ecx op %edx"
13156     *
13157     *
13158     * For: add-int/lit16, and-int/lit16, mul-int/lit16, or-int/lit16
13159     *      xor-int/lit16
13160     *
13161     * Description: Perform a binary operation on a register and a
13162     *              sign extended 16-bit literal value and store the
13163     *              result in a destination register.
13164     *
13165     * Format: B|A|op CCCC (22s)
13166     *
13167     * Syntax: op vA, vB, #+CCCC
13168     */
13169
13170     movl        rINST, %ecx             # %ecx<- BA
13171     shr         $4, %ecx               # %ecx<- B
13172     andl        $15, rINST             # rINST<- A
13173     FETCHs      1, %edx                 # %edx<- +CCCC, sign-extended literal
13174     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
13175     GET_VREG    %ecx                    # %ecx<- vB
13176     imul     %edx, %ecx                              # %ecx<- vA op vB
13177     SET_VREG    %ecx, rINST             # vA<- %ecx; result
13178     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
13179
13180 /* ------------------------------ */
13181     .balign 64
13182 .L_OP_DIV_INT_LIT16: /* 0xd3 */
13183 /* File: x86-atom/OP_DIV_INT_LIT16.S */
13184    /* Copyright (C) 2008 The Android Open Source Project
13185     *
13186     * Licensed under the Apache License, Version 2.0 (the "License");
13187     * you may not use this file except in compliance with the License.
13188     * You may obtain a copy of the License at
13189     *
13190     * http://www.apache.org/licenses/LICENSE-2.0
13191     *
13192     * Unless required by applicable law or agreed to in writing, software
13193     * distributed under the License is distributed on an "AS IS" BASIS,
13194     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13195     * See the License for the specific language governing permissions and
13196     * limitations under the License.
13197     */
13198
13199    /*
13200     * File: OP_DIV_INT_LIT16.S
13201     */
13202
13203 /* File: x86-atom/binopDLit16.S */
13204    /* Copyright (C) 2008 The Android Open Source Project
13205     *
13206     * Licensed under the Apache License, Version 2.0 (the "License");
13207     * you may not use this file except in compliance with the License.
13208     * You may obtain a copy of the License at
13209     *
13210     * http://www.apache.org/licenses/LICENSE-2.0
13211     *
13212     * Unless required by applicable law or agreed to in writing, software
13213     * distributed under the License is distributed on an "AS IS" BASIS,
13214     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13215     * See the License for the specific language governing permissions and
13216     * limitations under the License.
13217     */
13218
13219    /*
13220     * File: binopDLit16.S
13221     *
13222     * Code: 32-bit "lit16" divide operation. If "div" is set, the code
13223     *       returns the quotient, else it returns the remainder.
13224     *       Also, a divide-by-zero check is done.
13225     *
13226     * For: div-int/lit16, rem-int/lit16
13227     *
13228     * Description: Perform a binary operation on a register and a
13229     *              sign extended 16-bit literal value
13230     *
13231     * Format: B|A|op CCCC (22s)
13232     *
13233     * Syntax: op vA, vB, #+CCCC
13234     */
13235
13236
13237     movl        rINST, %eax             # %eax<- BA
13238     shr         $4, %eax               # %eax<- B
13239     FETCHs      1, %ecx                 # %ecx<- +CCCC, sign-extended literal
13240     testl       %ecx, %ecx              # check for divide by zero
13241     GET_VREG    %eax                    # %eax<- vB
13242     je          common_errDivideByZero  # handle divide by zero
13243     addl        $4, rPC                # update PC
13244     andl        $15, rINST             # rINST<- A
13245     cmpl        $-1, %ecx              # handle -1 special case divide error
13246     jnz         .LOP_DIV_INT_LIT16_continue
13247     cmpl        $0x80000000,%eax       # handle min int special case divide error
13248     je          .LOP_DIV_INT_LIT16_break
13249 .LOP_DIV_INT_LIT16_continue:
13250     cdq                                 # sign-extend %eax to %edx
13251     idiv        %ecx                    # divide %edx:%eax by %ecx
13252     .if  1
13253     movzbl      (rPC), %edx
13254     SET_VREG    %eax, rINST             # vA<- %eax (quotient)
13255     movzbl      1(rPC), rINST
13256     jmp         *dvmAsmInstructionJmpTable(, %edx, 4)
13257     .else
13258     movzbl      (rPC), %eax
13259     SET_VREG    %edx, rINST             # vA<- %edx (remainder)
13260     movzbl      1(rPC), rINST
13261     jmp         *dvmAsmInstructionJmpTable(, %eax, 4)
13262     .endif
13263
13264
13265
13266 /* ------------------------------ */
13267     .balign 64
13268 .L_OP_REM_INT_LIT16: /* 0xd4 */
13269 /* File: x86-atom/OP_REM_INT_LIT16.S */
13270    /* Copyright (C) 2008 The Android Open Source Project
13271     *
13272     * Licensed under the Apache License, Version 2.0 (the "License");
13273     * you may not use this file except in compliance with the License.
13274     * You may obtain a copy of the License at
13275     *
13276     * http://www.apache.org/licenses/LICENSE-2.0
13277     *
13278     * Unless required by applicable law or agreed to in writing, software
13279     * distributed under the License is distributed on an "AS IS" BASIS,
13280     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13281     * See the License for the specific language governing permissions and
13282     * limitations under the License.
13283     */
13284
13285    /*
13286     * File: OP_REM_INT_LIT16.S
13287     */
13288
13289 /* File: x86-atom/binopDLit16.S */
13290    /* Copyright (C) 2008 The Android Open Source Project
13291     *
13292     * Licensed under the Apache License, Version 2.0 (the "License");
13293     * you may not use this file except in compliance with the License.
13294     * You may obtain a copy of the License at
13295     *
13296     * http://www.apache.org/licenses/LICENSE-2.0
13297     *
13298     * Unless required by applicable law or agreed to in writing, software
13299     * distributed under the License is distributed on an "AS IS" BASIS,
13300     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13301     * See the License for the specific language governing permissions and
13302     * limitations under the License.
13303     */
13304
13305    /*
13306     * File: binopDLit16.S
13307     *
13308     * Code: 32-bit "lit16" divide operation. If "div" is set, the code
13309     *       returns the quotient, else it returns the remainder.
13310     *       Also, a divide-by-zero check is done.
13311     *
13312     * For: div-int/lit16, rem-int/lit16
13313     *
13314     * Description: Perform a binary operation on a register and a
13315     *              sign extended 16-bit literal value
13316     *
13317     * Format: B|A|op CCCC (22s)
13318     *
13319     * Syntax: op vA, vB, #+CCCC
13320     */
13321
13322
13323     movl        rINST, %eax             # %eax<- BA
13324     shr         $4, %eax               # %eax<- B
13325     FETCHs      1, %ecx                 # %ecx<- +CCCC, sign-extended literal
13326     testl       %ecx, %ecx              # check for divide by zero
13327     GET_VREG    %eax                    # %eax<- vB
13328     je          common_errDivideByZero  # handle divide by zero
13329     addl        $4, rPC                # update PC
13330     andl        $15, rINST             # rINST<- A
13331     cmpl        $-1, %ecx              # handle -1 special case divide error
13332     jnz         .LOP_REM_INT_LIT16_continue
13333     cmpl        $0x80000000,%eax       # handle min int special case divide error
13334     je          .LOP_REM_INT_LIT16_break
13335 .LOP_REM_INT_LIT16_continue:
13336     cdq                                 # sign-extend %eax to %edx
13337     idiv        %ecx                    # divide %edx:%eax by %ecx
13338     .if  0
13339     movzbl      (rPC), %edx
13340     SET_VREG    %eax, rINST             # vA<- %eax (quotient)
13341     movzbl      1(rPC), rINST
13342     jmp         *dvmAsmInstructionJmpTable(, %edx, 4)
13343     .else
13344     movzbl      (rPC), %eax
13345     SET_VREG    %edx, rINST             # vA<- %edx (remainder)
13346     movzbl      1(rPC), rINST
13347     jmp         *dvmAsmInstructionJmpTable(, %eax, 4)
13348     .endif
13349
13350
13351
13352 /* ------------------------------ */
13353     .balign 64
13354 .L_OP_AND_INT_LIT16: /* 0xd5 */
13355 /* File: x86-atom/OP_AND_INT_LIT16.S */
13356    /* Copyright (C) 2008 The Android Open Source Project
13357     *
13358     * Licensed under the Apache License, Version 2.0 (the "License");
13359     * you may not use this file except in compliance with the License.
13360     * You may obtain a copy of the License at
13361     *
13362     * http://www.apache.org/licenses/LICENSE-2.0
13363     *
13364     * Unless required by applicable law or agreed to in writing, software
13365     * distributed under the License is distributed on an "AS IS" BASIS,
13366     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13367     * See the License for the specific language governing permissions and
13368     * limitations under the License.
13369     */
13370
13371    /*
13372     * File: OP_AND_INT_LIT16.S
13373     */
13374
13375 /* File: x86-atom/binopLit16.S */
13376    /* Copyright (C) 2008 The Android Open Source Project
13377     *
13378     * Licensed under the Apache License, Version 2.0 (the "License");
13379     * you may not use this file except in compliance with the License.
13380     * You may obtain a copy of the License at
13381     *
13382     * http://www.apache.org/licenses/LICENSE-2.0
13383     *
13384     * Unless required by applicable law or agreed to in writing, software
13385     * distributed under the License is distributed on an "AS IS" BASIS,
13386     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13387     * See the License for the specific language governing permissions and
13388     * limitations under the License.
13389     */
13390
13391    /*
13392     * File: binopLit16.S
13393     *
13394     * Code: 32-bit "lit16" operation. Provides an "instr" line to
13395     *       specify an instruction that performs "%ecx = %ecx op %edx"
13396     *
13397     *
13398     * For: add-int/lit16, and-int/lit16, mul-int/lit16, or-int/lit16
13399     *      xor-int/lit16
13400     *
13401     * Description: Perform a binary operation on a register and a
13402     *              sign extended 16-bit literal value and store the
13403     *              result in a destination register.
13404     *
13405     * Format: B|A|op CCCC (22s)
13406     *
13407     * Syntax: op vA, vB, #+CCCC
13408     */
13409
13410     movl        rINST, %ecx             # %ecx<- BA
13411     shr         $4, %ecx               # %ecx<- B
13412     andl        $15, rINST             # rINST<- A
13413     FETCHs      1, %edx                 # %edx<- +CCCC, sign-extended literal
13414     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
13415     GET_VREG    %ecx                    # %ecx<- vB
13416     andl     %edx, %ecx                              # %ecx<- vA op vB
13417     SET_VREG    %ecx, rINST             # vA<- %ecx; result
13418     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
13419
13420 /* ------------------------------ */
13421     .balign 64
13422 .L_OP_OR_INT_LIT16: /* 0xd6 */
13423 /* File: x86-atom/OP_OR_INT_LIT16.S */
13424    /* Copyright (C) 2008 The Android Open Source Project
13425     *
13426     * Licensed under the Apache License, Version 2.0 (the "License");
13427     * you may not use this file except in compliance with the License.
13428     * You may obtain a copy of the License at
13429     *
13430     * http://www.apache.org/licenses/LICENSE-2.0
13431     *
13432     * Unless required by applicable law or agreed to in writing, software
13433     * distributed under the License is distributed on an "AS IS" BASIS,
13434     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13435     * See the License for the specific language governing permissions and
13436     * limitations under the License.
13437     */
13438
13439    /*
13440     * File: OP_OR_INT_LIT16.S
13441     */
13442
13443 /* File: x86-atom/binopLit16.S */
13444    /* Copyright (C) 2008 The Android Open Source Project
13445     *
13446     * Licensed under the Apache License, Version 2.0 (the "License");
13447     * you may not use this file except in compliance with the License.
13448     * You may obtain a copy of the License at
13449     *
13450     * http://www.apache.org/licenses/LICENSE-2.0
13451     *
13452     * Unless required by applicable law or agreed to in writing, software
13453     * distributed under the License is distributed on an "AS IS" BASIS,
13454     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13455     * See the License for the specific language governing permissions and
13456     * limitations under the License.
13457     */
13458
13459    /*
13460     * File: binopLit16.S
13461     *
13462     * Code: 32-bit "lit16" operation. Provides an "instr" line to
13463     *       specify an instruction that performs "%ecx = %ecx op %edx"
13464     *
13465     *
13466     * For: add-int/lit16, and-int/lit16, mul-int/lit16, or-int/lit16
13467     *      xor-int/lit16
13468     *
13469     * Description: Perform a binary operation on a register and a
13470     *              sign extended 16-bit literal value and store the
13471     *              result in a destination register.
13472     *
13473     * Format: B|A|op CCCC (22s)
13474     *
13475     * Syntax: op vA, vB, #+CCCC
13476     */
13477
13478     movl        rINST, %ecx             # %ecx<- BA
13479     shr         $4, %ecx               # %ecx<- B
13480     andl        $15, rINST             # rINST<- A
13481     FETCHs      1, %edx                 # %edx<- +CCCC, sign-extended literal
13482     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
13483     GET_VREG    %ecx                    # %ecx<- vB
13484     or %edx, %ecx                              # %ecx<- vA op vB
13485     SET_VREG    %ecx, rINST             # vA<- %ecx; result
13486     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
13487
13488 /* ------------------------------ */
13489     .balign 64
13490 .L_OP_XOR_INT_LIT16: /* 0xd7 */
13491 /* File: x86-atom/OP_XOR_INT_LIT16.S */
13492    /* Copyright (C) 2008 The Android Open Source Project
13493     *
13494     * Licensed under the Apache License, Version 2.0 (the "License");
13495     * you may not use this file except in compliance with the License.
13496     * You may obtain a copy of the License at
13497     *
13498     * http://www.apache.org/licenses/LICENSE-2.0
13499     *
13500     * Unless required by applicable law or agreed to in writing, software
13501     * distributed under the License is distributed on an "AS IS" BASIS,
13502     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13503     * See the License for the specific language governing permissions and
13504     * limitations under the License.
13505     */
13506
13507    /*
13508     * File: OP_XOR_INT_LIT16.S
13509     */
13510
13511 /* File: x86-atom/binopLit16.S */
13512    /* Copyright (C) 2008 The Android Open Source Project
13513     *
13514     * Licensed under the Apache License, Version 2.0 (the "License");
13515     * you may not use this file except in compliance with the License.
13516     * You may obtain a copy of the License at
13517     *
13518     * http://www.apache.org/licenses/LICENSE-2.0
13519     *
13520     * Unless required by applicable law or agreed to in writing, software
13521     * distributed under the License is distributed on an "AS IS" BASIS,
13522     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13523     * See the License for the specific language governing permissions and
13524     * limitations under the License.
13525     */
13526
13527    /*
13528     * File: binopLit16.S
13529     *
13530     * Code: 32-bit "lit16" operation. Provides an "instr" line to
13531     *       specify an instruction that performs "%ecx = %ecx op %edx"
13532     *
13533     *
13534     * For: add-int/lit16, and-int/lit16, mul-int/lit16, or-int/lit16
13535     *      xor-int/lit16
13536     *
13537     * Description: Perform a binary operation on a register and a
13538     *              sign extended 16-bit literal value and store the
13539     *              result in a destination register.
13540     *
13541     * Format: B|A|op CCCC (22s)
13542     *
13543     * Syntax: op vA, vB, #+CCCC
13544     */
13545
13546     movl        rINST, %ecx             # %ecx<- BA
13547     shr         $4, %ecx               # %ecx<- B
13548     andl        $15, rINST             # rINST<- A
13549     FETCHs      1, %edx                 # %edx<- +CCCC, sign-extended literal
13550     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
13551     GET_VREG    %ecx                    # %ecx<- vB
13552     xor     %edx, %ecx                              # %ecx<- vA op vB
13553     SET_VREG    %ecx, rINST             # vA<- %ecx; result
13554     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
13555
13556 /* ------------------------------ */
13557     .balign 64
13558 .L_OP_ADD_INT_LIT8: /* 0xd8 */
13559 /* File: x86-atom/OP_ADD_INT_LIT8.S */
13560    /* Copyright (C) 2008 The Android Open Source Project
13561     *
13562     * Licensed under the Apache License, Version 2.0 (the "License");
13563     * you may not use this file except in compliance with the License.
13564     * You may obtain a copy of the License at
13565     *
13566     * http://www.apache.org/licenses/LICENSE-2.0
13567     *
13568     * Unless required by applicable law or agreed to in writing, software
13569     * distributed under the License is distributed on an "AS IS" BASIS,
13570     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13571     * See the License for the specific language governing permissions and
13572     * limitations under the License.
13573     */
13574
13575    /*
13576     * File: OP_ADD_INT_LIT8.S
13577     */
13578
13579 /* File: x86-atom/binopLit8.S */
13580    /* Copyright (C) 2008 The Android Open Source Project
13581     *
13582     * Licensed under the Apache License, Version 2.0 (the "License");
13583     * you may not use this file except in compliance with the License.
13584     * You may obtain a copy of the License at
13585     *
13586     * http://www.apache.org/licenses/LICENSE-2.0
13587     *
13588     * Unless required by applicable law or agreed to in writing, software
13589     * distributed under the License is distributed on an "AS IS" BASIS,
13590     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13591     * See the License for the specific language governing permissions and
13592     * limitations under the License.
13593     */
13594
13595    /*
13596     * File: binopLit8.S
13597     *
13598     * Code: 32-bit "lit8" divide operation. Provides an "instr" line
13599     *       to specify an instruction that performs  "%ecx = %ecx op %edx"
13600     *
13601     *
13602     * For: add-int/lit8, and-int/lit8, mul-int/lit8, or-int/lit8
13603     *      xor-int/lit8
13604     *
13605     * Description: Perform a binary operation on a register and a
13606     *              signed extended 8-bit literal value
13607     *
13608     * Format: AA|op CC|BB (22b)
13609     *
13610     * Syntax: op vAA, vBB, #+CC
13611     */
13612
13613     FETCH_BB    1, %ecx                 # %ecx<- BB
13614     FETCH_CCs   1, %edx                 # %edx<- +CC, sign-extended literal
13615     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
13616     GET_VREG    %ecx                    # %ecx<- vBB
13617     addl     %edx, %ecx                              # %ecx<- vBB op +CC
13618     SET_VREG    %ecx, rINST             # vAA<- %ecx; result
13619     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
13620
13621 /* ------------------------------ */
13622     .balign 64
13623 .L_OP_RSUB_INT_LIT8: /* 0xd9 */
13624 /* File: x86-atom/OP_RSUB_INT_LIT8.S */
13625    /* Copyright (C) 2008 The Android Open Source Project
13626     *
13627     * Licensed under the Apache License, Version 2.0 (the "License");
13628     * you may not use this file except in compliance with the License.
13629     * You may obtain a copy of the License at
13630     *
13631     * http://www.apache.org/licenses/LICENSE-2.0
13632     *
13633     * Unless required by applicable law or agreed to in writing, software
13634     * distributed under the License is distributed on an "AS IS" BASIS,
13635     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13636     * See the License for the specific language governing permissions and
13637     * limitations under the License.
13638     */
13639
13640    /*
13641     * File: OP_RSUB_INT_LIT8.S
13642     *
13643     * Code: 32-bit reverse-subtraction. Uses no substitutions.
13644     *
13645     * For: rsub-int/lit8
13646     *
13647     * Description: Perform a reverse subtraction on a register and a
13648     *              signed extended 8-bit literal value.
13649     *
13650     * Format: AA|op CC|BB (22b)
13651     *
13652     * Syntax: op vAA, vBB, #+CC
13653     */
13654
13655     FETCH_BB    1, %ecx                 # %ecx<- BB
13656     FETCH_CCs   1, %edx                 # %edx<- +CC, sign-extended literal
13657     GET_VREG    %ecx                    # %ecx<- vBB
13658     sub         %ecx, %edx              # %edx<- +CC sub vBB
13659     SET_VREG    %edx, rINST             # vAA<- %edx; result
13660     FINISH      2                       # jump to next instruction
13661
13662 /* ------------------------------ */
13663     .balign 64
13664 .L_OP_MUL_INT_LIT8: /* 0xda */
13665 /* File: x86-atom/OP_MUL_INT_LIT8.S */
13666    /* Copyright (C) 2008 The Android Open Source Project
13667     *
13668     * Licensed under the Apache License, Version 2.0 (the "License");
13669     * you may not use this file except in compliance with the License.
13670     * You may obtain a copy of the License at
13671     *
13672     * http://www.apache.org/licenses/LICENSE-2.0
13673     *
13674     * Unless required by applicable law or agreed to in writing, software
13675     * distributed under the License is distributed on an "AS IS" BASIS,
13676     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13677     * See the License for the specific language governing permissions and
13678     * limitations under the License.
13679     */
13680
13681    /*
13682     * File: OP_MUL_INT_LIT8.S
13683     */
13684
13685 /* File: x86-atom/binopLit8.S */
13686    /* Copyright (C) 2008 The Android Open Source Project
13687     *
13688     * Licensed under the Apache License, Version 2.0 (the "License");
13689     * you may not use this file except in compliance with the License.
13690     * You may obtain a copy of the License at
13691     *
13692     * http://www.apache.org/licenses/LICENSE-2.0
13693     *
13694     * Unless required by applicable law or agreed to in writing, software
13695     * distributed under the License is distributed on an "AS IS" BASIS,
13696     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13697     * See the License for the specific language governing permissions and
13698     * limitations under the License.
13699     */
13700
13701    /*
13702     * File: binopLit8.S
13703     *
13704     * Code: 32-bit "lit8" divide operation. Provides an "instr" line
13705     *       to specify an instruction that performs  "%ecx = %ecx op %edx"
13706     *
13707     *
13708     * For: add-int/lit8, and-int/lit8, mul-int/lit8, or-int/lit8
13709     *      xor-int/lit8
13710     *
13711     * Description: Perform a binary operation on a register and a
13712     *              signed extended 8-bit literal value
13713     *
13714     * Format: AA|op CC|BB (22b)
13715     *
13716     * Syntax: op vAA, vBB, #+CC
13717     */
13718
13719     FETCH_BB    1, %ecx                 # %ecx<- BB
13720     FETCH_CCs   1, %edx                 # %edx<- +CC, sign-extended literal
13721     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
13722     GET_VREG    %ecx                    # %ecx<- vBB
13723     imul     %edx, %ecx                              # %ecx<- vBB op +CC
13724     SET_VREG    %ecx, rINST             # vAA<- %ecx; result
13725     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
13726
13727 /* ------------------------------ */
13728     .balign 64
13729 .L_OP_DIV_INT_LIT8: /* 0xdb */
13730 /* File: x86-atom/OP_DIV_INT_LIT8.S */
13731    /* Copyright (C) 2008 The Android Open Source Project
13732     *
13733     * Licensed under the Apache License, Version 2.0 (the "License");
13734     * you may not use this file except in compliance with the License.
13735     * You may obtain a copy of the License at
13736     *
13737     * http://www.apache.org/licenses/LICENSE-2.0
13738     *
13739     * Unless required by applicable law or agreed to in writing, software
13740     * distributed under the License is distributed on an "AS IS" BASIS,
13741     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13742     * See the License for the specific language governing permissions and
13743     * limitations under the License.
13744     */
13745
13746    /*
13747     * File: OP_DIV_INT_LIT8.S
13748     */
13749
13750 /* File: x86-atom/binopDLit8.S */
13751    /* Copyright (C) 2008 The Android Open Source Project
13752     *
13753     * Licensed under the Apache License, Version 2.0 (the "License");
13754     * you may not use this file except in compliance with the License.
13755     * You may obtain a copy of the License at
13756     *
13757     * http://www.apache.org/licenses/LICENSE-2.0
13758     *
13759     * Unless required by applicable law or agreed to in writing, software
13760     * distributed under the License is distributed on an "AS IS" BASIS,
13761     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13762     * See the License for the specific language governing permissions and
13763     * limitations under the License.
13764     */
13765
13766    /*
13767     * File: binopDLit8.S
13768     *
13769     * Code: 32-bit "lit8" divide operation. If "div" is set, the code
13770     *       returns the quotient, else it returns the remainder.
13771     *       Also, a divide-by-zero check is done.
13772     *
13773     * For: div-int/lit8, rem-int/lit8
13774     *
13775     * Description: Perform a binary operation on a register and a
13776     *              signe extended 8-bit literal value
13777     *
13778     * Format: AA|op CC|BB (22b)
13779     *
13780     * Syntax: op vAA, vBB, #+CC
13781     */
13782
13783
13784     FETCH_CCs   1, %ecx                 # %ecx<- +CC, sign-extended literal
13785     testl       %ecx, %ecx              # handle -1 special case divide error
13786     FETCH_BB    1, %eax                 # %eax<- BB
13787     jz          common_errDivideByZero  # handle divide by zero
13788     addl        $4, rPC                # update PC
13789     cmpl        $-1, %ecx
13790     GET_VREG    %eax                    # %eax<- vBB
13791     jnz         .LOP_DIV_INT_LIT8_continue
13792     cmpl        $0x80000000,%eax       # handle min int special case divide error
13793     je          .LOP_DIV_INT_LIT8_break
13794 .LOP_DIV_INT_LIT8_continue:
13795     cdq                                 # sign-extend %eax to %edx
13796     idiv        %ecx                    # divide %edx:%eax by %ecx
13797     .if  1
13798     movzbl      (rPC), %edx
13799     SET_VREG    %eax, rINST             # vA<- %eax (quotient)
13800     movzbl      1(rPC), rINST
13801     jmp         *dvmAsmInstructionJmpTable(, %edx, 4)
13802     .else
13803     movzbl      (rPC), %eax
13804     SET_VREG    %edx, rINST             # vA<- %edx (remainder)
13805     movzbl      1(rPC), rINST
13806     jmp         *dvmAsmInstructionJmpTable(, %eax, 4)
13807     .endif
13808
13809
13810 /* ------------------------------ */
13811     .balign 64
13812 .L_OP_REM_INT_LIT8: /* 0xdc */
13813 /* File: x86-atom/OP_REM_INT_LIT8.S */
13814    /* Copyright (C) 2008 The Android Open Source Project
13815     *
13816     * Licensed under the Apache License, Version 2.0 (the "License");
13817     * you may not use this file except in compliance with the License.
13818     * You may obtain a copy of the License at
13819     *
13820     * http://www.apache.org/licenses/LICENSE-2.0
13821     *
13822     * Unless required by applicable law or agreed to in writing, software
13823     * distributed under the License is distributed on an "AS IS" BASIS,
13824     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13825     * See the License for the specific language governing permissions and
13826     * limitations under the License.
13827     */
13828
13829    /*
13830     * File: OP_REM_INT_LIT8.S
13831     */
13832
13833 /* File: x86-atom/binopDLit8.S */
13834    /* Copyright (C) 2008 The Android Open Source Project
13835     *
13836     * Licensed under the Apache License, Version 2.0 (the "License");
13837     * you may not use this file except in compliance with the License.
13838     * You may obtain a copy of the License at
13839     *
13840     * http://www.apache.org/licenses/LICENSE-2.0
13841     *
13842     * Unless required by applicable law or agreed to in writing, software
13843     * distributed under the License is distributed on an "AS IS" BASIS,
13844     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13845     * See the License for the specific language governing permissions and
13846     * limitations under the License.
13847     */
13848
13849    /*
13850     * File: binopDLit8.S
13851     *
13852     * Code: 32-bit "lit8" divide operation. If "div" is set, the code
13853     *       returns the quotient, else it returns the remainder.
13854     *       Also, a divide-by-zero check is done.
13855     *
13856     * For: div-int/lit8, rem-int/lit8
13857     *
13858     * Description: Perform a binary operation on a register and a
13859     *              signe extended 8-bit literal value
13860     *
13861     * Format: AA|op CC|BB (22b)
13862     *
13863     * Syntax: op vAA, vBB, #+CC
13864     */
13865
13866
13867     FETCH_CCs   1, %ecx                 # %ecx<- +CC, sign-extended literal
13868     testl       %ecx, %ecx              # handle -1 special case divide error
13869     FETCH_BB    1, %eax                 # %eax<- BB
13870     jz          common_errDivideByZero  # handle divide by zero
13871     addl        $4, rPC                # update PC
13872     cmpl        $-1, %ecx
13873     GET_VREG    %eax                    # %eax<- vBB
13874     jnz         .LOP_REM_INT_LIT8_continue
13875     cmpl        $0x80000000,%eax       # handle min int special case divide error
13876     je          .LOP_REM_INT_LIT8_break
13877 .LOP_REM_INT_LIT8_continue:
13878     cdq                                 # sign-extend %eax to %edx
13879     idiv        %ecx                    # divide %edx:%eax by %ecx
13880     .if  0
13881     movzbl      (rPC), %edx
13882     SET_VREG    %eax, rINST             # vA<- %eax (quotient)
13883     movzbl      1(rPC), rINST
13884     jmp         *dvmAsmInstructionJmpTable(, %edx, 4)
13885     .else
13886     movzbl      (rPC), %eax
13887     SET_VREG    %edx, rINST             # vA<- %edx (remainder)
13888     movzbl      1(rPC), rINST
13889     jmp         *dvmAsmInstructionJmpTable(, %eax, 4)
13890     .endif
13891
13892
13893 /* ------------------------------ */
13894     .balign 64
13895 .L_OP_AND_INT_LIT8: /* 0xdd */
13896 /* File: x86-atom/OP_AND_INT_LIT8.S */
13897    /* Copyright (C) 2008 The Android Open Source Project
13898     *
13899     * Licensed under the Apache License, Version 2.0 (the "License");
13900     * you may not use this file except in compliance with the License.
13901     * You may obtain a copy of the License at
13902     *
13903     * http://www.apache.org/licenses/LICENSE-2.0
13904     *
13905     * Unless required by applicable law or agreed to in writing, software
13906     * distributed under the License is distributed on an "AS IS" BASIS,
13907     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13908     * See the License for the specific language governing permissions and
13909     * limitations under the License.
13910     */
13911
13912    /*
13913     * File: OP_AND_INT_LIT8.S
13914     */
13915
13916 /* File: x86-atom/binopLit8.S */
13917    /* Copyright (C) 2008 The Android Open Source Project
13918     *
13919     * Licensed under the Apache License, Version 2.0 (the "License");
13920     * you may not use this file except in compliance with the License.
13921     * You may obtain a copy of the License at
13922     *
13923     * http://www.apache.org/licenses/LICENSE-2.0
13924     *
13925     * Unless required by applicable law or agreed to in writing, software
13926     * distributed under the License is distributed on an "AS IS" BASIS,
13927     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13928     * See the License for the specific language governing permissions and
13929     * limitations under the License.
13930     */
13931
13932    /*
13933     * File: binopLit8.S
13934     *
13935     * Code: 32-bit "lit8" divide operation. Provides an "instr" line
13936     *       to specify an instruction that performs  "%ecx = %ecx op %edx"
13937     *
13938     *
13939     * For: add-int/lit8, and-int/lit8, mul-int/lit8, or-int/lit8
13940     *      xor-int/lit8
13941     *
13942     * Description: Perform a binary operation on a register and a
13943     *              signed extended 8-bit literal value
13944     *
13945     * Format: AA|op CC|BB (22b)
13946     *
13947     * Syntax: op vAA, vBB, #+CC
13948     */
13949
13950     FETCH_BB    1, %ecx                 # %ecx<- BB
13951     FETCH_CCs   1, %edx                 # %edx<- +CC, sign-extended literal
13952     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
13953     GET_VREG    %ecx                    # %ecx<- vBB
13954     andl     %edx, %ecx                              # %ecx<- vBB op +CC
13955     SET_VREG    %ecx, rINST             # vAA<- %ecx; result
13956     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
13957
13958 /* ------------------------------ */
13959     .balign 64
13960 .L_OP_OR_INT_LIT8: /* 0xde */
13961 /* File: x86-atom/OP_OR_INT_LIT8.S */
13962    /* Copyright (C) 2008 The Android Open Source Project
13963     *
13964     * Licensed under the Apache License, Version 2.0 (the "License");
13965     * you may not use this file except in compliance with the License.
13966     * You may obtain a copy of the License at
13967     *
13968     * http://www.apache.org/licenses/LICENSE-2.0
13969     *
13970     * Unless required by applicable law or agreed to in writing, software
13971     * distributed under the License is distributed on an "AS IS" BASIS,
13972     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13973     * See the License for the specific language governing permissions and
13974     * limitations under the License.
13975     */
13976
13977    /*
13978     * File: OP_OR_INT_LIT8.S
13979     */
13980
13981 /* File: x86-atom/binopLit8.S */
13982    /* Copyright (C) 2008 The Android Open Source Project
13983     *
13984     * Licensed under the Apache License, Version 2.0 (the "License");
13985     * you may not use this file except in compliance with the License.
13986     * You may obtain a copy of the License at
13987     *
13988     * http://www.apache.org/licenses/LICENSE-2.0
13989     *
13990     * Unless required by applicable law or agreed to in writing, software
13991     * distributed under the License is distributed on an "AS IS" BASIS,
13992     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13993     * See the License for the specific language governing permissions and
13994     * limitations under the License.
13995     */
13996
13997    /*
13998     * File: binopLit8.S
13999     *
14000     * Code: 32-bit "lit8" divide operation. Provides an "instr" line
14001     *       to specify an instruction that performs  "%ecx = %ecx op %edx"
14002     *
14003     *
14004     * For: add-int/lit8, and-int/lit8, mul-int/lit8, or-int/lit8
14005     *      xor-int/lit8
14006     *
14007     * Description: Perform a binary operation on a register and a
14008     *              signed extended 8-bit literal value
14009     *
14010     * Format: AA|op CC|BB (22b)
14011     *
14012     * Syntax: op vAA, vBB, #+CC
14013     */
14014
14015     FETCH_BB    1, %ecx                 # %ecx<- BB
14016     FETCH_CCs   1, %edx                 # %edx<- +CC, sign-extended literal
14017     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
14018     GET_VREG    %ecx                    # %ecx<- vBB
14019     or %edx, %ecx                              # %ecx<- vBB op +CC
14020     SET_VREG    %ecx, rINST             # vAA<- %ecx; result
14021     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
14022
14023 /* ------------------------------ */
14024     .balign 64
14025 .L_OP_XOR_INT_LIT8: /* 0xdf */
14026 /* File: x86-atom/OP_XOR_INT_LIT8.S */
14027    /* Copyright (C) 2008 The Android Open Source Project
14028     *
14029     * Licensed under the Apache License, Version 2.0 (the "License");
14030     * you may not use this file except in compliance with the License.
14031     * You may obtain a copy of the License at
14032     *
14033     * http://www.apache.org/licenses/LICENSE-2.0
14034     *
14035     * Unless required by applicable law or agreed to in writing, software
14036     * distributed under the License is distributed on an "AS IS" BASIS,
14037     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14038     * See the License for the specific language governing permissions and
14039     * limitations under the License.
14040     */
14041
14042    /*
14043     * File: OP_XOR_INT_LIT8.S
14044     */
14045
14046 /* File: x86-atom/binopLit8.S */
14047    /* Copyright (C) 2008 The Android Open Source Project
14048     *
14049     * Licensed under the Apache License, Version 2.0 (the "License");
14050     * you may not use this file except in compliance with the License.
14051     * You may obtain a copy of the License at
14052     *
14053     * http://www.apache.org/licenses/LICENSE-2.0
14054     *
14055     * Unless required by applicable law or agreed to in writing, software
14056     * distributed under the License is distributed on an "AS IS" BASIS,
14057     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14058     * See the License for the specific language governing permissions and
14059     * limitations under the License.
14060     */
14061
14062    /*
14063     * File: binopLit8.S
14064     *
14065     * Code: 32-bit "lit8" divide operation. Provides an "instr" line
14066     *       to specify an instruction that performs  "%ecx = %ecx op %edx"
14067     *
14068     *
14069     * For: add-int/lit8, and-int/lit8, mul-int/lit8, or-int/lit8
14070     *      xor-int/lit8
14071     *
14072     * Description: Perform a binary operation on a register and a
14073     *              signed extended 8-bit literal value
14074     *
14075     * Format: AA|op CC|BB (22b)
14076     *
14077     * Syntax: op vAA, vBB, #+CC
14078     */
14079
14080     FETCH_BB    1, %ecx                 # %ecx<- BB
14081     FETCH_CCs   1, %edx                 # %edx<- +CC, sign-extended literal
14082     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
14083     GET_VREG    %ecx                    # %ecx<- vBB
14084     xor     %edx, %ecx                              # %ecx<- vBB op +CC
14085     SET_VREG    %ecx, rINST             # vAA<- %ecx; result
14086     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
14087
14088 /* ------------------------------ */
14089     .balign 64
14090 .L_OP_SHL_INT_LIT8: /* 0xe0 */
14091 /* File: x86-atom/OP_SHL_INT_LIT8.S */
14092    /* Copyright (C) 2008 The Android Open Source Project
14093     *
14094     * Licensed under the Apache License, Version 2.0 (the "License");
14095     * you may not use this file except in compliance with the License.
14096     * You may obtain a copy of the License at
14097     *
14098     * http://www.apache.org/licenses/LICENSE-2.0
14099     *
14100     * Unless required by applicable law or agreed to in writing, software
14101     * distributed under the License is distributed on an "AS IS" BASIS,
14102     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14103     * See the License for the specific language governing permissions and
14104     * limitations under the License.
14105     */
14106
14107    /*
14108     * File: OP_SHL_INT_LIT8.S
14109     */
14110
14111 /* File: x86-atom/binopLit8S.S */
14112    /* Copyright (C) 2008 The Android Open Source Project
14113     *
14114     * Licensed under the Apache License, Version 2.0 (the "License");
14115     * you may not use this file except in compliance with the License.
14116     * You may obtain a copy of the License at
14117     *
14118     * http://www.apache.org/licenses/LICENSE-2.0
14119     *
14120     * Unless required by applicable law or agreed to in writing, software
14121     * distributed under the License is distributed on an "AS IS" BASIS,
14122     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14123     * See the License for the specific language governing permissions and
14124     * limitations under the License.
14125     */
14126
14127    /*
14128     * File: binopLit8S.S
14129     *
14130     * Code: 32-bit "lit8" divide operation. Provides an "instr" line
14131     *       to specify an instruction that performs "%edx = %edx op %cl"
14132     *
14133     *
14134     * For: shl-int/lit8, shr-int/lit8, ushr-int/lit8
14135     *
14136     *
14137     * Description: Perform a binary operation on a register and a
14138     *              signed extended 8-bit literal value
14139     *
14140     * Format: AA|op CC|BB (22b)
14141     *
14142     * Syntax: op vAA, vBB, #+CC
14143     */
14144
14145     FETCH_BB    1, %edx                 # %edx<- BB
14146     FETCH_CCs   1, %ecx                 # %ecx<- +CC, sign-extended literal
14147     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
14148     GET_VREG    %edx                    # %edx<- vBB
14149     sal     %cl, %edx                              # %edx<- vBB op +CC
14150     SET_VREG    %edx, rINST             # vAA<- %edx; result
14151     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
14152
14153 /* ------------------------------ */
14154     .balign 64
14155 .L_OP_SHR_INT_LIT8: /* 0xe1 */
14156 /* File: x86-atom/OP_SHR_INT_LIT8.S */
14157    /* Copyright (C) 2008 The Android Open Source Project
14158     *
14159     * Licensed under the Apache License, Version 2.0 (the "License");
14160     * you may not use this file except in compliance with the License.
14161     * You may obtain a copy of the License at
14162     *
14163     * http://www.apache.org/licenses/LICENSE-2.0
14164     *
14165     * Unless required by applicable law or agreed to in writing, software
14166     * distributed under the License is distributed on an "AS IS" BASIS,
14167     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14168     * See the License for the specific language governing permissions and
14169     * limitations under the License.
14170     */
14171
14172    /*
14173     * File: OP_SHR_INT_LIT8.S
14174     */
14175
14176 /* File: x86-atom/binopLit8S.S */
14177    /* Copyright (C) 2008 The Android Open Source Project
14178     *
14179     * Licensed under the Apache License, Version 2.0 (the "License");
14180     * you may not use this file except in compliance with the License.
14181     * You may obtain a copy of the License at
14182     *
14183     * http://www.apache.org/licenses/LICENSE-2.0
14184     *
14185     * Unless required by applicable law or agreed to in writing, software
14186     * distributed under the License is distributed on an "AS IS" BASIS,
14187     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14188     * See the License for the specific language governing permissions and
14189     * limitations under the License.
14190     */
14191
14192    /*
14193     * File: binopLit8S.S
14194     *
14195     * Code: 32-bit "lit8" divide operation. Provides an "instr" line
14196     *       to specify an instruction that performs "%edx = %edx op %cl"
14197     *
14198     *
14199     * For: shl-int/lit8, shr-int/lit8, ushr-int/lit8
14200     *
14201     *
14202     * Description: Perform a binary operation on a register and a
14203     *              signed extended 8-bit literal value
14204     *
14205     * Format: AA|op CC|BB (22b)
14206     *
14207     * Syntax: op vAA, vBB, #+CC
14208     */
14209
14210     FETCH_BB    1, %edx                 # %edx<- BB
14211     FETCH_CCs   1, %ecx                 # %ecx<- +CC, sign-extended literal
14212     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
14213     GET_VREG    %edx                    # %edx<- vBB
14214     sar     %cl, %edx                              # %edx<- vBB op +CC
14215     SET_VREG    %edx, rINST             # vAA<- %edx; result
14216     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
14217
14218 /* ------------------------------ */
14219     .balign 64
14220 .L_OP_USHR_INT_LIT8: /* 0xe2 */
14221 /* File: x86-atom/OP_USHR_INT_LIT8.S */
14222    /* Copyright (C) 2008 The Android Open Source Project
14223     *
14224     * Licensed under the Apache License, Version 2.0 (the "License");
14225     * you may not use this file except in compliance with the License.
14226     * You may obtain a copy of the License at
14227     *
14228     * http://www.apache.org/licenses/LICENSE-2.0
14229     *
14230     * Unless required by applicable law or agreed to in writing, software
14231     * distributed under the License is distributed on an "AS IS" BASIS,
14232     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14233     * See the License for the specific language governing permissions and
14234     * limitations under the License.
14235     */
14236
14237    /*
14238     * File: OP_USHR_INT_LIT8.S
14239     */
14240
14241 /* File: x86-atom/binopLit8S.S */
14242    /* Copyright (C) 2008 The Android Open Source Project
14243     *
14244     * Licensed under the Apache License, Version 2.0 (the "License");
14245     * you may not use this file except in compliance with the License.
14246     * You may obtain a copy of the License at
14247     *
14248     * http://www.apache.org/licenses/LICENSE-2.0
14249     *
14250     * Unless required by applicable law or agreed to in writing, software
14251     * distributed under the License is distributed on an "AS IS" BASIS,
14252     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14253     * See the License for the specific language governing permissions and
14254     * limitations under the License.
14255     */
14256
14257    /*
14258     * File: binopLit8S.S
14259     *
14260     * Code: 32-bit "lit8" divide operation. Provides an "instr" line
14261     *       to specify an instruction that performs "%edx = %edx op %cl"
14262     *
14263     *
14264     * For: shl-int/lit8, shr-int/lit8, ushr-int/lit8
14265     *
14266     *
14267     * Description: Perform a binary operation on a register and a
14268     *              signed extended 8-bit literal value
14269     *
14270     * Format: AA|op CC|BB (22b)
14271     *
14272     * Syntax: op vAA, vBB, #+CC
14273     */
14274
14275     FETCH_BB    1, %edx                 # %edx<- BB
14276     FETCH_CCs   1, %ecx                 # %ecx<- +CC, sign-extended literal
14277     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
14278     GET_VREG    %edx                    # %edx<- vBB
14279     shr     %cl, %edx                              # %edx<- vBB op +CC
14280     SET_VREG    %edx, rINST             # vAA<- %edx; result
14281     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
14282
14283 /* ------------------------------ */
14284     .balign 64
14285 .L_OP_IGET_VOLATILE: /* 0xe3 */
14286    /* Copyright (C) 2008 The Android Open Source Project
14287     *
14288     * Licensed under the Apache License, Version 2.0 (the "License");
14289     * you may not use this file except in compliance with the License.
14290     * You may obtain a copy of the License at
14291     *
14292     * http://www.apache.org/licenses/LICENSE-2.0
14293     *
14294     * Unless required by applicable law or agreed to in writing, software
14295     * distributed under the License is distributed on an "AS IS" BASIS,
14296     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14297     * See the License for the specific language governing permissions and
14298     * limitations under the License.
14299     */
14300
14301    /*
14302     * File: stub.S
14303     */
14304
14305     SAVE_PC_FP_TO_GLUE %edx             # save program counter and frame pointer
14306     pushl       rGLUE                   # push parameter glue
14307     call        dvmMterp_OP_IGET_VOLATILE      # call c-based implementation
14308     lea         4(%esp), %esp
14309     LOAD_PC_FP_FROM_GLUE                # restore program counter and frame pointer
14310     FINISH_A                            # jump to next instruction
14311 /* ------------------------------ */
14312     .balign 64
14313 .L_OP_IPUT_VOLATILE: /* 0xe4 */
14314    /* Copyright (C) 2008 The Android Open Source Project
14315     *
14316     * Licensed under the Apache License, Version 2.0 (the "License");
14317     * you may not use this file except in compliance with the License.
14318     * You may obtain a copy of the License at
14319     *
14320     * http://www.apache.org/licenses/LICENSE-2.0
14321     *
14322     * Unless required by applicable law or agreed to in writing, software
14323     * distributed under the License is distributed on an "AS IS" BASIS,
14324     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14325     * See the License for the specific language governing permissions and
14326     * limitations under the License.
14327     */
14328
14329    /*
14330     * File: stub.S
14331     */
14332
14333     SAVE_PC_FP_TO_GLUE %edx             # save program counter and frame pointer
14334     pushl       rGLUE                   # push parameter glue
14335     call        dvmMterp_OP_IPUT_VOLATILE      # call c-based implementation
14336     lea         4(%esp), %esp
14337     LOAD_PC_FP_FROM_GLUE                # restore program counter and frame pointer
14338     FINISH_A                            # jump to next instruction
14339 /* ------------------------------ */
14340     .balign 64
14341 .L_OP_SGET_VOLATILE: /* 0xe5 */
14342    /* Copyright (C) 2008 The Android Open Source Project
14343     *
14344     * Licensed under the Apache License, Version 2.0 (the "License");
14345     * you may not use this file except in compliance with the License.
14346     * You may obtain a copy of the License at
14347     *
14348     * http://www.apache.org/licenses/LICENSE-2.0
14349     *
14350     * Unless required by applicable law or agreed to in writing, software
14351     * distributed under the License is distributed on an "AS IS" BASIS,
14352     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14353     * See the License for the specific language governing permissions and
14354     * limitations under the License.
14355     */
14356
14357    /*
14358     * File: stub.S
14359     */
14360
14361     SAVE_PC_FP_TO_GLUE %edx             # save program counter and frame pointer
14362     pushl       rGLUE                   # push parameter glue
14363     call        dvmMterp_OP_SGET_VOLATILE      # call c-based implementation
14364     lea         4(%esp), %esp
14365     LOAD_PC_FP_FROM_GLUE                # restore program counter and frame pointer
14366     FINISH_A                            # jump to next instruction
14367 /* ------------------------------ */
14368     .balign 64
14369 .L_OP_SPUT_VOLATILE: /* 0xe6 */
14370    /* Copyright (C) 2008 The Android Open Source Project
14371     *
14372     * Licensed under the Apache License, Version 2.0 (the "License");
14373     * you may not use this file except in compliance with the License.
14374     * You may obtain a copy of the License at
14375     *
14376     * http://www.apache.org/licenses/LICENSE-2.0
14377     *
14378     * Unless required by applicable law or agreed to in writing, software
14379     * distributed under the License is distributed on an "AS IS" BASIS,
14380     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14381     * See the License for the specific language governing permissions and
14382     * limitations under the License.
14383     */
14384
14385    /*
14386     * File: stub.S
14387     */
14388
14389     SAVE_PC_FP_TO_GLUE %edx             # save program counter and frame pointer
14390     pushl       rGLUE                   # push parameter glue
14391     call        dvmMterp_OP_SPUT_VOLATILE      # call c-based implementation
14392     lea         4(%esp), %esp
14393     LOAD_PC_FP_FROM_GLUE                # restore program counter and frame pointer
14394     FINISH_A                            # jump to next instruction
14395 /* ------------------------------ */
14396     .balign 64
14397 .L_OP_IGET_OBJECT_VOLATILE: /* 0xe7 */
14398    /* Copyright (C) 2008 The Android Open Source Project
14399     *
14400     * Licensed under the Apache License, Version 2.0 (the "License");
14401     * you may not use this file except in compliance with the License.
14402     * You may obtain a copy of the License at
14403     *
14404     * http://www.apache.org/licenses/LICENSE-2.0
14405     *
14406     * Unless required by applicable law or agreed to in writing, software
14407     * distributed under the License is distributed on an "AS IS" BASIS,
14408     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14409     * See the License for the specific language governing permissions and
14410     * limitations under the License.
14411     */
14412
14413    /*
14414     * File: stub.S
14415     */
14416
14417     SAVE_PC_FP_TO_GLUE %edx             # save program counter and frame pointer
14418     pushl       rGLUE                   # push parameter glue
14419     call        dvmMterp_OP_IGET_OBJECT_VOLATILE      # call c-based implementation
14420     lea         4(%esp), %esp
14421     LOAD_PC_FP_FROM_GLUE                # restore program counter and frame pointer
14422     FINISH_A                            # jump to next instruction
14423 /* ------------------------------ */
14424     .balign 64
14425 .L_OP_IGET_WIDE_VOLATILE: /* 0xe8 */
14426    /* Copyright (C) 2008 The Android Open Source Project
14427     *
14428     * Licensed under the Apache License, Version 2.0 (the "License");
14429     * you may not use this file except in compliance with the License.
14430     * You may obtain a copy of the License at
14431     *
14432     * http://www.apache.org/licenses/LICENSE-2.0
14433     *
14434     * Unless required by applicable law or agreed to in writing, software
14435     * distributed under the License is distributed on an "AS IS" BASIS,
14436     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14437     * See the License for the specific language governing permissions and
14438     * limitations under the License.
14439     */
14440
14441    /*
14442     * File: stub.S
14443     */
14444
14445     SAVE_PC_FP_TO_GLUE %edx             # save program counter and frame pointer
14446     pushl       rGLUE                   # push parameter glue
14447     call        dvmMterp_OP_IGET_WIDE_VOLATILE      # call c-based implementation
14448     lea         4(%esp), %esp
14449     LOAD_PC_FP_FROM_GLUE                # restore program counter and frame pointer
14450     FINISH_A                            # jump to next instruction
14451 /* ------------------------------ */
14452     .balign 64
14453 .L_OP_IPUT_WIDE_VOLATILE: /* 0xe9 */
14454    /* Copyright (C) 2008 The Android Open Source Project
14455     *
14456     * Licensed under the Apache License, Version 2.0 (the "License");
14457     * you may not use this file except in compliance with the License.
14458     * You may obtain a copy of the License at
14459     *
14460     * http://www.apache.org/licenses/LICENSE-2.0
14461     *
14462     * Unless required by applicable law or agreed to in writing, software
14463     * distributed under the License is distributed on an "AS IS" BASIS,
14464     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14465     * See the License for the specific language governing permissions and
14466     * limitations under the License.
14467     */
14468
14469    /*
14470     * File: stub.S
14471     */
14472
14473     SAVE_PC_FP_TO_GLUE %edx             # save program counter and frame pointer
14474     pushl       rGLUE                   # push parameter glue
14475     call        dvmMterp_OP_IPUT_WIDE_VOLATILE      # call c-based implementation
14476     lea         4(%esp), %esp
14477     LOAD_PC_FP_FROM_GLUE                # restore program counter and frame pointer
14478     FINISH_A                            # jump to next instruction
14479 /* ------------------------------ */
14480     .balign 64
14481 .L_OP_SGET_WIDE_VOLATILE: /* 0xea */
14482    /* Copyright (C) 2008 The Android Open Source Project
14483     *
14484     * Licensed under the Apache License, Version 2.0 (the "License");
14485     * you may not use this file except in compliance with the License.
14486     * You may obtain a copy of the License at
14487     *
14488     * http://www.apache.org/licenses/LICENSE-2.0
14489     *
14490     * Unless required by applicable law or agreed to in writing, software
14491     * distributed under the License is distributed on an "AS IS" BASIS,
14492     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14493     * See the License for the specific language governing permissions and
14494     * limitations under the License.
14495     */
14496
14497    /*
14498     * File: stub.S
14499     */
14500
14501     SAVE_PC_FP_TO_GLUE %edx             # save program counter and frame pointer
14502     pushl       rGLUE                   # push parameter glue
14503     call        dvmMterp_OP_SGET_WIDE_VOLATILE      # call c-based implementation
14504     lea         4(%esp), %esp
14505     LOAD_PC_FP_FROM_GLUE                # restore program counter and frame pointer
14506     FINISH_A                            # jump to next instruction
14507 /* ------------------------------ */
14508     .balign 64
14509 .L_OP_SPUT_WIDE_VOLATILE: /* 0xeb */
14510    /* Copyright (C) 2008 The Android Open Source Project
14511     *
14512     * Licensed under the Apache License, Version 2.0 (the "License");
14513     * you may not use this file except in compliance with the License.
14514     * You may obtain a copy of the License at
14515     *
14516     * http://www.apache.org/licenses/LICENSE-2.0
14517     *
14518     * Unless required by applicable law or agreed to in writing, software
14519     * distributed under the License is distributed on an "AS IS" BASIS,
14520     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14521     * See the License for the specific language governing permissions and
14522     * limitations under the License.
14523     */
14524
14525    /*
14526     * File: stub.S
14527     */
14528
14529     SAVE_PC_FP_TO_GLUE %edx             # save program counter and frame pointer
14530     pushl       rGLUE                   # push parameter glue
14531     call        dvmMterp_OP_SPUT_WIDE_VOLATILE      # call c-based implementation
14532     lea         4(%esp), %esp
14533     LOAD_PC_FP_FROM_GLUE                # restore program counter and frame pointer
14534     FINISH_A                            # jump to next instruction
14535 /* ------------------------------ */
14536     .balign 64
14537 .L_OP_BREAKPOINT: /* 0xec */
14538 /* File: x86-atom/OP_BREAKPOINT.S */
14539 /* File: x86/unused.S */
14540     jmp     common_abort
14541
14542
14543 /* ------------------------------ */
14544     .balign 64
14545 .L_OP_THROW_VERIFICATION_ERROR: /* 0xed */
14546 /* File: x86-atom/OP_THROW_VERIFICATION_ERROR.S */
14547    /* Copyright (C) 2009 The Android Open Source Project
14548     *
14549     * Licensed under the Apache License, Version 2.0 (the "License");
14550     * you may not use this file except in compliance with the License.
14551     * You may obtain a copy of the License at
14552     *
14553     * http://www.apache.org/licenses/LICENSE-2.0
14554     *
14555     * Unless required by applicable law or agreed to in writing, software
14556     * distributed under the License is distributed on an "AS IS" BASIS,
14557     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14558     * See the License for the specific language governing permissions and
14559     * limitations under the License.
14560     */
14561
14562    /*
14563     * File: OP_THROW_VERIFICATION_ERROR.S
14564     *
14565     * Code:
14566     *
14567     * For: throw-verification-error
14568     *
14569     * Description: Throws an exception for an error discovered during verification.
14570     *              The exception is indicated by AA with details provided by BBBB.
14571     *
14572     * Format: AA|op BBBB (21c)
14573     *
14574     * Syntax: op vAA, ref@BBBB
14575     */
14576
14577     movl        rGLUE, %edx                 # %edx<- pMterpGlue
14578     movl        offGlue_method(%edx), %ecx  # %ecx<- glue->method
14579     EXPORT_PC                               # in case an exception is thrown
14580     FETCH       1, %eax                     # %eax<- BBBB
14581     movl        %eax, -4(%esp)              # push parameter BBBB; ref
14582     movl        rINST, -8(%esp)             # push parameter AA
14583     movl        %ecx, -12(%esp)             # push parameter glue->method
14584     lea         -12(%esp), %esp
14585     call        dvmThrowVerificationError   # call: (const Method* method, int kind, int ref)
14586     jmp     common_exceptionThrown      # failed; handle exception
14587
14588 /* ------------------------------ */
14589     .balign 64
14590 .L_OP_EXECUTE_INLINE: /* 0xee */
14591 /* File: x86-atom/OP_EXECUTE_INLINE.S */
14592    /* Copyright (C) 2008 The Android Open Source Project
14593     *
14594     * Licensed under the Apache License, Version 2.0 (the "License");
14595     * you may not use this file except in compliance with the License.
14596     * You may obtain a copy of the License at
14597     *
14598     * http://www.apache.org/licenses/LICENSE-2.0
14599     *
14600     * Unless required by applicable law or agreed to in writing, software
14601     * distributed under the License is distributed on an "AS IS" BASIS,
14602     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14603     * See the License for the specific language governing permissions and
14604     * limitations under the License.
14605     */
14606
14607    /*
14608     * File: OP_EXECUTE_INLINE.S
14609     *
14610     * Code: Executes a "native inline" instruction. Uses no substitutions.
14611     *
14612     * For: execute-inline
14613     *
14614     * Description: Executes a "native inline" instruction. This instruction
14615     *              is generated by the optimizer.
14616     *
14617     * Format:
14618     *
14619     * Syntax: A, {vC, vD, vE, vF}, inline@BBBB
14620     */
14621
14622     FETCH       1, %ecx                 # %ecx<- BBBB
14623     movl        rGLUE, %eax             # %eax<- MterpGlue pointer
14624     addl        $offGlue_retval, %eax  # %eax<- &glue->retval
14625     EXPORT_PC
14626     shr         $4, rINST              # rINST<- A
14627     movl        %eax, -8(%esp)          # push parameter glue->retval
14628     lea         -24(%esp), %esp
14629     jmp         .LOP_EXECUTE_INLINE_continue
14630
14631 /* ------------------------------ */
14632     .balign 64
14633 .L_OP_EXECUTE_INLINE_RANGE: /* 0xef */
14634 /* File: x86-atom/OP_EXECUTE_INLINE_RANGE.S */
14635    /* Copyright (C) 2010 The Android Open Source Project
14636     *
14637     * Licensed under the Apache License, Version 2.0 (the "License");
14638     * you may not use this file except in compliance with the License.
14639     * You may obtain a copy of the License at
14640     *
14641     * http://www.apache.org/licenses/LICENSE-2.0
14642     *
14643     * Unless required by applicable law or agreed to in writing, software
14644     * distributed under the License is distributed on an "AS IS" BASIS,
14645     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14646     * See the License for the specific language governing permissions and
14647     * limitations under the License.
14648     */
14649
14650    /*
14651     * File: OP_EXECUTE_INLINE_RANGE.S
14652     *
14653     * Code: Executes a "native inline" instruction. Uses no substitutions.
14654     *
14655     * For: execute-inline
14656     *
14657     * Description: Executes a "native inline" instruction. This instruction
14658     *              is generated by the optimizer.
14659     *
14660     * Format:
14661     *
14662     * Syntax: AA, {vCCCC..v(CCCC+AA-1)}, inline@BBBB
14663     */
14664
14665     FETCH       1, %ecx                 # %ecx<- BBBB
14666     movl        rGLUE, %eax             # %eax<- MterpGlue pointer
14667     addl        $offGlue_retval, %eax  # %eax<- &glue->retval
14668     EXPORT_PC
14669     movl        %eax, -8(%esp)          # push parameter glue->retval
14670     lea         -24(%esp), %esp
14671     jmp         .LOP_EXECUTE_INLINE_RANGE_continue
14672
14673 /* ------------------------------ */
14674     .balign 64
14675 .L_OP_INVOKE_DIRECT_EMPTY: /* 0xf0 */
14676 /* File: x86-atom/OP_INVOKE_DIRECT_EMPTY.S */
14677    /* Copyright (C) 2008 The Android Open Source Project
14678     *
14679     * Licensed under the Apache License, Version 2.0 (the "License");
14680     * you may not use this file except in compliance with the License.
14681     * You may obtain a copy of the License at
14682     *
14683     * http://www.apache.org/licenses/LICENSE-2.0
14684     *
14685     * Unless required by applicable law or agreed to in writing, software
14686     * distributed under the License is distributed on an "AS IS" BASIS,
14687     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14688     * See the License for the specific language governing permissions and
14689     * limitations under the License.
14690     */
14691
14692    /*
14693     * File: OP_INVOKE_DIRECT_EMPTY.S
14694     *
14695     * Code: Used as a no-op. Uses no substitutions.
14696     *
14697     * For: invoke-direct-empty
14698     *
14699     * Format: B|A|op CCCC G|F|E|D (35c)
14700     */
14701
14702     FINISH 3
14703 /* ------------------------------ */
14704     .balign 64
14705 .L_OP_RETURN_VOID_BARRIER: /* 0xf1 */
14706    /* Copyright (C) 2008 The Android Open Source Project
14707     *
14708     * Licensed under the Apache License, Version 2.0 (the "License");
14709     * you may not use this file except in compliance with the License.
14710     * You may obtain a copy of the License at
14711     *
14712     * http://www.apache.org/licenses/LICENSE-2.0
14713     *
14714     * Unless required by applicable law or agreed to in writing, software
14715     * distributed under the License is distributed on an "AS IS" BASIS,
14716     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14717     * See the License for the specific language governing permissions and
14718     * limitations under the License.
14719     */
14720
14721    /*
14722     * File: stub.S
14723     */
14724
14725     SAVE_PC_FP_TO_GLUE %edx             # save program counter and frame pointer
14726     pushl       rGLUE                   # push parameter glue
14727     call        dvmMterp_OP_RETURN_VOID_BARRIER      # call c-based implementation
14728     lea         4(%esp), %esp
14729     LOAD_PC_FP_FROM_GLUE                # restore program counter and frame pointer
14730     FINISH_A                            # jump to next instruction
14731 /* ------------------------------ */
14732     .balign 64
14733 .L_OP_IGET_QUICK: /* 0xf2 */
14734 /* File: x86-atom/OP_IGET_QUICK.S */
14735    /* Copyright (C) 2008 The Android Open Source Project
14736     *
14737     * Licensed under the Apache License, Version 2.0 (the "License");
14738     * you may not use this file except in compliance with the License.
14739     * You may obtain a copy of the License at
14740     *
14741     * http://www.apache.org/licenses/LICENSE-2.0
14742     *
14743     * Unless required by applicable law or agreed to in writing, software
14744     * distributed under the License is distributed on an "AS IS" BASIS,
14745     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14746     * See the License for the specific language governing permissions and
14747     * limitations under the License.
14748     */
14749
14750    /*
14751     * File: OP_IGET_QUICK.S
14752     *
14753     * Code: Optimization for iget
14754     *
14755     * For: iget-quick
14756     *
14757     * Format: B|A|op CCCC (22c)
14758     *
14759     * Syntax: op vA, vB, offset@CCCC
14760     */
14761
14762     movl        rINST, %eax             # %eax<- BA
14763     shr         $4, %eax               # %eax<- B
14764     and         $15, rINST             # rINST<- A
14765     GET_VREG    %eax                    # %eax<- vB; object to operate on
14766     FETCH       1, %ecx                 # %ecx<- CCCC; field byte offset
14767     cmp         $0, %eax               # check if object is null
14768     je          common_errNullObject    # handle null object
14769     FFETCH_ADV  2, %edx                 # %eax<- next instruction hi; fetch, advance
14770     movl        (%ecx, %eax), %eax      # %eax<- object field
14771     SET_VREG    %eax, rINST             # fp[A]<- %eax
14772     FGETOP_JMP  2, %edx                 # jump to next instruction; getop, jmp
14773
14774 /* ------------------------------ */
14775     .balign 64
14776 .L_OP_IGET_WIDE_QUICK: /* 0xf3 */
14777 /* File: x86-atom/OP_IGET_WIDE_QUICK.S */
14778    /* Copyright (C) 2008 The Android Open Source Project
14779     *
14780     * Licensed under the Apache License, Version 2.0 (the "License");
14781     * you may not use this file except in compliance with the License.
14782     * You may obtain a copy of the License at
14783     *
14784     * http://www.apache.org/licenses/LICENSE-2.0
14785     *
14786     * Unless required by applicable law or agreed to in writing, software
14787     * distributed under the License is distributed on an "AS IS" BASIS,
14788     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14789     * See the License for the specific language governing permissions and
14790     * limitations under the License.
14791     */
14792
14793    /*
14794     * File: OP_IGET_WIDE_QUICK.S
14795     *
14796     * Code: Optimization for iget
14797     *
14798     * For: iget/wide-quick
14799     *
14800     * Format: B|A|op CCCC (22c)
14801     *
14802     * Syntax: op vA, vB, offset@CCCC
14803     */
14804
14805     movl        rINST, %edx             # %edx<- BA
14806     shr         $4, %edx               # %edx<- B
14807     andl        $15, rINST             # rINST<- A
14808     GET_VREG    %edx                    # %edx<- vB; object to operate on
14809     cmp         $0, %edx               # check if object is null
14810     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
14811     je          common_errNullObject    # handle null object
14812     FETCH       1, %ecx                 # %ecx<- CCCC; field byte offset
14813     movq        (%ecx, %edx), %xmm0     # %xmm0<- object field
14814     movq        %xmm0, (rFP, rINST, 4)  # fp[A]<- %xmm0
14815     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
14816
14817 /* ------------------------------ */
14818     .balign 64
14819 .L_OP_IGET_OBJECT_QUICK: /* 0xf4 */
14820 /* File: x86-atom/OP_IGET_OBJECT_QUICK.S */
14821    /* Copyright (C) 2008 The Android Open Source Project
14822     *
14823     * Licensed under the Apache License, Version 2.0 (the "License");
14824     * you may not use this file except in compliance with the License.
14825     * You may obtain a copy of the License at
14826     *
14827     * http://www.apache.org/licenses/LICENSE-2.0
14828     *
14829     * Unless required by applicable law or agreed to in writing, software
14830     * distributed under the License is distributed on an "AS IS" BASIS,
14831     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14832     * See the License for the specific language governing permissions and
14833     * limitations under the License.
14834     */
14835
14836    /*
14837     * File: OP_IGET_OBJECT_QUICK.S
14838     */
14839
14840 /* File: x86-atom/OP_IGET_QUICK.S */
14841    /* Copyright (C) 2008 The Android Open Source Project
14842     *
14843     * Licensed under the Apache License, Version 2.0 (the "License");
14844     * you may not use this file except in compliance with the License.
14845     * You may obtain a copy of the License at
14846     *
14847     * http://www.apache.org/licenses/LICENSE-2.0
14848     *
14849     * Unless required by applicable law or agreed to in writing, software
14850     * distributed under the License is distributed on an "AS IS" BASIS,
14851     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14852     * See the License for the specific language governing permissions and
14853     * limitations under the License.
14854     */
14855
14856    /*
14857     * File: OP_IGET_QUICK.S
14858     *
14859     * Code: Optimization for iget
14860     *
14861     * For: iget-quick
14862     *
14863     * Format: B|A|op CCCC (22c)
14864     *
14865     * Syntax: op vA, vB, offset@CCCC
14866     */
14867
14868     movl        rINST, %eax             # %eax<- BA
14869     shr         $4, %eax               # %eax<- B
14870     and         $15, rINST             # rINST<- A
14871     GET_VREG    %eax                    # %eax<- vB; object to operate on
14872     FETCH       1, %ecx                 # %ecx<- CCCC; field byte offset
14873     cmp         $0, %eax               # check if object is null
14874     je          common_errNullObject    # handle null object
14875     FFETCH_ADV  2, %edx                 # %eax<- next instruction hi; fetch, advance
14876     movl        (%ecx, %eax), %eax      # %eax<- object field
14877     SET_VREG    %eax, rINST             # fp[A]<- %eax
14878     FGETOP_JMP  2, %edx                 # jump to next instruction; getop, jmp
14879
14880
14881 /* ------------------------------ */
14882     .balign 64
14883 .L_OP_IPUT_QUICK: /* 0xf5 */
14884 /* File: x86-atom/OP_IPUT_QUICK.S */
14885    /* Copyright (C) 2008 The Android Open Source Project
14886     *
14887     * Licensed under the Apache License, Version 2.0 (the "License");
14888     * you may not use this file except in compliance with the License.
14889     * You may obtain a copy of the License at
14890     *
14891     * http://www.apache.org/licenses/LICENSE-2.0
14892     *
14893     * Unless required by applicable law or agreed to in writing, software
14894     * distributed under the License is distributed on an "AS IS" BASIS,
14895     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14896     * See the License for the specific language governing permissions and
14897     * limitations under the License.
14898     */
14899
14900    /*
14901     * File: OP_IPUT_QUICK.S
14902     * Code: Optimization for iput
14903     *
14904     * For: iput-quick
14905     *
14906     * Format: B|A|op CCCC (22c)
14907     *
14908     * Syntax: op vA, vB, offset@CCCC
14909     */
14910
14911     movl        rINST, %eax             # %eax<- BA
14912     shr         $4, %eax               # %eax<- B
14913     and         $15, rINST             # rINST<- A
14914     GET_VREG    %eax                    # %eax<- vB; object to operate on
14915     FETCH       1, %ecx                 # %ecx<- CCCC; field byte offset
14916     cmp         $0, %eax               # check if object is null
14917     je          common_errNullObject    # handle null object
14918     FFETCH_ADV  2, %edx                 # %edx<- next instruction hi; fetch, advance
14919     GET_VREG    rINST                   # rINST<- vA
14920     movl        rINST, (%eax, %ecx)     # object field<- vA
14921     FGETOP_JMP  2, %edx                 # jump to next instruction; getop, jmp
14922
14923 /* ------------------------------ */
14924     .balign 64
14925 .L_OP_IPUT_WIDE_QUICK: /* 0xf6 */
14926 /* File: x86-atom/OP_IPUT_WIDE_QUICK.S */
14927    /* Copyright (C) 2008 The Android Open Source Project
14928     *
14929     * Licensed under the Apache License, Version 2.0 (the "License");
14930     * you may not use this file except in compliance with the License.
14931     * You may obtain a copy of the License at
14932     *
14933     * http://www.apache.org/licenses/LICENSE-2.0
14934     *
14935     * Unless required by applicable law or agreed to in writing, software
14936     * distributed under the License is distributed on an "AS IS" BASIS,
14937     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14938     * See the License for the specific language governing permissions and
14939     * limitations under the License.
14940     */
14941
14942    /*
14943     * File: OP_IPUT_WIDE_QUICK.S
14944     *
14945     * Code: Optimization for iput
14946     *
14947     * For: iput/wide-quick
14948     *
14949     * Format: B|A|op CCCC (22c)
14950     *
14951     * Syntax: op vA, vB, offset@CCCC
14952     */
14953
14954     movl        rINST, %edx             # %edx<- BA
14955     shr         $4, %edx               # %edx<- B
14956     andl        $15, rINST             # rINST<- A
14957     GET_VREG    %edx                    # %edx<- vB; object to operate on
14958     cmp         $0, %edx               # check if object is null
14959     FETCH       1, %ecx                 # %ecx<- CCCC; field byte offset
14960     je          common_errNullObject    # handle null object
14961     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
14962     movq        (rFP, rINST, 4), %xmm0  # %xmm0<- fp[A]
14963     movq        %xmm0, (%edx, %ecx)     # object field<- %xmm0; fp[A]
14964     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
14965
14966 /* ------------------------------ */
14967     .balign 64
14968 .L_OP_IPUT_OBJECT_QUICK: /* 0xf7 */
14969 /* File: x86-atom/OP_IPUT_OBJECT_QUICK.S */
14970    /* Copyright (C) 2008 The Android Open Source Project
14971     *
14972     * Licensed under the Apache License, Version 2.0 (the "License");
14973     * you may not use this file except in compliance with the License.
14974     * You may obtain a copy of the License at
14975     *
14976     * http://www.apache.org/licenses/LICENSE-2.0
14977     *
14978     * Unless required by applicable law or agreed to in writing, software
14979     * distributed under the License is distributed on an "AS IS" BASIS,
14980     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14981     * See the License for the specific language governing permissions and
14982     * limitations under the License.
14983     */
14984
14985    /*
14986     * File: OP_IPUT_OBJECT_QUICK.S
14987     */
14988
14989 /* File: x86-atom/OP_IPUT_QUICK.S */
14990    /* Copyright (C) 2008 The Android Open Source Project
14991     *
14992     * Licensed under the Apache License, Version 2.0 (the "License");
14993     * you may not use this file except in compliance with the License.
14994     * You may obtain a copy of the License at
14995     *
14996     * http://www.apache.org/licenses/LICENSE-2.0
14997     *
14998     * Unless required by applicable law or agreed to in writing, software
14999     * distributed under the License is distributed on an "AS IS" BASIS,
15000     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15001     * See the License for the specific language governing permissions and
15002     * limitations under the License.
15003     */
15004
15005    /*
15006     * File: OP_IPUT_QUICK.S
15007     * Code: Optimization for iput
15008     *
15009     * For: iput-quick
15010     *
15011     * Format: B|A|op CCCC (22c)
15012     *
15013     * Syntax: op vA, vB, offset@CCCC
15014     */
15015
15016     movl        rINST, %eax             # %eax<- BA
15017     shr         $4, %eax               # %eax<- B
15018     and         $15, rINST             # rINST<- A
15019     GET_VREG    %eax                    # %eax<- vB; object to operate on
15020     FETCH       1, %ecx                 # %ecx<- CCCC; field byte offset
15021     cmp         $0, %eax               # check if object is null
15022     je          common_errNullObject    # handle null object
15023     FFETCH_ADV  2, %edx                 # %edx<- next instruction hi; fetch, advance
15024     GET_VREG    rINST                   # rINST<- vA
15025     movl        rINST, (%eax, %ecx)     # object field<- vA
15026     FGETOP_JMP  2, %edx                 # jump to next instruction; getop, jmp
15027
15028
15029 /* ------------------------------ */
15030     .balign 64
15031 .L_OP_INVOKE_VIRTUAL_QUICK: /* 0xf8 */
15032 /* File: x86-atom/OP_INVOKE_VIRTUAL_QUICK.S */
15033    /* Copyright (C) 2008 The Android Open Source Project
15034     *
15035     * Licensed under the Apache License, Version 2.0 (the "License");
15036     * you may not use this file except in compliance with the License.
15037     * You may obtain a copy of the License at
15038     *
15039     * http://www.apache.org/licenses/LICENSE-2.0
15040     *
15041     * Unless required by applicable law or agreed to in writing, software
15042     * distributed under the License is distributed on an "AS IS" BASIS,
15043     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15044     * See the License for the specific language governing permissions and
15045     * limitations under the License.
15046     */
15047
15048    /*
15049     * File: OP_INVOKE_VIRTUAL_QUICK.S
15050     *
15051     * Code: Optimization for invoke-virtual and invoke-virtual/range
15052     *
15053     * For: invoke-virtual/quick, invoke-virtual/quick-range
15054     */
15055
15056
15057     FETCH       2, %edx                 # %edx<- GFED or CCCC
15058     .if (!0)
15059     and         $15, %edx              # %edx<- D if not range
15060     .endif
15061     FETCH       1, %ecx                 # %ecx<- method index
15062     GET_VREG    %edx                    # %edx<- "this" ptr
15063     cmp         $0, %edx               # %edx<- check for null "this"
15064     EXPORT_PC                           # must export pc for invoke
15065     je          common_errNullObject
15066     movl        offObject_clazz(%edx), %edx # %edx<- thisPtr->clazz
15067     movl        offClassObject_vtable(%edx), %edx # %edx<- thisPtr->clazz->vtable
15068     movl        (%edx, %ecx, 4), %ecx   # %ecx<- vtable[methodIndex]
15069     jmp         common_invokeMethodNoRange # invoke method common code
15070
15071 /* ------------------------------ */
15072     .balign 64
15073 .L_OP_INVOKE_VIRTUAL_QUICK_RANGE: /* 0xf9 */
15074 /* File: x86-atom/OP_INVOKE_VIRTUAL_QUICK_RANGE.S */
15075    /* Copyright (C) 2008 The Android Open Source Project
15076     *
15077     * Licensed under the Apache License, Version 2.0 (the "License");
15078     * you may not use this file except in compliance with the License.
15079     * You may obtain a copy of the License at
15080     *
15081     * http://www.apache.org/licenses/LICENSE-2.0
15082     *
15083     * Unless required by applicable law or agreed to in writing, software
15084     * distributed under the License is distributed on an "AS IS" BASIS,
15085     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15086     * See the License for the specific language governing permissions and
15087     * limitations under the License.
15088     */
15089
15090    /*
15091     * File: OP_INVOKE_VIRTUAL_QUICK_RANGE.S
15092     */
15093
15094 /* File: x86-atom/OP_INVOKE_VIRTUAL_QUICK.S */
15095    /* Copyright (C) 2008 The Android Open Source Project
15096     *
15097     * Licensed under the Apache License, Version 2.0 (the "License");
15098     * you may not use this file except in compliance with the License.
15099     * You may obtain a copy of the License at
15100     *
15101     * http://www.apache.org/licenses/LICENSE-2.0
15102     *
15103     * Unless required by applicable law or agreed to in writing, software
15104     * distributed under the License is distributed on an "AS IS" BASIS,
15105     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15106     * See the License for the specific language governing permissions and
15107     * limitations under the License.
15108     */
15109
15110    /*
15111     * File: OP_INVOKE_VIRTUAL_QUICK.S
15112     *
15113     * Code: Optimization for invoke-virtual and invoke-virtual/range
15114     *
15115     * For: invoke-virtual/quick, invoke-virtual/quick-range
15116     */
15117
15118
15119     FETCH       2, %edx                 # %edx<- GFED or CCCC
15120     .if (!1)
15121     and         $15, %edx              # %edx<- D if not range
15122     .endif
15123     FETCH       1, %ecx                 # %ecx<- method index
15124     GET_VREG    %edx                    # %edx<- "this" ptr
15125     cmp         $0, %edx               # %edx<- check for null "this"
15126     EXPORT_PC                           # must export pc for invoke
15127     je          common_errNullObject
15128     movl        offObject_clazz(%edx), %edx # %edx<- thisPtr->clazz
15129     movl        offClassObject_vtable(%edx), %edx # %edx<- thisPtr->clazz->vtable
15130     movl        (%edx, %ecx, 4), %ecx   # %ecx<- vtable[methodIndex]
15131     jmp         common_invokeMethodRange # invoke method common code
15132
15133
15134 /* ------------------------------ */
15135     .balign 64
15136 .L_OP_INVOKE_SUPER_QUICK: /* 0xfa */
15137 /* File: x86-atom/OP_INVOKE_SUPER_QUICK.S */
15138    /* Copyright (C) 2008 The Android Open Source Project
15139     *
15140     * Licensed under the Apache License, Version 2.0 (the "License");
15141     * you may not use this file except in compliance with the License.
15142     * You may obtain a copy of the License at
15143     *
15144     * http://www.apache.org/licenses/LICENSE-2.0
15145     *
15146     * Unless required by applicable law or agreed to in writing, software
15147     * distributed under the License is distributed on an "AS IS" BASIS,
15148     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15149     * See the License for the specific language governing permissions and
15150     * limitations under the License.
15151     */
15152
15153    /*
15154     * File: OP_INVOKE_SUPER_QUICK.S
15155     *
15156     * Code: Optimization for invoke-super and invoke-super/range
15157     *
15158     * For: invoke-super/quick, invoke-super/quick-range
15159     */
15160
15161
15162     FETCH       2, %edx                 # %edx<- GFED or CCCC
15163     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
15164     movl        offGlue_method(%ecx), %eax # %eax<- glue->method
15165     .if         (!0)
15166     and         $15, %edx              #  %edx<- D if not range
15167     .endif
15168     FETCH       1, %ecx                 # %ecx<- method index
15169     movl        offMethod_clazz(%eax), %eax # %eax<- glue->method->clazz
15170     movl        offClassObject_super(%eax), %eax # %eax<- glue->method->clazz->super
15171     EXPORT_PC                           # must export for invoke
15172     movl        offClassObject_vtable(%eax), %eax # %edx<- glue->method->clazz->super->vtable
15173     cmp         $0, (rFP, %edx, 4)     # check for null object
15174     movl        (%eax, %ecx, 4), %ecx   # %ecx<- vtable[methodIndex]
15175     je          common_errNullObject    # handle null object
15176     jmp         common_invokeMethodNoRange # invoke method common code
15177
15178 /* ------------------------------ */
15179     .balign 64
15180 .L_OP_INVOKE_SUPER_QUICK_RANGE: /* 0xfb */
15181 /* File: x86-atom/OP_INVOKE_SUPER_QUICK_RANGE.S */
15182    /* Copyright (C) 2008 The Android Open Source Project
15183     *
15184     * Licensed under the Apache License, Version 2.0 (the "License");
15185     * you may not use this file except in compliance with the License.
15186     * You may obtain a copy of the License at
15187     *
15188     * http://www.apache.org/licenses/LICENSE-2.0
15189     *
15190     * Unless required by applicable law or agreed to in writing, software
15191     * distributed under the License is distributed on an "AS IS" BASIS,
15192     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15193     * See the License for the specific language governing permissions and
15194     * limitations under the License.
15195     */
15196
15197    /*
15198     * File: OP_INVOKE_SUPER_QUICK_RANGE.S
15199     */
15200
15201 /* File: x86-atom/OP_INVOKE_SUPER_QUICK.S */
15202    /* Copyright (C) 2008 The Android Open Source Project
15203     *
15204     * Licensed under the Apache License, Version 2.0 (the "License");
15205     * you may not use this file except in compliance with the License.
15206     * You may obtain a copy of the License at
15207     *
15208     * http://www.apache.org/licenses/LICENSE-2.0
15209     *
15210     * Unless required by applicable law or agreed to in writing, software
15211     * distributed under the License is distributed on an "AS IS" BASIS,
15212     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15213     * See the License for the specific language governing permissions and
15214     * limitations under the License.
15215     */
15216
15217    /*
15218     * File: OP_INVOKE_SUPER_QUICK.S
15219     *
15220     * Code: Optimization for invoke-super and invoke-super/range
15221     *
15222     * For: invoke-super/quick, invoke-super/quick-range
15223     */
15224
15225
15226     FETCH       2, %edx                 # %edx<- GFED or CCCC
15227     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
15228     movl        offGlue_method(%ecx), %eax # %eax<- glue->method
15229     .if         (!1)
15230     and         $15, %edx              #  %edx<- D if not range
15231     .endif
15232     FETCH       1, %ecx                 # %ecx<- method index
15233     movl        offMethod_clazz(%eax), %eax # %eax<- glue->method->clazz
15234     movl        offClassObject_super(%eax), %eax # %eax<- glue->method->clazz->super
15235     EXPORT_PC                           # must export for invoke
15236     movl        offClassObject_vtable(%eax), %eax # %edx<- glue->method->clazz->super->vtable
15237     cmp         $0, (rFP, %edx, 4)     # check for null object
15238     movl        (%eax, %ecx, 4), %ecx   # %ecx<- vtable[methodIndex]
15239     je          common_errNullObject    # handle null object
15240     jmp         common_invokeMethodRange # invoke method common code
15241
15242
15243 /* ------------------------------ */
15244     .balign 64
15245 .L_OP_IPUT_OBJECT_VOLATILE: /* 0xfc */
15246    /* Copyright (C) 2008 The Android Open Source Project
15247     *
15248     * Licensed under the Apache License, Version 2.0 (the "License");
15249     * you may not use this file except in compliance with the License.
15250     * You may obtain a copy of the License at
15251     *
15252     * http://www.apache.org/licenses/LICENSE-2.0
15253     *
15254     * Unless required by applicable law or agreed to in writing, software
15255     * distributed under the License is distributed on an "AS IS" BASIS,
15256     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15257     * See the License for the specific language governing permissions and
15258     * limitations under the License.
15259     */
15260
15261    /*
15262     * File: stub.S
15263     */
15264
15265     SAVE_PC_FP_TO_GLUE %edx             # save program counter and frame pointer
15266     pushl       rGLUE                   # push parameter glue
15267     call        dvmMterp_OP_IPUT_OBJECT_VOLATILE      # call c-based implementation
15268     lea         4(%esp), %esp
15269     LOAD_PC_FP_FROM_GLUE                # restore program counter and frame pointer
15270     FINISH_A                            # jump to next instruction
15271 /* ------------------------------ */
15272     .balign 64
15273 .L_OP_SGET_OBJECT_VOLATILE: /* 0xfd */
15274    /* Copyright (C) 2008 The Android Open Source Project
15275     *
15276     * Licensed under the Apache License, Version 2.0 (the "License");
15277     * you may not use this file except in compliance with the License.
15278     * You may obtain a copy of the License at
15279     *
15280     * http://www.apache.org/licenses/LICENSE-2.0
15281     *
15282     * Unless required by applicable law or agreed to in writing, software
15283     * distributed under the License is distributed on an "AS IS" BASIS,
15284     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15285     * See the License for the specific language governing permissions and
15286     * limitations under the License.
15287     */
15288
15289    /*
15290     * File: stub.S
15291     */
15292
15293     SAVE_PC_FP_TO_GLUE %edx             # save program counter and frame pointer
15294     pushl       rGLUE                   # push parameter glue
15295     call        dvmMterp_OP_SGET_OBJECT_VOLATILE      # call c-based implementation
15296     lea         4(%esp), %esp
15297     LOAD_PC_FP_FROM_GLUE                # restore program counter and frame pointer
15298     FINISH_A                            # jump to next instruction
15299 /* ------------------------------ */
15300     .balign 64
15301 .L_OP_SPUT_OBJECT_VOLATILE: /* 0xfe */
15302    /* Copyright (C) 2008 The Android Open Source Project
15303     *
15304     * Licensed under the Apache License, Version 2.0 (the "License");
15305     * you may not use this file except in compliance with the License.
15306     * You may obtain a copy of the License at
15307     *
15308     * http://www.apache.org/licenses/LICENSE-2.0
15309     *
15310     * Unless required by applicable law or agreed to in writing, software
15311     * distributed under the License is distributed on an "AS IS" BASIS,
15312     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15313     * See the License for the specific language governing permissions and
15314     * limitations under the License.
15315     */
15316
15317    /*
15318     * File: stub.S
15319     */
15320
15321     SAVE_PC_FP_TO_GLUE %edx             # save program counter and frame pointer
15322     pushl       rGLUE                   # push parameter glue
15323     call        dvmMterp_OP_SPUT_OBJECT_VOLATILE      # call c-based implementation
15324     lea         4(%esp), %esp
15325     LOAD_PC_FP_FROM_GLUE                # restore program counter and frame pointer
15326     FINISH_A                            # jump to next instruction
15327 /* ------------------------------ */
15328     .balign 64
15329 .L_OP_DISPATCH_FF: /* 0xff */
15330 /* File: x86-atom/OP_DISPATCH_FF.S */
15331    /* Copyright (C) 2008 The Android Open Source Project
15332     *
15333     * Licensed under the Apache License, Version 2.0 (the "License");
15334     * you may not use this file except in compliance with the License.
15335     * You may obtain a copy of the License at
15336     *
15337     * http://www.apache.org/licenses/LICENSE-2.0
15338     *
15339     * Unless required by applicable law or agreed to in writing, software
15340     * distributed under the License is distributed on an "AS IS" BASIS,
15341     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15342     * See the License for the specific language governing permissions and
15343     * limitations under the License.
15344     */
15345
15346    /*
15347     * File: OP_DISPATCH_FF.S
15348     */
15349
15350 /* File: x86-atom/unused.S */
15351    /* Copyright (C) 2008 The Android Open Source Project
15352     *
15353     * Licensed under the Apache License, Version 2.0 (the "License");
15354     * you may not use this file except in compliance with the License.
15355     * You may obtain a copy of the License at
15356     *
15357     * http://www.apache.org/licenses/LICENSE-2.0
15358     *
15359     * Unless required by applicable law or agreed to in writing, software
15360     * distributed under the License is distributed on an "AS IS" BASIS,
15361     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15362     * See the License for the specific language governing permissions and
15363     * limitations under the License.
15364     */
15365
15366    /*
15367     * File: unused.S
15368     *
15369     * Code: Common code for unused bytecodes. Uses no subtitutions.
15370     *
15371     * For: all unused bytecodes
15372     *
15373     * Description: aborts if executed.
15374     *
15375     * Format: Ã˜Ã˜|op (10x)
15376     *
15377     * Syntax: op
15378     */
15379
15380     call        common_abort
15381
15382
15383
15384     .balign 64
15385     .size   dvmAsmInstructionStart, .-dvmAsmInstructionStart
15386     .global dvmAsmInstructionEnd
15387 dvmAsmInstructionEnd:
15388
15389 /*
15390  * ===========================================================================
15391  *  Sister implementations
15392  * ===========================================================================
15393  */
15394     .global dvmAsmSisterStart
15395     .type   dvmAsmSisterStart, %function
15396     .text
15397     .balign 4
15398 dvmAsmSisterStart:
15399
15400 /* continuation for OP_CONST_STRING */
15401
15402
15403    /*
15404     * Continuation if the Class has not yet been resolved.
15405     *  %ecx: BBBB (Class ref)
15406     *  need: target register
15407     */
15408
15409 .LOP_CONST_STRING_resolve:
15410     EXPORT_PC
15411     movl        offGlue_method(%edx), %edx # %edx<- glue->method
15412     movl        offMethod_clazz(%edx), %edx # %edx<- glue->method->clazz
15413     movl        %ecx, -4(%esp)          # push parameter class ref
15414     movl        %edx, -8(%esp)          # push parameter glue->method->clazz
15415     lea         -8(%esp), %esp
15416     call        dvmResolveString        # resolve string reference
15417                                         # call: (const ClassObject* referrer, u4 stringIdx)
15418                                         # return: StringObject*
15419     lea         8(%esp), %esp
15420     cmp         $0, %eax               # check if resolved string failed
15421     je          common_exceptionThrown  # resolve failed; exception thrown
15422     SET_VREG    %eax, rINST             # vAA<- %eax; pResString[BBBB]
15423     FFETCH_ADV  2, %edx                 # %edx<- next instruction hi; fetch, advance
15424     FGETOP_JMP  2, %edx                 # jump to next instruction; getop, jmp
15425
15426 /* continuation for OP_CONST_STRING_JUMBO */
15427
15428
15429    /*
15430     * Continuation if the Class has not yet been resolved.
15431     *  %ecx: BBBB (Class ref)
15432     *  need: target register
15433     */
15434 .LOP_CONST_STRING_JUMBO_resolve:
15435     EXPORT_PC
15436     movl        rGLUE, %edx             # get MterpGlue pointer
15437     movl        offGlue_method(%edx), %edx # %edx<- glue->method
15438     movl        offMethod_clazz(%edx), %edx # %edx <- glue->method->clazz
15439     movl        %ecx, -4(%esp)          # push parameter class ref
15440     movl        %edx, -8(%esp)          # push parameter glue->method->clazz
15441     lea         -8(%esp), %esp
15442     call        dvmResolveString        # resolve string reference
15443                                         # call: (const ClassObject* referrer, u4 stringIdx)
15444                                         # return: StringObject*
15445     lea         8(%esp), %esp
15446     cmp         $0, %eax               # check if resolved string failed
15447     je          common_exceptionThrown  # resolve failed; exception thrown
15448     SET_VREG    %eax, rINST             # vAA<- %eax; pResString[BBBB]
15449     FINISH      3                       # jump to next instruction
15450 /* continuation for OP_CONST_CLASS */
15451
15452    /*
15453     * Continuation if the Class has not yet been resolved.
15454     *  %ecx: BBBB (Class ref)
15455     *  need: target register
15456     */
15457
15458 .LOP_CONST_CLASS_resolve:
15459     EXPORT_PC
15460     movl        offGlue_method(%edx), %edx # %edx<- glue->method
15461     movl        offMethod_clazz(%edx), %edx # %edx<- glue->method->clazz
15462     movl        $1, -4(%esp)           # push parameter true
15463     movl        %ecx, -8(%esp)          # push parameter
15464     movl        %edx, -12(%esp)         # push parameter glue->method->clazz
15465     lea         -12(%esp), %esp
15466     call        dvmResolveClass         # resolve ClassObject pointer
15467                                         # class: (const ClassObject* referrer, u4 classIdx,
15468                                         #         bool fromUnverifiedConstant)
15469                                         # return: ClassObject*
15470     lea         12(%esp), %esp
15471     cmp         $0, %eax               # check for null pointer
15472     je          common_exceptionThrown  # handle exception
15473     SET_VREG    %eax, rINST             # vAA<- resolved class
15474     FINISH      2                       # jump to next instruction
15475 /* continuation for OP_CHECK_CAST */
15476
15477 .LOP_CHECK_CAST_resolved:
15478     cmp         %ecx, offObject_clazz(rINST) # check for same class
15479     jne         .LOP_CHECK_CAST_fullcheck   # not same class; do full check
15480
15481 .LOP_CHECK_CAST_okay:
15482     FINISH      2                       # jump to next instruction
15483
15484    /*
15485     *  Trivial test failed, need to perform full check.
15486     *  offObject_clazz(rINST) holds obj->clazz
15487     *  %ecx holds class resolved from BBBB
15488     *  rINST holds object
15489     */
15490
15491 .LOP_CHECK_CAST_fullcheck:
15492     movl        offObject_clazz(rINST), %eax  # %eax<- obj->clazz
15493     movl        %eax, -12(%esp)         # push parameter obj->clazz
15494     movl        %ecx, -8(%esp)          # push parameter # push parameter resolved class
15495     lea         -12(%esp), %esp
15496     call        dvmInstanceofNonTrivial # call: (ClassObject* instance, ClassObject* clazz)
15497                                         # return: int
15498     lea         12(%esp), %esp
15499     cmp         $0, %eax               # failed?
15500     jne         .LOP_CHECK_CAST_okay        # success
15501
15502    /*
15503     * A cast has failed.  We need to throw a ClassCastException with the
15504     * class of the object that failed to be cast.
15505     */
15506
15507     EXPORT_PC                           # we will throw an exception
15508     movl        $.LstrClassCastExceptionPtr, -8(%esp) # push parameter message
15509     movl        offObject_clazz(rINST), rINST # rINST<- obj->clazz
15510     movl        offClassObject_descriptor(rINST), rINST # rINST<- obj->clazz->descriptor
15511     movl        rINST, -4(%esp)         # push parameter obj->clazz->descriptor
15512     lea         -8(%esp), %esp
15513     call        dvmThrowExceptionWithClassMessage # call: (const char* exceptionDescriptor,
15514                                                   #       const char* messageDescriptor, Object* cause)
15515                                                   # return: void
15516     lea         8(%esp), %esp
15517     jmp         common_exceptionThrown
15518
15519    /*
15520     * Resolution required.  This is the least-likely path.
15521     *
15522     *  rINST holds object
15523     */
15524
15525 .LOP_CHECK_CAST_resolve:
15526     movl        offGlue_method(%edx), %eax # %eax<- glue->method
15527     FETCH       1, %ecx                 # %ecx holds BBBB
15528     EXPORT_PC                           # in case we throw an exception
15529     movl        $0, -8(%esp)           # push parameter false
15530     movl        offMethod_clazz(%eax), %eax # %eax<- glue->method->clazz
15531     movl        %ecx, -12(%esp)         # push parameter BBBB
15532     movl        %eax, -16(%esp)         # push parameter glue->method>clazz
15533     lea         -16(%esp), %esp
15534     call        dvmResolveClass         # resolve ClassObject pointer
15535                                         # call: (const ClassObject* referrer, u4 classIdx,
15536                                         #        bool fromUnverifiedConstant)
15537                                         # return ClassObject*
15538     lea         16(%esp), %esp
15539     cmp         $0, %eax               # check for null pointer
15540     je          common_exceptionThrown  # handle excpetion
15541     movl        %eax, %ecx              # %ecx<- resolved class
15542     jmp         .LOP_CHECK_CAST_resolved
15543
15544 .LstrClassCastExceptionPtr:
15545 .asciz      "Ljava/lang/ClassCastException;"
15546
15547 /* continuation for OP_INSTANCE_OF */
15548
15549 .LOP_INSTANCE_OF_break:
15550     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
15551     movl        offGlue_methodClassDex(%ecx), %ecx # %ecx<- pDvmDex
15552     FETCH       1, %eax                 # %eax<- CCCC
15553     movl        offDvmDex_pResClasses(%ecx), %ecx # %ecx<- pDvmDex->pResClasses
15554     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved class
15555     movl        offObject_clazz(%edx), %edx # %edx<- obj->clazz
15556     cmp         $0, %ecx               # check if already resovled
15557     je          .LOP_INSTANCE_OF_resolve     # not resolved before, so resolve now
15558
15559 .LOP_INSTANCE_OF_resolved:
15560     cmp         %ecx, %edx              # check if same class
15561     je          .LOP_INSTANCE_OF_trivial     # yes, finish
15562     jmp         .LOP_INSTANCE_OF_fullcheck   # no, do full check
15563
15564    /*
15565     * The trivial test failed, we need to perform a full check.
15566     * %edx holds obj->clazz
15567     * %ecx holds class resolved from BBBB
15568     */
15569
15570 .LOP_INSTANCE_OF_fullcheck:
15571     movl        %edx, -8(%esp)          # push parameter obj->clazz
15572     movl        %ecx, -4(%esp)          # push parameter resolved class
15573     lea         -8(%esp), %esp
15574     call        dvmInstanceofNonTrivial # perform full check
15575                                         # call: (ClassObject* instance, ClassObject* clazz)
15576                                         # return: int
15577     andl        $15, rINST             # rINST<- A
15578     FFETCH_ADV  2, %edx                 # %edx<- next instruction hi; fetch, advance
15579     lea         8(%esp), %esp
15580     SET_VREG    %eax, rINST             # vA<- r0
15581     FGETOP_JMP  2, %edx                 # jump to next instruction; getop, jmp
15582
15583    /*
15584     * %edx holds boolean result
15585     */
15586
15587 .LOP_INSTANCE_OF_store:
15588     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
15589     andl        $15, rINST             # rINST<- A
15590     SET_VREG    %edx, rINST             # vA<- r0
15591     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
15592
15593    /*
15594     * Trivial test succeeded, save and bail.
15595     */
15596
15597 .LOP_INSTANCE_OF_trivial:
15598     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
15599     andl        $15, rINST             # rINST<- A
15600     SET_VREG    $1, rINST              # vA<- r0
15601     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
15602
15603    /*
15604     * Resolution required.  This is the least-likely path.
15605     * %eax holds BBBB
15606     */
15607
15608 .LOP_INSTANCE_OF_resolve:
15609
15610     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
15611     EXPORT_PC
15612     movl        offGlue_method(%ecx), %ecx # %ecx<- glue->method
15613     movl        offMethod_clazz(%ecx), %ecx # %ecx<- glue->method->clazz
15614     movl        %ecx, -12(%esp)         # push parameter glue->method->clazz
15615     movl        %eax, -8(%esp)          # push parameter CCCC; type index
15616     movl        $1, -4(%esp)           # push parameter true
15617     lea         -12(%esp), %esp
15618     call        dvmResolveClass         # call: (const ClassObject* referrer, u4 classIdx,
15619                                         #        bool fromUnverifiedConstant)
15620                                         # return: ClassObject*
15621     lea         12(%esp), %esp
15622     cmp         $0, %eax               # check for null
15623     je          common_exceptionThrown  # handle exception
15624     movl        rINST, %edx             # %edx<- BA+
15625     shr         $4, %edx               # %edx<- B
15626     movl        %eax, %ecx              # need class in %ecx
15627     GET_VREG    %edx                    # %edx<- vB
15628     movl        offObject_clazz(%edx), %edx # %edx<- obj->clazz
15629     jmp         .LOP_INSTANCE_OF_resolved    # clazz resolved, continue
15630
15631 /* continuation for OP_NEW_INSTANCE */
15632 .balign 32
15633 .LOP_NEW_INSTANCE_finish:
15634     movl        %edx, -8(%esp)          # push parameter object
15635     movl        %eax, -4(%esp)          # push parameter flags
15636     lea         -8(%esp), %esp
15637     call        dvmAllocObject          # call: (ClassObject* clazz, int flags)
15638                                         # return: Object*
15639     cmp         $0, %eax               # check for failure
15640     lea         8(%esp), %esp
15641     je          common_exceptionThrown  # handle exception
15642     SET_VREG    %eax, rINST             # vAA<- pObject
15643     FINISH      2                       # jump to next instruction
15644
15645    /*
15646     * Class initialization required.
15647     *
15648     *  %edx holds class object
15649     */
15650
15651 .LOP_NEW_INSTANCE_needinit:
15652     movl        %edx, -4(%esp)          # push parameter object
15653     lea         -4(%esp), %esp
15654     call        dvmInitClass            # call: (ClassObject* clazz)
15655                                         # return: bool
15656     lea         4(%esp), %esp
15657     cmp         $0, %eax               # check for failure
15658     movl        -4(%esp), %edx          # %edx<- object
15659     je          common_exceptionThrown  # handle exception
15660     testl       $(ACC_INTERFACE|ACC_ABSTRACT), offClassObject_accessFlags(%edx)
15661     mov         $ALLOC_DONT_TRACK, %eax # %eax<- flag for alloc call
15662     je          .LOP_NEW_INSTANCE_finish      # continue
15663     jmp         .LOP_NEW_INSTANCE_abstract    # handle abstract or interface
15664
15665    /*
15666     * Resolution required.  This is the least-likely path.
15667     *
15668     *  BBBB in %eax
15669     */
15670
15671 .LOP_NEW_INSTANCE_resolve:
15672
15673
15674     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
15675     FETCH       1, %eax                 # %eax<- BBBB
15676     movl        offGlue_method(%ecx), %ecx # %ecx<- glue->method
15677     movl        offMethod_clazz(%ecx), %ecx # %ecx<- glue->method->clazz
15678     movl        %ecx, -12(%esp)         # push parameter clazz
15679     movl        $0, -4(%esp)           # push parameter false
15680     movl        %eax, -8(%esp)          # push parameter BBBB
15681     lea         -12(%esp), %esp
15682     call        dvmResolveClass         # call: (const ClassObject* referrer,
15683                                         #       u4 classIdx, bool fromUnverifiedConstant)
15684                                         # return: ClassObject*
15685     lea         12(%esp), %esp
15686     movl        %eax, %edx              # %edx<- pObject
15687     cmp         $0, %edx               # check for failure
15688     jne         .LOP_NEW_INSTANCE_resolved    # continue
15689     jmp         common_exceptionThrown  # handle exception
15690
15691    /*
15692     * We can't instantiate an abstract class or interface, so throw an
15693     * InstantiationError with the class descriptor as the message.
15694     *
15695     *  %edx holds class object
15696     */
15697
15698 .LOP_NEW_INSTANCE_abstract:
15699     movl        offClassObject_descriptor(%edx), %ecx # %ecx<- descriptor
15700     movl        %ecx, -4(%esp)          # push parameter descriptor
15701     movl        $.LstrInstantiationErrorPtr, -8(%esp) # push parameter message
15702     lea         -8(%esp), %esp
15703     call        dvmThrowExceptionWithClassMessage # call: (const char* exceptionDescriptor,
15704                                                   #        const char* messageDescriptor)
15705                                                   # return: void
15706     jmp         common_exceptionThrown  # handle exception
15707
15708 .LstrInstantiationErrorPtr:
15709 .asciz      "Ljava/lang/InstantiationError;"
15710
15711 /* continuation for OP_NEW_ARRAY */
15712
15713    /*
15714     * Resolve class.  (This is an uncommon case.)
15715     *
15716     *  %edx holds array length
15717     *  %ecx holds class ref CCCC
15718     */
15719
15720 .LOP_NEW_ARRAY_resolve:
15721     movl        rGLUE, %eax             # %eax<- pMterpGlue
15722     movl        offGlue_method(%eax), %eax # %eax<- glue->method
15723     movl        %edx, -4(%esp)          # save length
15724     movl        $0, -8(%esp)           # push parameter false
15725     movl        %ecx, -12(%esp)         # push parameter class ref
15726     movl        offMethod_clazz(%eax), %eax # %eax<- glue->method->clazz
15727     movl        %eax, -16(%esp)         # push parameter clazz
15728     lea         -16(%esp), %esp
15729     call        dvmResolveClass         # call: (const ClassObject* referrer,
15730                                         #       u4 classIdx, bool fromUnverifiedConstant)
15731                                         # return: ClassObject*
15732     cmp         $0, %eax               # check for failure
15733     lea         16(%esp), %esp
15734     je          common_exceptionThrown  # handle exception
15735     movl        -4(%esp), %edx          # %edx<- length
15736
15737    /*
15738     * Finish allocation.
15739     *
15740     *  %eax holds class
15741     *  %edx holds array length
15742     */
15743
15744 .LOP_NEW_ARRAY_finish:
15745     movl        %eax, -12(%esp)         # push parameter class
15746     movl        %edx, -8(%esp)          # push parameter length
15747     movl        $ALLOC_DONT_TRACK, -4(%esp)
15748     lea         -12(%esp), %esp
15749     call        dvmAllocArrayByClass    # call: (ClassObject* arrayClass,
15750                                         # size_t length, int allocFlags)
15751                                         # return: ArrayObject*
15752     and         $15, rINST             # rINST<- A
15753     cmp         $0, %eax               # check for allocation failure
15754     lea         12(%esp), %esp
15755     je          common_exceptionThrown  # handle exception
15756     SET_VREG    %eax, rINST             # vA<- pArray
15757     FINISH      2                       # jump to next instruction
15758
15759 /* continuation for OP_FILLED_NEW_ARRAY */
15760
15761 .LOP_FILLED_NEW_ARRAY_break:
15762     movl        $0, -8(%esp)           # push parameter false
15763     movl        %ecx, -12(%esp)         # push parameter BBBB
15764     movl        rGLUE, %edx             # %edx<- MterpGlue pointer
15765     movl        offGlue_method(%edx), %edx # %edx<- glue->method
15766     movl        offMethod_clazz(%edx), %edx # %edx<- glue->method->clazz
15767     movl        %edx, -16(%esp)         # push parameter glue->method->clazz
15768     lea         -16(%esp), %esp
15769     call        dvmResolveClass         # call: (const ClassObject* referrer, u4 classIdx,
15770                                         #        bool fromUnverifiedConstant)
15771                                         # return: ClassObject*
15772     lea         16(%esp), %esp
15773     cmp         $0, %eax               # check for null return
15774     je          common_exceptionThrown  # handle exception
15775
15776    /*
15777     * On entry:
15778     *  %eax holds array class
15779     *  rINST holds BA or AA
15780     */
15781
15782 .LOP_FILLED_NEW_ARRAY_continue:
15783     movl        offClassObject_descriptor(%eax), %eax # %eax<- arrayClass->descriptor
15784     movzbl      1(%eax), %eax           # %eax<- descriptor[1]
15785     cmp         $'I', %eax             # check if array of ints
15786     jne         .LOP_FILLED_NEW_ARRAY_notimpl     # jump to not implemented
15787     movl        rINST, -12(%esp)        # push parameter length
15788     movl        %eax, -16(%esp)         # push parameter descriptor[1]
15789     movl        $ALLOC_DONT_TRACK, -8(%esp) # push parameter to allocate flags
15790     .if         (!0)
15791     shrl        $4, -12(%esp)          # parameter length is B
15792     .endif
15793     lea         -16(%esp), %esp
15794     call        dvmAllocPrimitiveArray  # call: (char type, size_t length, int allocFlags)
15795                                         # return: ArrayObject*
15796     lea         16(%esp), %esp
15797     cmp         $0, %eax               # check for null return
15798     je          common_exceptionThrown  # handle exception
15799
15800     FETCH       2, %edx                 # %edx<- FEDC or CCCC
15801     movl        rGLUE, %ecx             # %ecx<- MterpGlue pointer
15802     movl        %eax, offGlue_retval(%ecx) # retval<- new array
15803     lea         offArrayObject_contents(%eax), %eax # %eax<- newArray->contents
15804     subl        $1, -12(%esp)          # length--; check for negative
15805     js          2f                      # if length was zero, finish
15806
15807    /*
15808     * copy values from registers into the array
15809     * %eax=array, %edx=CCCC/FEDC, -12(%esp)=length (from AA or B), rINST=AA/BA
15810     */
15811
15812     .if         0
15813     lea         (rFP, %edx, 4), %ecx    # %ecx<- &fpp[CCCC]
15814 1:
15815     movl        (%ecx), %edx            # %edx<- %ecx++
15816     lea         4(%ecx), %ecx           # %ecx++
15817     movl        %edx, (%eax)            # *contents<- vX
15818     lea         4(%eax), %eax           # %eax++; contents++
15819     subl        $1, -12(%esp)          # length--
15820     jns         1b                      # or continue at 2
15821     .else
15822     cmp         $4, -12(%esp)          # check length
15823     jne         1f                      # has four args
15824     and         $15, rINST             # rINST<- A
15825     GET_VREG    rINST                   # rINST<- vA
15826     subl        $1, -12(%esp)          # count--
15827     movl        rINST, 16(%eax)         # contents[4]<- vA
15828 1:
15829     movl        %edx, %ecx              # %ecx<- %edx; ecx for temp
15830     andl        $15, %ecx              # %ecx<- G/F/E/D
15831     GET_VREG    %ecx                    # %ecx<- vG/vF/vE/vD
15832     shr         $4, %edx               # %edx<- put next reg in low 4
15833     subl        $1, -12(%esp)          # count--
15834     movl        %ecx, (%eax)            # *contents<- vX
15835     lea         4(%eax), %eax           # %eax++; contents++
15836     jns         1b                      # or continue at 2
15837     .endif
15838 2:
15839     FINISH      3                       # jump to next instruction
15840
15841    /*
15842     * Throw an exception to indicate this mode of filled-new-array
15843     * has not been implemented.
15844     */
15845
15846 .LOP_FILLED_NEW_ARRAY_notimpl:
15847     movl        $.LstrInternalError, -8(%esp)
15848     movl        $.LstrFilledNewArrayNotImpl, -4(%esp)
15849     lea         -8(%esp), %esp
15850     call        dvmThrowException # call: (const char* exceptionDescriptor,
15851                                   #        const char* msg)
15852                                   # return: void
15853     lea         8(%esp), %esp
15854     jmp         common_exceptionThrown
15855
15856 .if         (!0)                 # define in one or the other, not both
15857 .LstrFilledNewArrayNotImpl:
15858 .asciz      "filled-new-array only implemented for 'int'"
15859 .LstrInternalError:
15860 .asciz  "Ljava/lang/InternalError;"
15861 .endif
15862
15863 /* continuation for OP_FILLED_NEW_ARRAY_RANGE */
15864
15865 .LOP_FILLED_NEW_ARRAY_RANGE_break:
15866     movl        $0, -8(%esp)           # push parameter false
15867     movl        %ecx, -12(%esp)         # push parameter BBBB
15868     movl        rGLUE, %edx             # %edx<- MterpGlue pointer
15869     movl        offGlue_method(%edx), %edx # %edx<- glue->method
15870     movl        offMethod_clazz(%edx), %edx # %edx<- glue->method->clazz
15871     movl        %edx, -16(%esp)         # push parameter glue->method->clazz
15872     lea         -16(%esp), %esp
15873     call        dvmResolveClass         # call: (const ClassObject* referrer, u4 classIdx,
15874                                         #        bool fromUnverifiedConstant)
15875                                         # return: ClassObject*
15876     lea         16(%esp), %esp
15877     cmp         $0, %eax               # check for null return
15878     je          common_exceptionThrown  # handle exception
15879
15880    /*
15881     * On entry:
15882     *  %eax holds array class
15883     *  rINST holds BA or AA
15884     */
15885
15886 .LOP_FILLED_NEW_ARRAY_RANGE_continue:
15887     movl        offClassObject_descriptor(%eax), %eax # %eax<- arrayClass->descriptor
15888     movzbl      1(%eax), %eax           # %eax<- descriptor[1]
15889     cmp         $'I', %eax             # check if array of ints
15890     jne         .LOP_FILLED_NEW_ARRAY_RANGE_notimpl     # jump to not implemented
15891     movl        rINST, -12(%esp)        # push parameter length
15892     movl        %eax, -16(%esp)         # push parameter descriptor[1]
15893     movl        $ALLOC_DONT_TRACK, -8(%esp) # push parameter to allocate flags
15894     .if         (!1)
15895     shrl        $4, -12(%esp)          # parameter length is B
15896     .endif
15897     lea         -16(%esp), %esp
15898     call        dvmAllocPrimitiveArray  # call: (char type, size_t length, int allocFlags)
15899                                         # return: ArrayObject*
15900     lea         16(%esp), %esp
15901     cmp         $0, %eax               # check for null return
15902     je          common_exceptionThrown  # handle exception
15903
15904     FETCH       2, %edx                 # %edx<- FEDC or CCCC
15905     movl        rGLUE, %ecx             # %ecx<- MterpGlue pointer
15906     movl        %eax, offGlue_retval(%ecx) # retval<- new array
15907     lea         offArrayObject_contents(%eax), %eax # %eax<- newArray->contents
15908     subl        $1, -12(%esp)          # length--; check for negative
15909     js          2f                      # if length was zero, finish
15910
15911    /*
15912     * copy values from registers into the array
15913     * %eax=array, %edx=CCCC/FEDC, -12(%esp)=length (from AA or B), rINST=AA/BA
15914     */
15915
15916     .if         1
15917     lea         (rFP, %edx, 4), %ecx    # %ecx<- &fpp[CCCC]
15918 1:
15919     movl        (%ecx), %edx            # %edx<- %ecx++
15920     lea         4(%ecx), %ecx           # %ecx++
15921     movl        %edx, (%eax)            # *contents<- vX
15922     lea         4(%eax), %eax           # %eax++; contents++
15923     subl        $1, -12(%esp)          # length--
15924     jns         1b                      # or continue at 2
15925     .else
15926     cmp         $4, -12(%esp)          # check length
15927     jne         1f                      # has four args
15928     and         $15, rINST             # rINST<- A
15929     GET_VREG    rINST                   # rINST<- vA
15930     subl        $1, -12(%esp)          # count--
15931     movl        rINST, 16(%eax)         # contents[4]<- vA
15932 1:
15933     movl        %edx, %ecx              # %ecx<- %edx; ecx for temp
15934     andl        $15, %ecx              # %ecx<- G/F/E/D
15935     GET_VREG    %ecx                    # %ecx<- vG/vF/vE/vD
15936     shr         $4, %edx               # %edx<- put next reg in low 4
15937     subl        $1, -12(%esp)          # count--
15938     movl        %ecx, (%eax)            # *contents<- vX
15939     lea         4(%eax), %eax           # %eax++; contents++
15940     jns         1b                      # or continue at 2
15941     .endif
15942 2:
15943     FINISH      3                       # jump to next instruction
15944
15945    /*
15946     * Throw an exception to indicate this mode of filled-new-array
15947     * has not been implemented.
15948     */
15949
15950 .LOP_FILLED_NEW_ARRAY_RANGE_notimpl:
15951     movl        $.LstrInternalError, -8(%esp)
15952     movl        $.LstrFilledNewArrayNotImpl, -4(%esp)
15953     lea         -8(%esp), %esp
15954     call        dvmThrowException # call: (const char* exceptionDescriptor,
15955                                   #        const char* msg)
15956                                   # return: void
15957     lea         8(%esp), %esp
15958     jmp         common_exceptionThrown
15959
15960 .if         (!1)                 # define in one or the other, not both
15961 .LstrFilledNewArrayNotImpl:
15962 .asciz      "filled-new-array only implemented for 'int'"
15963 .LstrInternalError:
15964 .asciz  "Ljava/lang/InternalError;"
15965 .endif
15966
15967 /* continuation for OP_PACKED_SWITCH */
15968 .LOP_PACKED_SWITCH_finish:
15969     FINISH_RB   %edx, %ecx              # jump to next instruction
15970
15971 /* continuation for OP_SPARSE_SWITCH */
15972 .LOP_SPARSE_SWITCH_finish:
15973     FINISH_RB   %edx, %ecx              # jump to next instruction
15974
15975 /* continuation for OP_CMPL_FLOAT */
15976 .LOP_CMPL_FLOAT_greater:
15977     movl        $0x1, (rFP, rINST, 4)  # vAA<- greater than
15978     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
15979
15980 .LOP_CMPL_FLOAT_final:
15981     movl        $0x0, (rFP, rINST, 4)  # vAA<- equal
15982     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
15983
15984 .LOP_CMPL_FLOAT_finalNan:
15985     movl        $0xFFFFFFFF, (rFP, rINST, 4)   # vAA<- NaN
15986     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
15987
15988 /* continuation for OP_CMPG_FLOAT */
15989 .LOP_CMPG_FLOAT_greater:
15990     movl        $0x1, (rFP, rINST, 4)  # vAA<- greater than
15991     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
15992
15993 .LOP_CMPG_FLOAT_final:
15994     movl        $0x0, (rFP, rINST, 4)  # vAA<- equal
15995     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
15996
15997 .LOP_CMPG_FLOAT_finalNan:
15998     movl        $0x1, (rFP, rINST, 4)   # vAA<- NaN
15999     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16000
16001 /* continuation for OP_CMPL_DOUBLE */
16002 .LOP_CMPL_DOUBLE_greater:
16003     movl        $0x1, (rFP, rINST, 4)  # vAA<- greater than
16004     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16005
16006 .LOP_CMPL_DOUBLE_final:
16007     movl        $0x0, (rFP, rINST, 4)  # vAA<- equal
16008     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16009
16010 .LOP_CMPL_DOUBLE_finalNan:
16011     movl        $0xFFFFFFFF, (rFP, rINST, 4)   # vAA<- NaN
16012     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16013
16014 /* continuation for OP_CMPG_DOUBLE */
16015 .LOP_CMPG_DOUBLE_greater:
16016     movl        $0x1, (rFP, rINST, 4)  # vAA<- greater than
16017     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16018
16019 .LOP_CMPG_DOUBLE_final:
16020     movl        $0x0, (rFP, rINST, 4)  # vAA<- equal
16021     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16022
16023 .LOP_CMPG_DOUBLE_finalNan:
16024     movl        $0x1, (rFP, rINST, 4)   # vAA<- NaN
16025     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16026
16027 /* continuation for OP_CMP_LONG */
16028
16029 .LOP_CMP_LONG_final:
16030     movl        $0x0, (rFP, rINST, 4)  # vAA<- equal
16031     FINISH      2                       # jump to next instruction
16032
16033 .LOP_CMP_LONG_less:
16034     movl        $0xFFFFFFFF, (rFP, rINST, 4) # vAA<- less than
16035     FINISH      2                       # jump to next instruction
16036
16037 .LOP_CMP_LONG_greater:
16038     movl        $0x1, (rFP, rINST, 4)  # vAA<- greater than
16039     FINISH      2                       # jump to next instruction
16040
16041 /* continuation for OP_APUT_OBJECT */
16042
16043 .LOP_APUT_OBJECT_finish:
16044     movl        %edx, sReg0             # save &vBB[vCC]
16045     movl        offObject_clazz(rINST), %edx # %edx<- obj->clazz
16046     movl        %edx, -8(%esp)          # push parameter obj->clazz
16047     movl        offObject_clazz(%eax), %eax # %eax<- arrayObj->clazz
16048     movl        %eax, -4(%esp)          # push parameter arrayObj->clazz
16049     lea         -8(%esp), %esp
16050     call        dvmCanPutArrayElement   # test object type vs. array type
16051                                         # call: ClassObject* elemClass, ClassObject* arrayClass)
16052                                         # return: bool
16053     lea         8(%esp), %esp
16054     cmp         $0, %eax               # check for invalid array value
16055     je          common_errArrayStore    # handle invalid array value
16056     movl        sReg0, %edx             # restore &vBB[vCC]
16057
16058 .LOP_APUT_OBJECT_skip_check:
16059     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16060     movl        rINST, offArrayObject_contents(%edx)
16061     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16062
16063 /* continuation for OP_IGET */
16064
16065 .LOP_IGET_finish:
16066     call        dvmResolveInstField     # call: (const ClassObject* referrer, u4 ifieldIdx)
16067                                         # return: InstField*
16068     cmp         $0, %eax               # check if resolved
16069     lea         8(%esp), %esp
16070     je          common_exceptionThrown  # not resolved; handle exception
16071
16072     /*
16073      *  %eax holds resolved field
16074      */
16075
16076 .LOP_IGET_finish2:
16077     movl        rINST, %ecx             # %ecx<- BA
16078     shr         $4, %ecx               # %ecx<- B
16079     and         $15, rINST             # rINST<- A
16080
16081     GET_VREG    %ecx                    # %ecx<- vB
16082     cmp         $0, %ecx               # check for null object
16083     je          common_errNullObject    # handle null object
16084     movl        offInstField_byteOffset(%eax), %edx # %edx<- field offset
16085     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16086     movl     (%ecx, %edx), %edx      # %edx<- object field
16087     SET_VREG    %edx, rINST             # vA<- %edx; object field
16088     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16089
16090 /* continuation for OP_IGET_WIDE */
16091
16092 .LOP_IGET_WIDE_finish2:
16093     lea         -8(%esp), %esp
16094     call        dvmResolveInstField     # resolve InstField ptr
16095                                         # call: (const ClassObject* referrer, u4 ifieldIdx)
16096                                         # return: InstField*
16097     cmp         $0, %eax               # check if resolved
16098     lea         8(%esp), %esp
16099     movl        %eax, %ecx              # %ecx<- %eax; %ecx expected to hold field
16100     je          common_exceptionThrown
16101
16102    /*
16103     *  %ecx holds resolved field
16104     */
16105
16106 .LOP_IGET_WIDE_finish:
16107
16108     movl        rINST, %edx             # %edx<- BA
16109     shr         $4, %edx               # %edx<- B
16110     andl        $15, rINST             # rINST<- A
16111     GET_VREG    %edx                    # %edx<- vB
16112     cmp         $0, %edx               # check for null object
16113     je          common_errNullObject
16114     movl        offInstField_byteOffset(%ecx), %ecx # %ecx<- field offset
16115     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16116     movq        (%ecx, %edx), %xmm0     # %xmm0<- object field
16117     movq        %xmm0, (rFP, rINST, 4)  # vA<- %xmm0; object field
16118     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16119
16120 /* continuation for OP_IGET_OBJECT */
16121
16122 .LOP_IGET_OBJECT_finish:
16123     call        dvmResolveInstField     # call: (const ClassObject* referrer, u4 ifieldIdx)
16124                                         # return: InstField*
16125     cmp         $0, %eax               # check if resolved
16126     lea         8(%esp), %esp
16127     je          common_exceptionThrown  # not resolved; handle exception
16128
16129     /*
16130      *  %eax holds resolved field
16131      */
16132
16133 .LOP_IGET_OBJECT_finish2:
16134     movl        rINST, %ecx             # %ecx<- BA
16135     shr         $4, %ecx               # %ecx<- B
16136     and         $15, rINST             # rINST<- A
16137
16138     GET_VREG    %ecx                    # %ecx<- vB
16139     cmp         $0, %ecx               # check for null object
16140     je          common_errNullObject    # handle null object
16141     movl        offInstField_byteOffset(%eax), %edx # %edx<- field offset
16142     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16143     movl     (%ecx, %edx), %edx      # %edx<- object field
16144     SET_VREG    %edx, rINST             # vA<- %edx; object field
16145     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16146
16147 /* continuation for OP_IGET_BOOLEAN */
16148
16149 .LOP_IGET_BOOLEAN_finish:
16150     call        dvmResolveInstField     # call: (const ClassObject* referrer, u4 ifieldIdx)
16151                                         # return: InstField*
16152     cmp         $0, %eax               # check if resolved
16153     lea         8(%esp), %esp
16154     je          common_exceptionThrown  # not resolved; handle exception
16155
16156     /*
16157      *  %eax holds resolved field
16158      */
16159
16160 .LOP_IGET_BOOLEAN_finish2:
16161     movl        rINST, %ecx             # %ecx<- BA
16162     shr         $4, %ecx               # %ecx<- B
16163     and         $15, rINST             # rINST<- A
16164
16165     GET_VREG    %ecx                    # %ecx<- vB
16166     cmp         $0, %ecx               # check for null object
16167     je          common_errNullObject    # handle null object
16168     movl        offInstField_byteOffset(%eax), %edx # %edx<- field offset
16169     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16170     movl     (%ecx, %edx), %edx      # %edx<- object field
16171     SET_VREG    %edx, rINST             # vA<- %edx; object field
16172     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16173
16174 /* continuation for OP_IGET_BYTE */
16175
16176 .LOP_IGET_BYTE_finish:
16177     call        dvmResolveInstField     # call: (const ClassObject* referrer, u4 ifieldIdx)
16178                                         # return: InstField*
16179     cmp         $0, %eax               # check if resolved
16180     lea         8(%esp), %esp
16181     je          common_exceptionThrown  # not resolved; handle exception
16182
16183     /*
16184      *  %eax holds resolved field
16185      */
16186
16187 .LOP_IGET_BYTE_finish2:
16188     movl        rINST, %ecx             # %ecx<- BA
16189     shr         $4, %ecx               # %ecx<- B
16190     and         $15, rINST             # rINST<- A
16191
16192     GET_VREG    %ecx                    # %ecx<- vB
16193     cmp         $0, %ecx               # check for null object
16194     je          common_errNullObject    # handle null object
16195     movl        offInstField_byteOffset(%eax), %edx # %edx<- field offset
16196     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16197     movl     (%ecx, %edx), %edx      # %edx<- object field
16198     SET_VREG    %edx, rINST             # vA<- %edx; object field
16199     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16200
16201 /* continuation for OP_IGET_CHAR */
16202
16203 .LOP_IGET_CHAR_finish:
16204     call        dvmResolveInstField     # call: (const ClassObject* referrer, u4 ifieldIdx)
16205                                         # return: InstField*
16206     cmp         $0, %eax               # check if resolved
16207     lea         8(%esp), %esp
16208     je          common_exceptionThrown  # not resolved; handle exception
16209
16210     /*
16211      *  %eax holds resolved field
16212      */
16213
16214 .LOP_IGET_CHAR_finish2:
16215     movl        rINST, %ecx             # %ecx<- BA
16216     shr         $4, %ecx               # %ecx<- B
16217     and         $15, rINST             # rINST<- A
16218
16219     GET_VREG    %ecx                    # %ecx<- vB
16220     cmp         $0, %ecx               # check for null object
16221     je          common_errNullObject    # handle null object
16222     movl        offInstField_byteOffset(%eax), %edx # %edx<- field offset
16223     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16224     movl     (%ecx, %edx), %edx      # %edx<- object field
16225     SET_VREG    %edx, rINST             # vA<- %edx; object field
16226     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16227
16228 /* continuation for OP_IGET_SHORT */
16229
16230 .LOP_IGET_SHORT_finish:
16231     call        dvmResolveInstField     # call: (const ClassObject* referrer, u4 ifieldIdx)
16232                                         # return: InstField*
16233     cmp         $0, %eax               # check if resolved
16234     lea         8(%esp), %esp
16235     je          common_exceptionThrown  # not resolved; handle exception
16236
16237     /*
16238      *  %eax holds resolved field
16239      */
16240
16241 .LOP_IGET_SHORT_finish2:
16242     movl        rINST, %ecx             # %ecx<- BA
16243     shr         $4, %ecx               # %ecx<- B
16244     and         $15, rINST             # rINST<- A
16245
16246     GET_VREG    %ecx                    # %ecx<- vB
16247     cmp         $0, %ecx               # check for null object
16248     je          common_errNullObject    # handle null object
16249     movl        offInstField_byteOffset(%eax), %edx # %edx<- field offset
16250     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16251     movl     (%ecx, %edx), %edx      # %edx<- object field
16252     SET_VREG    %edx, rINST             # vA<- %edx; object field
16253     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16254
16255 /* continuation for OP_IPUT */
16256
16257 .LOP_IPUT_finish:
16258     movl        offGlue_method(%edx), %edx # %edx<- glue->method
16259     EXPORT_PC                           # in case an exception is thrown
16260     movl        %ecx, -4(%esp)          # push parameter CCCC; field ref
16261     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16262     lea         -8(%esp), %esp
16263     movl        %edx, (%esp)            # push parameter method->clazz
16264     call        dvmResolveInstField     # call: (const ClassObject* referrer, u4 ifieldIdx)
16265                                         # return: InstField*
16266     lea         8(%esp), %esp
16267     cmp         $0, %eax               # check if resolved
16268     jne         .LOP_IPUT_finish2
16269     jmp         common_exceptionThrown  # not resolved; handle exception
16270
16271 .LOP_IPUT_finish2:
16272     movl        rINST, %ecx             # %ecx<- BA+
16273     shr         $4, %ecx               # %ecx<- B
16274     and         $15, rINST             # rINST<- A
16275     GET_VREG    %ecx                    # %ecx<- vB
16276     cmp         $0, %ecx               # check for null object
16277     je          common_errNullObject    # handle null object
16278     movl        offInstField_byteOffset(%eax), %edx # %edx<- field offset
16279     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16280     GET_VREG    rINST                   # rINST<- vA
16281     movl     rINST, (%edx, %ecx)     # object field<- vA
16282     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16283
16284 /* continuation for OP_IPUT_WIDE */
16285
16286 .LOP_IPUT_WIDE_finish2:
16287     lea         -8(%esp), %esp
16288     call        dvmResolveInstField     # resolve InstField ptr
16289     cmp         $0, %eax               # check if resolved
16290     lea         8(%esp), %esp
16291     movl        %eax, %ecx              # %ecx<- %eax; %ecx expected to hold field
16292     jne         .LOP_IPUT_WIDE_finish
16293     jmp         common_exceptionThrown
16294
16295    /*
16296     * Currently:
16297     *  %ecx holds resolved field
16298     *  %edx does not hold object yet
16299     */
16300
16301 .LOP_IPUT_WIDE_finish:
16302     movl        rINST, %edx             # %edx<- BA
16303     shr         $4, %edx               # %edx<- B
16304     andl        $15, rINST             # rINST<- A
16305     GET_VREG    %edx                    # %edx<- vB
16306     cmp         $0, %edx               # check for null object
16307     je          common_errNullObject
16308     movl        offInstField_byteOffset(%ecx), %ecx # %ecx<- field offset
16309     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16310     movq        (rFP, rINST, 4), %xmm0  # %xmm0<- vA
16311     movq        %xmm0, (%ecx, %edx)     # object field<- %xmm0; vA
16312     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16313
16314 /* continuation for OP_IPUT_OBJECT */
16315
16316 .LOP_IPUT_OBJECT_finish:
16317     movl        offGlue_method(%edx), %edx # %edx<- glue->method
16318     EXPORT_PC                           # in case an exception is thrown
16319     movl        %ecx, -4(%esp)          # push parameter CCCC; field ref
16320     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16321     lea         -8(%esp), %esp
16322     movl        %edx, (%esp)            # push parameter method->clazz
16323     call        dvmResolveInstField     # call: (const ClassObject* referrer, u4 ifieldIdx)
16324                                         # return: InstField*
16325     lea         8(%esp), %esp
16326     cmp         $0, %eax               # check if resolved
16327     jne         .LOP_IPUT_OBJECT_finish2
16328     jmp         common_exceptionThrown  # not resolved; handle exception
16329
16330 .LOP_IPUT_OBJECT_finish2:
16331     movl        rINST, %ecx             # %ecx<- BA+
16332     shr         $4, %ecx               # %ecx<- B
16333     and         $15, rINST             # rINST<- A
16334     GET_VREG    %ecx                    # %ecx<- vB
16335     cmp         $0, %ecx               # check for null object
16336     je          common_errNullObject    # handle null object
16337     movl        offInstField_byteOffset(%eax), %edx # %edx<- field offset
16338     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16339     GET_VREG    rINST                   # rINST<- vA
16340     movl     rINST, (%edx, %ecx)     # object field<- vA
16341     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16342
16343 /* continuation for OP_IPUT_BOOLEAN */
16344
16345 .LOP_IPUT_BOOLEAN_finish:
16346     movl        offGlue_method(%edx), %edx # %edx<- glue->method
16347     EXPORT_PC                           # in case an exception is thrown
16348     movl        %ecx, -4(%esp)          # push parameter CCCC; field ref
16349     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16350     lea         -8(%esp), %esp
16351     movl        %edx, (%esp)            # push parameter method->clazz
16352     call        dvmResolveInstField     # call: (const ClassObject* referrer, u4 ifieldIdx)
16353                                         # return: InstField*
16354     lea         8(%esp), %esp
16355     cmp         $0, %eax               # check if resolved
16356     jne         .LOP_IPUT_BOOLEAN_finish2
16357     jmp         common_exceptionThrown  # not resolved; handle exception
16358
16359 .LOP_IPUT_BOOLEAN_finish2:
16360     movl        rINST, %ecx             # %ecx<- BA+
16361     shr         $4, %ecx               # %ecx<- B
16362     and         $15, rINST             # rINST<- A
16363     GET_VREG    %ecx                    # %ecx<- vB
16364     cmp         $0, %ecx               # check for null object
16365     je          common_errNullObject    # handle null object
16366     movl        offInstField_byteOffset(%eax), %edx # %edx<- field offset
16367     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16368     GET_VREG    rINST                   # rINST<- vA
16369     movl     rINST, (%edx, %ecx)     # object field<- vA
16370     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16371
16372 /* continuation for OP_IPUT_BYTE */
16373
16374 .LOP_IPUT_BYTE_finish:
16375     movl        offGlue_method(%edx), %edx # %edx<- glue->method
16376     EXPORT_PC                           # in case an exception is thrown
16377     movl        %ecx, -4(%esp)          # push parameter CCCC; field ref
16378     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16379     lea         -8(%esp), %esp
16380     movl        %edx, (%esp)            # push parameter method->clazz
16381     call        dvmResolveInstField     # call: (const ClassObject* referrer, u4 ifieldIdx)
16382                                         # return: InstField*
16383     lea         8(%esp), %esp
16384     cmp         $0, %eax               # check if resolved
16385     jne         .LOP_IPUT_BYTE_finish2
16386     jmp         common_exceptionThrown  # not resolved; handle exception
16387
16388 .LOP_IPUT_BYTE_finish2:
16389     movl        rINST, %ecx             # %ecx<- BA+
16390     shr         $4, %ecx               # %ecx<- B
16391     and         $15, rINST             # rINST<- A
16392     GET_VREG    %ecx                    # %ecx<- vB
16393     cmp         $0, %ecx               # check for null object
16394     je          common_errNullObject    # handle null object
16395     movl        offInstField_byteOffset(%eax), %edx # %edx<- field offset
16396     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16397     GET_VREG    rINST                   # rINST<- vA
16398     movl     rINST, (%edx, %ecx)     # object field<- vA
16399     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16400
16401 /* continuation for OP_IPUT_CHAR */
16402
16403 .LOP_IPUT_CHAR_finish:
16404     movl        offGlue_method(%edx), %edx # %edx<- glue->method
16405     EXPORT_PC                           # in case an exception is thrown
16406     movl        %ecx, -4(%esp)          # push parameter CCCC; field ref
16407     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16408     lea         -8(%esp), %esp
16409     movl        %edx, (%esp)            # push parameter method->clazz
16410     call        dvmResolveInstField     # call: (const ClassObject* referrer, u4 ifieldIdx)
16411                                         # return: InstField*
16412     lea         8(%esp), %esp
16413     cmp         $0, %eax               # check if resolved
16414     jne         .LOP_IPUT_CHAR_finish2
16415     jmp         common_exceptionThrown  # not resolved; handle exception
16416
16417 .LOP_IPUT_CHAR_finish2:
16418     movl        rINST, %ecx             # %ecx<- BA+
16419     shr         $4, %ecx               # %ecx<- B
16420     and         $15, rINST             # rINST<- A
16421     GET_VREG    %ecx                    # %ecx<- vB
16422     cmp         $0, %ecx               # check for null object
16423     je          common_errNullObject    # handle null object
16424     movl        offInstField_byteOffset(%eax), %edx # %edx<- field offset
16425     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16426     GET_VREG    rINST                   # rINST<- vA
16427     movl     rINST, (%edx, %ecx)     # object field<- vA
16428     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16429
16430 /* continuation for OP_IPUT_SHORT */
16431
16432 .LOP_IPUT_SHORT_finish:
16433     movl        offGlue_method(%edx), %edx # %edx<- glue->method
16434     EXPORT_PC                           # in case an exception is thrown
16435     movl        %ecx, -4(%esp)          # push parameter CCCC; field ref
16436     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16437     lea         -8(%esp), %esp
16438     movl        %edx, (%esp)            # push parameter method->clazz
16439     call        dvmResolveInstField     # call: (const ClassObject* referrer, u4 ifieldIdx)
16440                                         # return: InstField*
16441     lea         8(%esp), %esp
16442     cmp         $0, %eax               # check if resolved
16443     jne         .LOP_IPUT_SHORT_finish2
16444     jmp         common_exceptionThrown  # not resolved; handle exception
16445
16446 .LOP_IPUT_SHORT_finish2:
16447     movl        rINST, %ecx             # %ecx<- BA+
16448     shr         $4, %ecx               # %ecx<- B
16449     and         $15, rINST             # rINST<- A
16450     GET_VREG    %ecx                    # %ecx<- vB
16451     cmp         $0, %ecx               # check for null object
16452     je          common_errNullObject    # handle null object
16453     movl        offInstField_byteOffset(%eax), %edx # %edx<- field offset
16454     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16455     GET_VREG    rINST                   # rINST<- vA
16456     movl     rINST, (%edx, %ecx)     # object field<- vA
16457     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16458
16459 /* continuation for OP_SGET */
16460
16461 .LOP_SGET_resolve:
16462     movl        offGlue_method(%edx), %edx # %edx <- glue->method
16463     EXPORT_PC                           # in case an exception is thrown
16464     movl        %eax, -4(%esp)          # push parameter CCCC; field ref
16465     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16466     movl        %edx, -8(%esp)          # push parameter method->clazz
16467     lea         -8(%esp), %esp
16468     call        dvmResolveStaticField   # call: (const ClassObject* referrer, u4 ifieldIdx)
16469                                         # return: StaticField*
16470     cmp         $0, %eax               # check if initalization failed
16471     lea         8(%esp), %esp
16472     je          common_exceptionThrown  # failed; handle exception
16473     mov         %eax, %ecx              # %ecx<- result
16474
16475 .LOP_SGET_finish:
16476     FFETCH_ADV  2, %edx                 # %edx<- next instruction hi; fetch, advance
16477     movl offStaticField_value(%ecx), %eax # %eax<- field value
16478     SET_VREG    %eax, rINST             # vAA<- field value
16479     FGETOP_JMP  2, %edx                 # jump to next instruction; getop, jmp
16480
16481 /* continuation for OP_SGET_WIDE */
16482
16483    /*
16484     * Continuation if the field has not yet been resolved.
16485     *  %edx: BBBB field ref
16486     */
16487
16488 .LOP_SGET_WIDE_resolve:
16489     movl        offGlue_method(%eax), %eax # %eax <- glue->method
16490     EXPORT_PC                           # in case an exception is thrown
16491     movl        %edx, -4(%esp)          # push parameter CCCC; field ref
16492     movl        offMethod_clazz(%eax), %eax # %eax<- method->clazz
16493     movl        %eax, -8(%esp)          # push parameter method->clazz
16494     lea         -8(%esp), %esp
16495     call        dvmResolveStaticField   # call: (const ClassObject* referrer, u4 ifieldIdx)
16496                                         # return: StaticField*
16497     lea         8(%esp), %esp
16498     cmp         $0, %eax               # check if initalization failed
16499     movl        %eax, %ecx              # %ecx<- result
16500     jne         .LOP_SGET_WIDE_finish      # success, continue
16501     jmp         common_exceptionThrown  # failed; handle exception
16502
16503 /* continuation for OP_SGET_OBJECT */
16504
16505 .LOP_SGET_OBJECT_resolve:
16506     movl        offGlue_method(%edx), %edx # %edx <- glue->method
16507     EXPORT_PC                           # in case an exception is thrown
16508     movl        %eax, -4(%esp)          # push parameter CCCC; field ref
16509     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16510     movl        %edx, -8(%esp)          # push parameter method->clazz
16511     lea         -8(%esp), %esp
16512     call        dvmResolveStaticField   # call: (const ClassObject* referrer, u4 ifieldIdx)
16513                                         # return: StaticField*
16514     cmp         $0, %eax               # check if initalization failed
16515     lea         8(%esp), %esp
16516     je          common_exceptionThrown  # failed; handle exception
16517     mov         %eax, %ecx              # %ecx<- result
16518
16519 .LOP_SGET_OBJECT_finish:
16520     FFETCH_ADV  2, %edx                 # %edx<- next instruction hi; fetch, advance
16521     movl offStaticField_value(%ecx), %eax # %eax<- field value
16522     SET_VREG    %eax, rINST             # vAA<- field value
16523     FGETOP_JMP  2, %edx                 # jump to next instruction; getop, jmp
16524
16525 /* continuation for OP_SGET_BOOLEAN */
16526
16527 .LOP_SGET_BOOLEAN_resolve:
16528     movl        offGlue_method(%edx), %edx # %edx <- glue->method
16529     EXPORT_PC                           # in case an exception is thrown
16530     movl        %eax, -4(%esp)          # push parameter CCCC; field ref
16531     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16532     movl        %edx, -8(%esp)          # push parameter method->clazz
16533     lea         -8(%esp), %esp
16534     call        dvmResolveStaticField   # call: (const ClassObject* referrer, u4 ifieldIdx)
16535                                         # return: StaticField*
16536     cmp         $0, %eax               # check if initalization failed
16537     lea         8(%esp), %esp
16538     je          common_exceptionThrown  # failed; handle exception
16539     mov         %eax, %ecx              # %ecx<- result
16540
16541 .LOP_SGET_BOOLEAN_finish:
16542     FFETCH_ADV  2, %edx                 # %edx<- next instruction hi; fetch, advance
16543     movl offStaticField_value(%ecx), %eax # %eax<- field value
16544     SET_VREG    %eax, rINST             # vAA<- field value
16545     FGETOP_JMP  2, %edx                 # jump to next instruction; getop, jmp
16546
16547 /* continuation for OP_SGET_BYTE */
16548
16549 .LOP_SGET_BYTE_resolve:
16550     movl        offGlue_method(%edx), %edx # %edx <- glue->method
16551     EXPORT_PC                           # in case an exception is thrown
16552     movl        %eax, -4(%esp)          # push parameter CCCC; field ref
16553     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16554     movl        %edx, -8(%esp)          # push parameter method->clazz
16555     lea         -8(%esp), %esp
16556     call        dvmResolveStaticField   # call: (const ClassObject* referrer, u4 ifieldIdx)
16557                                         # return: StaticField*
16558     cmp         $0, %eax               # check if initalization failed
16559     lea         8(%esp), %esp
16560     je          common_exceptionThrown  # failed; handle exception
16561     mov         %eax, %ecx              # %ecx<- result
16562
16563 .LOP_SGET_BYTE_finish:
16564     FFETCH_ADV  2, %edx                 # %edx<- next instruction hi; fetch, advance
16565     movl offStaticField_value(%ecx), %eax # %eax<- field value
16566     SET_VREG    %eax, rINST             # vAA<- field value
16567     FGETOP_JMP  2, %edx                 # jump to next instruction; getop, jmp
16568
16569 /* continuation for OP_SGET_CHAR */
16570
16571 .LOP_SGET_CHAR_resolve:
16572     movl        offGlue_method(%edx), %edx # %edx <- glue->method
16573     EXPORT_PC                           # in case an exception is thrown
16574     movl        %eax, -4(%esp)          # push parameter CCCC; field ref
16575     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16576     movl        %edx, -8(%esp)          # push parameter method->clazz
16577     lea         -8(%esp), %esp
16578     call        dvmResolveStaticField   # call: (const ClassObject* referrer, u4 ifieldIdx)
16579                                         # return: StaticField*
16580     cmp         $0, %eax               # check if initalization failed
16581     lea         8(%esp), %esp
16582     je          common_exceptionThrown  # failed; handle exception
16583     mov         %eax, %ecx              # %ecx<- result
16584
16585 .LOP_SGET_CHAR_finish:
16586     FFETCH_ADV  2, %edx                 # %edx<- next instruction hi; fetch, advance
16587     movl offStaticField_value(%ecx), %eax # %eax<- field value
16588     SET_VREG    %eax, rINST             # vAA<- field value
16589     FGETOP_JMP  2, %edx                 # jump to next instruction; getop, jmp
16590
16591 /* continuation for OP_SGET_SHORT */
16592
16593 .LOP_SGET_SHORT_resolve:
16594     movl        offGlue_method(%edx), %edx # %edx <- glue->method
16595     EXPORT_PC                           # in case an exception is thrown
16596     movl        %eax, -4(%esp)          # push parameter CCCC; field ref
16597     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16598     movl        %edx, -8(%esp)          # push parameter method->clazz
16599     lea         -8(%esp), %esp
16600     call        dvmResolveStaticField   # call: (const ClassObject* referrer, u4 ifieldIdx)
16601                                         # return: StaticField*
16602     cmp         $0, %eax               # check if initalization failed
16603     lea         8(%esp), %esp
16604     je          common_exceptionThrown  # failed; handle exception
16605     mov         %eax, %ecx              # %ecx<- result
16606
16607 .LOP_SGET_SHORT_finish:
16608     FFETCH_ADV  2, %edx                 # %edx<- next instruction hi; fetch, advance
16609     movl offStaticField_value(%ecx), %eax # %eax<- field value
16610     SET_VREG    %eax, rINST             # vAA<- field value
16611     FGETOP_JMP  2, %edx                 # jump to next instruction; getop, jmp
16612
16613 /* continuation for OP_SPUT */
16614
16615 .LOP_SPUT_resolve:
16616     movl        offGlue_method(%edx), %edx # %edx <- glue->method
16617     EXPORT_PC                           # in case an exception is thrown
16618     movl        %eax, -4(%esp)          # push parameter CCCC; field ref
16619     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16620     movl        %edx, -8(%esp)          # push parameter method->clazz
16621     lea         -8(%esp), %esp
16622     call        dvmResolveStaticField   # call: (const ClassObject* referrer, u4 ifieldIdx)
16623                                         # return: StaticField*
16624     cmp         $0, %eax               # check if initalization failed
16625     lea         8(%esp), %esp
16626     je          common_exceptionThrown  # failed; handle exception
16627     movl        %eax, %ecx              # %ecx<- result
16628
16629 .LOP_SPUT_finish:
16630     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16631     GET_VREG    rINST                   # rINST<- vAA
16632     movl        rINST, offStaticField_value(%ecx) # field value<- vAA
16633     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16634
16635 /* continuation for OP_SPUT_WIDE */
16636
16637    /*
16638     * Continuation if the field has not yet been resolved.
16639     *  %edx: BBBB field ref
16640     */
16641
16642 .LOP_SPUT_WIDE_resolve:
16643     movl        offGlue_method(%eax), %eax # %eax <- glue->method
16644     EXPORT_PC                           # in case an exception is thrown
16645     movl        %edx, -4(%esp)          # push parameter CCCC; field ref
16646     movl        offMethod_clazz(%eax), %eax # %eax<- method->clazz
16647     movl        %eax, -8(%esp)
16648     lea         -8(%esp), %esp
16649     call        dvmResolveStaticField   # call: (const ClassObject* referrer, u4 ifieldIdx)
16650                                         # return: StaticField*
16651     lea         8(%esp), %esp
16652     cmp         $0, %eax               # check if initalization failed
16653     movl        %eax, %ecx              # %ecx<- result
16654     jne         .LOP_SPUT_WIDE_finish      # success, continue
16655     jmp         common_exceptionThrown  # failed; handle exception
16656
16657 /* continuation for OP_SPUT_OBJECT */
16658
16659 .LOP_SPUT_OBJECT_resolve:
16660     movl        offGlue_method(%edx), %edx # %edx <- glue->method
16661     EXPORT_PC                           # in case an exception is thrown
16662     movl        %eax, -4(%esp)          # push parameter CCCC; field ref
16663     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16664     movl        %edx, -8(%esp)          # push parameter method->clazz
16665     lea         -8(%esp), %esp
16666     call        dvmResolveStaticField   # call: (const ClassObject* referrer, u4 ifieldIdx)
16667                                         # return: StaticField*
16668     cmp         $0, %eax               # check if initalization failed
16669     lea         8(%esp), %esp
16670     je          common_exceptionThrown  # failed; handle exception
16671     movl        %eax, %ecx              # %ecx<- result
16672
16673 .LOP_SPUT_OBJECT_finish:
16674     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16675     GET_VREG    rINST                   # rINST<- vAA
16676     movl        rINST, offStaticField_value(%ecx) # field value<- vAA
16677     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16678
16679 /* continuation for OP_SPUT_BOOLEAN */
16680
16681 .LOP_SPUT_BOOLEAN_resolve:
16682     movl        offGlue_method(%edx), %edx # %edx <- glue->method
16683     EXPORT_PC                           # in case an exception is thrown
16684     movl        %eax, -4(%esp)          # push parameter CCCC; field ref
16685     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16686     movl        %edx, -8(%esp)          # push parameter method->clazz
16687     lea         -8(%esp), %esp
16688     call        dvmResolveStaticField   # call: (const ClassObject* referrer, u4 ifieldIdx)
16689                                         # return: StaticField*
16690     cmp         $0, %eax               # check if initalization failed
16691     lea         8(%esp), %esp
16692     je          common_exceptionThrown  # failed; handle exception
16693     movl        %eax, %ecx              # %ecx<- result
16694
16695 .LOP_SPUT_BOOLEAN_finish:
16696     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16697     GET_VREG    rINST                   # rINST<- vAA
16698     movl        rINST, offStaticField_value(%ecx) # field value<- vAA
16699     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16700
16701 /* continuation for OP_SPUT_BYTE */
16702
16703 .LOP_SPUT_BYTE_resolve:
16704     movl        offGlue_method(%edx), %edx # %edx <- glue->method
16705     EXPORT_PC                           # in case an exception is thrown
16706     movl        %eax, -4(%esp)          # push parameter CCCC; field ref
16707     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16708     movl        %edx, -8(%esp)          # push parameter method->clazz
16709     lea         -8(%esp), %esp
16710     call        dvmResolveStaticField   # call: (const ClassObject* referrer, u4 ifieldIdx)
16711                                         # return: StaticField*
16712     cmp         $0, %eax               # check if initalization failed
16713     lea         8(%esp), %esp
16714     je          common_exceptionThrown  # failed; handle exception
16715     movl        %eax, %ecx              # %ecx<- result
16716
16717 .LOP_SPUT_BYTE_finish:
16718     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16719     GET_VREG    rINST                   # rINST<- vAA
16720     movl        rINST, offStaticField_value(%ecx) # field value<- vAA
16721     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16722
16723 /* continuation for OP_SPUT_CHAR */
16724
16725 .LOP_SPUT_CHAR_resolve:
16726     movl        offGlue_method(%edx), %edx # %edx <- glue->method
16727     EXPORT_PC                           # in case an exception is thrown
16728     movl        %eax, -4(%esp)          # push parameter CCCC; field ref
16729     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16730     movl        %edx, -8(%esp)          # push parameter method->clazz
16731     lea         -8(%esp), %esp
16732     call        dvmResolveStaticField   # call: (const ClassObject* referrer, u4 ifieldIdx)
16733                                         # return: StaticField*
16734     cmp         $0, %eax               # check if initalization failed
16735     lea         8(%esp), %esp
16736     je          common_exceptionThrown  # failed; handle exception
16737     movl        %eax, %ecx              # %ecx<- result
16738
16739 .LOP_SPUT_CHAR_finish:
16740     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16741     GET_VREG    rINST                   # rINST<- vAA
16742     movl        rINST, offStaticField_value(%ecx) # field value<- vAA
16743     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16744
16745 /* continuation for OP_SPUT_SHORT */
16746
16747 .LOP_SPUT_SHORT_resolve:
16748     movl        offGlue_method(%edx), %edx # %edx <- glue->method
16749     EXPORT_PC                           # in case an exception is thrown
16750     movl        %eax, -4(%esp)          # push parameter CCCC; field ref
16751     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
16752     movl        %edx, -8(%esp)          # push parameter method->clazz
16753     lea         -8(%esp), %esp
16754     call        dvmResolveStaticField   # call: (const ClassObject* referrer, u4 ifieldIdx)
16755                                         # return: StaticField*
16756     cmp         $0, %eax               # check if initalization failed
16757     lea         8(%esp), %esp
16758     je          common_exceptionThrown  # failed; handle exception
16759     movl        %eax, %ecx              # %ecx<- result
16760
16761 .LOP_SPUT_SHORT_finish:
16762     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
16763     GET_VREG    rINST                   # rINST<- vAA
16764     movl        rINST, offStaticField_value(%ecx) # field value<- vAA
16765     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
16766
16767 /* continuation for OP_INVOKE_VIRTUAL */
16768
16769 .LOP_INVOKE_VIRTUAL_break:
16770     movl        rGLUE, %eax             # %eax<- pMterpGlue
16771     movl        %edx, -4(%esp)          # save "this" pointer register
16772     movl        offGlue_method(%eax), %eax # %eax<- glue->method
16773     movl        $METHOD_VIRTUAL, -8(%esp) # push parameter method type
16774     movl        %ecx, -12(%esp)         # push paramter method index
16775     movl        offMethod_clazz(%eax), %eax # %eax<- glue->method->clazz
16776     lea         -16(%esp), %esp
16777     movl        %eax, (%esp)            # push parameter clazz
16778     call        dvmResolveMethod        # call: (const ClassObject* referrer,
16779                                         #       u4 methodIdx, MethodType methodType)
16780                                         # return: Method*
16781     lea         16(%esp), %esp
16782     cmp         $0, %eax               # check for null method return
16783     movl        -4(%esp), %edx          # get "this" pointer register
16784     jne         .LOP_INVOKE_VIRTUAL_continue
16785     jmp         common_exceptionThrown  # null pointer; handle exception
16786
16787    /*
16788     * At this point:
16789     *  %eax = resolved base method
16790     *  %edx = D or CCCC (index of first arg, which is the "this" ptr)
16791     */
16792
16793 .LOP_INVOKE_VIRTUAL_continue:
16794     GET_VREG    %edx                    # %edx<- "this" ptr
16795     movzwl      offMethod_methodIndex(%eax), %eax # %eax<- baseMethod->methodIndex
16796     cmp         $0, %edx               # %edx<- check for null "this"
16797     je          common_errNullObject    # handle null object
16798     movl        offObject_clazz(%edx), %edx # %edx<- thisPtr->clazz
16799     movl        offClassObject_vtable(%edx), %edx # %edx<- thisPtr->clazz->vtable
16800     movl        (%edx, %eax, 4), %ecx   # %ecx<- vtable[methodIndex]
16801     jmp         common_invokeMethodNoRange # invoke method common code
16802
16803 /* continuation for OP_INVOKE_SUPER */
16804
16805 .LOP_INVOKE_SUPER_continue2:
16806     movl        rGLUE, %eax             # %eax<- pMterpGlue
16807     movl        offGlue_method(%eax), %eax # %eax<- glue->method
16808     movl        offMethod_clazz(%eax), %eax # %eax<- glue->method->clazz
16809     EXPORT_PC                           # must export for invoke
16810     cmp         $0, %ecx               # check if already resolved
16811     jne         .LOP_INVOKE_SUPER_continue
16812     jmp         .LOP_INVOKE_SUPER_resolve     # handle resolve
16813
16814    /*
16815     *  %ecx = resolved base method
16816     *  %eax = method->clazz
16817     */
16818
16819 .LOP_INVOKE_SUPER_continue:
16820     movl        offClassObject_super(%eax), %edx # %edx<- glue->method->clazz->super
16821     movzwl      offMethod_methodIndex(%ecx), %ecx # %ecx<-  baseMethod->methodIndex
16822     cmp          offClassObject_vtableCount(%edx), %ecx # compare vtableCount with methodIndex
16823     EXPORT_PC                           # must export for invoke
16824     jnc         .LOP_INVOKE_SUPER_nsm         # handle method not present
16825     movl        offClassObject_vtable(%edx), %edx # %edx<- glue->method->clazz->super->vtable
16826     movl        (%edx, %ecx, 4), %ecx   # %ecx<- vtable[methodIndex]
16827     jmp         common_invokeMethodNoRange # invoke method common code
16828
16829 .LOP_INVOKE_SUPER_resolve:
16830     movl        %eax, -12(%esp)         # push parameter clazz
16831     movl        %edx, -8(%esp)          # push parameter method index
16832     movl        $METHOD_VIRTUAL, -4(%esp) # push parameter method type
16833     lea         -12(%esp), %esp
16834     call        dvmResolveMethod        # call: (const ClassObject* referrer,
16835                                         #       u4 methodIdx, MethodType methodType)
16836                                         # return: Method*
16837     lea         12(%esp), %esp
16838     movl        %eax, %ecx              # %ecx<- method
16839     cmp         $0, %ecx               # check for null method return
16840     movl        -12(%esp), %eax         # %eax<- glue->method->clazz
16841     jne         .LOP_INVOKE_SUPER_continue
16842     jmp         common_exceptionThrown  # null pointer; handle exception
16843
16844    /*
16845     * Throw a NoSuchMethodError with the method name as the message.
16846     * %ecx = resolved base method
16847     */
16848
16849 .LOP_INVOKE_SUPER_nsm:
16850     movl        offMethod_name(%ecx), %edx # %edx<- method name
16851     jmp         common_errNoSuchMethod
16852
16853 /* continuation for OP_INVOKE_DIRECT */
16854
16855    /*
16856     * %eax = reference (BBBB or CCCC)
16857     * -4(%esp) = "this" register
16858     */
16859
16860 .LOP_INVOKE_DIRECT_resolve:
16861     movl        rGLUE, %edx             # %edx<- pMterpGlue
16862     movl        $METHOD_DIRECT, -8(%esp) # push parameter method type
16863     movl        offGlue_method(%edx), %edx # %edx<- glue->method
16864     movl        %eax, -12(%esp)         # push parameter reference
16865     lea         -16(%esp), %esp
16866     movl        offMethod_clazz(%edx), %edx # %edx<- glue->method->clazz
16867     movl        %edx, (%esp)            # push parameter clazz
16868     call        dvmResolveMethod        # call: (const ClassObject* referrer,
16869                                         #       u4 methodIdx, MethodType methodType)
16870                                         # return: Method*
16871     lea         16(%esp), %esp
16872     cmp         $0, %eax               # check for null method return
16873     movl        -4(%esp), %edx          # get "this" pointer register
16874     GET_VREG    %edx                    # get "this" pointer
16875     je          common_exceptionThrown  # null pointer; handle exception
16876     cmp         $0, %edx               # check for null "this"
16877     movl        %eax, %ecx              # %ecx<- method
16878     jne         common_invokeMethodNoRange # invoke method common code
16879     jmp         common_errNullObject    # handle null object
16880 /* continuation for OP_INVOKE_STATIC */
16881
16882 .LOP_INVOKE_STATIC_break:
16883     movl        offGlue_method(%edx), %edx # %edx<- glue->method
16884     movl        $METHOD_STATIC, -4(%esp) # resolver method type
16885     movl        %eax, -8(%esp)          # push parameter method index
16886     movl        offMethod_clazz(%edx), %edx # %edx<- glue->method->clazz
16887     movl        %edx, -12(%esp)         # push parameter method
16888     lea         -12(%esp), %esp
16889     call        dvmResolveMethod        # call: (const ClassObject* referrer,
16890                                         #       u4 methodIdx, MethodType methodType)
16891                                         # return: Method*
16892     lea         12(%esp), %esp
16893     cmp         $0, %eax               # check for null method
16894     je          common_exceptionThrown
16895     movl        %eax, %ecx              # %ecx<- method
16896     jmp         common_invokeMethodNoRange # invoke method common code
16897
16898 /* continuation for OP_INVOKE_INTERFACE */
16899 .LOP_INVOKE_INTERFACE_break:
16900     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
16901     movl        offGlue_method(%ecx), %ecx # %ecx<- glue->method
16902     movl        %ecx, -8(%esp)          # push parameter method
16903     movl        offObject_clazz(%edx), %edx # %edx<- glue->method->clazz
16904     movl        %edx, -16(%esp)         # push parameter
16905     lea         -16(%esp), %esp
16906     call        dvmFindInterfaceMethodInCache # call: (ClassObject* thisClass, u4 methodIdx,
16907                                               #       const Method* method, DvmDex* methodClassDex)
16908                                               # return: Method*
16909     lea         16(%esp), %esp
16910     cmp         $0, %eax               # check if find failed
16911     je          common_exceptionThrown  # handle exception
16912     movl        %eax, %ecx              # %ecx<- method
16913     jmp         common_invokeMethodNoRange # invoke method common code
16914
16915 /* continuation for OP_INVOKE_VIRTUAL_RANGE */
16916
16917 .LOP_INVOKE_VIRTUAL_RANGE_break:
16918     movl        rGLUE, %eax             # %eax<- pMterpGlue
16919     movl        %edx, -4(%esp)          # save "this" pointer register
16920     movl        offGlue_method(%eax), %eax # %eax<- glue->method
16921     movl        $METHOD_VIRTUAL, -8(%esp) # push parameter method type
16922     movl        %ecx, -12(%esp)         # push paramter method index
16923     movl        offMethod_clazz(%eax), %eax # %eax<- glue->method->clazz
16924     lea         -16(%esp), %esp
16925     movl        %eax, (%esp)            # push parameter clazz
16926     call        dvmResolveMethod        # call: (const ClassObject* referrer,
16927                                         #       u4 methodIdx, MethodType methodType)
16928                                         # return: Method*
16929     lea         16(%esp), %esp
16930     cmp         $0, %eax               # check for null method return
16931     movl        -4(%esp), %edx          # get "this" pointer register
16932     jne         .LOP_INVOKE_VIRTUAL_RANGE_continue
16933     jmp         common_exceptionThrown  # null pointer; handle exception
16934
16935    /*
16936     * At this point:
16937     *  %eax = resolved base method
16938     *  %edx = D or CCCC (index of first arg, which is the "this" ptr)
16939     */
16940
16941 .LOP_INVOKE_VIRTUAL_RANGE_continue:
16942     GET_VREG    %edx                    # %edx<- "this" ptr
16943     movzwl      offMethod_methodIndex(%eax), %eax # %eax<- baseMethod->methodIndex
16944     cmp         $0, %edx               # %edx<- check for null "this"
16945     je          common_errNullObject    # handle null object
16946     movl        offObject_clazz(%edx), %edx # %edx<- thisPtr->clazz
16947     movl        offClassObject_vtable(%edx), %edx # %edx<- thisPtr->clazz->vtable
16948     movl        (%edx, %eax, 4), %ecx   # %ecx<- vtable[methodIndex]
16949     jmp         common_invokeMethodRange # invoke method common code
16950
16951 /* continuation for OP_INVOKE_SUPER_RANGE */
16952
16953 .LOP_INVOKE_SUPER_RANGE_continue2:
16954     movl        rGLUE, %eax             # %eax<- pMterpGlue
16955     movl        offGlue_method(%eax), %eax # %eax<- glue->method
16956     movl        offMethod_clazz(%eax), %eax # %eax<- glue->method->clazz
16957     EXPORT_PC                           # must export for invoke
16958     cmp         $0, %ecx               # check if already resolved
16959     jne         .LOP_INVOKE_SUPER_RANGE_continue
16960     jmp         .LOP_INVOKE_SUPER_RANGE_resolve     # handle resolve
16961
16962    /*
16963     *  %ecx = resolved base method
16964     *  %eax = method->clazz
16965     */
16966
16967 .LOP_INVOKE_SUPER_RANGE_continue:
16968     movl        offClassObject_super(%eax), %edx # %edx<- glue->method->clazz->super
16969     movzwl      offMethod_methodIndex(%ecx), %ecx # %ecx<-  baseMethod->methodIndex
16970     cmp          offClassObject_vtableCount(%edx), %ecx # compare vtableCount with methodIndex
16971     EXPORT_PC                           # must export for invoke
16972     jnc         .LOP_INVOKE_SUPER_RANGE_nsm         # handle method not present
16973     movl        offClassObject_vtable(%edx), %edx # %edx<- glue->method->clazz->super->vtable
16974     movl        (%edx, %ecx, 4), %ecx   # %ecx<- vtable[methodIndex]
16975     jmp         common_invokeMethodRange # invoke method common code
16976
16977 .LOP_INVOKE_SUPER_RANGE_resolve:
16978     movl        %eax, -12(%esp)         # push parameter clazz
16979     movl        %edx, -8(%esp)          # push parameter method index
16980     movl        $METHOD_VIRTUAL, -4(%esp) # push parameter method type
16981     lea         -12(%esp), %esp
16982     call        dvmResolveMethod        # call: (const ClassObject* referrer,
16983                                         #       u4 methodIdx, MethodType methodType)
16984                                         # return: Method*
16985     lea         12(%esp), %esp
16986     movl        %eax, %ecx              # %ecx<- method
16987     cmp         $0, %ecx               # check for null method return
16988     movl        -12(%esp), %eax         # %eax<- glue->method->clazz
16989     jne         .LOP_INVOKE_SUPER_RANGE_continue
16990     jmp         common_exceptionThrown  # null pointer; handle exception
16991
16992    /*
16993     * Throw a NoSuchMethodError with the method name as the message.
16994     * %ecx = resolved base method
16995     */
16996
16997 .LOP_INVOKE_SUPER_RANGE_nsm:
16998     movl        offMethod_name(%ecx), %edx # %edx<- method name
16999     jmp         common_errNoSuchMethod
17000
17001 /* continuation for OP_INVOKE_DIRECT_RANGE */
17002
17003    /*
17004     * %eax = reference (BBBB or CCCC)
17005     * -4(%esp) = "this" register
17006     */
17007
17008 .LOP_INVOKE_DIRECT_RANGE_resolve:
17009     movl        rGLUE, %edx             # %edx<- pMterpGlue
17010     movl        $METHOD_DIRECT, -8(%esp) # push parameter method type
17011     movl        offGlue_method(%edx), %edx # %edx<- glue->method
17012     movl        %eax, -12(%esp)         # push parameter reference
17013     lea         -16(%esp), %esp
17014     movl        offMethod_clazz(%edx), %edx # %edx<- glue->method->clazz
17015     movl        %edx, (%esp)            # push parameter clazz
17016     call        dvmResolveMethod        # call: (const ClassObject* referrer,
17017                                         #       u4 methodIdx, MethodType methodType)
17018                                         # return: Method*
17019     lea         16(%esp), %esp
17020     cmp         $0, %eax               # check for null method return
17021     movl        -4(%esp), %edx          # get "this" pointer register
17022     GET_VREG    %edx                    # get "this" pointer
17023     je          common_exceptionThrown  # null pointer; handle exception
17024     cmp         $0, %edx               # check for null "this"
17025     movl        %eax, %ecx              # %ecx<- method
17026     jne         common_invokeMethodRange # invoke method common code
17027     jmp         common_errNullObject    # handle null object
17028 /* continuation for OP_INVOKE_STATIC_RANGE */
17029
17030 .LOP_INVOKE_STATIC_RANGE_break:
17031     movl        offGlue_method(%edx), %edx # %edx<- glue->method
17032     movl        $METHOD_STATIC, -4(%esp) # resolver method type
17033     movl        %eax, -8(%esp)          # push parameter method index
17034     movl        offMethod_clazz(%edx), %edx # %edx<- glue->method->clazz
17035     movl        %edx, -12(%esp)         # push parameter method
17036     lea         -12(%esp), %esp
17037     call        dvmResolveMethod        # call: (const ClassObject* referrer,
17038                                         #       u4 methodIdx, MethodType methodType)
17039                                         # return: Method*
17040     lea         12(%esp), %esp
17041     cmp         $0, %eax               # check for null method
17042     je          common_exceptionThrown
17043     movl        %eax, %ecx              # %ecx<- method
17044     jmp         common_invokeMethodRange # invoke method common code
17045
17046 /* continuation for OP_INVOKE_INTERFACE_RANGE */
17047 .LOP_INVOKE_INTERFACE_RANGE_break:
17048     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
17049     movl        offGlue_method(%ecx), %ecx # %ecx<- glue->method
17050     movl        %ecx, -8(%esp)          # push parameter method
17051     movl        offObject_clazz(%edx), %edx # %edx<- glue->method->clazz
17052     movl        %edx, -16(%esp)         # push parameter
17053     lea         -16(%esp), %esp
17054     call        dvmFindInterfaceMethodInCache # call: (ClassObject* thisClass, u4 methodIdx,
17055                                               #       const Method* method, DvmDex* methodClassDex)
17056                                               # return: Method*
17057     lea         16(%esp), %esp
17058     cmp         $0, %eax               # check if find failed
17059     je          common_exceptionThrown  # handle exception
17060     movl        %eax, %ecx              # %ecx<- method
17061     jmp         common_invokeMethodRange # invoke method common code
17062
17063 /* continuation for OP_FLOAT_TO_INT */
17064
17065 .LOP_FLOAT_TO_INT_break:
17066     fnstcw      -2(%esp)                # save control word
17067     orl         $0xc00, -2(%esp)       # reset control
17068     fldcw       -2(%esp)                # load control word
17069     xorl        $0xc00, -2(%esp)       # reset control
17070     fistpl      (rFP, %edx, 4)          # move converted int
17071     fldcw       -2(%esp)                # load saved control word
17072     FINISH      1                       # jump to next instruction
17073
17074 .LOP_FLOAT_TO_INT_nanInf:
17075     jnp         .LOP_FLOAT_TO_INT_posInf      # handle posInf
17076     fstps       (rFP, %edx, 4)          # pop floating point stack
17077     movl        $0x00000000,  (rFP, %edx, 4) # vA<- NaN
17078     FINISH      1                       # jump to next instruction
17079
17080 .LOP_FLOAT_TO_INT_posInf:
17081     fstps       (rFP, %edx, 4)          # pop floating point stack
17082     movl        $0x7FFFFFFF,  (rFP, %edx, 4) # vA<- posInf
17083     FINISH      1                       # jump to next instruction
17084
17085 .LOP_FLOAT_TO_INT_negInf:
17086     fstps       (rFP, %edx, 4)          # pop floating point stack
17087     fstps       (rFP, %edx, 4)          # pop floating point stack
17088     movl        $0x80000000, (rFP, %edx, 4) # vA<- negInf
17089     FINISH      1                       # jump to next instruction
17090
17091 /* continuation for OP_FLOAT_TO_LONG */
17092
17093 .LOP_FLOAT_TO_LONG_break:
17094     fnstcw      -2(%esp)                # save control word
17095     orl         $0xc00, -2(%esp)       # update control
17096     fldcw       -2(%esp)                # load control word
17097     xorl        $0xc00, -2(%esp)       # reset control
17098     fistpll     (rFP, %edx, 4)          # move converted int
17099     fldcw       -2(%esp)                # load saved control word
17100     FINISH      1                       # jump to next instruction
17101
17102 .LOP_FLOAT_TO_LONG_nanInf:
17103     jnp         .LOP_FLOAT_TO_LONG_posInf
17104     fstpl       (rFP, %edx, 4)          # move converted int
17105     movq        .LvalueNanLong, %xmm0   # %xmm0<- NaN
17106     movq        %xmm0,  (rFP, %edx, 4)  # vA<- %xmm0; NaN
17107     FINISH      1                       # jump to next instruction
17108
17109 .LOP_FLOAT_TO_LONG_posInf:
17110     fstpl       (rFP, %edx, 4)          # move converted int
17111     movq        .LvaluePosInfLong, %xmm0 # %xmm0<- posInf
17112     movq        %xmm0, (rFP, %edx, 4)   # vA<- %xmm0; posInf
17113     FINISH      1                       # jump to next instruction
17114
17115 .LOP_FLOAT_TO_LONG_negInf:
17116     fstpl       (rFP, %edx, 4)          # move converted int
17117     movq        .LvalueNegInfLong, %xmm0 # %xmm0<- negInf
17118     fstpl       (rFP, %edx, 4)          # move converted int
17119     movq        %xmm0, (rFP, %edx, 4)   # vA<- %xmm0; negInf
17120     FINISH      1                       # jump to next instruction
17121
17122 /* continuation for OP_DOUBLE_TO_INT */
17123
17124 .LOP_DOUBLE_TO_INT_break:
17125     fnstcw      -2(%esp)                # save control word
17126     orl         $0xc00, -2(%esp)       # reset control
17127     fldcw       -2(%esp)                # load control word
17128     xorl        $0xc00, -2(%esp)       # reset control
17129     fistpl      (rFP, %edx, 4)          # move converted int
17130     fldcw       -2(%esp)                # load saved control word
17131     FINISH      1                       # jump to next instruction
17132
17133 .LOP_DOUBLE_TO_INT_nanInf:
17134     jnp         .LOP_DOUBLE_TO_INT_posInf
17135     fstps       (rFP, %edx, 4)
17136     movl        $0x00000000,  (rFP, %edx, 4) # vA<- NaN
17137     FINISH      1                       # jump to next instruction
17138
17139 .LOP_DOUBLE_TO_INT_posInf:
17140     fstps       (rFP, %edx, 4)
17141     movl        $0x7FFFFFFF,  (rFP, %edx, 4) # vA<- posInf
17142     FINISH      1                       # jump to next instruction
17143
17144 .LOP_DOUBLE_TO_INT_negInf:
17145     fstps       (rFP, %edx, 4)
17146     fstps       (rFP, %edx, 4)
17147     movl        $0x80000000,  (rFP, %edx, 4) # vA<- negInf
17148     FINISH      1                       # jump to next instruction
17149
17150 /* continuation for OP_DOUBLE_TO_LONG */
17151
17152 .LOP_DOUBLE_TO_LONG_break:
17153     fnstcw      -2(%esp)                # save control word
17154     orl         $0xc00, -2(%esp)       # reset control
17155     fldcw       -2(%esp)                # load control word
17156     xorl        $0xc00, -2(%esp)       # reset control
17157     fistpll     (rFP, %edx, 4)          # move converted int
17158     fldcw       -2(%esp)                # load saved control word
17159     FINISH      1                       # jump to next instruction
17160
17161 .LOP_DOUBLE_TO_LONG_nanInf:
17162     jnp         .LOP_DOUBLE_TO_LONG_posInf
17163     fstpl       (rFP, %edx, 4)          # move converted int
17164     movq        .LvalueNanLong, %xmm0   # %xmm0<- NaN
17165     movq        %xmm0,  (rFP, %edx, 4)  # vA<- %xmm0; NaN
17166     FINISH      1                       # jump to next instruction
17167
17168 .LOP_DOUBLE_TO_LONG_posInf:
17169     fstpl       (rFP, %edx, 4)          # move converted int
17170     movq        .LvaluePosInfLong, %xmm0 # %xmm0<- posInf
17171     movq        %xmm0, (rFP, %edx, 4)   # vA<- %xmm0; posInf
17172     FINISH      1                       # jump to next instruction
17173
17174 .LOP_DOUBLE_TO_LONG_negInf:
17175     fstpl       (rFP, %edx, 4)          # move converted int
17176     movq        .LvalueNegInfLong, %xmm0 # %xmm0<- negInf
17177     fstpl       (rFP, %edx, 4)          # move converted int
17178     movq        %xmm0, (rFP, %edx, 4)   # vA<- %xmm0; negInf
17179     FINISH      1                       # jump to next instruction
17180
17181 /* continuation for OP_DIV_INT */
17182 .LOP_DIV_INT_break:
17183     FFETCH_ADV  2 %eax
17184     .if  1
17185     movl        $0x80000000, (rFP, rINST, 4) # vAA<- min int
17186     .else
17187     movl        $0, (rFP, rINST, 4)    # vAA<- 0
17188     .endif
17189     FGETOP_JMP  2 %eax
17190 /* continuation for OP_REM_INT */
17191 .LOP_REM_INT_break:
17192     FFETCH_ADV  2 %eax
17193     .if  0
17194     movl        $0x80000000, (rFP, rINST, 4) # vAA<- min int
17195     .else
17196     movl        $0, (rFP, rINST, 4)    # vAA<- 0
17197     .endif
17198     FGETOP_JMP  2 %eax
17199 /* continuation for OP_MUL_LONG */
17200
17201    /*
17202     * X = (rFP, rINST, 4)
17203     * W = 4(rFP, rINST, 4)
17204     * Z = (rFP, %edx, 4)
17205     * Y = 4(rFP, %edx, 4)
17206     */
17207
17208 .LOP_MUL_LONG_finish:
17209     movl        4(rFP, rINST, 4), %ecx  # %ecx<- W
17210     imull       (rFP, %edx, 4),  %ecx   # %ecx<- WxZ
17211     mov         4(rFP, %edx, 4), %eax   # %ecx<- Y
17212     imull       (rFP, rINST, 4), %eax   # %eax<- XxY
17213     addl        %eax, %ecx              # %ecx<- (WZ + XY)
17214     movl        (rFP, %edx, 4), %eax    # %eax<- Z
17215     mull        (rFP, rINST, 4)         # %edx:eax<- XZ
17216     movzbl      -4(%esp), rINST         # rINST<- AA
17217     addl        %edx, %ecx              # %ecx<- carry + (WZ + XY)
17218     movl        %ecx, 4(rFP, rINST, 4)  # vAA+1<- results hi
17219     movl        %eax, (rFP, rINST, 4)   # vAA<- results lo
17220     FINISH      2                       # jump to next instruction
17221
17222 /* continuation for OP_DIV_LONG */
17223 .LOP_DIV_LONG_finish:
17224     movq        %xmm0, -16(%esp)        # push arg vBB,vBB+1
17225     lea         -16(%esp), %esp
17226     call        __divdi3                   # call func
17227     lea         16(%esp), %esp
17228     movl        %eax, (rFP, rINST, 4)   # vAA<- return low
17229     movl        %edx, 4(rFP, rINST, 4)  # vAA+1<- return high
17230     FINISH      2                       # jump to next instruction
17231
17232 /* continuation for OP_REM_LONG */
17233 .LOP_REM_LONG_finish:
17234     movq        %xmm0, -16(%esp)        # push arg vBB,vBB+1
17235     lea         -16(%esp), %esp
17236     call        __moddi3                   # call func
17237     lea         16(%esp), %esp
17238     movl        %eax, (rFP, rINST, 4)   # vAA<- return low
17239     movl        %edx, 4(rFP, rINST, 4)  # vAA+1<- return high
17240     FINISH      2                       # jump to next instruction
17241
17242 /* continuation for OP_SHR_LONG */
17243
17244 .LOP_SHR_LONG_finish:
17245     movq        .Lvalue64, %xmm3        # %xmm3<- 64
17246     psubq       %xmm0, %xmm3            # %xmm3<- 64 - shift amount
17247     movq        .L64bits, %xmm4         # %xmm4<- lower 64 bits set
17248     psllq       %xmm3, %xmm4            # %xmm4<- correct mask for sign bits
17249     por         %xmm4, %xmm1            # %xmm1<- signed and shifted vBB
17250
17251 .LOP_SHR_LONG_final:
17252     movq        %xmm1, (rFP, rINST, 4)  # vAA<- shifted vBB
17253     FINISH      2                       # jump to next instruction
17254
17255 /* continuation for OP_REM_DOUBLE */
17256
17257 .LOP_REM_DOUBLE_break:
17258     call        fmod                    # call: (long double x, long double y)
17259                                         # return: double
17260     lea         16(%esp), %esp
17261     fstpl       (rFP, rINST, 4)         # vAA<- remainder; return of fmod
17262     FINISH      2                       # jump to next instruction
17263
17264 /* continuation for OP_DIV_INT_2ADDR */
17265 .LOP_DIV_INT_2ADDR_break:
17266     FFETCH_ADV  1, %edx                 # %ecx<- next instruction hi; fetch, advance
17267     .if  1
17268     movl        $0x80000000, (rFP, rINST, 4) # vAA<- min int
17269     .else
17270     movl        $0, (rFP, rINST, 4)    # vAA<- 0
17271     .endif
17272     FGETOP_JMP  1, %edx                 # jump to next instruction; getop, jmp
17273
17274 /* continuation for OP_REM_INT_2ADDR */
17275 .LOP_REM_INT_2ADDR_break:
17276     FFETCH_ADV  1, %edx                 # %ecx<- next instruction hi; fetch, advance
17277     .if  0
17278     movl        $0x80000000, (rFP, rINST, 4) # vAA<- min int
17279     .else
17280     movl        $0, (rFP, rINST, 4)    # vAA<- 0
17281     .endif
17282     FGETOP_JMP  1, %edx                 # jump to next instruction; getop, jmp
17283
17284 /* continuation for OP_MUL_LONG_2ADDR */
17285
17286    /*
17287     * X = (rFP, rINST, 4)
17288     * W = 4(rFP, rINST, 4)
17289     * Z = (rFP, %edx, 4)
17290     * Y = 4(rFP, %edx, 4)
17291     */
17292
17293 .LOP_MUL_LONG_2ADDR_finish:
17294     movl        4(rFP, rINST, 4), %ecx  # %ecx<- W
17295     imull       (rFP, %edx, 4), %ecx    # %ecx<- WxZ
17296     movl                4(rFP, %edx, 4), %eax   # %eax<- Y
17297     imull       (rFP, rINST, 4), %eax   # %eax<- X*Y
17298     addl        %eax, %ecx              # %ecx<- (WZ + XY)
17299     movl        (rFP, %edx, 4), %eax    # %eax<- Z
17300     mull        (rFP, rINST, 4)         # %edx:eax<- XZ
17301     addl        %edx, %ecx              # %ecx<- carry + (WZ + XY)
17302     movl        sReg0, %edx             # %edx<- A
17303     movl        %ecx, 4(rFP, %edx, 4)   # vA+1<- results hi
17304     movl        %eax, (rFP, %edx, 4)    # vA<- results lo
17305     FINISH      1                       # jump to next instruction
17306
17307 /* continuation for OP_DIV_LONG_2ADDR */
17308 .LOP_DIV_LONG_2ADDR_break:
17309     movq        %xmm0, -20(%esp)        # push arg vA, vA+1
17310     lea         -20(%esp), %esp
17311     call        __divdi3                   # call func
17312     lea         20(%esp), %esp
17313     movl        %eax, (rFP, rINST, 4)   # vA<- return low
17314     movl        %edx, 4(rFP, rINST, 4)  # vA<- return high
17315     FFETCH_ADV  1, %ecx                 # %ecx<- next instruction hi; fetch, advance
17316     FGETOP_JMP 1, %ecx                  # jump to next instruction; getop, jmp
17317 /* continuation for OP_REM_LONG_2ADDR */
17318 .LOP_REM_LONG_2ADDR_break:
17319     movq        %xmm0, -20(%esp)        # push arg vA, vA+1
17320     lea         -20(%esp), %esp
17321     call        __moddi3                   # call func
17322     lea         20(%esp), %esp
17323     movl        %eax, (rFP, rINST, 4)   # vA<- return low
17324     movl        %edx, 4(rFP, rINST, 4)  # vA<- return high
17325     FFETCH_ADV  1, %ecx                 # %ecx<- next instruction hi; fetch, advance
17326     FGETOP_JMP 1, %ecx                  # jump to next instruction; getop, jmp
17327 /* continuation for OP_SHR_LONG_2ADDR */
17328
17329 .LOP_SHR_LONG_2ADDR_finish:
17330     movq        .Lvalue64, %xmm3        # %xmm3<- 64
17331     psubq       %xmm0, %xmm3            # %xmm3<- 64 - shift amount
17332     movq        .L64bits, %xmm4         # %xmm4<- lower 64 bits set
17333     psllq       %xmm3, %xmm4            # %xmm4<- correct mask for sign bits
17334     por         %xmm4, %xmm1            # %xmm1<- signed and shifted vBB
17335
17336 .LOP_SHR_LONG_2ADDR_final:
17337     movq        %xmm1, (rFP, rINST, 4)  # vAA<- shifted vBB
17338     FINISH      1                       # jump to next instruction
17339
17340 /* continuation for OP_REM_DOUBLE_2ADDR */
17341
17342 .LOP_REM_DOUBLE_2ADDR_break:
17343     call        fmod                    # call: (long double x, long double y)
17344                                         # return: double
17345     lea         20(%esp), %esp
17346     fstpl       (rFP, rINST, 4)         # vAA<- remainder; return of fmod
17347     FINISH      1                       # jump to next instruction
17348
17349 /* continuation for OP_DIV_INT_LIT16 */
17350 .LOP_DIV_INT_LIT16_break:
17351     movzbl      (rPC), %edx
17352     .if  1
17353     movl        $0x80000000, (rFP, rINST, 4) # vAA<- min int
17354     .else
17355     movl        $0, (rFP, rINST, 4)    # vAA<- 0
17356     .endif
17357     movzbl      1(rPC), rINST
17358     jmp         *dvmAsmInstructionJmpTable(, %edx, 4)
17359
17360 /* continuation for OP_REM_INT_LIT16 */
17361 .LOP_REM_INT_LIT16_break:
17362     movzbl      (rPC), %edx
17363     .if  0
17364     movl        $0x80000000, (rFP, rINST, 4) # vAA<- min int
17365     .else
17366     movl        $0, (rFP, rINST, 4)    # vAA<- 0
17367     .endif
17368     movzbl      1(rPC), rINST
17369     jmp         *dvmAsmInstructionJmpTable(, %edx, 4)
17370
17371 /* continuation for OP_DIV_INT_LIT8 */
17372 .LOP_DIV_INT_LIT8_break:
17373     movzbl      (rPC), %edx
17374     .if  1
17375     movl        $0x80000000, (rFP, rINST, 4) # vAA<- min int
17376     .else
17377     movl        $0, (rFP, rINST, 4)    # vAA<- 0
17378     .endif
17379     movzbl      1(rPC), rINST
17380     jmp         *dvmAsmInstructionJmpTable(, %edx, 4)
17381
17382 /* continuation for OP_REM_INT_LIT8 */
17383 .LOP_REM_INT_LIT8_break:
17384     movzbl      (rPC), %edx
17385     .if  0
17386     movl        $0x80000000, (rFP, rINST, 4) # vAA<- min int
17387     .else
17388     movl        $0, (rFP, rINST, 4)    # vAA<- 0
17389     .endif
17390     movzbl      1(rPC), rINST
17391     jmp         *dvmAsmInstructionJmpTable(, %edx, 4)
17392
17393 /* continuation for OP_EXECUTE_INLINE */
17394
17395    /*
17396     * Extract args, call function.
17397     *  rINST = #of args (0-4)
17398     *  %ecx = call index
17399     */
17400
17401 .LOP_EXECUTE_INLINE_continue:
17402     FETCH       2, %edx                 # %edx<- FEDC
17403     cmp         $1, rINST              # determine number of arguments
17404     jl          0f                      # handle zero args
17405     je          1f                      # handle one arg
17406     cmp         $3, rINST
17407     jl          2f                      # handle two args
17408     je          3f                      # handle three args
17409 4:
17410     movl        %edx, rINST             # rINST<- FEDC
17411     and         $0xf000, rINST         # isolate F
17412     shr         $10, rINST
17413     movl        (rFP, rINST), rINST     # rINST<- vF
17414     movl        rINST, 12(%esp)         # push parameter vF
17415 3:
17416     movl        %edx, rINST             # rINST<- FEDC
17417     and         $0x0f00, rINST         # isolate E
17418     shr         $6, rINST
17419     movl        (rFP, rINST), rINST     # rINST<- vE
17420     movl        rINST, 8(%esp)          # push parameter E
17421 2:
17422     movl        %edx, rINST             # rINST<- FEDC
17423     and         $0x00f0, rINST         # isolate D
17424     shr         $2, rINST
17425     movl        (rFP, rINST), rINST     # rINST<- vD
17426     movl        rINST, 4(%esp)          # push parameter D
17427 1:
17428     and         $0x000f, %edx          # isolate C
17429     movl        (rFP, %edx, 4), %edx    # rINST<- vC
17430     movl        %edx, (%esp)            # push parameter C
17431 0:
17432     shl         $4, %ecx
17433     movl        $gDvmInlineOpsTable, %eax # %eax<- address for table of inline operations
17434     call        *(%eax, %ecx)           # call function
17435
17436     cmp         $0, %eax               # check boolean result of inline
17437     FFETCH_ADV  3, %eax                 # %eax<- next instruction hi; fetch, advance
17438     lea         24(%esp), %esp          # update stack pointer
17439     je          common_exceptionThrown  # handle exception
17440     FGETOP_JMP  3, %eax                 # jump to next instruction; getop, jmp
17441 /* continuation for OP_EXECUTE_INLINE_RANGE */
17442
17443    /*
17444     * Extract args, call function.
17445     *  rINST = #of args (0-4)
17446     *  %ecx = call index
17447     */
17448
17449 .LOP_EXECUTE_INLINE_RANGE_continue:
17450     FETCH       2, %edx                 # %edx<- FEDC
17451     cmp         $1, rINST              # determine number of arguments
17452     jl          0f                      # handle zero args
17453     je          1f                      # handle one arg
17454     cmp         $3, rINST
17455     jl          2f                      # handle two args
17456     je          3f                      # handle three args
17457 4:
17458     movl        12(rFP, %edx, 4), rINST     # rINST<- vF
17459     movl        rINST, 12(%esp)         # push parameter vF
17460 3:
17461     movl        8(rFP, %edx, 4), rINST     # rINST<- vE
17462     movl        rINST, 8(%esp)          # push parameter E
17463 2:
17464     movl        4(rFP, %edx, 4), rINST     # rINST<- vD
17465     movl        rINST, 4(%esp)          # push parameter D
17466 1:
17467     movl        (rFP, %edx, 4), %edx    # rINST<- vC
17468     movl        %edx, (%esp)            # push parameter C
17469 0:
17470     shl         $4, %ecx
17471     movl        $gDvmInlineOpsTable, %eax # %eax<- address for table of inline operations
17472     call        *(%eax, %ecx)           # call function
17473
17474     cmp         $0, %eax               # check boolean result of inline
17475     FFETCH_ADV  3, %eax                 # %eax<- next instruction hi; fetch, advance
17476     lea         24(%esp), %esp          # update stack pointer
17477     je          common_exceptionThrown  # handle exception
17478     FGETOP_JMP  3, %eax                 # jump to next instruction; getop, jmp
17479
17480     .size   dvmAsmSisterStart, .-dvmAsmSisterStart
17481     .global dvmAsmSisterEnd
17482 dvmAsmSisterEnd:
17483
17484 /* File: x86-atom/entry.S */
17485    /* Copyright (C) 2008 The Android Open Source Project
17486     *
17487     * Licensed under the Apache License, Version 2.0 (the "License");
17488     * you may not use this file except in compliance with the License.
17489     * You may obtain a copy of the License at
17490     *
17491     * http://www.apache.org/licenses/LICENSE-2.0
17492     *
17493     * Unless required by applicable law or agreed to in writing, software
17494     * distributed under the License is distributed on an "AS IS" BASIS,
17495     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17496     * See the License for the specific language governing permissions and
17497     * limitations under the License.
17498     */
17499
17500    /*
17501     * File: entry.S
17502     */
17503
17504 #define ASSIST_DEBUGGER 1
17505     .text
17506     .align      2
17507     .global     dvmMterpStdRun
17508     .type       dvmMterpStdRun, %function
17509
17510    /*
17511     * Save registers, initialize sp and fp.
17512     * On entry:
17513     *     bool MterpGlue(glue *)
17514     */
17515
17516     .macro      MTERP_ENTRY
17517     movl        4(%esp), %ecx           # get first argument
17518     movl        %ebp, -4(%esp)          # save caller base pointer
17519     movl        %ebx, -8(%esp)          # save %ebx
17520     movl        %esi, -12(%esp)         # save %esi
17521     movl        %edi, -16(%esp)         # save %edi
17522     lea         -40(%esp), %ebp         # set callee base pointer
17523     lea         -40(%esp), %esp         # set callee stack pointer
17524     .endm
17525
17526    /*
17527     * Restore registers.
17528     * This function returns a boolean "changeInterp" value.
17529     * The return value is from dvmMterpStdBail().
17530     */
17531
17532     .macro      MTERP_EXIT
17533     #lea                40(%ebp), %esp          # correct stack pointer
17534     #movl       24(%ebp), %edi          # restore %edi
17535     #movl       28(%ebp), %esi          # restore %esi
17536     #movl       32(%ebp), %ebx          # restore %ebx
17537     #movl       36(%ebp), %ebp          # restore caller base pointer
17538     #ret                                        # return
17539
17540     lea         40(%esp), %esp          # correct stack pointer
17541     movl        -16(%esp), %edi         # restore %edi
17542     movl        -12(%esp), %esi         # restore %esi
17543     movl        -8(%esp), %ebx          # restore %ebx
17544     movl        -4(%esp), %ebp          # restore caller base pointer
17545     ret                                 # return
17546     .endm
17547
17548    /*
17549     * DvmMterpStdRun entry point: save stack pointer, setup memory locations, get
17550     * entry point, start executing instructions.
17551     */
17552
17553 dvmMterpStdRun:
17554     MTERP_ENTRY
17555     movl        %ecx, rGLUE             # save value for pMterpGlue
17556     movl        offGlue_pc(%ecx), rPC   # get program counter
17557     cmp         $kInterpEntryInstr, offGlue_entryPoint(%ecx) # check instruction
17558     movl        offGlue_fp(%ecx), rFP   # get frame pointer
17559     movl        %esp, offGlue_bailPtr(%ecx) # save SP for eventual return
17560     FFETCH      %edx                    # %edx<- opcode
17561     jne         .Lnot_instr             # no, handle it
17562     FGETOP_JMPa %edx                    # start executing the instruction at rPC
17563
17564    /*
17565     * Not an instruction. Are we returning from a method?
17566     */
17567
17568 .Lnot_instr:
17569     cmpl        $kInterpEntryReturn, offGlue_entryPoint(%ecx)
17570     je          common_returnFromMethod
17571
17572    /*
17573     * No, are we throwing an exception?
17574     */
17575
17576 .Lnot_return:
17577     cmpl        $kInterpEntryThrow, offGlue_entryPoint(%ecx)
17578     je          common_exceptionThrown
17579
17580    /*
17581     * No, then we must abort.
17582     */
17583
17584 .Lbad_arg:
17585     pushl       offGlue_entryPoint(%ecx)
17586     movl        $.LstrBadEntryPoint, -4(%esp)
17587     lea         -4(%esp), %esp
17588     call        printf
17589     lea         8(%esp), %esp
17590     call        dvmAbort                # call (void)
17591
17592    /*
17593     * Restore the stack pointer and PC from the save point established on entry and
17594     * return to whoever called dvmMterpStdRun.
17595     *
17596     * On entry:
17597     *  4(%esp) MterpGlue* glue
17598     *  8(%esp) bool changeInterp
17599     */
17600
17601     .global     dvmMterpStdBail
17602     .type       dvmMterpStdBail, %function
17603
17604 dvmMterpStdBail:
17605     movl        4(%esp), %ecx           # get first argument
17606     movl        8(%esp), %eax           # get second argument
17607     movl        offGlue_bailPtr(%ecx), %esp # sp <- saved SP
17608     MTERP_EXIT
17609
17610    /*
17611     * String references.
17612     */
17613
17614 .LstrBadEntryPoint:
17615     .asciz "Bad entry point %d\n"
17616
17617
17618 dvmAsmInstructionJmpTable = .LdvmAsmInstructionJmpTable
17619 .LdvmAsmInstructionJmpTable:
17620 .long .L_OP_NOP
17621 .long .L_OP_MOVE
17622 .long .L_OP_MOVE_FROM16
17623 .long .L_OP_MOVE_16
17624 .long .L_OP_MOVE_WIDE
17625 .long .L_OP_MOVE_WIDE_FROM16
17626 .long .L_OP_MOVE_WIDE_16
17627 .long .L_OP_MOVE_OBJECT
17628 .long .L_OP_MOVE_OBJECT_FROM16
17629 .long .L_OP_MOVE_OBJECT_16
17630 .long .L_OP_MOVE_RESULT
17631 .long .L_OP_MOVE_RESULT_WIDE
17632 .long .L_OP_MOVE_RESULT_OBJECT
17633 .long .L_OP_MOVE_EXCEPTION
17634 .long .L_OP_RETURN_VOID
17635 .long .L_OP_RETURN
17636 .long .L_OP_RETURN_WIDE
17637 .long .L_OP_RETURN_OBJECT
17638 .long .L_OP_CONST_4
17639 .long .L_OP_CONST_16
17640 .long .L_OP_CONST
17641 .long .L_OP_CONST_HIGH16
17642 .long .L_OP_CONST_WIDE_16
17643 .long .L_OP_CONST_WIDE_32
17644 .long .L_OP_CONST_WIDE
17645 .long .L_OP_CONST_WIDE_HIGH16
17646 .long .L_OP_CONST_STRING
17647 .long .L_OP_CONST_STRING_JUMBO
17648 .long .L_OP_CONST_CLASS
17649 .long .L_OP_MONITOR_ENTER
17650 .long .L_OP_MONITOR_EXIT
17651 .long .L_OP_CHECK_CAST
17652 .long .L_OP_INSTANCE_OF
17653 .long .L_OP_ARRAY_LENGTH
17654 .long .L_OP_NEW_INSTANCE
17655 .long .L_OP_NEW_ARRAY
17656 .long .L_OP_FILLED_NEW_ARRAY
17657 .long .L_OP_FILLED_NEW_ARRAY_RANGE
17658 .long .L_OP_FILL_ARRAY_DATA
17659 .long .L_OP_THROW
17660 .long .L_OP_GOTO
17661 .long .L_OP_GOTO_16
17662 .long .L_OP_GOTO_32
17663 .long .L_OP_PACKED_SWITCH
17664 .long .L_OP_SPARSE_SWITCH
17665 .long .L_OP_CMPL_FLOAT
17666 .long .L_OP_CMPG_FLOAT
17667 .long .L_OP_CMPL_DOUBLE
17668 .long .L_OP_CMPG_DOUBLE
17669 .long .L_OP_CMP_LONG
17670 .long .L_OP_IF_EQ
17671 .long .L_OP_IF_NE
17672 .long .L_OP_IF_LT
17673 .long .L_OP_IF_GE
17674 .long .L_OP_IF_GT
17675 .long .L_OP_IF_LE
17676 .long .L_OP_IF_EQZ
17677 .long .L_OP_IF_NEZ
17678 .long .L_OP_IF_LTZ
17679 .long .L_OP_IF_GEZ
17680 .long .L_OP_IF_GTZ
17681 .long .L_OP_IF_LEZ
17682 .long .L_OP_UNUSED_3E
17683 .long .L_OP_UNUSED_3F
17684 .long .L_OP_UNUSED_40
17685 .long .L_OP_UNUSED_41
17686 .long .L_OP_UNUSED_42
17687 .long .L_OP_UNUSED_43
17688 .long .L_OP_AGET
17689 .long .L_OP_AGET_WIDE
17690 .long .L_OP_AGET_OBJECT
17691 .long .L_OP_AGET_BOOLEAN
17692 .long .L_OP_AGET_BYTE
17693 .long .L_OP_AGET_CHAR
17694 .long .L_OP_AGET_SHORT
17695 .long .L_OP_APUT
17696 .long .L_OP_APUT_WIDE
17697 .long .L_OP_APUT_OBJECT
17698 .long .L_OP_APUT_BOOLEAN
17699 .long .L_OP_APUT_BYTE
17700 .long .L_OP_APUT_CHAR
17701 .long .L_OP_APUT_SHORT
17702 .long .L_OP_IGET
17703 .long .L_OP_IGET_WIDE
17704 .long .L_OP_IGET_OBJECT
17705 .long .L_OP_IGET_BOOLEAN
17706 .long .L_OP_IGET_BYTE
17707 .long .L_OP_IGET_CHAR
17708 .long .L_OP_IGET_SHORT
17709 .long .L_OP_IPUT
17710 .long .L_OP_IPUT_WIDE
17711 .long .L_OP_IPUT_OBJECT
17712 .long .L_OP_IPUT_BOOLEAN
17713 .long .L_OP_IPUT_BYTE
17714 .long .L_OP_IPUT_CHAR
17715 .long .L_OP_IPUT_SHORT
17716 .long .L_OP_SGET
17717 .long .L_OP_SGET_WIDE
17718 .long .L_OP_SGET_OBJECT
17719 .long .L_OP_SGET_BOOLEAN
17720 .long .L_OP_SGET_BYTE
17721 .long .L_OP_SGET_CHAR
17722 .long .L_OP_SGET_SHORT
17723 .long .L_OP_SPUT
17724 .long .L_OP_SPUT_WIDE
17725 .long .L_OP_SPUT_OBJECT
17726 .long .L_OP_SPUT_BOOLEAN
17727 .long .L_OP_SPUT_BYTE
17728 .long .L_OP_SPUT_CHAR
17729 .long .L_OP_SPUT_SHORT
17730 .long .L_OP_INVOKE_VIRTUAL
17731 .long .L_OP_INVOKE_SUPER
17732 .long .L_OP_INVOKE_DIRECT
17733 .long .L_OP_INVOKE_STATIC
17734 .long .L_OP_INVOKE_INTERFACE
17735 .long .L_OP_UNUSED_73
17736 .long .L_OP_INVOKE_VIRTUAL_RANGE
17737 .long .L_OP_INVOKE_SUPER_RANGE
17738 .long .L_OP_INVOKE_DIRECT_RANGE
17739 .long .L_OP_INVOKE_STATIC_RANGE
17740 .long .L_OP_INVOKE_INTERFACE_RANGE
17741 .long .L_OP_UNUSED_79
17742 .long .L_OP_UNUSED_7A
17743 .long .L_OP_NEG_INT
17744 .long .L_OP_NOT_INT
17745 .long .L_OP_NEG_LONG
17746 .long .L_OP_NOT_LONG
17747 .long .L_OP_NEG_FLOAT
17748 .long .L_OP_NEG_DOUBLE
17749 .long .L_OP_INT_TO_LONG
17750 .long .L_OP_INT_TO_FLOAT
17751 .long .L_OP_INT_TO_DOUBLE
17752 .long .L_OP_LONG_TO_INT
17753 .long .L_OP_LONG_TO_FLOAT
17754 .long .L_OP_LONG_TO_DOUBLE
17755 .long .L_OP_FLOAT_TO_INT
17756 .long .L_OP_FLOAT_TO_LONG
17757 .long .L_OP_FLOAT_TO_DOUBLE
17758 .long .L_OP_DOUBLE_TO_INT
17759 .long .L_OP_DOUBLE_TO_LONG
17760 .long .L_OP_DOUBLE_TO_FLOAT
17761 .long .L_OP_INT_TO_BYTE
17762 .long .L_OP_INT_TO_CHAR
17763 .long .L_OP_INT_TO_SHORT
17764 .long .L_OP_ADD_INT
17765 .long .L_OP_SUB_INT
17766 .long .L_OP_MUL_INT
17767 .long .L_OP_DIV_INT
17768 .long .L_OP_REM_INT
17769 .long .L_OP_AND_INT
17770 .long .L_OP_OR_INT
17771 .long .L_OP_XOR_INT
17772 .long .L_OP_SHL_INT
17773 .long .L_OP_SHR_INT
17774 .long .L_OP_USHR_INT
17775 .long .L_OP_ADD_LONG
17776 .long .L_OP_SUB_LONG
17777 .long .L_OP_MUL_LONG
17778 .long .L_OP_DIV_LONG
17779 .long .L_OP_REM_LONG
17780 .long .L_OP_AND_LONG
17781 .long .L_OP_OR_LONG
17782 .long .L_OP_XOR_LONG
17783 .long .L_OP_SHL_LONG
17784 .long .L_OP_SHR_LONG
17785 .long .L_OP_USHR_LONG
17786 .long .L_OP_ADD_FLOAT
17787 .long .L_OP_SUB_FLOAT
17788 .long .L_OP_MUL_FLOAT
17789 .long .L_OP_DIV_FLOAT
17790 .long .L_OP_REM_FLOAT
17791 .long .L_OP_ADD_DOUBLE
17792 .long .L_OP_SUB_DOUBLE
17793 .long .L_OP_MUL_DOUBLE
17794 .long .L_OP_DIV_DOUBLE
17795 .long .L_OP_REM_DOUBLE
17796 .long .L_OP_ADD_INT_2ADDR
17797 .long .L_OP_SUB_INT_2ADDR
17798 .long .L_OP_MUL_INT_2ADDR
17799 .long .L_OP_DIV_INT_2ADDR
17800 .long .L_OP_REM_INT_2ADDR
17801 .long .L_OP_AND_INT_2ADDR
17802 .long .L_OP_OR_INT_2ADDR
17803 .long .L_OP_XOR_INT_2ADDR
17804 .long .L_OP_SHL_INT_2ADDR
17805 .long .L_OP_SHR_INT_2ADDR
17806 .long .L_OP_USHR_INT_2ADDR
17807 .long .L_OP_ADD_LONG_2ADDR
17808 .long .L_OP_SUB_LONG_2ADDR
17809 .long .L_OP_MUL_LONG_2ADDR
17810 .long .L_OP_DIV_LONG_2ADDR
17811 .long .L_OP_REM_LONG_2ADDR
17812 .long .L_OP_AND_LONG_2ADDR
17813 .long .L_OP_OR_LONG_2ADDR
17814 .long .L_OP_XOR_LONG_2ADDR
17815 .long .L_OP_SHL_LONG_2ADDR
17816 .long .L_OP_SHR_LONG_2ADDR
17817 .long .L_OP_USHR_LONG_2ADDR
17818 .long .L_OP_ADD_FLOAT_2ADDR
17819 .long .L_OP_SUB_FLOAT_2ADDR
17820 .long .L_OP_MUL_FLOAT_2ADDR
17821 .long .L_OP_DIV_FLOAT_2ADDR
17822 .long .L_OP_REM_FLOAT_2ADDR
17823 .long .L_OP_ADD_DOUBLE_2ADDR
17824 .long .L_OP_SUB_DOUBLE_2ADDR
17825 .long .L_OP_MUL_DOUBLE_2ADDR
17826 .long .L_OP_DIV_DOUBLE_2ADDR
17827 .long .L_OP_REM_DOUBLE_2ADDR
17828 .long .L_OP_ADD_INT_LIT16
17829 .long .L_OP_RSUB_INT
17830 .long .L_OP_MUL_INT_LIT16
17831 .long .L_OP_DIV_INT_LIT16
17832 .long .L_OP_REM_INT_LIT16
17833 .long .L_OP_AND_INT_LIT16
17834 .long .L_OP_OR_INT_LIT16
17835 .long .L_OP_XOR_INT_LIT16
17836 .long .L_OP_ADD_INT_LIT8
17837 .long .L_OP_RSUB_INT_LIT8
17838 .long .L_OP_MUL_INT_LIT8
17839 .long .L_OP_DIV_INT_LIT8
17840 .long .L_OP_REM_INT_LIT8
17841 .long .L_OP_AND_INT_LIT8
17842 .long .L_OP_OR_INT_LIT8
17843 .long .L_OP_XOR_INT_LIT8
17844 .long .L_OP_SHL_INT_LIT8
17845 .long .L_OP_SHR_INT_LIT8
17846 .long .L_OP_USHR_INT_LIT8
17847 .long .L_OP_UNUSED_E3
17848 .long .L_OP_UNUSED_E4
17849 .long .L_OP_UNUSED_E5
17850 .long .L_OP_UNUSED_E6
17851 .long .L_OP_UNUSED_E7
17852 .long .L_OP_IGET_WIDE_VOLATILE
17853 .long .L_OP_IPUT_WIDE_VOLATILE
17854 .long .L_OP_SGET_WIDE_VOLATILE
17855 .long .L_OP_SPUT_WIDE_VOLATILE
17856 .long .L_OP_BREAKPOINT
17857 .long .L_OP_THROW_VERIFICATION_ERROR
17858 .long .L_OP_EXECUTE_INLINE
17859 .long .L_OP_EXECUTE_INLINE_RANGE
17860 .long .L_OP_INVOKE_DIRECT_EMPTY
17861 .long .L_OP_UNUSED_F1
17862 .long .L_OP_IGET_QUICK
17863 .long .L_OP_IGET_WIDE_QUICK
17864 .long .L_OP_IGET_OBJECT_QUICK
17865 .long .L_OP_IPUT_QUICK
17866 .long .L_OP_IPUT_WIDE_QUICK
17867 .long .L_OP_IPUT_OBJECT_QUICK
17868 .long .L_OP_INVOKE_VIRTUAL_QUICK
17869 .long .L_OP_INVOKE_VIRTUAL_QUICK_RANGE
17870 .long .L_OP_INVOKE_SUPER_QUICK
17871 .long .L_OP_INVOKE_SUPER_QUICK_RANGE
17872 .long .L_OP_UNUSED_FC
17873 .long .L_OP_UNUSED_FD
17874 .long .L_OP_UNUSED_FE
17875 .long .L_OP_DISPATCH_FF
17876
17877 /* File: x86-atom/footer.S */
17878    /* Copyright (C) 2008 The Android Open Source Project
17879     *
17880     * Licensed under the Apache License, Version 2.0 (the "License");
17881     * you may not use this file except in compliance with the License.
17882     * You may obtain a copy of the License at
17883     *
17884     * http://www.apache.org/licenses/LICENSE-2.0
17885     *
17886     * Unless required by applicable law or agreed to in writing, software
17887     * distributed under the License is distributed on an "AS IS" BASIS,
17888     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17889     * See the License for the specific language governing permissions and
17890     * limitations under the License.
17891     */
17892
17893    /*
17894     * File: footer.S
17895     */
17896
17897     .text
17898     .align      2
17899
17900    /*
17901     * Check to see if the thread needs to be suspended or debugger/profiler
17902     * activity has begun.
17903     *
17904     * On entry:
17905     *  %ecx is reentry type, e.g. kInterpEntryInstr
17906     *  %edx is PC adjustment in bytes
17907     */
17908
17909 common_periodicChecks:
17910     movl        %edx, -8(%esp)          # save pc adjustments
17911     movl        rGLUE, %edx             # %edx<- pMterpGlue
17912     movl        %ebx, -4(%esp)          # save %ebx to the stack
17913     movl        offGlue_pSelfSuspendCount(%edx), %ebx # %ebx<- pSuspendCount (int)
17914 #if defined(WITH_DEBUGGER)
17915     movl        offGlue_pDebuggerActive(%edx), %eax # %eax<- pDebuggerActive
17916     movl        (%eax), %eax            # %eax<- get debuggerActive (boolean)
17917     and         $7, %eax               # %eax<- mask for boolean (just how many bits does it take?)
17918 #endif
17919     cmp         $0, (%ebx)             # check if suspend is pending
17920     jne         2f                      # handle suspend
17921 #if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
17922 #if defined(WITH_PROFILER)
17923     movl        offGlue_pActiveProfilers(%edx), %ebx # %ebx<- activeProfilers (int)
17924     or          (%ebx), %eax            # %eax<- merge activeProfilers and debuggerActive
17925 #else
17926     cmp         $0, %eax               # check for debuggerActive
17927 #endif
17928     jne         3f                      # debugger or profiler active; switch interp
17929 #endif
17930     movl        -8(%esp), %edx          # %edx<- restore %edx
17931     movl        -4(%esp), %ebx          # %ebx<- restore %ebx
17932     ret                                 # return
17933 2:                                      # check suspended
17934     movl        offGlue_self(%edx), %eax # %eax<- glue->self
17935     movl        %eax, -12(%esp)         # push parameter boolean
17936     lea         -12(%esp), %esp
17937     call        dvmCheckSuspendPending  # call: (Thread* self)
17938                                         # return: bool
17939     movl        4(%esp), %edx           # %edx<- restore %edx
17940     movl        8(%esp), %ebx           # %ebx<- restore %ebx
17941     lea         12(%esp), %esp
17942     ret                                 # return
17943 3:                                      # debugger/profiler enabled, bail out
17944     add         -8(%esp), rPC           # rPC<- pc adjustments
17945     movl        %ecx, offGlue_entryPoint(%edx) # glue->entryPoint<- reentry type
17946     movl        $1, %edx               # switch to interp == true
17947     jmp         common_gotoBail         # bail
17948
17949    /*
17950     * Check to see if the thread needs to be suspended or debugger/profiler
17951     * activity has begun. With this variant, the reentry type is hard coded
17952     * as kInterpEntryInstr.
17953     *
17954     * On entry:
17955     *  %edx is PC adjustment in bytes
17956     */
17957
17958 common_periodicChecks2:
17959     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
17960     movl        offGlue_pSelfSuspendCount(%ecx), rINST # %ebx<- pSuspendCount (int)
17961 #if defined(WITH_DEBUGGER)
17962     movl offGlue_pDebuggerActive(%ecx), %eax # %eax<- pDebuggerActive
17963     movl        (%eax), %eax            # %eax<- get debuggerActive (boolean)
17964     and         $7, %eax               # %eax<- mask for boolean (just how many bits does it take?)
17965 #endif
17966     cmp         $0, (rINST)            # check if suspend is pending
17967     jne         2f                      # handle suspend
17968 #if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
17969 #if defined(WITH_PROFILER)
17970     movl        offGlue_pActiveProfilers(%ecx), rINST # %edx<- activeProfilers (int)
17971     or          (rINST), %eax           # %eax<- merge activeProfilers and debuggerActive
17972 #else
17973     cmp         $0, %eax               # check for debuggerActive
17974 #endif
17975     jne         3f                      # debugger or profiler active; switch interp
17976 #endif
17977     FINISH_RB   %edx, %ecx              # jump to next instruction
17978 2:                                      # check suspended
17979     movl        offGlue_self(%ecx), %eax# %eax<- glue->self
17980     movl        %edx, rINST
17981     movl        %eax, -12(%esp)         # push parameter boolean
17982     lea         -12(%esp), %esp
17983     call        dvmCheckSuspendPending  # call: (Thread* self)
17984                                         # return: bool
17985     movl        rINST, %edx             # %edx<- restore %edx
17986     lea         12(%esp), %esp
17987     FINISH_RB   %edx, %ecx              # jump to next instruction
17988
17989 3:                                      # debugger/profiler enabled, bail out
17990     add         -8(%esp), rPC           # rPC<- pc adjustments
17991     movl        $kInterpEntryInstr, offGlue_entryPoint(%ecx) # glue->entryPoint<- reentry type
17992     movl        $1, %edx               # switch to interp<- true
17993     jmp         common_gotoBail         # bail
17994
17995
17996    /*
17997     * The equivalent of "goto bail", this calls through the "bail handler".
17998     * State registers will be saved to the "glue" area before bailing.
17999     *
18000     * On entry:
18001     *  %edx is "bool changeInterp", indicating if we want to switch to the
18002     *     other interpreter or just bail all the way out
18003     */
18004
18005 common_gotoBail:
18006     SAVE_PC_FP_TO_GLUE %ecx             # save program counter and frame pointer
18007
18008    /*
18009     * Inlined dvmMterpStdBail
18010     */
18011
18012     lea         40(%ebp), %esp
18013     movl        %edx, %eax
18014     movl        24(%ebp), %edi
18015     movl        28(%ebp), %esi
18016     movl        32(%ebp), %ebx
18017     movl        36(%ebp), %ebp
18018     ret
18019
18020    /*
18021     * Common code for method invocation with range.
18022     *
18023     * On entry:
18024     *  %ecx is "Method* methodToCall", the method we're trying to call
18025     */
18026
18027 common_invokeMethodRange:
18028 .LinvokeNewRange:
18029
18030    /*
18031     * prepare to copy args to "outs" area of current frame
18032     */
18033
18034     SAVEAREA_FROM_FP %eax               # %eax<- &outs; &StackSaveArea
18035     test        rINST, rINST            # test for no args
18036     movl        rINST, sReg0            # sReg0<- AA
18037     jz          .LinvokeArgsDone        # no args; jump to args done
18038     FETCH       2, %edx                 # %edx<- CCCC
18039
18040    /*
18041     * %ecx=methodToCall, %edx=CCCC, sReg0=count, %eax=&outs (&stackSaveArea)
18042     * (very few methods have > 10 args; could unroll for common cases)
18043     */
18044
18045     movl        %ebx, sReg1             # sReg1<- save %ebx
18046     lea         (rFP, %edx, 4), %edx    # %edx<- &vCCCC
18047     shll        $2, sReg0              # sReg0<- offset
18048     subl        sReg0, %eax             # %eax<- update &outs
18049     shrl        $2, sReg0              # sReg0<- offset
18050 1:
18051     movl        (%edx), %ebx            # %ebx<- vCCCC
18052     lea         4(%edx), %edx           # %edx<- &vCCCC++
18053     subl        $1, sReg0              # sReg<- sReg--
18054     movl        %ebx, (%eax)            # *outs<- vCCCC
18055     lea         4(%eax), %eax           # outs++
18056     jne         1b                      # loop if count (sReg0) not zero
18057     movl        sReg1, %ebx             # %ebx<- restore %ebx
18058     jmp         .LinvokeArgsDone        # continue
18059
18060    /*
18061     * %ecx is "Method* methodToCall", the method we're trying to call
18062     * prepare to copy args to "outs" area of current frame
18063     */
18064
18065 common_invokeMethodNoRange:
18066 .LinvokeNewNoRange:
18067     movl        rINST, sReg0            # sReg0<- BA
18068     shrl        $4, sReg0              # sReg0<- B
18069     je          .LinvokeArgsDone        # no args; jump to args done
18070     SAVEAREA_FROM_FP %eax               # %eax<- &outs; &StackSaveArea
18071     FETCH       2, %edx                 # %edx<- GFED
18072
18073    /*
18074     * %ecx=methodToCall, %edx=GFED, sReg0=count, %eax=outs
18075     */
18076
18077 .LinvokeNonRange:
18078     cmp         $2, sReg0              # compare sReg0 to 2
18079     movl        %edx, sReg1             # sReg1<- GFED
18080     jl          1f                      # handle 1 arg
18081     je          2f                      # handle 2 args
18082     cmp         $4, sReg0              # compare sReg0 to 4
18083     jl          3f                      # handle 3 args
18084     je          4f                      # handle 4 args
18085 5:
18086     andl        $15, rINST             # rINST<- A
18087     lea         -4(%eax), %eax          # %eax<- update &outs; &outs--
18088     movl        (rFP, rINST, 4), %edx   # %edx<- vA
18089     movl        %edx, (%eax)            # *outs<- vA
18090     movl        sReg1, %edx             # %edx<- GFED
18091 4:
18092     shr         $12, %edx              # %edx<- G
18093     lea         -4(%eax), %eax          # %eax<- update &outs; &outs--
18094     movl        (rFP, %edx, 4), %edx    # %edx<- vG
18095     movl        %edx, (%eax)            # *outs<- vG
18096     movl        sReg1, %edx             # %edx<- GFED
18097 3:
18098     and         $0x0f00, %edx          # %edx<- 0F00
18099     shr         $6, %edx               # %edx<- F at correct offset
18100     lea         -4(%eax), %eax          # %eax<- update &outs; &outs--
18101     movl        (rFP, %edx), %edx       # %edx<- vF
18102     movl        %edx, (%eax)            # *outs<- vF
18103     movl        sReg1, %edx             # %edx<- GFED
18104 2:
18105     and         $0x00f0, %edx          # %edx<- 00E0
18106     shr         $2, %edx               # %edx<- E at correct offset
18107     lea         -4(%eax), %eax          # %eax<- update &outs; &outs--
18108     movl        (rFP, %edx), %edx       # %edx<- vE
18109     movl        %edx, (%eax)            # *outs<- vE
18110     movl        sReg1, %edx             # %edx<- GFED
18111 1:
18112     and         $0x000f, %edx          # %edx<- 000D
18113     movl        (rFP, %edx, 4), %edx    # %edx<- vD
18114     movl        %edx, -4(%eax)          # *--outs<- vD
18115 0:
18116
18117    /*
18118     * %ecx is "Method* methodToCall", the method we're trying to call
18119     * find space for the new stack frame, check for overflow
18120     */
18121
18122 .LinvokeArgsDone:
18123     movzwl      offMethod_registersSize(%ecx), %eax # %eax<- methodToCall->regsSize
18124     movzwl      offMethod_outsSize(%ecx), %edx # %edx<- methodToCall->outsSize
18125     movl        %ecx, sReg0             # sReg<- methodToCall
18126     shl         $2, %eax               # %eax<- update offset
18127     SAVEAREA_FROM_FP %ecx               # %ecx<- &outs; &StackSaveArea
18128     subl        %eax, %ecx              # %ecx<- newFP; (old savearea - regsSize)
18129     movl        rGLUE, %eax             # %eax<- pMterpGlue
18130     movl        %ecx, sReg1             # sReg1<- &outs
18131     subl        $sizeofStackSaveArea, %ecx # %ecx<- newSaveArea (stack save area using newFP)
18132     movl        offGlue_interpStackEnd(%eax), %eax # %eax<- glue->interpStackEnd
18133     movl        %eax, sReg2             # sReg2<- glue->interpStackEnd
18134     shl         $2, %edx               # %edx<- update offset for outsSize
18135     movl        %ecx, %eax              # %eax<- newSaveArea
18136     sub         %edx, %ecx              # %ecx<- bottom; (newSaveArea - outsSize)
18137     cmp         sReg2, %ecx             # compare interpStackEnd and bottom
18138     movl        sReg0, %ecx             # %ecx<- restore methodToCall
18139     jl          .LstackOverflow         # handle frame overflow
18140
18141    /*
18142     * set up newSaveArea
18143     */
18144
18145 #ifdef EASY_GDB
18146     SAVEAREA_FROM_FP %edx               # %edx<- &outs; &StackSaveArea
18147     movl        %edx, offStackSaveArea_prevSave(%eax) # newSaveArea->prevSave<- &outs
18148 #endif
18149     movl        rFP, offStackSaveArea_prevFrame(%eax) # newSaveArea->prevFrame<- rFP
18150     movl        rPC, offStackSaveArea_savedPc(%eax) # newSaveArea->savedPc<- rPC
18151     testl       $ACC_NATIVE, offMethod_accessFlags(%ecx) # check for native call
18152     movl        %ecx, offStackSaveArea_method(%eax) # newSaveArea->method<- method to call
18153     jne         .LinvokeNative          # handle native call
18154
18155    /*
18156     * Update "glue" values for the new method
18157     * %ecx=methodToCall, sReg1=newFp
18158     */
18159
18160     movl        offMethod_clazz(%ecx), %edx # %edx<- method->clazz
18161     movl        rGLUE, %eax             # %eax<- pMterpGlue
18162     movl        %ecx, offGlue_method(%eax) # glue->method<- methodToCall
18163     movl        offClassObject_pDvmDex(%edx), %edx # %edx<- method->clazz->pDvmDex
18164     movl        offMethod_insns(%ecx), rPC # rPC<- methodToCall->insns
18165     movl        %edx, offGlue_methodClassDex(%eax) # glue->methodClassDex<- method->clazz->pDvmDex
18166     movl        offGlue_self(%eax), %ecx # %ecx<- glue->self
18167     movl        sReg1, rFP              # rFP<- newFP
18168     movl        rFP, offThread_curFrame(%ecx) # glue->self->curFrame<- newFP
18169     FINISH_A                            # jump to methodToCall->insns
18170
18171    /*
18172     * Prep for the native call
18173     * %ecx=methodToCall, sReg1=newFP, %eax=newSaveArea
18174     */
18175
18176 .LinvokeNative:
18177     movl        rGLUE, %edx             # %edx<- pMterpGlue
18178     movl        %ecx, -20(%esp)         # push parameter methodToCall
18179     movl        offGlue_self(%edx), %edx # %edx<- glue->self
18180     movl        offThread_jniLocal_topCookie(%edx), %ecx # %ecx<- glue->self->thread->refNext
18181     movl        %ecx, offStackSaveArea_localRefCookie(%eax) # newSaveArea->localRefCookie<- refNext
18182     movl        %eax, -4(%esp)          # save newSaveArea
18183     movl        sReg1, %eax             # %eax<- newFP
18184     movl        %eax, offThread_curFrame(%edx) # glue->self->curFrame<- newFP
18185     movl        %edx, -8(%esp)          # save glue->self
18186     movl        %edx, -16(%esp)         # push parameter glue->self
18187     movl        rGLUE, %edx             # %edx<- pMterpGlue
18188     movl        -20(%esp), %ecx         # %ecx<- methodToCall
18189     lea         offGlue_retval(%edx), %edx # %edx<- &retval
18190     movl        %edx, -24(%esp)         # push parameter pMterpGlue
18191     movl        %eax, -28(%esp)         # push parameter newFP
18192     lea         -28(%esp), %esp
18193
18194 #ifdef ASSIST_DEBUGGER
18195     jmp         .Lskip
18196     .type       dalvik_mterp, %function
18197 dalvik_mterp:
18198     MTERP_ENTRY
18199 .Lskip:
18200 #endif
18201     call        *offMethod_nativeFunc(%ecx) # call methodToCall->nativeFunc
18202     lea         28(%esp), %esp
18203     movl        -4(%esp), %edx          # %edx<- newSaveArea
18204     movl        -8(%esp), %ecx          # %ecx<- glue->self
18205     movl        offStackSaveArea_localRefCookie(%edx), %eax  # %eax<- newSaveArea->localRefCookie
18206     FFETCH_ADV  3, %edx                 # %edx<- next instruction hi; fetch, advance
18207     cmp         $0, offThread_exception(%ecx) # check for exception
18208     movl        rFP, offThread_curFrame(%ecx) # glue->self->curFrame<- rFP
18209     movl        %eax, offThread_jniLocal_topCookie(%ecx) # glue->self<- newSaveArea->localRefCookie
18210     jne         common_exceptionThrown  # handle exception
18211     FGETOP_JMP  3, %edx                 # jump to next instruction; getop, jmp
18212
18213 .LstackOverflow:  # %ecx=methodToCall
18214     movl        %ecx, -4(%esp)          # push parameter method to call
18215     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
18216     movl        offGlue_self(%ecx), %ecx # %ecx<- glue->self
18217     movl        %ecx, -8(%esp)          # push parameter self
18218     lea         -8(%esp), %esp
18219     call        dvmHandleStackOverflow  # call: (Thread* self, Method* method)
18220                                         # return: void
18221     lea         8(%esp), %esp
18222     jmp         common_exceptionThrown  # handle exception
18223 #ifdef ASSIST_DEBUGGER
18224 #endif
18225
18226    /*
18227     * Common code for handling a return instruction.
18228     *
18229     * This does not return.
18230     */
18231
18232 common_returnFromMethod:
18233 .LreturnNew:
18234
18235    /*
18236     * Inline common periodic checks
18237     */
18238
18239     movl        rGLUE, rINST            # %ecx<- pMterpGlue
18240     movl        offGlue_pSelfSuspendCount(rINST), %edx # %ebx<- pSuspendCount (int)
18241 #if defined(WITH_DEBUGGER)
18242     movl        offGlue_pDebuggerActive(rINST), %eax # %eax<- pDebuggerActive
18243     movl        (%eax), %eax            # %eax<- get debuggerActive (boolean)
18244     and         $7, %eax               # %eax<- mask for boolean (just how many bits does it take?)
18245 #endif
18246     cmp         $0, (%edx)             # check if suspend is pending
18247     jne         2f                      # handle suspend
18248 #if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
18249 #if defined(WITH_PROFILER)
18250     movl        offGlue_pActiveProfilers(rINST), %edx # %edx<- activeProfilers (int)
18251     or          (%edx), %eax            # %eax<- merge activeProfilers and debuggerActive
18252 #else
18253     cmp         $0, %eax               # check for debuggerActive
18254 #endif
18255     jne         3f                      # debugger or profiler active; switch interp
18256 #endif
18257     jmp         4f
18258 2:                                      # check suspended
18259     movl        offGlue_self(rINST), %eax# %eax<- glue->self
18260     movl        %eax, -12(%esp)         # push parameter boolean
18261     lea         -12(%esp), %esp
18262     call        dvmCheckSuspendPending  # call: (Thread* self)
18263                                         # return: bool
18264     lea         12(%esp), %esp
18265     jmp         4f
18266 3:                                      # debugger/profiler enabled, bail out
18267     movl        $kInterpEntryInstr, offGlue_entryPoint(rINST) # glue->entryPoint<- reentry type
18268     movl        $1, %edx               # switch to interp<- true
18269     jmp         common_gotoBail         # bail
18270
18271
18272    /*
18273     * Get save area; rGLUE is %ebx, rFP is %eax
18274     */
18275 4:
18276     SAVEAREA_FROM_FP %ecx               # %ecx<- saveArea(old)
18277     movl        offStackSaveArea_prevFrame(%ecx), rFP # rFP<- saveArea->PrevFrame
18278     movl        (offStackSaveArea_method - sizeofStackSaveArea)(rFP), %edx # %edx<- method we are returning to
18279     cmpl        $0, %edx               # check for break frame
18280     je          common_gotoBail         # bail if break frame
18281     movl        offStackSaveArea_savedPc(%ecx), rPC # rPC<- saveAreaOld->savedPc
18282     movl        offGlue_self(rINST), %ecx # %eax<- glue->self
18283     movl        %edx, offGlue_method(rINST) # glue->method<- newSave->method
18284     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
18285     FFETCH_ADV  3, %eax                 # %ecx<- next instruction hi; fetch, advance
18286     movl        rFP, offThread_curFrame(%ecx) # glue->self->curFrame<- rFP
18287     movl        offClassObject_pDvmDex(%edx), %edx # %edx<- method->clazz->pDvmDex
18288     movl        %edx, offGlue_methodClassDex(rINST) # glue->pDvmDex<- method->clazz->pDvmDex
18289     FGETOP_JMP  3, %eax                 # jump to next instruction; getop, jmp
18290
18291    /*
18292     * Handle thrown an exception. If the exception processing code
18293     * returns to us (instead of falling out of the interpreter),
18294     * continue with whatever the next instruction now happens to be.
18295     * This does not return.
18296     */
18297
18298 common_exceptionThrown:
18299 .LexceptionNew:
18300     movl        $kInterpEntryThrow, %ecx # %ecx<- reentry type
18301     movl        $0, %edx               # %edx<- pc adjustment
18302     call        common_periodicChecks
18303     movl        rGLUE, %eax             # %eax<- pMterpGlue
18304     movl        offGlue_self(%eax), %edx # %edx<- glue->self
18305     movl        offThread_exception(%edx), %ecx # %ecx<- pMterpGlue->self->exception
18306     movl        %edx, -4(%esp)          # push parameter self
18307     movl        %ecx, -8(%esp)          # push parameter obj
18308     lea         -8(%esp), %esp
18309     call        dvmAddTrackedAlloc      # don't allow the exception to be GC'd
18310                                         # call: (Object* obj, Thread* self)
18311                                         # return: void
18312     movl        4(%esp), %edx           # %edx<- glue->self
18313     movl        $0, offThread_exception(%edx) # glue->self->exception<- NULL
18314
18315    /*
18316     * set up args and a local for &fp
18317     */
18318
18319     movl        rFP, -4(%esp)           # move fp to stack
18320     lea         -4(%esp), %esp          # update %esp
18321     movl        %esp, -4(%esp)          # push parameter 4<- &fp
18322     movl        $0, -8(%esp)           # push parameter 3<- false
18323     movl        4(%esp), %edx
18324     movl        %edx, -12(%esp)         # push parameter 2<- glue->self->exception
18325     movl        rGLUE, %eax             # %eax<- pMterpGlue
18326     movl        offGlue_method(%eax), %edx # %edx<- glue->method
18327     movl        offMethod_insns(%edx), %edx # %edx<- glue->method->insns
18328     movl        rPC, %ecx               # %ecx<- rPC
18329     subl        %edx, %ecx              # %ecx<- pc - glue->method->insns
18330     sar         $1, %ecx               # %ecx<- adjust %ecx for offset
18331     movl        %ecx, -16(%esp)         # push parameter 1<- glue->method->insns
18332     movl        8(%esp), %edx
18333     movl        %edx, -20(%esp)         # push parameter 0<- glue->self
18334     lea         -20(%esp), %esp
18335
18336    /*
18337     * call dvmFindCatchBlock, %eax gets catchRelPc (a code-unit offset)
18338     */
18339
18340     call        dvmFindCatchBlock       # call: (Thread* self, int relPc, Object* exception,
18341                                         #      bool doUnroll, void** newFrame)
18342                                         # return: int
18343     lea         32(%esp), %esp
18344     movl        -12(%esp), rFP          # rFP<- updated rFP
18345     cmp         $0, %eax               # check for catchRelPc < 0
18346     jl          .LnotCaughtLocally      # handle not caught locally
18347
18348    /*
18349     * fix stack overflow if necessary
18350     */
18351
18352     movl        -4(%esp), %ecx          # %ecx<- glue->self
18353     cmp         $0, offThread_stackOverflowed(%ecx)
18354     je          1f
18355     movl        %eax, -4(%esp)          # save %eax for later
18356     movl        %ecx, -12(%esp)         # push parameter 2 glue->self
18357     lea         -12(%esp), %esp
18358     call        dvmCleanupStackOverflow # call: (Thread* self, Object* exception)
18359                                         # return: void
18360     lea         12(%esp), %esp
18361     movl        -4(%esp), %eax          # %eax<- restore %eax
18362     jmp         2f
18363 1:
18364     movl        %ecx, -12(%esp)         # push parameter 2 glue->self
18365 2:
18366
18367    /*
18368     * adjust locals to match self->curFrame and updated PC
18369     *
18370     */
18371
18372     SAVEAREA_FROM_FP %edx               # %edx<- get newSaveArea
18373     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
18374     movl        offStackSaveArea_method(%edx), rPC # rPC<- newMethod
18375     movl        rPC, offGlue_method(%ecx) # glue->method<- newMethod
18376     movl        offMethod_clazz(rPC), %edx # %edx<- method->clazz
18377     movl        offMethod_insns(rPC), rPC # rPC<- method->insns
18378     movl        offClassObject_pDvmDex(%edx), %edx # %edx<- method->clazz->pDvmDex
18379     lea         (rPC, %eax, 2), rPC     # rPC<- method->insns + catchRelPc
18380     movl        %edx, offGlue_methodClassDex(%ecx) # glue->pDvmDex<- method->clazz->pDvmDex
18381     movl        -8(%esp), %eax
18382     movl        %eax, -16(%esp)         # push parameter 1 obj
18383     lea         -16(%esp), %esp
18384     call        dvmReleaseTrackedAlloc  # call: (Object* obj, Thread* self)
18385                                         # return: void
18386     lea         16(%esp), %esp
18387     FINISH_FETCH %eax
18388     cmp         $OP_MOVE_EXCEPTION, %eax # is it a move exception
18389     jne         1f
18390     movl        -12(%esp), %edx         # %edx<- glue->self
18391     movl        -8(%esp), %ecx          # %ecx<- exception
18392     movl        %ecx, offThread_exception(%edx) # restore the exception
18393 1:
18394     FINISH_JMP  %eax
18395
18396    /*
18397     * -8(%esp) = exception, -4(%esp) = self
18398     */
18399
18400 .LnotCaughtLocally:
18401     movl        -4(%esp), %edx          # %edx<- glue->self
18402     movzb       offThread_stackOverflowed(%edx), %eax # %eax<- self->stackOverflowed
18403     cmp         $0, %eax               # check for stack overflow;
18404                                         # maybe should use cmpb
18405     je          1f                      #
18406     movl        %edx, -12(%esp)         # push parameter 1 glue->self
18407     lea         -12(%esp), %esp
18408     call        dvmCleanupStackOverflow # call: (Thread* self, Object* exception)
18409                                         # return: void
18410     lea         12(%esp), %esp
18411
18412    /*
18413     * Release the exception
18414     * -8(%esp) = exception, -4(%esp) = self
18415     */
18416 1:
18417     movl        -8(%esp), %ecx          # %ecx<- exception
18418     movl        -4(%esp), %edx          # %edx<- glue->self
18419     movl        %ecx, offThread_exception(%edx) # glue->self<- exception
18420     lea         -8(%esp), %esp
18421     call        dvmReleaseTrackedAlloc  # call: (Object* obj, Thread* self)
18422                                         # return: void
18423     lea         8(%esp), %esp
18424     movl        $0, %edx               # switch to interp<- false
18425     jmp         common_gotoBail         # bail
18426
18427    /*
18428     * After returning from a "glued" function, pull out the updated
18429     * values and start executing at the next instruction.
18430     */
18431
18432 common_resumeAfterGlueCall:
18433     LOAD_PC_FP_FROM_GLUE                # pull rPC and rFP out of glue
18434     FINISH_A                            # jump to next instruction
18435
18436    /*
18437     * For debugging, cause an immediate fault.
18438     */
18439
18440 common_abort:
18441     jmp         .LdeadFood
18442
18443 .LdeadFood:
18444 .word 0xdeadf00d
18445
18446    /*
18447     * Invalid array index.
18448     */
18449
18450 common_errArrayIndex:
18451     EXPORT_PC
18452     movl        $.LstrArrayIndexException, -8(%esp) # push parameter description
18453     movl        $0, -4(%esp)           # push parameter msg paramter
18454     lea         -8(%esp), %esp
18455     call        dvmThrowException       # call: (const char* exceptionDescriptor, const char* msg)
18456                                         # return: void
18457     lea         8(%esp), %esp
18458     jmp         common_exceptionThrown  # handle exception
18459
18460    /*
18461     * Invalid array value.
18462     */
18463
18464 common_errArrayStore:
18465     EXPORT_PC
18466     movl        $.LstrArrayStoreException, -8(%esp) # push parameter description
18467     movl        $0, -4(%esp)           # push parameter msg paramter
18468     lea         -8(%esp), %esp
18469     call        dvmThrowException       # call: (const char* exceptionDescriptor, const char* msg)
18470                                         # return: void
18471     lea         8(%esp), %esp
18472     jmp         common_exceptionThrown  # handle exception
18473
18474    /*
18475     * Integer divide or mod by zero.
18476     */
18477
18478 common_errDivideByZero:
18479     EXPORT_PC
18480     movl        $.LstrArithmeticException, -8(%esp) # push parameter description
18481     movl        $.LstrDivideByZero, -4(%esp) # push parameter msg paramter
18482     lea         -8(%esp), %esp
18483     call        dvmThrowException       # call: (const char* exceptionDescriptor, const char* msg)
18484                                         # return: void
18485     lea         8(%esp), %esp
18486     jmp         common_exceptionThrown  # handle exception
18487
18488    /*
18489     * Attempt to allocate an array with a negative size.
18490     */
18491
18492 common_errNegativeArraySize:
18493     EXPORT_PC
18494     movl        $.LstrNegativeArraySizeException, -8(%esp) # push parameter description
18495     movl        $0, -4(%esp)           # push parameter msg paramter
18496     lea         -8(%esp), %esp
18497     call        dvmThrowException       # call: (const char* exceptionDescriptor, const char* msg)
18498                                         # return: void
18499     lea         8(%esp), %esp
18500     jmp         common_exceptionThrown  # handle exception
18501
18502    /*
18503     * Invocation of a non-existent method.
18504     */
18505
18506 common_errNoSuchMethod:
18507     EXPORT_PC
18508     movl        $.LstrNoSuchMethodError, -8(%esp) # push parameter description
18509     movl        $0, -4(%esp)           # push parameter msg paramter
18510     lea         -8(%esp), %esp
18511     call        dvmThrowException       # call: (const char* exceptionDescriptor, const char* msg)
18512                                         # return: void
18513     lea         8(%esp), %esp
18514     jmp         common_exceptionThrown  # handle exception
18515
18516    /*
18517     * Unexpected null object.
18518     */
18519
18520 common_errNullObject:
18521     EXPORT_PC
18522     movl        $.LstrNullPointerException, -8(%esp) # push parameter description
18523     movl        $0, -4(%esp)           # push parameter msg paramter
18524     lea         -8(%esp), %esp
18525     call        dvmThrowException       # call: (const char* exceptionDescriptor, const char* msg)
18526                                         # return: void
18527     lea         8(%esp), %esp
18528     jmp         common_exceptionThrown  # handle exception
18529
18530    /*
18531     * String references
18532     */
18533
18534     .align 4
18535     .section .rodata
18536 .LstrArithmeticException:
18537     .asciz "Ljava/lang/ArithmeticException;"
18538 .LstrArrayIndexException:
18539     .asciz "Ljava/lang/ArrayIndexOutOfBoundsException;"
18540 .LstrArrayStoreException:
18541     .asciz "Ljava/lang/ArrayStoreException;"
18542 .LstrClassCastException:
18543     .asciz "Ljava/lang/ClassCastException;"
18544 .LstrDivideByZero:
18545     .asciz "divide by zero"
18546 .LstrInstantiationError:
18547     .asciz "Ljava/lang/InstantiationError;"
18548 .LstrNegativeArraySizeException:
18549     .asciz "Ljava/lang/NegativeArraySizeException;"
18550 .LstrNoSuchMethodError:
18551     .asciz "Ljava/lang/NoSuchMethodError;"
18552 .LstrNullPointerException:
18553     .asciz "Ljava/lang/NullPointerException;"
18554 .LstrExceptionNotCaughtLocally:
18555     .asciz "Exception %s from %s:%d not caught locally\n"
18556