xref: /aosp_15_r20/art/runtime/interpreter/mterp/x86ng/object.S (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1%def op_check_cast():
2%  slow_path = add_slow_path(op_check_cast_slow_path)
3   // Fast-path which gets the class from thread-local cache.
4%  fetch_from_thread_cache("%ecx", miss_label="3f")
51:
6   GET_VREG %eax, rINST
7   testl %eax, %eax
8   je .L${opcode}_resume
9   // Fast path without read barriers.
10   POISON_HEAP_REF ecx  // Poison class reference for in-memory comparison.
11   cmpl MIRROR_OBJECT_CLASS_OFFSET(%eax), %ecx
12   jne ${slow_path}
13.L${opcode}_resume:
14   ADVANCE_PC_FETCH_AND_GOTO_NEXT 2
153:
16   EXPORT_PC
17   movl rSELF:THREAD_SELF_OFFSET, ARG0
18   movl 0(%esp), ARG1
19   movl rPC, ARG2
20   call nterp_get_class
21   movl %eax, %ecx
22   jmp 1b
23
24%def op_check_cast_slow_path():
25   UNPOISON_HEAP_REF ecx  // Unpoison class reference poisoned in main path.
26   cmpl $$0, rSELF:THREAD_READ_BARRIER_MARK_REG00_OFFSET
27   jne 2f
281:
29   EXPORT_PC
30   call art_quick_check_instance_of
31   RESTORE_IBASE
32   jmp .L${opcode}_resume
332:
34   // 01 is %ecx
35   call art_quick_read_barrier_mark_reg01
36   jmp 1b
37
38%def op_instance_of():
39%  slow_path = add_slow_path(op_instance_of_slow_path)
40   /* instance-of vA, vB, class@CCCC */
41   // Fast-path which gets the class from thread-local cache.
42%  fetch_from_thread_cache("%ecx", miss_label="2f")
431:
44   movzbl  rINSTbl, %eax
45   sarl    $$4,%eax                          # eax<- B
46   GET_VREG %eax %eax                        # eax<- vB (object)
47   testl %eax, %eax
48   je .L${opcode}_resume
49   // Fast path without read barriers.
50   POISON_HEAP_REF ecx  // Poison class reference for in-memory comparison.
51   cmpl MIRROR_OBJECT_CLASS_OFFSET(%eax), %ecx
52   jne ${slow_path}
53.L${opcode}_set_one:
54   movl $$1, %eax
55.L${opcode}_resume:
56   andb    $$0xf,rINSTbl                     # rINST<- A
57   SET_VREG %eax, rINST                      # fp[A] <- value
58   ADVANCE_PC_FETCH_AND_GOTO_NEXT 2
592:
60   EXPORT_PC
61   movl rSELF:THREAD_SELF_OFFSET, ARG0
62   movl 0(%esp), ARG1
63   movl rPC, ARG2
64   call nterp_get_class
65   movl %eax, %ecx
66   jmp 1b
67
68%def op_instance_of_slow_path():
69   UNPOISON_HEAP_REF ecx  // Unpoison class reference poisoned in main path.
70   cmpl $$0, rSELF:THREAD_READ_BARRIER_MARK_REG00_OFFSET
71   jne 2f
72   testl $$MIRROR_CLASS_IS_INTERFACE_FLAG, MIRROR_CLASS_ACCESS_FLAGS_OFFSET(%ecx)
73   jne 3f
74   cmpl $$0, MIRROR_CLASS_COMPONENT_TYPE_OFFSET(%ecx)
75   jne 3f
76   movl MIRROR_OBJECT_CLASS_OFFSET(%eax), %eax
77   UNPOISON_HEAP_REF eax
781:
79   movl MIRROR_CLASS_SUPER_CLASS_OFFSET(%eax), %eax
80   UNPOISON_HEAP_REF eax
81   cmpl %eax, %ecx
82   je .L${opcode}_set_one
83   testl %eax, %eax
84   jne 1b
85   jmp .L${opcode}_resume
862:
87   // 01 is %ecx
88   call art_quick_read_barrier_mark_reg01
893:
90   EXPORT_PC
91   call art_quick_instance_of
92   RESTORE_IBASE
93   FETCH_INST_CLEAR_OPCODE
94   jmp .L${opcode}_resume
95
96%def op_iget_boolean():
97   jmp NterpGetBooleanInstanceField
98
99%def op_iget_byte():
100   jmp NterpGetByteInstanceField
101
102%def op_iget_char():
103   jmp NterpGetCharInstanceField
104
105%def op_iget_object():
106    jmp NterpGetObjectInstanceField
107
108%def op_iget_short():
109   jmp NterpGetShortInstanceField
110
111%def op_iget_wide():
112   jmp NterpGetWideInstanceField
113
114%def op_iget():
115   jmp NterpGetInstanceField
116
117%def op_iput():
118   jmp NterpPutInstanceField
119
120%def op_iput_boolean():
121   jmp NterpPutBooleanInstanceField
122
123%def op_iput_byte():
124   jmp NterpPutByteInstanceField
125
126%def op_iput_char():
127   jmp NterpPutCharInstanceField
128
129%def op_iput_object():
130    jmp NterpPutObjectInstanceField
131
132%def op_iput_short():
133   jmp NterpPutShortInstanceField
134
135%def op_iput_wide():
136   jmp NterpPutWideInstanceField
137
138%def op_sget(load="movl", wide="0"):
139   jmp NterpGetIntStaticField
140
141%def op_sget_boolean():
142   jmp NterpGetBooleanStaticField
143
144%def op_sget_byte():
145   jmp NterpGetByteStaticField
146
147%def op_sget_char():
148   jmp NterpGetCharStaticField
149
150%def op_sget_object():
151   jmp NterpGetObjectStaticField
152
153%def op_sget_short():
154   jmp NterpGetShortStaticField
155
156%def op_sget_wide():
157   jmp NterpGetWideStaticField
158
159%def op_sput():
160   jmp NterpPutStaticField
161
162%def op_sput_boolean():
163   jmp NterpPutBooleanStaticField
164
165%def op_sput_byte():
166   jmp NterpPutByteStaticField
167
168%def op_sput_char():
169   jmp NterpPutCharStaticField
170
171%def op_sput_object():
172   jmp NterpPutObjectStaticField
173
174%def op_sput_short():
175   jmp NterpPutShortStaticField
176
177%def op_sput_wide():
178   jmp NterpPutWideStaticField
179
180%def op_new_instance():
181   // The routine is too big to fit in a handler, so jump to it.
182   jmp NterpNewInstance
183