blob: 01a0e4b45715ec4731f0bad76a1e27976fd99e5f [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>
54static JValue ExecuteSwitchImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item,
55 ShadowFrame& shadow_frame, JValue result_register) {
56 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
57 LOG(FATAL) << "Invalid shadow frame for interpreter use";
58 return JValue();
59 }
60 self->VerifyStack();
Sebastien Hertz8ece0502013-08-07 11:26:41 +020061
62 uint32_t dex_pc = shadow_frame.GetDexPC();
Sebastien Hertz947ff082013-09-17 14:10:13 +020063 const instrumentation::Instrumentation* const instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +020064 if (LIKELY(dex_pc == 0)) { // We are entering the method as opposed to deoptimizing..
65 if (UNLIKELY(instrumentation->HasMethodEntryListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +020066 instrumentation->MethodEnterEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +020067 shadow_frame.GetMethod(), 0);
68 }
69 }
70 const uint16_t* const insns = code_item->insns_;
71 const Instruction* inst = Instruction::At(insns + dex_pc);
72 while (true) {
73 dex_pc = inst->GetDexPc(insns);
74 shadow_frame.SetDexPC(dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +020075 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +020076 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +020077 shadow_frame.GetMethod(), dex_pc);
78 }
79 TraceExecution(shadow_frame, inst, dex_pc, mh);
80 switch (inst->Opcode()) {
81 case Instruction::NOP:
82 PREAMBLE();
83 inst = inst->Next_1xx();
84 break;
85 case Instruction::MOVE:
86 PREAMBLE();
87 shadow_frame.SetVReg(inst->VRegA_12x(),
88 shadow_frame.GetVReg(inst->VRegB_12x()));
89 inst = inst->Next_1xx();
90 break;
91 case Instruction::MOVE_FROM16:
92 PREAMBLE();
93 shadow_frame.SetVReg(inst->VRegA_22x(),
94 shadow_frame.GetVReg(inst->VRegB_22x()));
95 inst = inst->Next_2xx();
96 break;
97 case Instruction::MOVE_16:
98 PREAMBLE();
99 shadow_frame.SetVReg(inst->VRegA_32x(),
100 shadow_frame.GetVReg(inst->VRegB_32x()));
101 inst = inst->Next_3xx();
102 break;
103 case Instruction::MOVE_WIDE:
104 PREAMBLE();
105 shadow_frame.SetVRegLong(inst->VRegA_12x(),
106 shadow_frame.GetVRegLong(inst->VRegB_12x()));
107 inst = inst->Next_1xx();
108 break;
109 case Instruction::MOVE_WIDE_FROM16:
110 PREAMBLE();
111 shadow_frame.SetVRegLong(inst->VRegA_22x(),
112 shadow_frame.GetVRegLong(inst->VRegB_22x()));
113 inst = inst->Next_2xx();
114 break;
115 case Instruction::MOVE_WIDE_16:
116 PREAMBLE();
117 shadow_frame.SetVRegLong(inst->VRegA_32x(),
118 shadow_frame.GetVRegLong(inst->VRegB_32x()));
119 inst = inst->Next_3xx();
120 break;
121 case Instruction::MOVE_OBJECT:
122 PREAMBLE();
123 shadow_frame.SetVRegReference(inst->VRegA_12x(),
124 shadow_frame.GetVRegReference(inst->VRegB_12x()));
125 inst = inst->Next_1xx();
126 break;
127 case Instruction::MOVE_OBJECT_FROM16:
128 PREAMBLE();
129 shadow_frame.SetVRegReference(inst->VRegA_22x(),
130 shadow_frame.GetVRegReference(inst->VRegB_22x()));
131 inst = inst->Next_2xx();
132 break;
133 case Instruction::MOVE_OBJECT_16:
134 PREAMBLE();
135 shadow_frame.SetVRegReference(inst->VRegA_32x(),
136 shadow_frame.GetVRegReference(inst->VRegB_32x()));
137 inst = inst->Next_3xx();
138 break;
139 case Instruction::MOVE_RESULT:
140 PREAMBLE();
141 shadow_frame.SetVReg(inst->VRegA_11x(), result_register.GetI());
142 inst = inst->Next_1xx();
143 break;
144 case Instruction::MOVE_RESULT_WIDE:
145 PREAMBLE();
146 shadow_frame.SetVRegLong(inst->VRegA_11x(), result_register.GetJ());
147 inst = inst->Next_1xx();
148 break;
149 case Instruction::MOVE_RESULT_OBJECT:
150 PREAMBLE();
151 shadow_frame.SetVRegReference(inst->VRegA_11x(), result_register.GetL());
152 inst = inst->Next_1xx();
153 break;
154 case Instruction::MOVE_EXCEPTION: {
155 PREAMBLE();
156 Throwable* exception = self->GetException(NULL);
157 self->ClearException();
158 shadow_frame.SetVRegReference(inst->VRegA_11x(), exception);
159 inst = inst->Next_1xx();
160 break;
161 }
162 case Instruction::RETURN_VOID: {
163 PREAMBLE();
164 JValue result;
Sebastien Hertz043036f2013-09-09 18:26:48 +0200165 if (do_access_check) {
166 // If access checks are required then the dex-to-dex compiler and analysis of
167 // whether the class has final fields hasn't been performed. Conservatively
168 // perform the memory barrier now.
169 ANDROID_MEMBAR_STORE();
170 }
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200171 if (UNLIKELY(self->TestAllFlags())) {
172 CheckSuspend(self);
173 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200174 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200175 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200176 shadow_frame.GetMethod(), inst->GetDexPc(insns),
177 result);
178 }
179 return result;
180 }
181 case Instruction::RETURN_VOID_BARRIER: {
182 PREAMBLE();
183 ANDROID_MEMBAR_STORE();
184 JValue result;
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200185 if (UNLIKELY(self->TestAllFlags())) {
186 CheckSuspend(self);
187 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200188 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200189 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200190 shadow_frame.GetMethod(), inst->GetDexPc(insns),
191 result);
192 }
193 return result;
194 }
195 case Instruction::RETURN: {
196 PREAMBLE();
197 JValue result;
198 result.SetJ(0);
199 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x()));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200200 if (UNLIKELY(self->TestAllFlags())) {
201 CheckSuspend(self);
202 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200203 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200204 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200205 shadow_frame.GetMethod(), inst->GetDexPc(insns),
206 result);
207 }
208 return result;
209 }
210 case Instruction::RETURN_WIDE: {
211 PREAMBLE();
212 JValue result;
213 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x()));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200214 if (UNLIKELY(self->TestAllFlags())) {
215 CheckSuspend(self);
216 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200217 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200218 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200219 shadow_frame.GetMethod(), inst->GetDexPc(insns),
220 result);
221 }
222 return result;
223 }
224 case Instruction::RETURN_OBJECT: {
225 PREAMBLE();
226 JValue result;
227 result.SetJ(0);
228 result.SetL(shadow_frame.GetVRegReference(inst->VRegA_11x()));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200229 if (UNLIKELY(self->TestAllFlags())) {
230 CheckSuspend(self);
231 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200232 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200233 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200234 shadow_frame.GetMethod(), inst->GetDexPc(insns),
235 result);
236 }
237 return result;
238 }
239 case Instruction::CONST_4: {
240 PREAMBLE();
241 uint4_t dst = inst->VRegA_11n();
242 int4_t val = inst->VRegB_11n();
243 shadow_frame.SetVReg(dst, val);
244 if (val == 0) {
245 shadow_frame.SetVRegReference(dst, NULL);
246 }
247 inst = inst->Next_1xx();
248 break;
249 }
250 case Instruction::CONST_16: {
251 PREAMBLE();
252 uint8_t dst = inst->VRegA_21s();
253 int16_t val = inst->VRegB_21s();
254 shadow_frame.SetVReg(dst, val);
255 if (val == 0) {
256 shadow_frame.SetVRegReference(dst, NULL);
257 }
258 inst = inst->Next_2xx();
259 break;
260 }
261 case Instruction::CONST: {
262 PREAMBLE();
263 uint8_t dst = inst->VRegA_31i();
264 int32_t val = inst->VRegB_31i();
265 shadow_frame.SetVReg(dst, val);
266 if (val == 0) {
267 shadow_frame.SetVRegReference(dst, NULL);
268 }
269 inst = inst->Next_3xx();
270 break;
271 }
272 case Instruction::CONST_HIGH16: {
273 PREAMBLE();
274 uint8_t dst = inst->VRegA_21h();
275 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
276 shadow_frame.SetVReg(dst, val);
277 if (val == 0) {
278 shadow_frame.SetVRegReference(dst, NULL);
279 }
280 inst = inst->Next_2xx();
281 break;
282 }
283 case Instruction::CONST_WIDE_16:
284 PREAMBLE();
285 shadow_frame.SetVRegLong(inst->VRegA_21s(), inst->VRegB_21s());
286 inst = inst->Next_2xx();
287 break;
288 case Instruction::CONST_WIDE_32:
289 PREAMBLE();
290 shadow_frame.SetVRegLong(inst->VRegA_31i(), inst->VRegB_31i());
291 inst = inst->Next_3xx();
292 break;
293 case Instruction::CONST_WIDE:
294 PREAMBLE();
295 shadow_frame.SetVRegLong(inst->VRegA_51l(), inst->VRegB_51l());
296 inst = inst->Next_51l();
297 break;
298 case Instruction::CONST_WIDE_HIGH16:
299 shadow_frame.SetVRegLong(inst->VRegA_21h(),
300 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
301 inst = inst->Next_2xx();
302 break;
303 case Instruction::CONST_STRING: {
304 PREAMBLE();
305 String* s = ResolveString(self, mh, inst->VRegB_21c());
306 if (UNLIKELY(s == NULL)) {
307 HANDLE_PENDING_EXCEPTION();
308 } else {
309 shadow_frame.SetVRegReference(inst->VRegA_21c(), s);
310 inst = inst->Next_2xx();
311 }
312 break;
313 }
314 case Instruction::CONST_STRING_JUMBO: {
315 PREAMBLE();
316 String* s = ResolveString(self, mh, inst->VRegB_31c());
317 if (UNLIKELY(s == NULL)) {
318 HANDLE_PENDING_EXCEPTION();
319 } else {
320 shadow_frame.SetVRegReference(inst->VRegA_31c(), s);
321 inst = inst->Next_3xx();
322 }
323 break;
324 }
325 case Instruction::CONST_CLASS: {
326 PREAMBLE();
327 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
328 self, false, do_access_check);
329 if (UNLIKELY(c == NULL)) {
330 HANDLE_PENDING_EXCEPTION();
331 } else {
332 shadow_frame.SetVRegReference(inst->VRegA_21c(), c);
333 inst = inst->Next_2xx();
334 }
335 break;
336 }
337 case Instruction::MONITOR_ENTER: {
338 PREAMBLE();
339 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x());
340 if (UNLIKELY(obj == NULL)) {
341 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
342 HANDLE_PENDING_EXCEPTION();
343 } else {
344 DoMonitorEnter(self, obj);
345 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
346 }
347 break;
348 }
349 case Instruction::MONITOR_EXIT: {
350 PREAMBLE();
351 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x());
352 if (UNLIKELY(obj == NULL)) {
353 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
354 HANDLE_PENDING_EXCEPTION();
355 } else {
356 DoMonitorExit(self, obj);
357 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
358 }
359 break;
360 }
361 case Instruction::CHECK_CAST: {
362 PREAMBLE();
363 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
364 self, false, do_access_check);
365 if (UNLIKELY(c == NULL)) {
366 HANDLE_PENDING_EXCEPTION();
367 } else {
368 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c());
369 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
370 ThrowClassCastException(c, obj->GetClass());
371 HANDLE_PENDING_EXCEPTION();
372 } else {
373 inst = inst->Next_2xx();
374 }
375 }
376 break;
377 }
378 case Instruction::INSTANCE_OF: {
379 PREAMBLE();
380 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
381 self, false, do_access_check);
382 if (UNLIKELY(c == NULL)) {
383 HANDLE_PENDING_EXCEPTION();
384 } else {
385 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c());
386 shadow_frame.SetVReg(inst->VRegA_22c(), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
387 inst = inst->Next_2xx();
388 }
389 break;
390 }
391 case Instruction::ARRAY_LENGTH: {
392 PREAMBLE();
393 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x());
394 if (UNLIKELY(array == NULL)) {
395 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
396 HANDLE_PENDING_EXCEPTION();
397 } else {
398 shadow_frame.SetVReg(inst->VRegA_12x(), array->AsArray()->GetLength());
399 inst = inst->Next_1xx();
400 }
401 break;
402 }
403 case Instruction::NEW_INSTANCE: {
404 PREAMBLE();
405 Object* obj = AllocObjectFromCode(inst->VRegB_21c(), shadow_frame.GetMethod(),
406 self, do_access_check);
407 if (UNLIKELY(obj == NULL)) {
408 HANDLE_PENDING_EXCEPTION();
409 } else {
410 shadow_frame.SetVRegReference(inst->VRegA_21c(), obj);
411 inst = inst->Next_2xx();
412 }
413 break;
414 }
415 case Instruction::NEW_ARRAY: {
416 PREAMBLE();
417 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c());
418 Object* obj = AllocArrayFromCode(inst->VRegC_22c(), shadow_frame.GetMethod(),
419 length, self, do_access_check);
420 if (UNLIKELY(obj == NULL)) {
421 HANDLE_PENDING_EXCEPTION();
422 } else {
423 shadow_frame.SetVRegReference(inst->VRegA_22c(), obj);
424 inst = inst->Next_2xx();
425 }
426 break;
427 }
428 case Instruction::FILLED_NEW_ARRAY: {
429 PREAMBLE();
430 bool success = DoFilledNewArray<false, do_access_check>(inst, shadow_frame,
431 self, &result_register);
432 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
433 break;
434 }
435 case Instruction::FILLED_NEW_ARRAY_RANGE: {
436 PREAMBLE();
437 bool success = DoFilledNewArray<true, do_access_check>(inst, shadow_frame,
438 self, &result_register);
439 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
440 break;
441 }
442 case Instruction::FILL_ARRAY_DATA: {
443 PREAMBLE();
444 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t());
445 if (UNLIKELY(obj == NULL)) {
446 ThrowNullPointerException(NULL, "null array in FILL_ARRAY_DATA");
447 HANDLE_PENDING_EXCEPTION();
448 break;
449 }
450 Array* array = obj->AsArray();
451 DCHECK(array->IsArrayInstance() && !array->IsObjectArray());
452 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
453 const Instruction::ArrayDataPayload* payload =
454 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
455 if (UNLIKELY(static_cast<int32_t>(payload->element_count) > array->GetLength())) {
456 self->ThrowNewExceptionF(shadow_frame.GetCurrentLocationForThrow(),
457 "Ljava/lang/ArrayIndexOutOfBoundsException;",
458 "failed FILL_ARRAY_DATA; length=%d, index=%d",
459 array->GetLength(), payload->element_count);
460 HANDLE_PENDING_EXCEPTION();
461 break;
462 }
463 uint32_t size_in_bytes = payload->element_count * payload->element_width;
464 memcpy(array->GetRawData(payload->element_width), payload->data, size_in_bytes);
465 inst = inst->Next_3xx();
466 break;
467 }
468 case Instruction::THROW: {
469 PREAMBLE();
470 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x());
471 if (UNLIKELY(exception == NULL)) {
472 ThrowNullPointerException(NULL, "throw with null exception");
473 } else {
474 self->SetException(shadow_frame.GetCurrentLocationForThrow(), exception->AsThrowable());
475 }
476 HANDLE_PENDING_EXCEPTION();
477 break;
478 }
479 case Instruction::GOTO: {
480 PREAMBLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200481 int8_t offset = inst->VRegA_10t();
482 if (IsBackwardBranch(offset)) {
483 if (UNLIKELY(self->TestAllFlags())) {
484 CheckSuspend(self);
485 }
486 }
487 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200488 break;
489 }
490 case Instruction::GOTO_16: {
491 PREAMBLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200492 int16_t offset = inst->VRegA_20t();
493 if (IsBackwardBranch(offset)) {
494 if (UNLIKELY(self->TestAllFlags())) {
495 CheckSuspend(self);
496 }
497 }
498 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200499 break;
500 }
501 case Instruction::GOTO_32: {
502 PREAMBLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200503 int32_t offset = inst->VRegA_30t();
504 if (IsBackwardBranch(offset)) {
505 if (UNLIKELY(self->TestAllFlags())) {
506 CheckSuspend(self);
507 }
508 }
509 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200510 break;
511 }
512 case Instruction::PACKED_SWITCH: {
513 PREAMBLE();
514 int32_t offset = DoPackedSwitch(inst, shadow_frame);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200515 if (IsBackwardBranch(offset)) {
516 if (UNLIKELY(self->TestAllFlags())) {
517 CheckSuspend(self);
518 }
519 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200520 inst = inst->RelativeAt(offset);
521 break;
522 }
523 case Instruction::SPARSE_SWITCH: {
524 PREAMBLE();
525 int32_t offset = DoSparseSwitch(inst, shadow_frame);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200526 if (IsBackwardBranch(offset)) {
527 if (UNLIKELY(self->TestAllFlags())) {
528 CheckSuspend(self);
529 }
530 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200531 inst = inst->RelativeAt(offset);
532 break;
533 }
534 case Instruction::CMPL_FLOAT: {
535 PREAMBLE();
536 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
537 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
538 int32_t result;
539 if (val1 > val2) {
540 result = 1;
541 } else if (val1 == val2) {
542 result = 0;
543 } else {
544 result = -1;
545 }
546 shadow_frame.SetVReg(inst->VRegA_23x(), result);
547 inst = inst->Next_2xx();
548 break;
549 }
550 case Instruction::CMPG_FLOAT: {
551 PREAMBLE();
552 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
553 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
554 int32_t result;
555 if (val1 < val2) {
556 result = -1;
557 } else if (val1 == val2) {
558 result = 0;
559 } else {
560 result = 1;
561 }
562 shadow_frame.SetVReg(inst->VRegA_23x(), result);
563 inst = inst->Next_2xx();
564 break;
565 }
566 case Instruction::CMPL_DOUBLE: {
567 PREAMBLE();
568 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
569 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
570 int32_t result;
571 if (val1 > val2) {
572 result = 1;
573 } else if (val1 == val2) {
574 result = 0;
575 } else {
576 result = -1;
577 }
578 shadow_frame.SetVReg(inst->VRegA_23x(), result);
579 inst = inst->Next_2xx();
580 break;
581 }
582
583 case Instruction::CMPG_DOUBLE: {
584 PREAMBLE();
585 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
586 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
587 int32_t result;
588 if (val1 < val2) {
589 result = -1;
590 } else if (val1 == val2) {
591 result = 0;
592 } else {
593 result = 1;
594 }
595 shadow_frame.SetVReg(inst->VRegA_23x(), result);
596 inst = inst->Next_2xx();
597 break;
598 }
599 case Instruction::CMP_LONG: {
600 PREAMBLE();
601 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
602 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
603 int32_t result;
604 if (val1 > val2) {
605 result = 1;
606 } else if (val1 == val2) {
607 result = 0;
608 } else {
609 result = -1;
610 }
611 shadow_frame.SetVReg(inst->VRegA_23x(), result);
612 inst = inst->Next_2xx();
613 break;
614 }
615 case Instruction::IF_EQ: {
616 PREAMBLE();
617 if (shadow_frame.GetVReg(inst->VRegA_22t()) == shadow_frame.GetVReg(inst->VRegB_22t())) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200618 int16_t offset = inst->VRegC_22t();
619 if (IsBackwardBranch(offset)) {
620 if (UNLIKELY(self->TestAllFlags())) {
621 CheckSuspend(self);
622 }
623 }
624 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200625 } else {
626 inst = inst->Next_2xx();
627 }
628 break;
629 }
630 case Instruction::IF_NE: {
631 PREAMBLE();
632 if (shadow_frame.GetVReg(inst->VRegA_22t()) != shadow_frame.GetVReg(inst->VRegB_22t())) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200633 int16_t offset = inst->VRegC_22t();
634 if (IsBackwardBranch(offset)) {
635 if (UNLIKELY(self->TestAllFlags())) {
636 CheckSuspend(self);
637 }
638 }
639 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200640 } else {
641 inst = inst->Next_2xx();
642 }
643 break;
644 }
645 case Instruction::IF_LT: {
646 PREAMBLE();
647 if (shadow_frame.GetVReg(inst->VRegA_22t()) < shadow_frame.GetVReg(inst->VRegB_22t())) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200648 int16_t offset = inst->VRegC_22t();
649 if (IsBackwardBranch(offset)) {
650 if (UNLIKELY(self->TestAllFlags())) {
651 CheckSuspend(self);
652 }
653 }
654 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200655 } else {
656 inst = inst->Next_2xx();
657 }
658 break;
659 }
660 case Instruction::IF_GE: {
661 PREAMBLE();
662 if (shadow_frame.GetVReg(inst->VRegA_22t()) >= shadow_frame.GetVReg(inst->VRegB_22t())) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200663 int16_t offset = inst->VRegC_22t();
664 if (IsBackwardBranch(offset)) {
665 if (UNLIKELY(self->TestAllFlags())) {
666 CheckSuspend(self);
667 }
668 }
669 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200670 } else {
671 inst = inst->Next_2xx();
672 }
673 break;
674 }
675 case Instruction::IF_GT: {
676 PREAMBLE();
677 if (shadow_frame.GetVReg(inst->VRegA_22t()) > shadow_frame.GetVReg(inst->VRegB_22t())) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200678 int16_t offset = inst->VRegC_22t();
679 if (IsBackwardBranch(offset)) {
680 if (UNLIKELY(self->TestAllFlags())) {
681 CheckSuspend(self);
682 }
683 }
684 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200685 } else {
686 inst = inst->Next_2xx();
687 }
688 break;
689 }
690 case Instruction::IF_LE: {
691 PREAMBLE();
692 if (shadow_frame.GetVReg(inst->VRegA_22t()) <= shadow_frame.GetVReg(inst->VRegB_22t())) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200693 int16_t offset = inst->VRegC_22t();
694 if (IsBackwardBranch(offset)) {
695 if (UNLIKELY(self->TestAllFlags())) {
696 CheckSuspend(self);
697 }
698 }
699 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200700 } else {
701 inst = inst->Next_2xx();
702 }
703 break;
704 }
705 case Instruction::IF_EQZ: {
706 PREAMBLE();
707 if (shadow_frame.GetVReg(inst->VRegA_21t()) == 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200708 int16_t offset = inst->VRegB_21t();
709 if (IsBackwardBranch(offset)) {
710 if (UNLIKELY(self->TestAllFlags())) {
711 CheckSuspend(self);
712 }
713 }
714 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200715 } else {
716 inst = inst->Next_2xx();
717 }
718 break;
719 }
720 case Instruction::IF_NEZ: {
721 PREAMBLE();
722 if (shadow_frame.GetVReg(inst->VRegA_21t()) != 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200723 int16_t offset = inst->VRegB_21t();
724 if (IsBackwardBranch(offset)) {
725 if (UNLIKELY(self->TestAllFlags())) {
726 CheckSuspend(self);
727 }
728 }
729 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200730 } else {
731 inst = inst->Next_2xx();
732 }
733 break;
734 }
735 case Instruction::IF_LTZ: {
736 PREAMBLE();
737 if (shadow_frame.GetVReg(inst->VRegA_21t()) < 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200738 int16_t offset = inst->VRegB_21t();
739 if (IsBackwardBranch(offset)) {
740 if (UNLIKELY(self->TestAllFlags())) {
741 CheckSuspend(self);
742 }
743 }
744 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200745 } else {
746 inst = inst->Next_2xx();
747 }
748 break;
749 }
750 case Instruction::IF_GEZ: {
751 PREAMBLE();
752 if (shadow_frame.GetVReg(inst->VRegA_21t()) >= 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200753 int16_t offset = inst->VRegB_21t();
754 if (IsBackwardBranch(offset)) {
755 if (UNLIKELY(self->TestAllFlags())) {
756 CheckSuspend(self);
757 }
758 }
759 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200760 } else {
761 inst = inst->Next_2xx();
762 }
763 break;
764 }
765 case Instruction::IF_GTZ: {
766 PREAMBLE();
767 if (shadow_frame.GetVReg(inst->VRegA_21t()) > 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200768 int16_t offset = inst->VRegB_21t();
769 if (IsBackwardBranch(offset)) {
770 if (UNLIKELY(self->TestAllFlags())) {
771 CheckSuspend(self);
772 }
773 }
774 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200775 } else {
776 inst = inst->Next_2xx();
777 }
778 break;
779 }
780 case Instruction::IF_LEZ: {
781 PREAMBLE();
782 if (shadow_frame.GetVReg(inst->VRegA_21t()) <= 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200783 int16_t offset = inst->VRegB_21t();
784 if (IsBackwardBranch(offset)) {
785 if (UNLIKELY(self->TestAllFlags())) {
786 CheckSuspend(self);
787 }
788 }
789 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200790 } else {
791 inst = inst->Next_2xx();
792 }
793 break;
794 }
795 case Instruction::AGET_BOOLEAN: {
796 PREAMBLE();
797 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
798 if (UNLIKELY(a == NULL)) {
799 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
800 HANDLE_PENDING_EXCEPTION();
801 break;
802 }
803 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
804 BooleanArray* array = a->AsBooleanArray();
805 if (LIKELY(array->IsValidIndex(index))) {
806 shadow_frame.SetVReg(inst->VRegA_23x(), array->GetData()[index]);
807 inst = inst->Next_2xx();
808 } else {
809 HANDLE_PENDING_EXCEPTION();
810 }
811 break;
812 }
813 case Instruction::AGET_BYTE: {
814 PREAMBLE();
815 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
816 if (UNLIKELY(a == NULL)) {
817 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
818 HANDLE_PENDING_EXCEPTION();
819 break;
820 }
821 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
822 ByteArray* array = a->AsByteArray();
823 if (LIKELY(array->IsValidIndex(index))) {
824 shadow_frame.SetVReg(inst->VRegA_23x(), array->GetData()[index]);
825 inst = inst->Next_2xx();
826 } else {
827 HANDLE_PENDING_EXCEPTION();
828 }
829 break;
830 }
831 case Instruction::AGET_CHAR: {
832 PREAMBLE();
833 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
834 if (UNLIKELY(a == NULL)) {
835 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
836 HANDLE_PENDING_EXCEPTION();
837 break;
838 }
839 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
840 CharArray* array = a->AsCharArray();
841 if (LIKELY(array->IsValidIndex(index))) {
842 shadow_frame.SetVReg(inst->VRegA_23x(), array->GetData()[index]);
843 inst = inst->Next_2xx();
844 } else {
845 HANDLE_PENDING_EXCEPTION();
846 }
847 break;
848 }
849 case Instruction::AGET_SHORT: {
850 PREAMBLE();
851 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
852 if (UNLIKELY(a == NULL)) {
853 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
854 HANDLE_PENDING_EXCEPTION();
855 break;
856 }
857 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
858 ShortArray* array = a->AsShortArray();
859 if (LIKELY(array->IsValidIndex(index))) {
860 shadow_frame.SetVReg(inst->VRegA_23x(), array->GetData()[index]);
861 inst = inst->Next_2xx();
862 } else {
863 HANDLE_PENDING_EXCEPTION();
864 }
865 break;
866 }
867 case Instruction::AGET: {
868 PREAMBLE();
869 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
870 if (UNLIKELY(a == NULL)) {
871 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
872 HANDLE_PENDING_EXCEPTION();
873 break;
874 }
875 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
876 IntArray* array = a->AsIntArray();
877 if (LIKELY(array->IsValidIndex(index))) {
878 shadow_frame.SetVReg(inst->VRegA_23x(), array->GetData()[index]);
879 inst = inst->Next_2xx();
880 } else {
881 HANDLE_PENDING_EXCEPTION();
882 }
883 break;
884 }
885 case Instruction::AGET_WIDE: {
886 PREAMBLE();
887 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
888 if (UNLIKELY(a == NULL)) {
889 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
890 HANDLE_PENDING_EXCEPTION();
891 break;
892 }
893 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
894 LongArray* array = a->AsLongArray();
895 if (LIKELY(array->IsValidIndex(index))) {
896 shadow_frame.SetVRegLong(inst->VRegA_23x(), array->GetData()[index]);
897 inst = inst->Next_2xx();
898 } else {
899 HANDLE_PENDING_EXCEPTION();
900 }
901 break;
902 }
903 case Instruction::AGET_OBJECT: {
904 PREAMBLE();
905 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
906 if (UNLIKELY(a == NULL)) {
907 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
908 HANDLE_PENDING_EXCEPTION();
909 break;
910 }
911 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
912 ObjectArray<Object>* array = a->AsObjectArray<Object>();
913 if (LIKELY(array->IsValidIndex(index))) {
914 shadow_frame.SetVRegReference(inst->VRegA_23x(), array->GetWithoutChecks(index));
915 inst = inst->Next_2xx();
916 } else {
917 HANDLE_PENDING_EXCEPTION();
918 }
919 break;
920 }
921 case Instruction::APUT_BOOLEAN: {
922 PREAMBLE();
923 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
924 if (UNLIKELY(a == NULL)) {
925 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
926 HANDLE_PENDING_EXCEPTION();
927 break;
928 }
929 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x());
930 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
931 BooleanArray* array = a->AsBooleanArray();
932 if (LIKELY(array->IsValidIndex(index))) {
933 array->GetData()[index] = val;
934 inst = inst->Next_2xx();
935 } else {
936 HANDLE_PENDING_EXCEPTION();
937 }
938 break;
939 }
940 case Instruction::APUT_BYTE: {
941 PREAMBLE();
942 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
943 if (UNLIKELY(a == NULL)) {
944 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
945 HANDLE_PENDING_EXCEPTION();
946 break;
947 }
948 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x());
949 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
950 ByteArray* array = a->AsByteArray();
951 if (LIKELY(array->IsValidIndex(index))) {
952 array->GetData()[index] = val;
953 inst = inst->Next_2xx();
954 } else {
955 HANDLE_PENDING_EXCEPTION();
956 }
957 break;
958 }
959 case Instruction::APUT_CHAR: {
960 PREAMBLE();
961 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
962 if (UNLIKELY(a == NULL)) {
963 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
964 HANDLE_PENDING_EXCEPTION();
965 break;
966 }
967 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x());
968 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
969 CharArray* array = a->AsCharArray();
970 if (LIKELY(array->IsValidIndex(index))) {
971 array->GetData()[index] = val;
972 inst = inst->Next_2xx();
973 } else {
974 HANDLE_PENDING_EXCEPTION();
975 }
976 break;
977 }
978 case Instruction::APUT_SHORT: {
979 PREAMBLE();
980 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
981 if (UNLIKELY(a == NULL)) {
982 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
983 HANDLE_PENDING_EXCEPTION();
984 break;
985 }
986 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x());
987 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
988 ShortArray* array = a->AsShortArray();
989 if (LIKELY(array->IsValidIndex(index))) {
990 array->GetData()[index] = val;
991 inst = inst->Next_2xx();
992 } else {
993 HANDLE_PENDING_EXCEPTION();
994 }
995 break;
996 }
997 case Instruction::APUT: {
998 PREAMBLE();
999 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1000 if (UNLIKELY(a == NULL)) {
1001 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1002 HANDLE_PENDING_EXCEPTION();
1003 break;
1004 }
1005 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x());
1006 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1007 IntArray* array = a->AsIntArray();
1008 if (LIKELY(array->IsValidIndex(index))) {
1009 array->GetData()[index] = val;
1010 inst = inst->Next_2xx();
1011 } else {
1012 HANDLE_PENDING_EXCEPTION();
1013 }
1014 break;
1015 }
1016 case Instruction::APUT_WIDE: {
1017 PREAMBLE();
1018 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1019 if (UNLIKELY(a == NULL)) {
1020 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1021 HANDLE_PENDING_EXCEPTION();
1022 break;
1023 }
1024 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x());
1025 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1026 LongArray* array = a->AsLongArray();
1027 if (LIKELY(array->IsValidIndex(index))) {
1028 array->GetData()[index] = val;
1029 inst = inst->Next_2xx();
1030 } else {
1031 HANDLE_PENDING_EXCEPTION();
1032 }
1033 break;
1034 }
1035 case Instruction::APUT_OBJECT: {
1036 PREAMBLE();
1037 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1038 if (UNLIKELY(a == NULL)) {
1039 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1040 HANDLE_PENDING_EXCEPTION();
1041 break;
1042 }
1043 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1044 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x());
1045 ObjectArray<Object>* array = a->AsObjectArray<Object>();
1046 if (LIKELY(array->IsValidIndex(index) && array->CheckAssignable(val))) {
1047 array->SetWithoutChecks(index, val);
1048 inst = inst->Next_2xx();
1049 } else {
1050 HANDLE_PENDING_EXCEPTION();
1051 }
1052 break;
1053 }
1054 case Instruction::IGET_BOOLEAN: {
1055 PREAMBLE();
1056 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst);
1057 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1058 break;
1059 }
1060 case Instruction::IGET_BYTE: {
1061 PREAMBLE();
1062 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst);
1063 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1064 break;
1065 }
1066 case Instruction::IGET_CHAR: {
1067 PREAMBLE();
1068 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst);
1069 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1070 break;
1071 }
1072 case Instruction::IGET_SHORT: {
1073 PREAMBLE();
1074 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst);
1075 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1076 break;
1077 }
1078 case Instruction::IGET: {
1079 PREAMBLE();
1080 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst);
1081 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1082 break;
1083 }
1084 case Instruction::IGET_WIDE: {
1085 PREAMBLE();
1086 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst);
1087 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1088 break;
1089 }
1090 case Instruction::IGET_OBJECT: {
1091 PREAMBLE();
1092 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst);
1093 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1094 break;
1095 }
1096 case Instruction::IGET_QUICK: {
1097 PREAMBLE();
1098 bool success = DoIGetQuick<Primitive::kPrimInt>(self, shadow_frame, inst);
1099 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1100 break;
1101 }
1102 case Instruction::IGET_WIDE_QUICK: {
1103 PREAMBLE();
1104 bool success = DoIGetQuick<Primitive::kPrimLong>(self, shadow_frame, inst);
1105 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1106 break;
1107 }
1108 case Instruction::IGET_OBJECT_QUICK: {
1109 PREAMBLE();
1110 bool success = DoIGetQuick<Primitive::kPrimNot>(self, shadow_frame, inst);
1111 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1112 break;
1113 }
1114 case Instruction::SGET_BOOLEAN: {
1115 PREAMBLE();
1116 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst);
1117 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1118 break;
1119 }
1120 case Instruction::SGET_BYTE: {
1121 PREAMBLE();
1122 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst);
1123 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1124 break;
1125 }
1126 case Instruction::SGET_CHAR: {
1127 PREAMBLE();
1128 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst);
1129 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1130 break;
1131 }
1132 case Instruction::SGET_SHORT: {
1133 PREAMBLE();
1134 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst);
1135 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1136 break;
1137 }
1138 case Instruction::SGET: {
1139 PREAMBLE();
1140 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst);
1141 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1142 break;
1143 }
1144 case Instruction::SGET_WIDE: {
1145 PREAMBLE();
1146 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst);
1147 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1148 break;
1149 }
1150 case Instruction::SGET_OBJECT: {
1151 PREAMBLE();
1152 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst);
1153 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1154 break;
1155 }
1156 case Instruction::IPUT_BOOLEAN: {
1157 PREAMBLE();
1158 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst);
1159 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1160 break;
1161 }
1162 case Instruction::IPUT_BYTE: {
1163 PREAMBLE();
1164 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst);
1165 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1166 break;
1167 }
1168 case Instruction::IPUT_CHAR: {
1169 PREAMBLE();
1170 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst);
1171 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1172 break;
1173 }
1174 case Instruction::IPUT_SHORT: {
1175 PREAMBLE();
1176 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst);
1177 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1178 break;
1179 }
1180 case Instruction::IPUT: {
1181 PREAMBLE();
1182 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst);
1183 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1184 break;
1185 }
1186 case Instruction::IPUT_WIDE: {
1187 PREAMBLE();
1188 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst);
1189 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1190 break;
1191 }
1192 case Instruction::IPUT_OBJECT: {
1193 PREAMBLE();
1194 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst);
1195 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1196 break;
1197 }
1198 case Instruction::IPUT_QUICK: {
1199 PREAMBLE();
1200 bool success = DoIPutQuick<Primitive::kPrimInt>(self, shadow_frame, inst);
1201 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1202 break;
1203 }
1204 case Instruction::IPUT_WIDE_QUICK: {
1205 PREAMBLE();
1206 bool success = DoIPutQuick<Primitive::kPrimLong>(self, shadow_frame, inst);
1207 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1208 break;
1209 }
1210 case Instruction::IPUT_OBJECT_QUICK: {
1211 PREAMBLE();
1212 bool success = DoIPutQuick<Primitive::kPrimNot>(self, shadow_frame, inst);
1213 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1214 break;
1215 }
1216 case Instruction::SPUT_BOOLEAN: {
1217 PREAMBLE();
1218 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst);
1219 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1220 break;
1221 }
1222 case Instruction::SPUT_BYTE: {
1223 PREAMBLE();
1224 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst);
1225 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1226 break;
1227 }
1228 case Instruction::SPUT_CHAR: {
1229 PREAMBLE();
1230 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst);
1231 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1232 break;
1233 }
1234 case Instruction::SPUT_SHORT: {
1235 PREAMBLE();
1236 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst);
1237 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1238 break;
1239 }
1240 case Instruction::SPUT: {
1241 PREAMBLE();
1242 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst);
1243 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1244 break;
1245 }
1246 case Instruction::SPUT_WIDE: {
1247 PREAMBLE();
1248 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst);
1249 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1250 break;
1251 }
1252 case Instruction::SPUT_OBJECT: {
1253 PREAMBLE();
1254 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst);
1255 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1256 break;
1257 }
1258 case Instruction::INVOKE_VIRTUAL: {
1259 PREAMBLE();
1260 bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, &result_register);
1261 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1262 break;
1263 }
1264 case Instruction::INVOKE_VIRTUAL_RANGE: {
1265 PREAMBLE();
1266 bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, &result_register);
1267 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1268 break;
1269 }
1270 case Instruction::INVOKE_SUPER: {
1271 PREAMBLE();
1272 bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, &result_register);
1273 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1274 break;
1275 }
1276 case Instruction::INVOKE_SUPER_RANGE: {
1277 PREAMBLE();
1278 bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, &result_register);
1279 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1280 break;
1281 }
1282 case Instruction::INVOKE_DIRECT: {
1283 PREAMBLE();
1284 bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, &result_register);
1285 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1286 break;
1287 }
1288 case Instruction::INVOKE_DIRECT_RANGE: {
1289 PREAMBLE();
1290 bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, &result_register);
1291 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1292 break;
1293 }
1294 case Instruction::INVOKE_INTERFACE: {
1295 PREAMBLE();
1296 bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, &result_register);
1297 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1298 break;
1299 }
1300 case Instruction::INVOKE_INTERFACE_RANGE: {
1301 PREAMBLE();
1302 bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, &result_register);
1303 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1304 break;
1305 }
1306 case Instruction::INVOKE_STATIC: {
1307 PREAMBLE();
1308 bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, &result_register);
1309 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1310 break;
1311 }
1312 case Instruction::INVOKE_STATIC_RANGE: {
1313 PREAMBLE();
1314 bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, &result_register);
1315 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1316 break;
1317 }
1318 case Instruction::INVOKE_VIRTUAL_QUICK: {
1319 PREAMBLE();
1320 bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, &result_register);
1321 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1322 break;
1323 }
1324 case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: {
1325 PREAMBLE();
1326 bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, &result_register);
1327 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1328 break;
1329 }
1330 case Instruction::NEG_INT:
1331 PREAMBLE();
1332 shadow_frame.SetVReg(inst->VRegA_12x(), -shadow_frame.GetVReg(inst->VRegB_12x()));
1333 inst = inst->Next_1xx();
1334 break;
1335 case Instruction::NOT_INT:
1336 PREAMBLE();
1337 shadow_frame.SetVReg(inst->VRegA_12x(), ~shadow_frame.GetVReg(inst->VRegB_12x()));
1338 inst = inst->Next_1xx();
1339 break;
1340 case Instruction::NEG_LONG:
1341 PREAMBLE();
1342 shadow_frame.SetVRegLong(inst->VRegA_12x(), -shadow_frame.GetVRegLong(inst->VRegB_12x()));
1343 inst = inst->Next_1xx();
1344 break;
1345 case Instruction::NOT_LONG:
1346 PREAMBLE();
1347 shadow_frame.SetVRegLong(inst->VRegA_12x(), ~shadow_frame.GetVRegLong(inst->VRegB_12x()));
1348 inst = inst->Next_1xx();
1349 break;
1350 case Instruction::NEG_FLOAT:
1351 PREAMBLE();
1352 shadow_frame.SetVRegFloat(inst->VRegA_12x(), -shadow_frame.GetVRegFloat(inst->VRegB_12x()));
1353 inst = inst->Next_1xx();
1354 break;
1355 case Instruction::NEG_DOUBLE:
1356 PREAMBLE();
1357 shadow_frame.SetVRegDouble(inst->VRegA_12x(), -shadow_frame.GetVRegDouble(inst->VRegB_12x()));
1358 inst = inst->Next_1xx();
1359 break;
1360 case Instruction::INT_TO_LONG:
1361 PREAMBLE();
1362 shadow_frame.SetVRegLong(inst->VRegA_12x(), shadow_frame.GetVReg(inst->VRegB_12x()));
1363 inst = inst->Next_1xx();
1364 break;
1365 case Instruction::INT_TO_FLOAT:
1366 PREAMBLE();
1367 shadow_frame.SetVRegFloat(inst->VRegA_12x(), shadow_frame.GetVReg(inst->VRegB_12x()));
1368 inst = inst->Next_1xx();
1369 break;
1370 case Instruction::INT_TO_DOUBLE:
1371 PREAMBLE();
1372 shadow_frame.SetVRegDouble(inst->VRegA_12x(), shadow_frame.GetVReg(inst->VRegB_12x()));
1373 inst = inst->Next_1xx();
1374 break;
1375 case Instruction::LONG_TO_INT:
1376 PREAMBLE();
1377 shadow_frame.SetVReg(inst->VRegA_12x(), shadow_frame.GetVRegLong(inst->VRegB_12x()));
1378 inst = inst->Next_1xx();
1379 break;
1380 case Instruction::LONG_TO_FLOAT:
1381 PREAMBLE();
1382 shadow_frame.SetVRegFloat(inst->VRegA_12x(), shadow_frame.GetVRegLong(inst->VRegB_12x()));
1383 inst = inst->Next_1xx();
1384 break;
1385 case Instruction::LONG_TO_DOUBLE:
1386 PREAMBLE();
1387 shadow_frame.SetVRegDouble(inst->VRegA_12x(), shadow_frame.GetVRegLong(inst->VRegB_12x()));
1388 inst = inst->Next_1xx();
1389 break;
1390 case Instruction::FLOAT_TO_INT: {
1391 PREAMBLE();
1392 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x());
1393 int32_t result;
1394 if (val != val) {
1395 result = 0;
1396 } else if (val > static_cast<float>(kMaxInt)) {
1397 result = kMaxInt;
1398 } else if (val < static_cast<float>(kMinInt)) {
1399 result = kMinInt;
1400 } else {
1401 result = val;
1402 }
1403 shadow_frame.SetVReg(inst->VRegA_12x(), result);
1404 inst = inst->Next_1xx();
1405 break;
1406 }
1407 case Instruction::FLOAT_TO_LONG: {
1408 PREAMBLE();
1409 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x());
1410 int64_t result;
1411 if (val != val) {
1412 result = 0;
1413 } else if (val > static_cast<float>(kMaxLong)) {
1414 result = kMaxLong;
1415 } else if (val < static_cast<float>(kMinLong)) {
1416 result = kMinLong;
1417 } else {
1418 result = val;
1419 }
1420 shadow_frame.SetVRegLong(inst->VRegA_12x(), result);
1421 inst = inst->Next_1xx();
1422 break;
1423 }
1424 case Instruction::FLOAT_TO_DOUBLE:
1425 PREAMBLE();
1426 shadow_frame.SetVRegDouble(inst->VRegA_12x(), shadow_frame.GetVRegFloat(inst->VRegB_12x()));
1427 inst = inst->Next_1xx();
1428 break;
1429 case Instruction::DOUBLE_TO_INT: {
1430 PREAMBLE();
1431 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x());
1432 int32_t result;
1433 if (val != val) {
1434 result = 0;
1435 } else if (val > static_cast<double>(kMaxInt)) {
1436 result = kMaxInt;
1437 } else if (val < static_cast<double>(kMinInt)) {
1438 result = kMinInt;
1439 } else {
1440 result = val;
1441 }
1442 shadow_frame.SetVReg(inst->VRegA_12x(), result);
1443 inst = inst->Next_1xx();
1444 break;
1445 }
1446 case Instruction::DOUBLE_TO_LONG: {
1447 PREAMBLE();
1448 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x());
1449 int64_t result;
1450 if (val != val) {
1451 result = 0;
1452 } else if (val > static_cast<double>(kMaxLong)) {
1453 result = kMaxLong;
1454 } else if (val < static_cast<double>(kMinLong)) {
1455 result = kMinLong;
1456 } else {
1457 result = val;
1458 }
1459 shadow_frame.SetVRegLong(inst->VRegA_12x(), result);
1460 inst = inst->Next_1xx();
1461 break;
1462 }
1463 case Instruction::DOUBLE_TO_FLOAT:
1464 PREAMBLE();
1465 shadow_frame.SetVRegFloat(inst->VRegA_12x(), shadow_frame.GetVRegDouble(inst->VRegB_12x()));
1466 inst = inst->Next_1xx();
1467 break;
1468 case Instruction::INT_TO_BYTE:
1469 PREAMBLE();
1470 shadow_frame.SetVReg(inst->VRegA_12x(),
1471 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x())));
1472 inst = inst->Next_1xx();
1473 break;
1474 case Instruction::INT_TO_CHAR:
1475 PREAMBLE();
1476 shadow_frame.SetVReg(inst->VRegA_12x(),
1477 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x())));
1478 inst = inst->Next_1xx();
1479 break;
1480 case Instruction::INT_TO_SHORT:
1481 PREAMBLE();
1482 shadow_frame.SetVReg(inst->VRegA_12x(),
1483 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x())));
1484 inst = inst->Next_1xx();
1485 break;
1486 case Instruction::ADD_INT:
1487 PREAMBLE();
1488 shadow_frame.SetVReg(inst->VRegA_23x(),
1489 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();
1495 shadow_frame.SetVReg(inst->VRegA_23x(),
1496 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();
1502 shadow_frame.SetVReg(inst->VRegA_23x(),
1503 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();
1509 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(),
1510 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();
1517 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(),
1518 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();
1525 shadow_frame.SetVReg(inst->VRegA_23x(),
1526 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();
1532 shadow_frame.SetVReg(inst->VRegA_23x(),
1533 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();
1539 shadow_frame.SetVReg(inst->VRegA_23x(),
1540 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();
1546 shadow_frame.SetVReg(inst->VRegA_23x(),
1547 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();
1553 shadow_frame.SetVReg(inst->VRegA_23x(),
1554 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();
1560 shadow_frame.SetVReg(inst->VRegA_23x(),
1561 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();
1567 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1568 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();
1574 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1575 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();
1581 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1582 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();
1588 DoLongDivide(shadow_frame, inst->VRegA_23x(),
1589 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();
1595 DoLongRemainder(shadow_frame, inst->VRegA_23x(),
1596 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();
1602 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1603 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();
1609 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1610 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();
1616 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1617 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();
1623 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1624 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();
1630 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1631 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();
1637 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1638 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();
1644 shadow_frame.SetVRegFloat(inst->VRegA_23x(),
1645 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();
1651 shadow_frame.SetVRegFloat(inst->VRegA_23x(),
1652 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();
1658 shadow_frame.SetVRegFloat(inst->VRegA_23x(),
1659 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();
1665 shadow_frame.SetVRegFloat(inst->VRegA_23x(),
1666 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();
1672 shadow_frame.SetVRegFloat(inst->VRegA_23x(),
1673 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();
1679 shadow_frame.SetVRegDouble(inst->VRegA_23x(),
1680 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();
1686 shadow_frame.SetVRegDouble(inst->VRegA_23x(),
1687 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();
1693 shadow_frame.SetVRegDouble(inst->VRegA_23x(),
1694 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();
1700 shadow_frame.SetVRegDouble(inst->VRegA_23x(),
1701 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();
1707 shadow_frame.SetVRegDouble(inst->VRegA_23x(),
1708 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();
1714 uint4_t vregA = inst->VRegA_12x();
1715 shadow_frame.SetVReg(vregA,
1716 shadow_frame.GetVReg(vregA) +
1717 shadow_frame.GetVReg(inst->VRegB_12x()));
1718 inst = inst->Next_1xx();
1719 break;
1720 }
1721 case Instruction::SUB_INT_2ADDR: {
1722 PREAMBLE();
1723 uint4_t vregA = inst->VRegA_12x();
1724 shadow_frame.SetVReg(vregA,
1725 shadow_frame.GetVReg(vregA) -
1726 shadow_frame.GetVReg(inst->VRegB_12x()));
1727 inst = inst->Next_1xx();
1728 break;
1729 }
1730 case Instruction::MUL_INT_2ADDR: {
1731 PREAMBLE();
1732 uint4_t vregA = inst->VRegA_12x();
1733 shadow_frame.SetVReg(vregA,
1734 shadow_frame.GetVReg(vregA) *
1735 shadow_frame.GetVReg(inst->VRegB_12x()));
1736 inst = inst->Next_1xx();
1737 break;
1738 }
1739 case Instruction::DIV_INT_2ADDR: {
1740 PREAMBLE();
1741 uint4_t vregA = inst->VRegA_12x();
1742 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
1743 shadow_frame.GetVReg(inst->VRegB_12x()));
1744 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx);
1745 break;
1746 }
1747 case Instruction::REM_INT_2ADDR: {
1748 PREAMBLE();
1749 uint4_t vregA = inst->VRegA_12x();
1750 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
1751 shadow_frame.GetVReg(inst->VRegB_12x()));
1752 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx);
1753 break;
1754 }
1755 case Instruction::SHL_INT_2ADDR: {
1756 PREAMBLE();
1757 uint4_t vregA = inst->VRegA_12x();
1758 shadow_frame.SetVReg(vregA,
1759 shadow_frame.GetVReg(vregA) <<
1760 (shadow_frame.GetVReg(inst->VRegB_12x()) & 0x1f));
1761 inst = inst->Next_1xx();
1762 break;
1763 }
1764 case Instruction::SHR_INT_2ADDR: {
1765 PREAMBLE();
1766 uint4_t vregA = inst->VRegA_12x();
1767 shadow_frame.SetVReg(vregA,
1768 shadow_frame.GetVReg(vregA) >>
1769 (shadow_frame.GetVReg(inst->VRegB_12x()) & 0x1f));
1770 inst = inst->Next_1xx();
1771 break;
1772 }
1773 case Instruction::USHR_INT_2ADDR: {
1774 PREAMBLE();
1775 uint4_t vregA = inst->VRegA_12x();
1776 shadow_frame.SetVReg(vregA,
1777 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
1778 (shadow_frame.GetVReg(inst->VRegB_12x()) & 0x1f));
1779 inst = inst->Next_1xx();
1780 break;
1781 }
1782 case Instruction::AND_INT_2ADDR: {
1783 PREAMBLE();
1784 uint4_t vregA = inst->VRegA_12x();
1785 shadow_frame.SetVReg(vregA,
1786 shadow_frame.GetVReg(vregA) &
1787 shadow_frame.GetVReg(inst->VRegB_12x()));
1788 inst = inst->Next_1xx();
1789 break;
1790 }
1791 case Instruction::OR_INT_2ADDR: {
1792 PREAMBLE();
1793 uint4_t vregA = inst->VRegA_12x();
1794 shadow_frame.SetVReg(vregA,
1795 shadow_frame.GetVReg(vregA) |
1796 shadow_frame.GetVReg(inst->VRegB_12x()));
1797 inst = inst->Next_1xx();
1798 break;
1799 }
1800 case Instruction::XOR_INT_2ADDR: {
1801 PREAMBLE();
1802 uint4_t vregA = inst->VRegA_12x();
1803 shadow_frame.SetVReg(vregA,
1804 shadow_frame.GetVReg(vregA) ^
1805 shadow_frame.GetVReg(inst->VRegB_12x()));
1806 inst = inst->Next_1xx();
1807 break;
1808 }
1809 case Instruction::ADD_LONG_2ADDR: {
1810 PREAMBLE();
1811 uint4_t vregA = inst->VRegA_12x();
1812 shadow_frame.SetVRegLong(vregA,
1813 shadow_frame.GetVRegLong(vregA) +
1814 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1815 inst = inst->Next_1xx();
1816 break;
1817 }
1818 case Instruction::SUB_LONG_2ADDR: {
1819 PREAMBLE();
1820 uint4_t vregA = inst->VRegA_12x();
1821 shadow_frame.SetVRegLong(vregA,
1822 shadow_frame.GetVRegLong(vregA) -
1823 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1824 inst = inst->Next_1xx();
1825 break;
1826 }
1827 case Instruction::MUL_LONG_2ADDR: {
1828 PREAMBLE();
1829 uint4_t vregA = inst->VRegA_12x();
1830 shadow_frame.SetVRegLong(vregA,
1831 shadow_frame.GetVRegLong(vregA) *
1832 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1833 inst = inst->Next_1xx();
1834 break;
1835 }
1836 case Instruction::DIV_LONG_2ADDR: {
1837 PREAMBLE();
1838 uint4_t vregA = inst->VRegA_12x();
1839 DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
1840 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1841 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
1842 break;
1843 }
1844 case Instruction::REM_LONG_2ADDR: {
1845 PREAMBLE();
1846 uint4_t vregA = inst->VRegA_12x();
1847 DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
1848 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1849 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
1850 break;
1851 }
1852 case Instruction::AND_LONG_2ADDR: {
1853 PREAMBLE();
1854 uint4_t vregA = inst->VRegA_12x();
1855 shadow_frame.SetVRegLong(vregA,
1856 shadow_frame.GetVRegLong(vregA) &
1857 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1858 inst = inst->Next_1xx();
1859 break;
1860 }
1861 case Instruction::OR_LONG_2ADDR: {
1862 PREAMBLE();
1863 uint4_t vregA = inst->VRegA_12x();
1864 shadow_frame.SetVRegLong(vregA,
1865 shadow_frame.GetVRegLong(vregA) |
1866 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1867 inst = inst->Next_1xx();
1868 break;
1869 }
1870 case Instruction::XOR_LONG_2ADDR: {
1871 PREAMBLE();
1872 uint4_t vregA = inst->VRegA_12x();
1873 shadow_frame.SetVRegLong(vregA,
1874 shadow_frame.GetVRegLong(vregA) ^
1875 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1876 inst = inst->Next_1xx();
1877 break;
1878 }
1879 case Instruction::SHL_LONG_2ADDR: {
1880 PREAMBLE();
1881 uint4_t vregA = inst->VRegA_12x();
1882 shadow_frame.SetVRegLong(vregA,
1883 shadow_frame.GetVRegLong(vregA) <<
1884 (shadow_frame.GetVReg(inst->VRegB_12x()) & 0x3f));
1885 inst = inst->Next_1xx();
1886 break;
1887 }
1888 case Instruction::SHR_LONG_2ADDR: {
1889 PREAMBLE();
1890 uint4_t vregA = inst->VRegA_12x();
1891 shadow_frame.SetVRegLong(vregA,
1892 shadow_frame.GetVRegLong(vregA) >>
1893 (shadow_frame.GetVReg(inst->VRegB_12x()) & 0x3f));
1894 inst = inst->Next_1xx();
1895 break;
1896 }
1897 case Instruction::USHR_LONG_2ADDR: {
1898 PREAMBLE();
1899 uint4_t vregA = inst->VRegA_12x();
1900 shadow_frame.SetVRegLong(vregA,
1901 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
1902 (shadow_frame.GetVReg(inst->VRegB_12x()) & 0x3f));
1903 inst = inst->Next_1xx();
1904 break;
1905 }
1906 case Instruction::ADD_FLOAT_2ADDR: {
1907 PREAMBLE();
1908 uint4_t vregA = inst->VRegA_12x();
1909 shadow_frame.SetVRegFloat(vregA,
1910 shadow_frame.GetVRegFloat(vregA) +
1911 shadow_frame.GetVRegFloat(inst->VRegB_12x()));
1912 inst = inst->Next_1xx();
1913 break;
1914 }
1915 case Instruction::SUB_FLOAT_2ADDR: {
1916 PREAMBLE();
1917 uint4_t vregA = inst->VRegA_12x();
1918 shadow_frame.SetVRegFloat(vregA,
1919 shadow_frame.GetVRegFloat(vregA) -
1920 shadow_frame.GetVRegFloat(inst->VRegB_12x()));
1921 inst = inst->Next_1xx();
1922 break;
1923 }
1924 case Instruction::MUL_FLOAT_2ADDR: {
1925 PREAMBLE();
1926 uint4_t vregA = inst->VRegA_12x();
1927 shadow_frame.SetVRegFloat(vregA,
1928 shadow_frame.GetVRegFloat(vregA) *
1929 shadow_frame.GetVRegFloat(inst->VRegB_12x()));
1930 inst = inst->Next_1xx();
1931 break;
1932 }
1933 case Instruction::DIV_FLOAT_2ADDR: {
1934 PREAMBLE();
1935 uint4_t vregA = inst->VRegA_12x();
1936 shadow_frame.SetVRegFloat(vregA,
1937 shadow_frame.GetVRegFloat(vregA) /
1938 shadow_frame.GetVRegFloat(inst->VRegB_12x()));
1939 inst = inst->Next_1xx();
1940 break;
1941 }
1942 case Instruction::REM_FLOAT_2ADDR: {
1943 PREAMBLE();
1944 uint4_t vregA = inst->VRegA_12x();
1945 shadow_frame.SetVRegFloat(vregA,
1946 fmodf(shadow_frame.GetVRegFloat(vregA),
1947 shadow_frame.GetVRegFloat(inst->VRegB_12x())));
1948 inst = inst->Next_1xx();
1949 break;
1950 }
1951 case Instruction::ADD_DOUBLE_2ADDR: {
1952 PREAMBLE();
1953 uint4_t vregA = inst->VRegA_12x();
1954 shadow_frame.SetVRegDouble(vregA,
1955 shadow_frame.GetVRegDouble(vregA) +
1956 shadow_frame.GetVRegDouble(inst->VRegB_12x()));
1957 inst = inst->Next_1xx();
1958 break;
1959 }
1960 case Instruction::SUB_DOUBLE_2ADDR: {
1961 PREAMBLE();
1962 uint4_t vregA = inst->VRegA_12x();
1963 shadow_frame.SetVRegDouble(vregA,
1964 shadow_frame.GetVRegDouble(vregA) -
1965 shadow_frame.GetVRegDouble(inst->VRegB_12x()));
1966 inst = inst->Next_1xx();
1967 break;
1968 }
1969 case Instruction::MUL_DOUBLE_2ADDR: {
1970 PREAMBLE();
1971 uint4_t vregA = inst->VRegA_12x();
1972 shadow_frame.SetVRegDouble(vregA,
1973 shadow_frame.GetVRegDouble(vregA) *
1974 shadow_frame.GetVRegDouble(inst->VRegB_12x()));
1975 inst = inst->Next_1xx();
1976 break;
1977 }
1978 case Instruction::DIV_DOUBLE_2ADDR: {
1979 PREAMBLE();
1980 uint4_t vregA = inst->VRegA_12x();
1981 shadow_frame.SetVRegDouble(vregA,
1982 shadow_frame.GetVRegDouble(vregA) /
1983 shadow_frame.GetVRegDouble(inst->VRegB_12x()));
1984 inst = inst->Next_1xx();
1985 break;
1986 }
1987 case Instruction::REM_DOUBLE_2ADDR: {
1988 PREAMBLE();
1989 uint4_t vregA = inst->VRegA_12x();
1990 shadow_frame.SetVRegDouble(vregA,
1991 fmod(shadow_frame.GetVRegDouble(vregA),
1992 shadow_frame.GetVRegDouble(inst->VRegB_12x())));
1993 inst = inst->Next_1xx();
1994 break;
1995 }
1996 case Instruction::ADD_INT_LIT16:
1997 PREAMBLE();
1998 shadow_frame.SetVReg(inst->VRegA_22s(),
1999 shadow_frame.GetVReg(inst->VRegB_22s()) +
2000 inst->VRegC_22s());
2001 inst = inst->Next_2xx();
2002 break;
2003 case Instruction::RSUB_INT:
2004 PREAMBLE();
2005 shadow_frame.SetVReg(inst->VRegA_22s(),
2006 inst->VRegC_22s() -
2007 shadow_frame.GetVReg(inst->VRegB_22s()));
2008 inst = inst->Next_2xx();
2009 break;
2010 case Instruction::MUL_INT_LIT16:
2011 PREAMBLE();
2012 shadow_frame.SetVReg(inst->VRegA_22s(),
2013 shadow_frame.GetVReg(inst->VRegB_22s()) *
2014 inst->VRegC_22s());
2015 inst = inst->Next_2xx();
2016 break;
2017 case Instruction::DIV_INT_LIT16: {
2018 PREAMBLE();
2019 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(),
2020 shadow_frame.GetVReg(inst->VRegB_22s()), inst->VRegC_22s());
2021 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2022 break;
2023 }
2024 case Instruction::REM_INT_LIT16: {
2025 PREAMBLE();
2026 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(),
2027 shadow_frame.GetVReg(inst->VRegB_22s()), inst->VRegC_22s());
2028 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2029 break;
2030 }
2031 case Instruction::AND_INT_LIT16:
2032 PREAMBLE();
2033 shadow_frame.SetVReg(inst->VRegA_22s(),
2034 shadow_frame.GetVReg(inst->VRegB_22s()) &
2035 inst->VRegC_22s());
2036 inst = inst->Next_2xx();
2037 break;
2038 case Instruction::OR_INT_LIT16:
2039 PREAMBLE();
2040 shadow_frame.SetVReg(inst->VRegA_22s(),
2041 shadow_frame.GetVReg(inst->VRegB_22s()) |
2042 inst->VRegC_22s());
2043 inst = inst->Next_2xx();
2044 break;
2045 case Instruction::XOR_INT_LIT16:
2046 PREAMBLE();
2047 shadow_frame.SetVReg(inst->VRegA_22s(),
2048 shadow_frame.GetVReg(inst->VRegB_22s()) ^
2049 inst->VRegC_22s());
2050 inst = inst->Next_2xx();
2051 break;
2052 case Instruction::ADD_INT_LIT8:
2053 PREAMBLE();
2054 shadow_frame.SetVReg(inst->VRegA_22b(),
2055 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();
2061 shadow_frame.SetVReg(inst->VRegA_22b(),
2062 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();
2068 shadow_frame.SetVReg(inst->VRegA_22b(),
2069 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();
2075 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(),
2076 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();
2082 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(),
2083 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();
2089 shadow_frame.SetVReg(inst->VRegA_22b(),
2090 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();
2096 shadow_frame.SetVReg(inst->VRegA_22b(),
2097 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();
2103 shadow_frame.SetVReg(inst->VRegA_22b(),
2104 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();
2110 shadow_frame.SetVReg(inst->VRegA_22b(),
2111 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();
2117 shadow_frame.SetVReg(inst->VRegA_22b(),
2118 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();
2124 shadow_frame.SetVReg(inst->VRegA_22b(),
2125 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.
2139template JValue ExecuteSwitchImpl<true>(Thread* self, MethodHelper& mh,
2140 const DexFile::CodeItem* code_item,
2141 ShadowFrame& shadow_frame, JValue result_register);
2142template JValue ExecuteSwitchImpl<false>(Thread* self, MethodHelper& mh,
2143 const DexFile::CodeItem* code_item,
2144 ShadowFrame& shadow_frame, JValue result_register);
2145
2146} // namespace interpreter
2147} // namespace art