blob: 675095f442de4124ddcd5324a158f3aa504b3c7a [file] [log] [blame]
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "interpreter_common.h"
18
19namespace art {
20namespace interpreter {
21
22#define HANDLE_PENDING_EXCEPTION() \
23 do { \
24 CHECK(self->IsExceptionPending()); \
Sebastien Hertz1eda2262013-09-09 16:53:14 +020025 if (UNLIKELY(self->TestAllFlags())) { \
26 CheckSuspend(self); \
27 } \
Sebastien Hertz947ff082013-09-17 14:10:13 +020028 Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_); \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020029 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, \
30 inst->GetDexPc(insns), \
Sebastien Hertz947ff082013-09-17 14:10:13 +020031 this_object, \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020032 instrumentation); \
33 if (found_dex_pc == DexFile::kDexNoIndex) { \
34 return JValue(); /* Handled in caller. */ \
35 } else { \
36 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc); \
37 inst = inst->RelativeAt(displacement); \
38 } \
39 } while (false)
40
41#define POSSIBLY_HANDLE_PENDING_EXCEPTION(_is_exception_pending, _next_function) \
42 do { \
43 if (UNLIKELY(_is_exception_pending)) { \
44 HANDLE_PENDING_EXCEPTION(); \
45 } else { \
46 inst = inst->_next_function(); \
47 } \
48 } while (false)
49
50// Code to run before each dex instruction.
51#define PREAMBLE()
52
53template<bool do_access_check>
Sebastien Hertzc6714852013-09-30 16:42:32 +020054JValue ExecuteSwitchImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item,
Sebastien Hertz8ece0502013-08-07 11:26:41 +020055 ShadowFrame& shadow_frame, JValue result_register) {
Jeff Haoa3faaf42013-09-03 19:07:00 -070056 bool do_assignability_check = do_access_check;
Sebastien Hertz8ece0502013-08-07 11:26:41 +020057 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
58 LOG(FATAL) << "Invalid shadow frame for interpreter use";
59 return JValue();
60 }
61 self->VerifyStack();
Sebastien Hertz8ece0502013-08-07 11:26:41 +020062
63 uint32_t dex_pc = shadow_frame.GetDexPC();
Sebastien Hertz947ff082013-09-17 14:10:13 +020064 const instrumentation::Instrumentation* const instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +020065 if (LIKELY(dex_pc == 0)) { // We are entering the method as opposed to deoptimizing..
66 if (UNLIKELY(instrumentation->HasMethodEntryListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +020067 instrumentation->MethodEnterEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +020068 shadow_frame.GetMethod(), 0);
69 }
70 }
71 const uint16_t* const insns = code_item->insns_;
72 const Instruction* inst = Instruction::At(insns + dex_pc);
Sebastien Hertz3b588e02013-09-11 14:33:18 +020073 uint16_t inst_data;
Sebastien Hertz8ece0502013-08-07 11:26:41 +020074 while (true) {
75 dex_pc = inst->GetDexPc(insns);
76 shadow_frame.SetDexPC(dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +020077 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +020078 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +020079 shadow_frame.GetMethod(), dex_pc);
80 }
81 TraceExecution(shadow_frame, inst, dex_pc, mh);
Sebastien Hertz3b588e02013-09-11 14:33:18 +020082 inst_data = inst->Fetch16(0);
83 switch (inst->Opcode(inst_data)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +020084 case Instruction::NOP:
85 PREAMBLE();
86 inst = inst->Next_1xx();
87 break;
88 case Instruction::MOVE:
89 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +020090 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
91 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +020092 inst = inst->Next_1xx();
93 break;
94 case Instruction::MOVE_FROM16:
95 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +020096 shadow_frame.SetVReg(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +020097 shadow_frame.GetVReg(inst->VRegB_22x()));
98 inst = inst->Next_2xx();
99 break;
100 case Instruction::MOVE_16:
101 PREAMBLE();
102 shadow_frame.SetVReg(inst->VRegA_32x(),
103 shadow_frame.GetVReg(inst->VRegB_32x()));
104 inst = inst->Next_3xx();
105 break;
106 case Instruction::MOVE_WIDE:
107 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200108 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
109 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200110 inst = inst->Next_1xx();
111 break;
112 case Instruction::MOVE_WIDE_FROM16:
113 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200114 shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200115 shadow_frame.GetVRegLong(inst->VRegB_22x()));
116 inst = inst->Next_2xx();
117 break;
118 case Instruction::MOVE_WIDE_16:
119 PREAMBLE();
120 shadow_frame.SetVRegLong(inst->VRegA_32x(),
121 shadow_frame.GetVRegLong(inst->VRegB_32x()));
122 inst = inst->Next_3xx();
123 break;
124 case Instruction::MOVE_OBJECT:
125 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200126 shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data),
127 shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200128 inst = inst->Next_1xx();
129 break;
130 case Instruction::MOVE_OBJECT_FROM16:
131 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200132 shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200133 shadow_frame.GetVRegReference(inst->VRegB_22x()));
134 inst = inst->Next_2xx();
135 break;
136 case Instruction::MOVE_OBJECT_16:
137 PREAMBLE();
138 shadow_frame.SetVRegReference(inst->VRegA_32x(),
139 shadow_frame.GetVRegReference(inst->VRegB_32x()));
140 inst = inst->Next_3xx();
141 break;
142 case Instruction::MOVE_RESULT:
143 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200144 shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200145 inst = inst->Next_1xx();
146 break;
147 case Instruction::MOVE_RESULT_WIDE:
148 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200149 shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200150 inst = inst->Next_1xx();
151 break;
152 case Instruction::MOVE_RESULT_OBJECT:
153 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200154 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200155 inst = inst->Next_1xx();
156 break;
157 case Instruction::MOVE_EXCEPTION: {
158 PREAMBLE();
159 Throwable* exception = self->GetException(NULL);
160 self->ClearException();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200161 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200162 inst = inst->Next_1xx();
163 break;
164 }
165 case Instruction::RETURN_VOID: {
166 PREAMBLE();
167 JValue result;
Sebastien Hertz043036f2013-09-09 18:26:48 +0200168 if (do_access_check) {
169 // If access checks are required then the dex-to-dex compiler and analysis of
170 // whether the class has final fields hasn't been performed. Conservatively
171 // perform the memory barrier now.
172 ANDROID_MEMBAR_STORE();
173 }
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200174 if (UNLIKELY(self->TestAllFlags())) {
175 CheckSuspend(self);
176 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200177 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200178 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200179 shadow_frame.GetMethod(), inst->GetDexPc(insns),
180 result);
181 }
182 return result;
183 }
184 case Instruction::RETURN_VOID_BARRIER: {
185 PREAMBLE();
186 ANDROID_MEMBAR_STORE();
187 JValue result;
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200188 if (UNLIKELY(self->TestAllFlags())) {
189 CheckSuspend(self);
190 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200191 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200192 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200193 shadow_frame.GetMethod(), inst->GetDexPc(insns),
194 result);
195 }
196 return result;
197 }
198 case Instruction::RETURN: {
199 PREAMBLE();
200 JValue result;
201 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200202 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200203 if (UNLIKELY(self->TestAllFlags())) {
204 CheckSuspend(self);
205 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200206 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200207 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200208 shadow_frame.GetMethod(), inst->GetDexPc(insns),
209 result);
210 }
211 return result;
212 }
213 case Instruction::RETURN_WIDE: {
214 PREAMBLE();
215 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200216 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200217 if (UNLIKELY(self->TestAllFlags())) {
218 CheckSuspend(self);
219 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200220 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200221 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200222 shadow_frame.GetMethod(), inst->GetDexPc(insns),
223 result);
224 }
225 return result;
226 }
227 case Instruction::RETURN_OBJECT: {
228 PREAMBLE();
229 JValue result;
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200230 if (UNLIKELY(self->TestAllFlags())) {
231 CheckSuspend(self);
232 }
Mathieu Chartiere861ebd2013-10-09 15:01:21 -0700233 Object* obj_result = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
234 result.SetJ(0);
235 result.SetL(obj_result);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700236 if (do_assignability_check && obj_result != NULL) {
237 Class* return_type = MethodHelper(shadow_frame.GetMethod()).GetReturnType();
238 if (return_type == NULL) {
239 // Return the pending exception.
240 HANDLE_PENDING_EXCEPTION();
241 }
242 if (!obj_result->VerifierInstanceOf(return_type)) {
243 // This should never happen.
244 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
245 "Ljava/lang/VirtualMachineError;",
246 "Returning '%s' that is not instance of return type '%s'",
247 ClassHelper(obj_result->GetClass()).GetDescriptor(),
248 ClassHelper(return_type).GetDescriptor());
249 HANDLE_PENDING_EXCEPTION();
250 }
251 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200252 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200253 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200254 shadow_frame.GetMethod(), inst->GetDexPc(insns),
255 result);
256 }
257 return result;
258 }
259 case Instruction::CONST_4: {
260 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200261 uint4_t dst = inst->VRegA_11n(inst_data);
262 int4_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200263 shadow_frame.SetVReg(dst, val);
264 if (val == 0) {
265 shadow_frame.SetVRegReference(dst, NULL);
266 }
267 inst = inst->Next_1xx();
268 break;
269 }
270 case Instruction::CONST_16: {
271 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200272 uint8_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200273 int16_t val = inst->VRegB_21s();
274 shadow_frame.SetVReg(dst, val);
275 if (val == 0) {
276 shadow_frame.SetVRegReference(dst, NULL);
277 }
278 inst = inst->Next_2xx();
279 break;
280 }
281 case Instruction::CONST: {
282 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200283 uint8_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200284 int32_t val = inst->VRegB_31i();
285 shadow_frame.SetVReg(dst, val);
286 if (val == 0) {
287 shadow_frame.SetVRegReference(dst, NULL);
288 }
289 inst = inst->Next_3xx();
290 break;
291 }
292 case Instruction::CONST_HIGH16: {
293 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200294 uint8_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200295 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
296 shadow_frame.SetVReg(dst, val);
297 if (val == 0) {
298 shadow_frame.SetVRegReference(dst, NULL);
299 }
300 inst = inst->Next_2xx();
301 break;
302 }
303 case Instruction::CONST_WIDE_16:
304 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200305 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200306 inst = inst->Next_2xx();
307 break;
308 case Instruction::CONST_WIDE_32:
309 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200310 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200311 inst = inst->Next_3xx();
312 break;
313 case Instruction::CONST_WIDE:
314 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200315 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200316 inst = inst->Next_51l();
317 break;
318 case Instruction::CONST_WIDE_HIGH16:
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200319 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200320 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
321 inst = inst->Next_2xx();
322 break;
323 case Instruction::CONST_STRING: {
324 PREAMBLE();
325 String* s = ResolveString(self, mh, inst->VRegB_21c());
326 if (UNLIKELY(s == NULL)) {
327 HANDLE_PENDING_EXCEPTION();
328 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200329 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200330 inst = inst->Next_2xx();
331 }
332 break;
333 }
334 case Instruction::CONST_STRING_JUMBO: {
335 PREAMBLE();
336 String* s = ResolveString(self, mh, inst->VRegB_31c());
337 if (UNLIKELY(s == NULL)) {
338 HANDLE_PENDING_EXCEPTION();
339 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200340 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200341 inst = inst->Next_3xx();
342 }
343 break;
344 }
345 case Instruction::CONST_CLASS: {
346 PREAMBLE();
347 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
348 self, false, do_access_check);
349 if (UNLIKELY(c == NULL)) {
350 HANDLE_PENDING_EXCEPTION();
351 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200352 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200353 inst = inst->Next_2xx();
354 }
355 break;
356 }
357 case Instruction::MONITOR_ENTER: {
358 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200359 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200360 if (UNLIKELY(obj == NULL)) {
361 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
362 HANDLE_PENDING_EXCEPTION();
363 } else {
364 DoMonitorEnter(self, obj);
365 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
366 }
367 break;
368 }
369 case Instruction::MONITOR_EXIT: {
370 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200371 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200372 if (UNLIKELY(obj == NULL)) {
373 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
374 HANDLE_PENDING_EXCEPTION();
375 } else {
376 DoMonitorExit(self, obj);
377 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
378 }
379 break;
380 }
381 case Instruction::CHECK_CAST: {
382 PREAMBLE();
383 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
384 self, false, do_access_check);
385 if (UNLIKELY(c == NULL)) {
386 HANDLE_PENDING_EXCEPTION();
387 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200388 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200389 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
390 ThrowClassCastException(c, obj->GetClass());
391 HANDLE_PENDING_EXCEPTION();
392 } else {
393 inst = inst->Next_2xx();
394 }
395 }
396 break;
397 }
398 case Instruction::INSTANCE_OF: {
399 PREAMBLE();
400 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
401 self, false, do_access_check);
402 if (UNLIKELY(c == NULL)) {
403 HANDLE_PENDING_EXCEPTION();
404 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200405 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
406 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200407 inst = inst->Next_2xx();
408 }
409 break;
410 }
411 case Instruction::ARRAY_LENGTH: {
412 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200413 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200414 if (UNLIKELY(array == NULL)) {
415 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
416 HANDLE_PENDING_EXCEPTION();
417 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200418 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200419 inst = inst->Next_1xx();
420 }
421 break;
422 }
423 case Instruction::NEW_INSTANCE: {
424 PREAMBLE();
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800425 Object* obj = AllocObjectFromCode<do_access_check, true>(
426 inst->VRegB_21c(), shadow_frame.GetMethod(), self,
427 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200428 if (UNLIKELY(obj == NULL)) {
429 HANDLE_PENDING_EXCEPTION();
430 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200431 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200432 inst = inst->Next_2xx();
433 }
434 break;
435 }
436 case Instruction::NEW_ARRAY: {
437 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200438 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800439 Object* obj = AllocArrayFromCode<do_access_check, true>(
440 inst->VRegC_22c(), shadow_frame.GetMethod(), length, self,
441 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200442 if (UNLIKELY(obj == NULL)) {
443 HANDLE_PENDING_EXCEPTION();
444 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200445 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200446 inst = inst->Next_2xx();
447 }
448 break;
449 }
450 case Instruction::FILLED_NEW_ARRAY: {
451 PREAMBLE();
452 bool success = DoFilledNewArray<false, do_access_check>(inst, shadow_frame,
453 self, &result_register);
454 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
455 break;
456 }
457 case Instruction::FILLED_NEW_ARRAY_RANGE: {
458 PREAMBLE();
459 bool success = DoFilledNewArray<true, do_access_check>(inst, shadow_frame,
460 self, &result_register);
461 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
462 break;
463 }
464 case Instruction::FILL_ARRAY_DATA: {
465 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200466 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200467 if (UNLIKELY(obj == NULL)) {
468 ThrowNullPointerException(NULL, "null array in FILL_ARRAY_DATA");
469 HANDLE_PENDING_EXCEPTION();
470 break;
471 }
472 Array* array = obj->AsArray();
473 DCHECK(array->IsArrayInstance() && !array->IsObjectArray());
474 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
475 const Instruction::ArrayDataPayload* payload =
476 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
477 if (UNLIKELY(static_cast<int32_t>(payload->element_count) > array->GetLength())) {
478 self->ThrowNewExceptionF(shadow_frame.GetCurrentLocationForThrow(),
479 "Ljava/lang/ArrayIndexOutOfBoundsException;",
480 "failed FILL_ARRAY_DATA; length=%d, index=%d",
481 array->GetLength(), payload->element_count);
482 HANDLE_PENDING_EXCEPTION();
483 break;
484 }
485 uint32_t size_in_bytes = payload->element_count * payload->element_width;
486 memcpy(array->GetRawData(payload->element_width), payload->data, size_in_bytes);
487 inst = inst->Next_3xx();
488 break;
489 }
490 case Instruction::THROW: {
491 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200492 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200493 if (UNLIKELY(exception == NULL)) {
494 ThrowNullPointerException(NULL, "throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700495 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
496 // This should never happen.
497 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
498 "Ljava/lang/VirtualMachineError;",
499 "Throwing '%s' that is not instance of Throwable",
500 ClassHelper(exception->GetClass()).GetDescriptor());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200501 } else {
502 self->SetException(shadow_frame.GetCurrentLocationForThrow(), exception->AsThrowable());
503 }
504 HANDLE_PENDING_EXCEPTION();
505 break;
506 }
507 case Instruction::GOTO: {
508 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200509 int8_t offset = inst->VRegA_10t(inst_data);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200510 if (IsBackwardBranch(offset)) {
511 if (UNLIKELY(self->TestAllFlags())) {
512 CheckSuspend(self);
513 }
514 }
515 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200516 break;
517 }
518 case Instruction::GOTO_16: {
519 PREAMBLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200520 int16_t offset = inst->VRegA_20t();
521 if (IsBackwardBranch(offset)) {
522 if (UNLIKELY(self->TestAllFlags())) {
523 CheckSuspend(self);
524 }
525 }
526 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200527 break;
528 }
529 case Instruction::GOTO_32: {
530 PREAMBLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200531 int32_t offset = inst->VRegA_30t();
532 if (IsBackwardBranch(offset)) {
533 if (UNLIKELY(self->TestAllFlags())) {
534 CheckSuspend(self);
535 }
536 }
537 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200538 break;
539 }
540 case Instruction::PACKED_SWITCH: {
541 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200542 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200543 if (IsBackwardBranch(offset)) {
544 if (UNLIKELY(self->TestAllFlags())) {
545 CheckSuspend(self);
546 }
547 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200548 inst = inst->RelativeAt(offset);
549 break;
550 }
551 case Instruction::SPARSE_SWITCH: {
552 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200553 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200554 if (IsBackwardBranch(offset)) {
555 if (UNLIKELY(self->TestAllFlags())) {
556 CheckSuspend(self);
557 }
558 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200559 inst = inst->RelativeAt(offset);
560 break;
561 }
562 case Instruction::CMPL_FLOAT: {
563 PREAMBLE();
564 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
565 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
566 int32_t result;
567 if (val1 > val2) {
568 result = 1;
569 } else if (val1 == val2) {
570 result = 0;
571 } else {
572 result = -1;
573 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200574 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200575 inst = inst->Next_2xx();
576 break;
577 }
578 case Instruction::CMPG_FLOAT: {
579 PREAMBLE();
580 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
581 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
582 int32_t result;
583 if (val1 < val2) {
584 result = -1;
585 } else if (val1 == val2) {
586 result = 0;
587 } else {
588 result = 1;
589 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200590 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200591 inst = inst->Next_2xx();
592 break;
593 }
594 case Instruction::CMPL_DOUBLE: {
595 PREAMBLE();
596 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
597 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
598 int32_t result;
599 if (val1 > val2) {
600 result = 1;
601 } else if (val1 == val2) {
602 result = 0;
603 } else {
604 result = -1;
605 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200606 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200607 inst = inst->Next_2xx();
608 break;
609 }
610
611 case Instruction::CMPG_DOUBLE: {
612 PREAMBLE();
613 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
614 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
615 int32_t result;
616 if (val1 < val2) {
617 result = -1;
618 } else if (val1 == val2) {
619 result = 0;
620 } else {
621 result = 1;
622 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200623 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200624 inst = inst->Next_2xx();
625 break;
626 }
627 case Instruction::CMP_LONG: {
628 PREAMBLE();
629 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
630 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
631 int32_t result;
632 if (val1 > val2) {
633 result = 1;
634 } else if (val1 == val2) {
635 result = 0;
636 } else {
637 result = -1;
638 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200639 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200640 inst = inst->Next_2xx();
641 break;
642 }
643 case Instruction::IF_EQ: {
644 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200645 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200646 int16_t offset = inst->VRegC_22t();
647 if (IsBackwardBranch(offset)) {
648 if (UNLIKELY(self->TestAllFlags())) {
649 CheckSuspend(self);
650 }
651 }
652 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200653 } else {
654 inst = inst->Next_2xx();
655 }
656 break;
657 }
658 case Instruction::IF_NE: {
659 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200660 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) != shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200661 int16_t offset = inst->VRegC_22t();
662 if (IsBackwardBranch(offset)) {
663 if (UNLIKELY(self->TestAllFlags())) {
664 CheckSuspend(self);
665 }
666 }
667 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200668 } else {
669 inst = inst->Next_2xx();
670 }
671 break;
672 }
673 case Instruction::IF_LT: {
674 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200675 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) < shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200676 int16_t offset = inst->VRegC_22t();
677 if (IsBackwardBranch(offset)) {
678 if (UNLIKELY(self->TestAllFlags())) {
679 CheckSuspend(self);
680 }
681 }
682 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200683 } else {
684 inst = inst->Next_2xx();
685 }
686 break;
687 }
688 case Instruction::IF_GE: {
689 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200690 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200691 int16_t offset = inst->VRegC_22t();
692 if (IsBackwardBranch(offset)) {
693 if (UNLIKELY(self->TestAllFlags())) {
694 CheckSuspend(self);
695 }
696 }
697 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200698 } else {
699 inst = inst->Next_2xx();
700 }
701 break;
702 }
703 case Instruction::IF_GT: {
704 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200705 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200706 int16_t offset = inst->VRegC_22t();
707 if (IsBackwardBranch(offset)) {
708 if (UNLIKELY(self->TestAllFlags())) {
709 CheckSuspend(self);
710 }
711 }
712 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200713 } else {
714 inst = inst->Next_2xx();
715 }
716 break;
717 }
718 case Instruction::IF_LE: {
719 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200720 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200721 int16_t offset = inst->VRegC_22t();
722 if (IsBackwardBranch(offset)) {
723 if (UNLIKELY(self->TestAllFlags())) {
724 CheckSuspend(self);
725 }
726 }
727 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200728 } else {
729 inst = inst->Next_2xx();
730 }
731 break;
732 }
733 case Instruction::IF_EQZ: {
734 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200735 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200736 int16_t offset = inst->VRegB_21t();
737 if (IsBackwardBranch(offset)) {
738 if (UNLIKELY(self->TestAllFlags())) {
739 CheckSuspend(self);
740 }
741 }
742 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200743 } else {
744 inst = inst->Next_2xx();
745 }
746 break;
747 }
748 case Instruction::IF_NEZ: {
749 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200750 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200751 int16_t offset = inst->VRegB_21t();
752 if (IsBackwardBranch(offset)) {
753 if (UNLIKELY(self->TestAllFlags())) {
754 CheckSuspend(self);
755 }
756 }
757 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200758 } else {
759 inst = inst->Next_2xx();
760 }
761 break;
762 }
763 case Instruction::IF_LTZ: {
764 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200765 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200766 int16_t offset = inst->VRegB_21t();
767 if (IsBackwardBranch(offset)) {
768 if (UNLIKELY(self->TestAllFlags())) {
769 CheckSuspend(self);
770 }
771 }
772 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200773 } else {
774 inst = inst->Next_2xx();
775 }
776 break;
777 }
778 case Instruction::IF_GEZ: {
779 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200780 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200781 int16_t offset = inst->VRegB_21t();
782 if (IsBackwardBranch(offset)) {
783 if (UNLIKELY(self->TestAllFlags())) {
784 CheckSuspend(self);
785 }
786 }
787 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200788 } else {
789 inst = inst->Next_2xx();
790 }
791 break;
792 }
793 case Instruction::IF_GTZ: {
794 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200795 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200796 int16_t offset = inst->VRegB_21t();
797 if (IsBackwardBranch(offset)) {
798 if (UNLIKELY(self->TestAllFlags())) {
799 CheckSuspend(self);
800 }
801 }
802 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200803 } else {
804 inst = inst->Next_2xx();
805 }
806 break;
807 }
808 case Instruction::IF_LEZ: {
809 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200810 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200811 int16_t offset = inst->VRegB_21t();
812 if (IsBackwardBranch(offset)) {
813 if (UNLIKELY(self->TestAllFlags())) {
814 CheckSuspend(self);
815 }
816 }
817 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200818 } else {
819 inst = inst->Next_2xx();
820 }
821 break;
822 }
823 case Instruction::AGET_BOOLEAN: {
824 PREAMBLE();
825 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
826 if (UNLIKELY(a == NULL)) {
827 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
828 HANDLE_PENDING_EXCEPTION();
829 break;
830 }
831 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
832 BooleanArray* array = a->AsBooleanArray();
833 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200834 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200835 inst = inst->Next_2xx();
836 } else {
837 HANDLE_PENDING_EXCEPTION();
838 }
839 break;
840 }
841 case Instruction::AGET_BYTE: {
842 PREAMBLE();
843 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
844 if (UNLIKELY(a == NULL)) {
845 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
846 HANDLE_PENDING_EXCEPTION();
847 break;
848 }
849 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
850 ByteArray* array = a->AsByteArray();
851 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200852 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200853 inst = inst->Next_2xx();
854 } else {
855 HANDLE_PENDING_EXCEPTION();
856 }
857 break;
858 }
859 case Instruction::AGET_CHAR: {
860 PREAMBLE();
861 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
862 if (UNLIKELY(a == NULL)) {
863 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
864 HANDLE_PENDING_EXCEPTION();
865 break;
866 }
867 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
868 CharArray* array = a->AsCharArray();
869 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200870 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200871 inst = inst->Next_2xx();
872 } else {
873 HANDLE_PENDING_EXCEPTION();
874 }
875 break;
876 }
877 case Instruction::AGET_SHORT: {
878 PREAMBLE();
879 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
880 if (UNLIKELY(a == NULL)) {
881 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
882 HANDLE_PENDING_EXCEPTION();
883 break;
884 }
885 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
886 ShortArray* array = a->AsShortArray();
887 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200888 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200889 inst = inst->Next_2xx();
890 } else {
891 HANDLE_PENDING_EXCEPTION();
892 }
893 break;
894 }
895 case Instruction::AGET: {
896 PREAMBLE();
897 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
898 if (UNLIKELY(a == NULL)) {
899 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
900 HANDLE_PENDING_EXCEPTION();
901 break;
902 }
903 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
904 IntArray* array = a->AsIntArray();
905 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200906 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200907 inst = inst->Next_2xx();
908 } else {
909 HANDLE_PENDING_EXCEPTION();
910 }
911 break;
912 }
913 case Instruction::AGET_WIDE: {
914 PREAMBLE();
915 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
916 if (UNLIKELY(a == NULL)) {
917 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
918 HANDLE_PENDING_EXCEPTION();
919 break;
920 }
921 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
922 LongArray* array = a->AsLongArray();
923 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200924 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200925 inst = inst->Next_2xx();
926 } else {
927 HANDLE_PENDING_EXCEPTION();
928 }
929 break;
930 }
931 case Instruction::AGET_OBJECT: {
932 PREAMBLE();
933 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
934 if (UNLIKELY(a == NULL)) {
935 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
936 HANDLE_PENDING_EXCEPTION();
937 break;
938 }
939 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
940 ObjectArray<Object>* array = a->AsObjectArray<Object>();
941 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200942 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200943 inst = inst->Next_2xx();
944 } else {
945 HANDLE_PENDING_EXCEPTION();
946 }
947 break;
948 }
949 case Instruction::APUT_BOOLEAN: {
950 PREAMBLE();
951 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
952 if (UNLIKELY(a == NULL)) {
953 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
954 HANDLE_PENDING_EXCEPTION();
955 break;
956 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200957 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200958 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
959 BooleanArray* array = a->AsBooleanArray();
960 if (LIKELY(array->IsValidIndex(index))) {
961 array->GetData()[index] = val;
962 inst = inst->Next_2xx();
963 } else {
964 HANDLE_PENDING_EXCEPTION();
965 }
966 break;
967 }
968 case Instruction::APUT_BYTE: {
969 PREAMBLE();
970 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
971 if (UNLIKELY(a == NULL)) {
972 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
973 HANDLE_PENDING_EXCEPTION();
974 break;
975 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200976 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200977 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
978 ByteArray* array = a->AsByteArray();
979 if (LIKELY(array->IsValidIndex(index))) {
980 array->GetData()[index] = val;
981 inst = inst->Next_2xx();
982 } else {
983 HANDLE_PENDING_EXCEPTION();
984 }
985 break;
986 }
987 case Instruction::APUT_CHAR: {
988 PREAMBLE();
989 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
990 if (UNLIKELY(a == NULL)) {
991 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
992 HANDLE_PENDING_EXCEPTION();
993 break;
994 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200995 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200996 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
997 CharArray* array = a->AsCharArray();
998 if (LIKELY(array->IsValidIndex(index))) {
999 array->GetData()[index] = val;
1000 inst = inst->Next_2xx();
1001 } else {
1002 HANDLE_PENDING_EXCEPTION();
1003 }
1004 break;
1005 }
1006 case Instruction::APUT_SHORT: {
1007 PREAMBLE();
1008 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1009 if (UNLIKELY(a == NULL)) {
1010 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1011 HANDLE_PENDING_EXCEPTION();
1012 break;
1013 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001014 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001015 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1016 ShortArray* array = a->AsShortArray();
1017 if (LIKELY(array->IsValidIndex(index))) {
1018 array->GetData()[index] = val;
1019 inst = inst->Next_2xx();
1020 } else {
1021 HANDLE_PENDING_EXCEPTION();
1022 }
1023 break;
1024 }
1025 case Instruction::APUT: {
1026 PREAMBLE();
1027 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1028 if (UNLIKELY(a == NULL)) {
1029 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1030 HANDLE_PENDING_EXCEPTION();
1031 break;
1032 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001033 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001034 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1035 IntArray* array = a->AsIntArray();
1036 if (LIKELY(array->IsValidIndex(index))) {
1037 array->GetData()[index] = val;
1038 inst = inst->Next_2xx();
1039 } else {
1040 HANDLE_PENDING_EXCEPTION();
1041 }
1042 break;
1043 }
1044 case Instruction::APUT_WIDE: {
1045 PREAMBLE();
1046 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1047 if (UNLIKELY(a == NULL)) {
1048 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1049 HANDLE_PENDING_EXCEPTION();
1050 break;
1051 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001052 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001053 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1054 LongArray* array = a->AsLongArray();
1055 if (LIKELY(array->IsValidIndex(index))) {
1056 array->GetData()[index] = val;
1057 inst = inst->Next_2xx();
1058 } else {
1059 HANDLE_PENDING_EXCEPTION();
1060 }
1061 break;
1062 }
1063 case Instruction::APUT_OBJECT: {
1064 PREAMBLE();
1065 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1066 if (UNLIKELY(a == NULL)) {
1067 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1068 HANDLE_PENDING_EXCEPTION();
1069 break;
1070 }
1071 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001072 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001073 ObjectArray<Object>* array = a->AsObjectArray<Object>();
1074 if (LIKELY(array->IsValidIndex(index) && array->CheckAssignable(val))) {
1075 array->SetWithoutChecks(index, val);
1076 inst = inst->Next_2xx();
1077 } else {
1078 HANDLE_PENDING_EXCEPTION();
1079 }
1080 break;
1081 }
1082 case Instruction::IGET_BOOLEAN: {
1083 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001084 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001085 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1086 break;
1087 }
1088 case Instruction::IGET_BYTE: {
1089 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001090 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001091 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1092 break;
1093 }
1094 case Instruction::IGET_CHAR: {
1095 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001096 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001097 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1098 break;
1099 }
1100 case Instruction::IGET_SHORT: {
1101 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001102 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001103 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1104 break;
1105 }
1106 case Instruction::IGET: {
1107 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001108 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001109 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1110 break;
1111 }
1112 case Instruction::IGET_WIDE: {
1113 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001114 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001115 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1116 break;
1117 }
1118 case Instruction::IGET_OBJECT: {
1119 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001120 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001121 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1122 break;
1123 }
1124 case Instruction::IGET_QUICK: {
1125 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001126 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001127 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1128 break;
1129 }
1130 case Instruction::IGET_WIDE_QUICK: {
1131 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001132 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001133 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1134 break;
1135 }
1136 case Instruction::IGET_OBJECT_QUICK: {
1137 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001138 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001139 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1140 break;
1141 }
1142 case Instruction::SGET_BOOLEAN: {
1143 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001144 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001145 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1146 break;
1147 }
1148 case Instruction::SGET_BYTE: {
1149 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001150 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001151 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1152 break;
1153 }
1154 case Instruction::SGET_CHAR: {
1155 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001156 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001157 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1158 break;
1159 }
1160 case Instruction::SGET_SHORT: {
1161 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001162 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001163 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1164 break;
1165 }
1166 case Instruction::SGET: {
1167 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001168 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001169 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1170 break;
1171 }
1172 case Instruction::SGET_WIDE: {
1173 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001174 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001175 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1176 break;
1177 }
1178 case Instruction::SGET_OBJECT: {
1179 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001180 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001181 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1182 break;
1183 }
1184 case Instruction::IPUT_BOOLEAN: {
1185 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001186 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001187 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1188 break;
1189 }
1190 case Instruction::IPUT_BYTE: {
1191 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001192 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001193 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1194 break;
1195 }
1196 case Instruction::IPUT_CHAR: {
1197 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001198 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001199 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1200 break;
1201 }
1202 case Instruction::IPUT_SHORT: {
1203 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001204 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001205 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1206 break;
1207 }
1208 case Instruction::IPUT: {
1209 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001210 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001211 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1212 break;
1213 }
1214 case Instruction::IPUT_WIDE: {
1215 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001216 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001217 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1218 break;
1219 }
1220 case Instruction::IPUT_OBJECT: {
1221 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001222 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001223 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1224 break;
1225 }
1226 case Instruction::IPUT_QUICK: {
1227 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001228 bool success = DoIPutQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001229 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1230 break;
1231 }
1232 case Instruction::IPUT_WIDE_QUICK: {
1233 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001234 bool success = DoIPutQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001235 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1236 break;
1237 }
1238 case Instruction::IPUT_OBJECT_QUICK: {
1239 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001240 bool success = DoIPutQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001241 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1242 break;
1243 }
1244 case Instruction::SPUT_BOOLEAN: {
1245 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001246 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001247 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1248 break;
1249 }
1250 case Instruction::SPUT_BYTE: {
1251 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001252 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001253 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1254 break;
1255 }
1256 case Instruction::SPUT_CHAR: {
1257 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001258 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001259 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1260 break;
1261 }
1262 case Instruction::SPUT_SHORT: {
1263 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001264 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001265 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1266 break;
1267 }
1268 case Instruction::SPUT: {
1269 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001270 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001271 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1272 break;
1273 }
1274 case Instruction::SPUT_WIDE: {
1275 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001276 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001277 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1278 break;
1279 }
1280 case Instruction::SPUT_OBJECT: {
1281 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001282 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001283 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1284 break;
1285 }
1286 case Instruction::INVOKE_VIRTUAL: {
1287 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001288 bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001289 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1290 break;
1291 }
1292 case Instruction::INVOKE_VIRTUAL_RANGE: {
1293 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001294 bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001295 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1296 break;
1297 }
1298 case Instruction::INVOKE_SUPER: {
1299 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001300 bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001301 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1302 break;
1303 }
1304 case Instruction::INVOKE_SUPER_RANGE: {
1305 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001306 bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001307 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1308 break;
1309 }
1310 case Instruction::INVOKE_DIRECT: {
1311 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001312 bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001313 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1314 break;
1315 }
1316 case Instruction::INVOKE_DIRECT_RANGE: {
1317 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001318 bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001319 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1320 break;
1321 }
1322 case Instruction::INVOKE_INTERFACE: {
1323 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001324 bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001325 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1326 break;
1327 }
1328 case Instruction::INVOKE_INTERFACE_RANGE: {
1329 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001330 bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001331 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1332 break;
1333 }
1334 case Instruction::INVOKE_STATIC: {
1335 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001336 bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001337 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1338 break;
1339 }
1340 case Instruction::INVOKE_STATIC_RANGE: {
1341 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001342 bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001343 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1344 break;
1345 }
1346 case Instruction::INVOKE_VIRTUAL_QUICK: {
1347 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001348 bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001349 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1350 break;
1351 }
1352 case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: {
1353 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001354 bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001355 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1356 break;
1357 }
1358 case Instruction::NEG_INT:
1359 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001360 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001361 inst = inst->Next_1xx();
1362 break;
1363 case Instruction::NOT_INT:
1364 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001365 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001366 inst = inst->Next_1xx();
1367 break;
1368 case Instruction::NEG_LONG:
1369 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001370 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001371 inst = inst->Next_1xx();
1372 break;
1373 case Instruction::NOT_LONG:
1374 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001375 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001376 inst = inst->Next_1xx();
1377 break;
1378 case Instruction::NEG_FLOAT:
1379 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001380 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001381 inst = inst->Next_1xx();
1382 break;
1383 case Instruction::NEG_DOUBLE:
1384 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001385 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001386 inst = inst->Next_1xx();
1387 break;
1388 case Instruction::INT_TO_LONG:
1389 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001390 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
1391 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001392 inst = inst->Next_1xx();
1393 break;
1394 case Instruction::INT_TO_FLOAT:
1395 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001396 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1397 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001398 inst = inst->Next_1xx();
1399 break;
1400 case Instruction::INT_TO_DOUBLE:
1401 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001402 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1403 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001404 inst = inst->Next_1xx();
1405 break;
1406 case Instruction::LONG_TO_INT:
1407 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001408 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1409 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001410 inst = inst->Next_1xx();
1411 break;
1412 case Instruction::LONG_TO_FLOAT:
1413 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001414 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1415 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001416 inst = inst->Next_1xx();
1417 break;
1418 case Instruction::LONG_TO_DOUBLE:
1419 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001420 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1421 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001422 inst = inst->Next_1xx();
1423 break;
1424 case Instruction::FLOAT_TO_INT: {
1425 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001426 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001427 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001428 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001429 inst = inst->Next_1xx();
1430 break;
1431 }
1432 case Instruction::FLOAT_TO_LONG: {
1433 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001434 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001435 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001436 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001437 inst = inst->Next_1xx();
1438 break;
1439 }
1440 case Instruction::FLOAT_TO_DOUBLE:
1441 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001442 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1443 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001444 inst = inst->Next_1xx();
1445 break;
1446 case Instruction::DOUBLE_TO_INT: {
1447 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001448 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001449 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001450 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001451 inst = inst->Next_1xx();
1452 break;
1453 }
1454 case Instruction::DOUBLE_TO_LONG: {
1455 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001456 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001457 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001458 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001459 inst = inst->Next_1xx();
1460 break;
1461 }
1462 case Instruction::DOUBLE_TO_FLOAT:
1463 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001464 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1465 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001466 inst = inst->Next_1xx();
1467 break;
1468 case Instruction::INT_TO_BYTE:
1469 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001470 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1471 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001472 inst = inst->Next_1xx();
1473 break;
1474 case Instruction::INT_TO_CHAR:
1475 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001476 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1477 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001478 inst = inst->Next_1xx();
1479 break;
1480 case Instruction::INT_TO_SHORT:
1481 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001482 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1483 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001484 inst = inst->Next_1xx();
1485 break;
1486 case Instruction::ADD_INT:
1487 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001488 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001489 shadow_frame.GetVReg(inst->VRegB_23x()) +
1490 shadow_frame.GetVReg(inst->VRegC_23x()));
1491 inst = inst->Next_2xx();
1492 break;
1493 case Instruction::SUB_INT:
1494 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001495 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001496 shadow_frame.GetVReg(inst->VRegB_23x()) -
1497 shadow_frame.GetVReg(inst->VRegC_23x()));
1498 inst = inst->Next_2xx();
1499 break;
1500 case Instruction::MUL_INT:
1501 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001502 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001503 shadow_frame.GetVReg(inst->VRegB_23x()) *
1504 shadow_frame.GetVReg(inst->VRegC_23x()));
1505 inst = inst->Next_2xx();
1506 break;
1507 case Instruction::DIV_INT: {
1508 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001509 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001510 shadow_frame.GetVReg(inst->VRegB_23x()),
1511 shadow_frame.GetVReg(inst->VRegC_23x()));
1512 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1513 break;
1514 }
1515 case Instruction::REM_INT: {
1516 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001517 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001518 shadow_frame.GetVReg(inst->VRegB_23x()),
1519 shadow_frame.GetVReg(inst->VRegC_23x()));
1520 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1521 break;
1522 }
1523 case Instruction::SHL_INT:
1524 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001525 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001526 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1527 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1528 inst = inst->Next_2xx();
1529 break;
1530 case Instruction::SHR_INT:
1531 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001532 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001533 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1534 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1535 inst = inst->Next_2xx();
1536 break;
1537 case Instruction::USHR_INT:
1538 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001539 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001540 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1541 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1542 inst = inst->Next_2xx();
1543 break;
1544 case Instruction::AND_INT:
1545 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001546 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001547 shadow_frame.GetVReg(inst->VRegB_23x()) &
1548 shadow_frame.GetVReg(inst->VRegC_23x()));
1549 inst = inst->Next_2xx();
1550 break;
1551 case Instruction::OR_INT:
1552 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001553 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001554 shadow_frame.GetVReg(inst->VRegB_23x()) |
1555 shadow_frame.GetVReg(inst->VRegC_23x()));
1556 inst = inst->Next_2xx();
1557 break;
1558 case Instruction::XOR_INT:
1559 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001560 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001561 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1562 shadow_frame.GetVReg(inst->VRegC_23x()));
1563 inst = inst->Next_2xx();
1564 break;
1565 case Instruction::ADD_LONG:
1566 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001567 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001568 shadow_frame.GetVRegLong(inst->VRegB_23x()) +
1569 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1570 inst = inst->Next_2xx();
1571 break;
1572 case Instruction::SUB_LONG:
1573 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001574 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001575 shadow_frame.GetVRegLong(inst->VRegB_23x()) -
1576 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1577 inst = inst->Next_2xx();
1578 break;
1579 case Instruction::MUL_LONG:
1580 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001581 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001582 shadow_frame.GetVRegLong(inst->VRegB_23x()) *
1583 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1584 inst = inst->Next_2xx();
1585 break;
1586 case Instruction::DIV_LONG:
1587 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001588 DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001589 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1590 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1591 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_2xx);
1592 break;
1593 case Instruction::REM_LONG:
1594 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001595 DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001596 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1597 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1598 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_2xx);
1599 break;
1600 case Instruction::AND_LONG:
1601 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001602 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001603 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1604 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1605 inst = inst->Next_2xx();
1606 break;
1607 case Instruction::OR_LONG:
1608 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001609 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001610 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1611 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1612 inst = inst->Next_2xx();
1613 break;
1614 case Instruction::XOR_LONG:
1615 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001616 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001617 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1618 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1619 inst = inst->Next_2xx();
1620 break;
1621 case Instruction::SHL_LONG:
1622 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001623 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001624 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1625 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1626 inst = inst->Next_2xx();
1627 break;
1628 case Instruction::SHR_LONG:
1629 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001630 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001631 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1632 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1633 inst = inst->Next_2xx();
1634 break;
1635 case Instruction::USHR_LONG:
1636 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001637 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001638 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1639 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1640 inst = inst->Next_2xx();
1641 break;
1642 case Instruction::ADD_FLOAT:
1643 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001644 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001645 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1646 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1647 inst = inst->Next_2xx();
1648 break;
1649 case Instruction::SUB_FLOAT:
1650 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001651 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001652 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1653 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1654 inst = inst->Next_2xx();
1655 break;
1656 case Instruction::MUL_FLOAT:
1657 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001658 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001659 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1660 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1661 inst = inst->Next_2xx();
1662 break;
1663 case Instruction::DIV_FLOAT:
1664 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001665 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001666 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1667 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1668 inst = inst->Next_2xx();
1669 break;
1670 case Instruction::REM_FLOAT:
1671 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001672 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001673 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1674 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1675 inst = inst->Next_2xx();
1676 break;
1677 case Instruction::ADD_DOUBLE:
1678 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001679 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001680 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1681 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1682 inst = inst->Next_2xx();
1683 break;
1684 case Instruction::SUB_DOUBLE:
1685 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001686 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001687 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1688 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1689 inst = inst->Next_2xx();
1690 break;
1691 case Instruction::MUL_DOUBLE:
1692 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001693 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001694 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1695 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1696 inst = inst->Next_2xx();
1697 break;
1698 case Instruction::DIV_DOUBLE:
1699 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001700 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001701 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1702 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1703 inst = inst->Next_2xx();
1704 break;
1705 case Instruction::REM_DOUBLE:
1706 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001707 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001708 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1709 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1710 inst = inst->Next_2xx();
1711 break;
1712 case Instruction::ADD_INT_2ADDR: {
1713 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001714 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001715 shadow_frame.SetVReg(vregA,
1716 shadow_frame.GetVReg(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001717 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001718 inst = inst->Next_1xx();
1719 break;
1720 }
1721 case Instruction::SUB_INT_2ADDR: {
1722 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001723 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001724 shadow_frame.SetVReg(vregA,
1725 shadow_frame.GetVReg(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001726 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001727 inst = inst->Next_1xx();
1728 break;
1729 }
1730 case Instruction::MUL_INT_2ADDR: {
1731 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001732 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001733 shadow_frame.SetVReg(vregA,
1734 shadow_frame.GetVReg(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001735 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001736 inst = inst->Next_1xx();
1737 break;
1738 }
1739 case Instruction::DIV_INT_2ADDR: {
1740 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001741 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001742 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001743 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001744 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx);
1745 break;
1746 }
1747 case Instruction::REM_INT_2ADDR: {
1748 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001749 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001750 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001751 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001752 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx);
1753 break;
1754 }
1755 case Instruction::SHL_INT_2ADDR: {
1756 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001757 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001758 shadow_frame.SetVReg(vregA,
1759 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001760 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001761 inst = inst->Next_1xx();
1762 break;
1763 }
1764 case Instruction::SHR_INT_2ADDR: {
1765 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001766 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001767 shadow_frame.SetVReg(vregA,
1768 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001769 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001770 inst = inst->Next_1xx();
1771 break;
1772 }
1773 case Instruction::USHR_INT_2ADDR: {
1774 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001775 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001776 shadow_frame.SetVReg(vregA,
1777 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001778 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001779 inst = inst->Next_1xx();
1780 break;
1781 }
1782 case Instruction::AND_INT_2ADDR: {
1783 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001784 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001785 shadow_frame.SetVReg(vregA,
1786 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001787 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001788 inst = inst->Next_1xx();
1789 break;
1790 }
1791 case Instruction::OR_INT_2ADDR: {
1792 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001793 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001794 shadow_frame.SetVReg(vregA,
1795 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001796 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001797 inst = inst->Next_1xx();
1798 break;
1799 }
1800 case Instruction::XOR_INT_2ADDR: {
1801 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001802 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001803 shadow_frame.SetVReg(vregA,
1804 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001805 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001806 inst = inst->Next_1xx();
1807 break;
1808 }
1809 case Instruction::ADD_LONG_2ADDR: {
1810 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001811 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001812 shadow_frame.SetVRegLong(vregA,
1813 shadow_frame.GetVRegLong(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001814 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001815 inst = inst->Next_1xx();
1816 break;
1817 }
1818 case Instruction::SUB_LONG_2ADDR: {
1819 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001820 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001821 shadow_frame.SetVRegLong(vregA,
1822 shadow_frame.GetVRegLong(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001823 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001824 inst = inst->Next_1xx();
1825 break;
1826 }
1827 case Instruction::MUL_LONG_2ADDR: {
1828 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001829 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001830 shadow_frame.SetVRegLong(vregA,
1831 shadow_frame.GetVRegLong(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001832 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001833 inst = inst->Next_1xx();
1834 break;
1835 }
1836 case Instruction::DIV_LONG_2ADDR: {
1837 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001838 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001839 DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001840 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001841 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
1842 break;
1843 }
1844 case Instruction::REM_LONG_2ADDR: {
1845 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001846 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001847 DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001848 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001849 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
1850 break;
1851 }
1852 case Instruction::AND_LONG_2ADDR: {
1853 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001854 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001855 shadow_frame.SetVRegLong(vregA,
1856 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001857 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001858 inst = inst->Next_1xx();
1859 break;
1860 }
1861 case Instruction::OR_LONG_2ADDR: {
1862 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001863 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001864 shadow_frame.SetVRegLong(vregA,
1865 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001866 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001867 inst = inst->Next_1xx();
1868 break;
1869 }
1870 case Instruction::XOR_LONG_2ADDR: {
1871 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001872 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001873 shadow_frame.SetVRegLong(vregA,
1874 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001875 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001876 inst = inst->Next_1xx();
1877 break;
1878 }
1879 case Instruction::SHL_LONG_2ADDR: {
1880 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001881 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001882 shadow_frame.SetVRegLong(vregA,
1883 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001884 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001885 inst = inst->Next_1xx();
1886 break;
1887 }
1888 case Instruction::SHR_LONG_2ADDR: {
1889 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001890 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001891 shadow_frame.SetVRegLong(vregA,
1892 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001893 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001894 inst = inst->Next_1xx();
1895 break;
1896 }
1897 case Instruction::USHR_LONG_2ADDR: {
1898 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001899 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001900 shadow_frame.SetVRegLong(vregA,
1901 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001902 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001903 inst = inst->Next_1xx();
1904 break;
1905 }
1906 case Instruction::ADD_FLOAT_2ADDR: {
1907 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001908 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001909 shadow_frame.SetVRegFloat(vregA,
1910 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001911 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001912 inst = inst->Next_1xx();
1913 break;
1914 }
1915 case Instruction::SUB_FLOAT_2ADDR: {
1916 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001917 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001918 shadow_frame.SetVRegFloat(vregA,
1919 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001920 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001921 inst = inst->Next_1xx();
1922 break;
1923 }
1924 case Instruction::MUL_FLOAT_2ADDR: {
1925 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001926 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001927 shadow_frame.SetVRegFloat(vregA,
1928 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001929 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001930 inst = inst->Next_1xx();
1931 break;
1932 }
1933 case Instruction::DIV_FLOAT_2ADDR: {
1934 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001935 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001936 shadow_frame.SetVRegFloat(vregA,
1937 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001938 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001939 inst = inst->Next_1xx();
1940 break;
1941 }
1942 case Instruction::REM_FLOAT_2ADDR: {
1943 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001944 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001945 shadow_frame.SetVRegFloat(vregA,
1946 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001947 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001948 inst = inst->Next_1xx();
1949 break;
1950 }
1951 case Instruction::ADD_DOUBLE_2ADDR: {
1952 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001953 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001954 shadow_frame.SetVRegDouble(vregA,
1955 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001956 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001957 inst = inst->Next_1xx();
1958 break;
1959 }
1960 case Instruction::SUB_DOUBLE_2ADDR: {
1961 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001962 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001963 shadow_frame.SetVRegDouble(vregA,
1964 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001965 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001966 inst = inst->Next_1xx();
1967 break;
1968 }
1969 case Instruction::MUL_DOUBLE_2ADDR: {
1970 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001971 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001972 shadow_frame.SetVRegDouble(vregA,
1973 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001974 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001975 inst = inst->Next_1xx();
1976 break;
1977 }
1978 case Instruction::DIV_DOUBLE_2ADDR: {
1979 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001980 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001981 shadow_frame.SetVRegDouble(vregA,
1982 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001983 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001984 inst = inst->Next_1xx();
1985 break;
1986 }
1987 case Instruction::REM_DOUBLE_2ADDR: {
1988 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001989 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001990 shadow_frame.SetVRegDouble(vregA,
1991 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001992 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001993 inst = inst->Next_1xx();
1994 break;
1995 }
1996 case Instruction::ADD_INT_LIT16:
1997 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001998 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
1999 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) +
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002000 inst->VRegC_22s());
2001 inst = inst->Next_2xx();
2002 break;
2003 case Instruction::RSUB_INT:
2004 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002005 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002006 inst->VRegC_22s() -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002007 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002008 inst = inst->Next_2xx();
2009 break;
2010 case Instruction::MUL_INT_LIT16:
2011 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002012 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2013 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) *
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002014 inst->VRegC_22s());
2015 inst = inst->Next_2xx();
2016 break;
2017 case Instruction::DIV_INT_LIT16: {
2018 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002019 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
2020 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002021 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2022 break;
2023 }
2024 case Instruction::REM_INT_LIT16: {
2025 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002026 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
2027 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002028 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2029 break;
2030 }
2031 case Instruction::AND_INT_LIT16:
2032 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002033 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2034 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002035 inst->VRegC_22s());
2036 inst = inst->Next_2xx();
2037 break;
2038 case Instruction::OR_INT_LIT16:
2039 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002040 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2041 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002042 inst->VRegC_22s());
2043 inst = inst->Next_2xx();
2044 break;
2045 case Instruction::XOR_INT_LIT16:
2046 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002047 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2048 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002049 inst->VRegC_22s());
2050 inst = inst->Next_2xx();
2051 break;
2052 case Instruction::ADD_INT_LIT8:
2053 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002054 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002055 shadow_frame.GetVReg(inst->VRegB_22b()) +
2056 inst->VRegC_22b());
2057 inst = inst->Next_2xx();
2058 break;
2059 case Instruction::RSUB_INT_LIT8:
2060 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002061 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002062 inst->VRegC_22b() -
2063 shadow_frame.GetVReg(inst->VRegB_22b()));
2064 inst = inst->Next_2xx();
2065 break;
2066 case Instruction::MUL_INT_LIT8:
2067 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002068 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002069 shadow_frame.GetVReg(inst->VRegB_22b()) *
2070 inst->VRegC_22b());
2071 inst = inst->Next_2xx();
2072 break;
2073 case Instruction::DIV_INT_LIT8: {
2074 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002075 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002076 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
2077 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2078 break;
2079 }
2080 case Instruction::REM_INT_LIT8: {
2081 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002082 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002083 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
2084 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2085 break;
2086 }
2087 case Instruction::AND_INT_LIT8:
2088 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002089 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002090 shadow_frame.GetVReg(inst->VRegB_22b()) &
2091 inst->VRegC_22b());
2092 inst = inst->Next_2xx();
2093 break;
2094 case Instruction::OR_INT_LIT8:
2095 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002096 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002097 shadow_frame.GetVReg(inst->VRegB_22b()) |
2098 inst->VRegC_22b());
2099 inst = inst->Next_2xx();
2100 break;
2101 case Instruction::XOR_INT_LIT8:
2102 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002103 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002104 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2105 inst->VRegC_22b());
2106 inst = inst->Next_2xx();
2107 break;
2108 case Instruction::SHL_INT_LIT8:
2109 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002110 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002111 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2112 (inst->VRegC_22b() & 0x1f));
2113 inst = inst->Next_2xx();
2114 break;
2115 case Instruction::SHR_INT_LIT8:
2116 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002117 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002118 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2119 (inst->VRegC_22b() & 0x1f));
2120 inst = inst->Next_2xx();
2121 break;
2122 case Instruction::USHR_INT_LIT8:
2123 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002124 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002125 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2126 (inst->VRegC_22b() & 0x1f));
2127 inst = inst->Next_2xx();
2128 break;
2129 case Instruction::UNUSED_3E ... Instruction::UNUSED_43:
2130 case Instruction::UNUSED_EB ... Instruction::UNUSED_FF:
2131 case Instruction::UNUSED_79:
2132 case Instruction::UNUSED_7A:
2133 UnexpectedOpcode(inst, mh);
2134 }
2135 }
2136} // NOLINT(readability/fn_size)
2137
2138// Explicit definitions of ExecuteSwitchImpl.
Sebastien Hertzc6714852013-09-30 16:42:32 +02002139template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
2140JValue ExecuteSwitchImpl<true>(Thread* self, MethodHelper& mh,
2141 const DexFile::CodeItem* code_item,
2142 ShadowFrame& shadow_frame, JValue result_register);
2143template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
2144JValue ExecuteSwitchImpl<false>(Thread* self, MethodHelper& mh,
2145 const DexFile::CodeItem* code_item,
2146 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002147
2148} // namespace interpreter
2149} // namespace art