blob: 243ed57c481835e6e8f406008071cd9a5dba7015 [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
Andreas Gampe5e26eb12016-08-22 17:54:17 -070017#include "interpreter_switch_impl.h"
18
Andreas Gampe542451c2016-07-26 09:02:02 -070019#include "base/enums.h"
Alex Lighteb7c1442015-08-31 13:17:42 -070020#include "experimental_flags.h"
Sebastien Hertz8ece0502013-08-07 11:26:41 +020021#include "interpreter_common.h"
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +000022#include "jit/jit.h"
Mathieu Chartier28bd2e42016-10-04 13:54:57 -070023#include "jvalue-inl.h"
Ian Rogersf72a11d2014-10-30 15:41:08 -070024#include "safe_math.h"
Sebastien Hertz8ece0502013-08-07 11:26:41 +020025
26namespace art {
27namespace interpreter {
28
29#define HANDLE_PENDING_EXCEPTION() \
30 do { \
Sebastien Hertz82aeddb2014-05-20 20:09:45 +020031 DCHECK(self->IsExceptionPending()); \
Ian Rogers7b078e82014-09-10 14:44:24 -070032 self->AllowThreadSuspension(); \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020033 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, \
34 inst->GetDexPc(insns), \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020035 instrumentation); \
36 if (found_dex_pc == DexFile::kDexNoIndex) { \
Andreas Gampe03ec9302015-08-27 17:41:47 -070037 /* Structured locking is to be enforced for abnormal termination, too. */ \
Andreas Gampe56fdd0e2016-04-28 14:56:54 -070038 DoMonitorCheckOnExit<do_assignability_check>(self, &shadow_frame); \
buzbee1452bee2015-03-06 14:43:04 -080039 if (interpret_one_instruction) { \
buzbee93e94f22016-04-07 13:52:48 -070040 /* Signal mterp to return to caller */ \
buzbee1452bee2015-03-06 14:43:04 -080041 shadow_frame.SetDexPC(DexFile::kDexNoIndex); \
42 } \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020043 return JValue(); /* Handled in caller. */ \
44 } else { \
45 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc); \
46 inst = inst->RelativeAt(displacement); \
47 } \
48 } while (false)
49
50#define POSSIBLY_HANDLE_PENDING_EXCEPTION(_is_exception_pending, _next_function) \
51 do { \
52 if (UNLIKELY(_is_exception_pending)) { \
53 HANDLE_PENDING_EXCEPTION(); \
54 } else { \
55 inst = inst->_next_function(); \
56 } \
57 } while (false)
58
Andreas Gampe03ec9302015-08-27 17:41:47 -070059#define HANDLE_MONITOR_CHECKS() \
Andreas Gampe56fdd0e2016-04-28 14:56:54 -070060 if (!DoMonitorCheckOnExit<do_assignability_check>(self, &shadow_frame)) { \
Andreas Gampe03ec9302015-08-27 17:41:47 -070061 HANDLE_PENDING_EXCEPTION(); \
62 }
63
Sebastien Hertz8ece0502013-08-07 11:26:41 +020064// Code to run before each dex instruction.
Sebastien Hertz8379b222014-02-24 17:38:15 +010065#define PREAMBLE() \
66 do { \
Sebastien Hertz9d6bf692015-04-10 12:12:33 +020067 if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
Sebastien Hertz8379b222014-02-24 17:38:15 +010068 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), \
69 shadow_frame.GetMethod(), dex_pc); \
70 } \
71 } while (false)
Sebastien Hertz8ece0502013-08-07 11:26:41 +020072
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +000073#define BRANCH_INSTRUMENTATION(offset) \
74 do { \
Nicolas Geoffray274fe4a2016-04-12 16:33:24 +010075 if (UNLIKELY(instrumentation->HasBranchListeners())) { \
76 instrumentation->Branch(self, method, dex_pc, offset); \
77 } \
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +000078 JValue result; \
79 if (jit::Jit::MaybeDoOnStackReplacement(self, method, dex_pc, offset, &result)) { \
buzbee93e94f22016-04-07 13:52:48 -070080 if (interpret_one_instruction) { \
81 /* OSR has completed execution of the method. Signal mterp to return to caller */ \
82 shadow_frame.SetDexPC(DexFile::kDexNoIndex); \
83 } \
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +000084 return result; \
85 } \
Nicolas Geoffray3108daf2015-11-24 16:32:33 +000086 } while (false)
87
Bill Buzbee1d011d92016-04-04 16:59:29 +000088#define HOTNESS_UPDATE() \
89 do { \
Nicolas Geoffray274fe4a2016-04-12 16:33:24 +010090 if (jit != nullptr) { \
Nicolas Geoffray71cd50f2016-04-14 15:00:33 +010091 jit->AddSamples(self, method, 1, /*with_backedges*/ true); \
Bill Buzbee1d011d92016-04-04 16:59:29 +000092 } \
93 } while (false)
94
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +010095template<bool do_access_check, bool transaction_active>
Ian Rogerse94652f2014-12-02 11:13:19 -080096JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -080097 ShadowFrame& shadow_frame, JValue result_register,
98 bool interpret_one_instruction) {
Igor Murashkinc449e8b2015-06-10 15:56:42 -070099 constexpr bool do_assignability_check = do_access_check;
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200100 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
101 LOG(FATAL) << "Invalid shadow frame for interpreter use";
102 return JValue();
103 }
104 self->VerifyStack();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200105
106 uint32_t dex_pc = shadow_frame.GetDexPC();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700107 const auto* const instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200108 const uint16_t* const insns = code_item->insns_;
109 const Instruction* inst = Instruction::At(insns + dex_pc);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200110 uint16_t inst_data;
Bill Buzbee1d011d92016-04-04 16:59:29 +0000111 ArtMethod* method = shadow_frame.GetMethod();
112 jit::Jit* jit = Runtime::Current()->GetJit();
Igor Murashkin6918bf12015-09-27 19:19:06 -0700113
buzbee1452bee2015-03-06 14:43:04 -0800114 do {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200115 dex_pc = inst->GetDexPc(insns);
116 shadow_frame.SetDexPC(dex_pc);
Ian Rogerse94652f2014-12-02 11:13:19 -0800117 TraceExecution(shadow_frame, inst, dex_pc);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200118 inst_data = inst->Fetch16(0);
119 switch (inst->Opcode(inst_data)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200120 case Instruction::NOP:
121 PREAMBLE();
122 inst = inst->Next_1xx();
123 break;
124 case Instruction::MOVE:
125 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200126 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
127 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200128 inst = inst->Next_1xx();
129 break;
130 case Instruction::MOVE_FROM16:
131 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200132 shadow_frame.SetVReg(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200133 shadow_frame.GetVReg(inst->VRegB_22x()));
134 inst = inst->Next_2xx();
135 break;
136 case Instruction::MOVE_16:
137 PREAMBLE();
138 shadow_frame.SetVReg(inst->VRegA_32x(),
139 shadow_frame.GetVReg(inst->VRegB_32x()));
140 inst = inst->Next_3xx();
141 break;
142 case Instruction::MOVE_WIDE:
143 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200144 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
145 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200146 inst = inst->Next_1xx();
147 break;
148 case Instruction::MOVE_WIDE_FROM16:
149 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200150 shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200151 shadow_frame.GetVRegLong(inst->VRegB_22x()));
152 inst = inst->Next_2xx();
153 break;
154 case Instruction::MOVE_WIDE_16:
155 PREAMBLE();
156 shadow_frame.SetVRegLong(inst->VRegA_32x(),
157 shadow_frame.GetVRegLong(inst->VRegB_32x()));
158 inst = inst->Next_3xx();
159 break;
160 case Instruction::MOVE_OBJECT:
161 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200162 shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data),
163 shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200164 inst = inst->Next_1xx();
165 break;
166 case Instruction::MOVE_OBJECT_FROM16:
167 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200168 shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200169 shadow_frame.GetVRegReference(inst->VRegB_22x()));
170 inst = inst->Next_2xx();
171 break;
172 case Instruction::MOVE_OBJECT_16:
173 PREAMBLE();
174 shadow_frame.SetVRegReference(inst->VRegA_32x(),
175 shadow_frame.GetVRegReference(inst->VRegB_32x()));
176 inst = inst->Next_3xx();
177 break;
178 case Instruction::MOVE_RESULT:
179 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200180 shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200181 inst = inst->Next_1xx();
182 break;
183 case Instruction::MOVE_RESULT_WIDE:
184 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200185 shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200186 inst = inst->Next_1xx();
187 break;
188 case Instruction::MOVE_RESULT_OBJECT:
189 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200190 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200191 inst = inst->Next_1xx();
192 break;
193 case Instruction::MOVE_EXCEPTION: {
194 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700195 ObjPtr<mirror::Throwable> exception = self->GetException();
Sebastien Hertz270a0e12015-01-16 19:49:09 +0100196 DCHECK(exception != nullptr) << "No pending exception on MOVE_EXCEPTION instruction";
Mathieu Chartieref41db72016-10-25 15:08:01 -0700197 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception.Ptr());
Sebastien Hertz5c004902014-05-21 10:07:42 +0200198 self->ClearException();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200199 inst = inst->Next_1xx();
200 break;
201 }
Mathieu Chartierd7cbf8a2015-03-19 12:43:20 -0700202 case Instruction::RETURN_VOID_NO_BARRIER: {
Sebastien Hertz9d6bf692015-04-10 12:12:33 +0200203 PREAMBLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200204 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700205 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700206 HANDLE_MONITOR_CHECKS();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200207 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200208 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200209 shadow_frame.GetMethod(), inst->GetDexPc(insns),
210 result);
211 }
buzbee1452bee2015-03-06 14:43:04 -0800212 if (interpret_one_instruction) {
buzbee93e94f22016-04-07 13:52:48 -0700213 /* Signal mterp to return to caller */
buzbee1452bee2015-03-06 14:43:04 -0800214 shadow_frame.SetDexPC(DexFile::kDexNoIndex);
215 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200216 return result;
217 }
Mathieu Chartierd7cbf8a2015-03-19 12:43:20 -0700218 case Instruction::RETURN_VOID: {
Sebastien Hertz9d6bf692015-04-10 12:12:33 +0200219 PREAMBLE();
Hans Boehm30359612014-05-21 17:46:23 -0700220 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200221 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700222 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700223 HANDLE_MONITOR_CHECKS();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200224 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200225 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200226 shadow_frame.GetMethod(), inst->GetDexPc(insns),
227 result);
228 }
buzbee1452bee2015-03-06 14:43:04 -0800229 if (interpret_one_instruction) {
buzbee93e94f22016-04-07 13:52:48 -0700230 /* Signal mterp to return to caller */
buzbee1452bee2015-03-06 14:43:04 -0800231 shadow_frame.SetDexPC(DexFile::kDexNoIndex);
232 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200233 return result;
234 }
235 case Instruction::RETURN: {
Sebastien Hertz9d6bf692015-04-10 12:12:33 +0200236 PREAMBLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200237 JValue result;
238 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200239 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700240 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700241 HANDLE_MONITOR_CHECKS();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200242 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200243 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200244 shadow_frame.GetMethod(), inst->GetDexPc(insns),
245 result);
246 }
buzbee1452bee2015-03-06 14:43:04 -0800247 if (interpret_one_instruction) {
buzbee93e94f22016-04-07 13:52:48 -0700248 /* Signal mterp to return to caller */
buzbee1452bee2015-03-06 14:43:04 -0800249 shadow_frame.SetDexPC(DexFile::kDexNoIndex);
250 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200251 return result;
252 }
253 case Instruction::RETURN_WIDE: {
Sebastien Hertz9d6bf692015-04-10 12:12:33 +0200254 PREAMBLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200255 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200256 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700257 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700258 HANDLE_MONITOR_CHECKS();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200259 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200260 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200261 shadow_frame.GetMethod(), inst->GetDexPc(insns),
262 result);
263 }
buzbee1452bee2015-03-06 14:43:04 -0800264 if (interpret_one_instruction) {
buzbee93e94f22016-04-07 13:52:48 -0700265 /* Signal mterp to return to caller */
buzbee1452bee2015-03-06 14:43:04 -0800266 shadow_frame.SetDexPC(DexFile::kDexNoIndex);
267 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200268 return result;
269 }
270 case Instruction::RETURN_OBJECT: {
Sebastien Hertz9d6bf692015-04-10 12:12:33 +0200271 PREAMBLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200272 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700273 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700274 HANDLE_MONITOR_CHECKS();
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700275 const size_t ref_idx = inst->VRegA_11x(inst_data);
Mathieu Chartieref41db72016-10-25 15:08:01 -0700276 ObjPtr<mirror::Object> obj_result = shadow_frame.GetVRegReference(ref_idx);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700277 if (do_assignability_check && obj_result != nullptr) {
Andreas Gampe542451c2016-07-26 09:02:02 -0700278 PointerSize pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700279 ObjPtr<mirror::Class> return_type = method->GetReturnType(true /* resolve */,
280 pointer_size);
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700281 // Re-load since it might have moved.
282 obj_result = shadow_frame.GetVRegReference(ref_idx);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700283 if (return_type == nullptr) {
Jeff Haoa3faaf42013-09-03 19:07:00 -0700284 // Return the pending exception.
285 HANDLE_PENDING_EXCEPTION();
286 }
287 if (!obj_result->VerifierInstanceOf(return_type)) {
288 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700289 std::string temp1, temp2;
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000290 self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700291 "Returning '%s' that is not instance of return type '%s'",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700292 obj_result->GetClass()->GetDescriptor(&temp1),
293 return_type->GetDescriptor(&temp2));
Jeff Haoa3faaf42013-09-03 19:07:00 -0700294 HANDLE_PENDING_EXCEPTION();
295 }
296 }
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700297 result.SetL(obj_result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200298 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200299 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200300 shadow_frame.GetMethod(), inst->GetDexPc(insns),
301 result);
302 }
buzbee1452bee2015-03-06 14:43:04 -0800303 if (interpret_one_instruction) {
buzbee93e94f22016-04-07 13:52:48 -0700304 /* Signal mterp to return to caller */
buzbee1452bee2015-03-06 14:43:04 -0800305 shadow_frame.SetDexPC(DexFile::kDexNoIndex);
306 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200307 return result;
308 }
309 case Instruction::CONST_4: {
310 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200311 uint4_t dst = inst->VRegA_11n(inst_data);
312 int4_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200313 shadow_frame.SetVReg(dst, val);
314 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700315 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200316 }
317 inst = inst->Next_1xx();
318 break;
319 }
320 case Instruction::CONST_16: {
321 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200322 uint8_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200323 int16_t val = inst->VRegB_21s();
324 shadow_frame.SetVReg(dst, val);
325 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700326 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200327 }
328 inst = inst->Next_2xx();
329 break;
330 }
331 case Instruction::CONST: {
332 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200333 uint8_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200334 int32_t val = inst->VRegB_31i();
335 shadow_frame.SetVReg(dst, val);
336 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700337 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200338 }
339 inst = inst->Next_3xx();
340 break;
341 }
342 case Instruction::CONST_HIGH16: {
343 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200344 uint8_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200345 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
346 shadow_frame.SetVReg(dst, val);
347 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700348 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200349 }
350 inst = inst->Next_2xx();
351 break;
352 }
353 case Instruction::CONST_WIDE_16:
354 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200355 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200356 inst = inst->Next_2xx();
357 break;
358 case Instruction::CONST_WIDE_32:
359 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200360 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200361 inst = inst->Next_3xx();
362 break;
363 case Instruction::CONST_WIDE:
364 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200365 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200366 inst = inst->Next_51l();
367 break;
368 case Instruction::CONST_WIDE_HIGH16:
Sebastien Hertz3c5aec12014-06-04 09:41:21 +0200369 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200370 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200371 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
372 inst = inst->Next_2xx();
373 break;
374 case Instruction::CONST_STRING: {
375 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700376 ObjPtr<mirror::String> s = ResolveString(self, shadow_frame, inst->VRegB_21c());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700377 if (UNLIKELY(s == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200378 HANDLE_PENDING_EXCEPTION();
379 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700380 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s.Ptr());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200381 inst = inst->Next_2xx();
382 }
383 break;
384 }
385 case Instruction::CONST_STRING_JUMBO: {
386 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700387 ObjPtr<mirror::String> s = ResolveString(self, shadow_frame, inst->VRegB_31c());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700388 if (UNLIKELY(s == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200389 HANDLE_PENDING_EXCEPTION();
390 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700391 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s.Ptr());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200392 inst = inst->Next_3xx();
393 }
394 break;
395 }
396 case Instruction::CONST_CLASS: {
397 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700398 ObjPtr<mirror::Class> c = ResolveVerifyAndClinit(inst->VRegB_21c(),
399 shadow_frame.GetMethod(),
400 self,
401 false,
402 do_access_check);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700403 if (UNLIKELY(c == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200404 HANDLE_PENDING_EXCEPTION();
405 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700406 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c.Ptr());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200407 inst = inst->Next_2xx();
408 }
409 break;
410 }
411 case Instruction::MONITOR_ENTER: {
412 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700413 ObjPtr<mirror::Object> obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700414 if (UNLIKELY(obj == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000415 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200416 HANDLE_PENDING_EXCEPTION();
417 } else {
Andreas Gampe03ec9302015-08-27 17:41:47 -0700418 DoMonitorEnter<do_assignability_check>(self, &shadow_frame, obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200419 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
420 }
421 break;
422 }
423 case Instruction::MONITOR_EXIT: {
424 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700425 ObjPtr<mirror::Object> obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700426 if (UNLIKELY(obj == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000427 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200428 HANDLE_PENDING_EXCEPTION();
429 } else {
Andreas Gampe03ec9302015-08-27 17:41:47 -0700430 DoMonitorExit<do_assignability_check>(self, &shadow_frame, obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200431 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
432 }
433 break;
434 }
435 case Instruction::CHECK_CAST: {
436 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700437 ObjPtr<mirror::Class> c = ResolveVerifyAndClinit(inst->VRegB_21c(),
438 shadow_frame.GetMethod(),
439 self,
440 false,
441 do_access_check);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700442 if (UNLIKELY(c == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200443 HANDLE_PENDING_EXCEPTION();
444 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700445 ObjPtr<mirror::Object> obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700446 if (UNLIKELY(obj != nullptr && !obj->InstanceOf(c))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200447 ThrowClassCastException(c, obj->GetClass());
448 HANDLE_PENDING_EXCEPTION();
449 } else {
450 inst = inst->Next_2xx();
451 }
452 }
453 break;
454 }
455 case Instruction::INSTANCE_OF: {
456 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700457 ObjPtr<mirror::Class> c = ResolveVerifyAndClinit(inst->VRegC_22c(),
458 shadow_frame.GetMethod(),
459 self,
460 false,
461 do_access_check);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700462 if (UNLIKELY(c == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200463 HANDLE_PENDING_EXCEPTION();
464 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700465 ObjPtr<mirror::Object> obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700466 shadow_frame.SetVReg(inst->VRegA_22c(inst_data),
467 (obj != nullptr && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200468 inst = inst->Next_2xx();
469 }
470 break;
471 }
472 case Instruction::ARRAY_LENGTH: {
473 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700474 ObjPtr<mirror::Object> array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700475 if (UNLIKELY(array == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000476 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200477 HANDLE_PENDING_EXCEPTION();
478 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200479 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200480 inst = inst->Next_1xx();
481 }
482 break;
483 }
484 case Instruction::NEW_INSTANCE: {
485 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700486 ObjPtr<mirror::Object> obj = nullptr;
487 ObjPtr<mirror::Class> c = ResolveVerifyAndClinit(inst->VRegB_21c(),
488 shadow_frame.GetMethod(),
489 self,
490 false,
491 do_access_check);
Jeff Hao848f70a2014-01-15 13:49:50 -0800492 if (LIKELY(c != nullptr)) {
493 if (UNLIKELY(c->IsStringClass())) {
494 gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
jessicahandojo3aaa37b2016-07-29 14:46:37 -0700495 obj = mirror::String::AllocEmptyString<true>(self, allocator_type);
Jeff Hao848f70a2014-01-15 13:49:50 -0800496 } else {
497 obj = AllocObjectFromCode<do_access_check, true>(
498 inst->VRegB_21c(), shadow_frame.GetMethod(), self,
499 Runtime::Current()->GetHeap()->GetCurrentAllocator());
500 }
501 }
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700502 if (UNLIKELY(obj == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200503 HANDLE_PENDING_EXCEPTION();
504 } else {
Sebastien Hertz4e99b3d2014-06-24 14:35:40 +0200505 obj->GetClass()->AssertInitializedOrInitializingInThread(self);
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700506 // Don't allow finalizable objects to be allocated during a transaction since these can't
507 // be finalized without a started runtime.
508 if (transaction_active && obj->GetClass()->IsFinalizable()) {
Sebastien Hertz45b15972015-04-03 16:07:05 +0200509 AbortTransactionF(self, "Allocating finalizable object in transaction: %s",
David Sehr709b0702016-10-13 09:12:37 -0700510 obj->PrettyTypeOf().c_str());
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700511 HANDLE_PENDING_EXCEPTION();
512 break;
513 }
Mathieu Chartieref41db72016-10-25 15:08:01 -0700514 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj.Ptr());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200515 inst = inst->Next_2xx();
516 }
517 break;
518 }
519 case Instruction::NEW_ARRAY: {
520 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200521 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Mathieu Chartieref41db72016-10-25 15:08:01 -0700522 ObjPtr<mirror::Object> obj = AllocArrayFromCode<do_access_check, true>(
Andreas Gampe1cc7dba2014-12-17 18:43:01 -0800523 inst->VRegC_22c(), length, shadow_frame.GetMethod(), self,
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800524 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700525 if (UNLIKELY(obj == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200526 HANDLE_PENDING_EXCEPTION();
527 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700528 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj.Ptr());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200529 inst = inst->Next_2xx();
530 }
531 break;
532 }
533 case Instruction::FILLED_NEW_ARRAY: {
534 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100535 bool success =
536 DoFilledNewArray<false, do_access_check, transaction_active>(inst, shadow_frame, self,
537 &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200538 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
539 break;
540 }
541 case Instruction::FILLED_NEW_ARRAY_RANGE: {
542 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100543 bool success =
544 DoFilledNewArray<true, do_access_check, transaction_active>(inst, shadow_frame,
545 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200546 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
547 break;
548 }
549 case Instruction::FILL_ARRAY_DATA: {
550 PREAMBLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200551 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
552 const Instruction::ArrayDataPayload* payload =
553 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
Mathieu Chartieref41db72016-10-25 15:08:01 -0700554 ObjPtr<mirror::Object> obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Ian Rogers832336b2014-10-08 15:35:22 -0700555 bool success = FillArrayData(obj, payload);
556 if (!success) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200557 HANDLE_PENDING_EXCEPTION();
558 break;
559 }
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100560 if (transaction_active) {
Ian Rogers832336b2014-10-08 15:35:22 -0700561 RecordArrayElementsInTransaction(obj->AsArray(), payload->element_count);
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100562 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200563 inst = inst->Next_3xx();
564 break;
565 }
566 case Instruction::THROW: {
567 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700568 ObjPtr<mirror::Object> exception =
569 shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700570 if (UNLIKELY(exception == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000571 ThrowNullPointerException("throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700572 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
573 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700574 std::string temp;
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000575 self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700576 "Throwing '%s' that is not instance of Throwable",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700577 exception->GetClass()->GetDescriptor(&temp));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200578 } else {
Nicolas Geoffray14691c52015-03-05 10:40:17 +0000579 self->SetException(exception->AsThrowable());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200580 }
581 HANDLE_PENDING_EXCEPTION();
582 break;
583 }
584 case Instruction::GOTO: {
585 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200586 int8_t offset = inst->VRegA_10t(inst_data);
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000587 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200588 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000589 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700590 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200591 }
592 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200593 break;
594 }
595 case Instruction::GOTO_16: {
596 PREAMBLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200597 int16_t offset = inst->VRegA_20t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000598 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200599 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000600 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700601 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200602 }
603 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200604 break;
605 }
606 case Instruction::GOTO_32: {
607 PREAMBLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200608 int32_t offset = inst->VRegA_30t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000609 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200610 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000611 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700612 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200613 }
614 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200615 break;
616 }
617 case Instruction::PACKED_SWITCH: {
618 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200619 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000620 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200621 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000622 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700623 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200624 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200625 inst = inst->RelativeAt(offset);
626 break;
627 }
628 case Instruction::SPARSE_SWITCH: {
629 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200630 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000631 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200632 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000633 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700634 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200635 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200636 inst = inst->RelativeAt(offset);
637 break;
638 }
Ian Rogers647b1a82014-10-10 11:02:11 -0700639
Ian Rogers647b1a82014-10-10 11:02:11 -0700640#pragma clang diagnostic push
641#pragma clang diagnostic ignored "-Wfloat-equal"
Ian Rogers647b1a82014-10-10 11:02:11 -0700642
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200643 case Instruction::CMPL_FLOAT: {
644 PREAMBLE();
645 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
646 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
647 int32_t result;
648 if (val1 > val2) {
649 result = 1;
650 } else if (val1 == val2) {
651 result = 0;
652 } else {
653 result = -1;
654 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200655 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200656 inst = inst->Next_2xx();
657 break;
658 }
659 case Instruction::CMPG_FLOAT: {
660 PREAMBLE();
661 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
662 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
663 int32_t result;
664 if (val1 < val2) {
665 result = -1;
666 } else if (val1 == val2) {
667 result = 0;
668 } else {
669 result = 1;
670 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200671 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200672 inst = inst->Next_2xx();
673 break;
674 }
675 case Instruction::CMPL_DOUBLE: {
676 PREAMBLE();
677 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
678 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
679 int32_t result;
680 if (val1 > val2) {
681 result = 1;
682 } else if (val1 == val2) {
683 result = 0;
684 } else {
685 result = -1;
686 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200687 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200688 inst = inst->Next_2xx();
689 break;
690 }
691
692 case Instruction::CMPG_DOUBLE: {
693 PREAMBLE();
694 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
695 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
696 int32_t result;
697 if (val1 < val2) {
698 result = -1;
699 } else if (val1 == val2) {
700 result = 0;
701 } else {
702 result = 1;
703 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200704 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200705 inst = inst->Next_2xx();
706 break;
707 }
Ian Rogers647b1a82014-10-10 11:02:11 -0700708
Ian Rogers647b1a82014-10-10 11:02:11 -0700709#pragma clang diagnostic pop
Ian Rogers647b1a82014-10-10 11:02:11 -0700710
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200711 case Instruction::CMP_LONG: {
712 PREAMBLE();
713 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
714 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
715 int32_t result;
716 if (val1 > val2) {
717 result = 1;
718 } else if (val1 == val2) {
719 result = 0;
720 } else {
721 result = -1;
722 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200723 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200724 inst = inst->Next_2xx();
725 break;
726 }
727 case Instruction::IF_EQ: {
728 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700729 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) ==
730 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200731 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000732 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200733 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000734 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700735 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200736 }
737 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200738 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800739 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200740 inst = inst->Next_2xx();
741 }
742 break;
743 }
744 case Instruction::IF_NE: {
745 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700746 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) !=
747 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200748 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000749 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200750 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000751 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700752 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200753 }
754 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200755 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800756 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200757 inst = inst->Next_2xx();
758 }
759 break;
760 }
761 case Instruction::IF_LT: {
762 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700763 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <
764 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200765 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000766 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200767 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000768 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700769 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200770 }
771 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200772 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800773 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200774 inst = inst->Next_2xx();
775 }
776 break;
777 }
778 case Instruction::IF_GE: {
779 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700780 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >=
781 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200782 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000783 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200784 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000785 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700786 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200787 }
788 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200789 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800790 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200791 inst = inst->Next_2xx();
792 }
793 break;
794 }
795 case Instruction::IF_GT: {
796 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700797 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >
798 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200799 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000800 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200801 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000802 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700803 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200804 }
805 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200806 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800807 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200808 inst = inst->Next_2xx();
809 }
810 break;
811 }
812 case Instruction::IF_LE: {
813 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700814 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <=
815 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200816 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000817 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200818 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000819 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700820 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200821 }
822 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200823 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800824 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200825 inst = inst->Next_2xx();
826 }
827 break;
828 }
829 case Instruction::IF_EQZ: {
830 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200831 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200832 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000833 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200834 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000835 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700836 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200837 }
838 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200839 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800840 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200841 inst = inst->Next_2xx();
842 }
843 break;
844 }
845 case Instruction::IF_NEZ: {
846 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200847 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200848 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000849 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200850 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000851 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700852 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200853 }
854 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200855 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800856 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200857 inst = inst->Next_2xx();
858 }
859 break;
860 }
861 case Instruction::IF_LTZ: {
862 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200863 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200864 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000865 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200866 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000867 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700868 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200869 }
870 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200871 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800872 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200873 inst = inst->Next_2xx();
874 }
875 break;
876 }
877 case Instruction::IF_GEZ: {
878 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200879 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200880 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000881 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200882 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000883 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700884 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200885 }
886 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200887 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800888 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200889 inst = inst->Next_2xx();
890 }
891 break;
892 }
893 case Instruction::IF_GTZ: {
894 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200895 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200896 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000897 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200898 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000899 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700900 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200901 }
902 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200903 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800904 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200905 inst = inst->Next_2xx();
906 }
907 break;
908 }
909 case Instruction::IF_LEZ: {
910 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200911 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200912 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000913 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200914 if (IsBackwardBranch(offset)) {
Bill Buzbee1d011d92016-04-04 16:59:29 +0000915 HOTNESS_UPDATE();
Ian Rogers7b078e82014-09-10 14:44:24 -0700916 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200917 }
918 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200919 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800920 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200921 inst = inst->Next_2xx();
922 }
923 break;
924 }
925 case Instruction::AGET_BOOLEAN: {
926 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700927 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700928 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000929 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200930 HANDLE_PENDING_EXCEPTION();
931 break;
932 }
933 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -0700934 ObjPtr<mirror::BooleanArray> array = a->AsBooleanArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700935 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100936 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200937 inst = inst->Next_2xx();
938 } else {
939 HANDLE_PENDING_EXCEPTION();
940 }
941 break;
942 }
943 case Instruction::AGET_BYTE: {
944 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700945 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700946 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000947 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200948 HANDLE_PENDING_EXCEPTION();
949 break;
950 }
951 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -0700952 ObjPtr<mirror::ByteArray> array = a->AsByteArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700953 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100954 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200955 inst = inst->Next_2xx();
956 } else {
957 HANDLE_PENDING_EXCEPTION();
958 }
959 break;
960 }
961 case Instruction::AGET_CHAR: {
962 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700963 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700964 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000965 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200966 HANDLE_PENDING_EXCEPTION();
967 break;
968 }
969 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -0700970 ObjPtr<mirror::CharArray> array = a->AsCharArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700971 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100972 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200973 inst = inst->Next_2xx();
974 } else {
975 HANDLE_PENDING_EXCEPTION();
976 }
977 break;
978 }
979 case Instruction::AGET_SHORT: {
980 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700981 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700982 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000983 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200984 HANDLE_PENDING_EXCEPTION();
985 break;
986 }
987 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -0700988 ObjPtr<mirror::ShortArray> array = a->AsShortArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700989 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100990 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200991 inst = inst->Next_2xx();
992 } else {
993 HANDLE_PENDING_EXCEPTION();
994 }
995 break;
996 }
997 case Instruction::AGET: {
998 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700999 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001000 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001001 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001002 HANDLE_PENDING_EXCEPTION();
1003 break;
1004 }
1005 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
David Sehr709b0702016-10-13 09:12:37 -07001006 DCHECK(a->IsIntArray() || a->IsFloatArray()) << a->PrettyTypeOf();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001007 ObjPtr<mirror::IntArray> array = ObjPtr<mirror::IntArray>::DownCast(a);
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001008 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +01001009 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001010 inst = inst->Next_2xx();
1011 } else {
1012 HANDLE_PENDING_EXCEPTION();
1013 }
1014 break;
1015 }
1016 case Instruction::AGET_WIDE: {
1017 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001018 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001019 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001020 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001021 HANDLE_PENDING_EXCEPTION();
1022 break;
1023 }
1024 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
David Sehr709b0702016-10-13 09:12:37 -07001025 DCHECK(a->IsLongArray() || a->IsDoubleArray()) << a->PrettyTypeOf();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001026 ObjPtr<mirror::LongArray> array = ObjPtr<mirror::LongArray>::DownCast(a);
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001027 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +01001028 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001029 inst = inst->Next_2xx();
1030 } else {
1031 HANDLE_PENDING_EXCEPTION();
1032 }
1033 break;
1034 }
1035 case Instruction::AGET_OBJECT: {
1036 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001037 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001038 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001039 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001040 HANDLE_PENDING_EXCEPTION();
1041 break;
1042 }
1043 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001044 ObjPtr<mirror::ObjectArray<mirror::Object>> array = a->AsObjectArray<mirror::Object>();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001045 if (array->CheckIsValidIndex(index)) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001046 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001047 inst = inst->Next_2xx();
1048 } else {
1049 HANDLE_PENDING_EXCEPTION();
1050 }
1051 break;
1052 }
1053 case Instruction::APUT_BOOLEAN: {
1054 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001055 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001056 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001057 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001058 HANDLE_PENDING_EXCEPTION();
1059 break;
1060 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001061 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001062 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001063 ObjPtr<mirror::BooleanArray> array = a->AsBooleanArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001064 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001065 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001066 inst = inst->Next_2xx();
1067 } else {
1068 HANDLE_PENDING_EXCEPTION();
1069 }
1070 break;
1071 }
1072 case Instruction::APUT_BYTE: {
1073 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001074 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001075 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001076 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001077 HANDLE_PENDING_EXCEPTION();
1078 break;
1079 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001080 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001081 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001082 ObjPtr<mirror::ByteArray> array = a->AsByteArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001083 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001084 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001085 inst = inst->Next_2xx();
1086 } else {
1087 HANDLE_PENDING_EXCEPTION();
1088 }
1089 break;
1090 }
1091 case Instruction::APUT_CHAR: {
1092 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001093 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001094 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001095 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001096 HANDLE_PENDING_EXCEPTION();
1097 break;
1098 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001099 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001100 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001101 ObjPtr<mirror::CharArray> array = a->AsCharArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001102 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001103 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001104 inst = inst->Next_2xx();
1105 } else {
1106 HANDLE_PENDING_EXCEPTION();
1107 }
1108 break;
1109 }
1110 case Instruction::APUT_SHORT: {
1111 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001112 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001113 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001114 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001115 HANDLE_PENDING_EXCEPTION();
1116 break;
1117 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001118 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001119 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001120 ObjPtr<mirror::ShortArray> array = a->AsShortArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001121 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001122 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001123 inst = inst->Next_2xx();
1124 } else {
1125 HANDLE_PENDING_EXCEPTION();
1126 }
1127 break;
1128 }
1129 case Instruction::APUT: {
1130 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001131 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001132 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001133 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001134 HANDLE_PENDING_EXCEPTION();
1135 break;
1136 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001137 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001138 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
David Sehr709b0702016-10-13 09:12:37 -07001139 DCHECK(a->IsIntArray() || a->IsFloatArray()) << a->PrettyTypeOf();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001140 ObjPtr<mirror::IntArray> array = ObjPtr<mirror::IntArray>::DownCast(a);
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001141 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001142 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001143 inst = inst->Next_2xx();
1144 } else {
1145 HANDLE_PENDING_EXCEPTION();
1146 }
1147 break;
1148 }
1149 case Instruction::APUT_WIDE: {
1150 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001151 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001152 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001153 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001154 HANDLE_PENDING_EXCEPTION();
1155 break;
1156 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001157 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001158 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
David Sehr709b0702016-10-13 09:12:37 -07001159 DCHECK(a->IsLongArray() || a->IsDoubleArray()) << a->PrettyTypeOf();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001160 ObjPtr<mirror::LongArray> array = ObjPtr<mirror::LongArray>::DownCast(a);
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001161 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001162 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001163 inst = inst->Next_2xx();
1164 } else {
1165 HANDLE_PENDING_EXCEPTION();
1166 }
1167 break;
1168 }
1169 case Instruction::APUT_OBJECT: {
1170 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001171 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001172 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001173 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001174 HANDLE_PENDING_EXCEPTION();
1175 break;
1176 }
1177 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001178 ObjPtr<mirror::Object> val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
1179 ObjPtr<mirror::ObjectArray<mirror::Object>> array = a->AsObjectArray<mirror::Object>();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001180 if (array->CheckIsValidIndex(index) && array->CheckAssignable(val)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001181 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001182 inst = inst->Next_2xx();
1183 } else {
1184 HANDLE_PENDING_EXCEPTION();
1185 }
1186 break;
1187 }
1188 case Instruction::IGET_BOOLEAN: {
1189 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001190 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(
1191 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001192 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1193 break;
1194 }
1195 case Instruction::IGET_BYTE: {
1196 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001197 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(
1198 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::IGET_CHAR: {
1203 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001204 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(
1205 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001206 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1207 break;
1208 }
1209 case Instruction::IGET_SHORT: {
1210 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001211 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(
1212 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001213 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1214 break;
1215 }
1216 case Instruction::IGET: {
1217 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001218 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(
1219 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001220 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1221 break;
1222 }
1223 case Instruction::IGET_WIDE: {
1224 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001225 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(
1226 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001227 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1228 break;
1229 }
1230 case Instruction::IGET_OBJECT: {
1231 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001232 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(
1233 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001234 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1235 break;
1236 }
1237 case Instruction::IGET_QUICK: {
1238 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001239 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001240 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1241 break;
1242 }
1243 case Instruction::IGET_WIDE_QUICK: {
1244 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001245 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001246 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1247 break;
1248 }
1249 case Instruction::IGET_OBJECT_QUICK: {
1250 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001251 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001252 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1253 break;
1254 }
Mathieu Chartierffc605c2014-12-10 10:35:44 -08001255 case Instruction::IGET_BOOLEAN_QUICK: {
1256 PREAMBLE();
1257 bool success = DoIGetQuick<Primitive::kPrimBoolean>(shadow_frame, inst, inst_data);
1258 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1259 break;
1260 }
1261 case Instruction::IGET_BYTE_QUICK: {
1262 PREAMBLE();
1263 bool success = DoIGetQuick<Primitive::kPrimByte>(shadow_frame, inst, inst_data);
1264 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1265 break;
1266 }
1267 case Instruction::IGET_CHAR_QUICK: {
1268 PREAMBLE();
1269 bool success = DoIGetQuick<Primitive::kPrimChar>(shadow_frame, inst, inst_data);
1270 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1271 break;
1272 }
1273 case Instruction::IGET_SHORT_QUICK: {
1274 PREAMBLE();
1275 bool success = DoIGetQuick<Primitive::kPrimShort>(shadow_frame, inst, inst_data);
1276 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1277 break;
1278 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001279 case Instruction::SGET_BOOLEAN: {
1280 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001281 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(
1282 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::SGET_BYTE: {
1287 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001288 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(
1289 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001290 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1291 break;
1292 }
1293 case Instruction::SGET_CHAR: {
1294 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001295 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(
1296 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001297 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1298 break;
1299 }
1300 case Instruction::SGET_SHORT: {
1301 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001302 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(
1303 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001304 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1305 break;
1306 }
1307 case Instruction::SGET: {
1308 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001309 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(
1310 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001311 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1312 break;
1313 }
1314 case Instruction::SGET_WIDE: {
1315 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001316 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(
1317 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001318 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1319 break;
1320 }
1321 case Instruction::SGET_OBJECT: {
1322 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001323 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(
1324 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001325 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1326 break;
1327 }
1328 case Instruction::IPUT_BOOLEAN: {
1329 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001330 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check,
1331 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001332 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1333 break;
1334 }
1335 case Instruction::IPUT_BYTE: {
1336 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001337 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check,
1338 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001339 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1340 break;
1341 }
1342 case Instruction::IPUT_CHAR: {
1343 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001344 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check,
1345 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001346 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1347 break;
1348 }
1349 case Instruction::IPUT_SHORT: {
1350 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001351 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check,
1352 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001353 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1354 break;
1355 }
1356 case Instruction::IPUT: {
1357 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001358 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check,
1359 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001360 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1361 break;
1362 }
1363 case Instruction::IPUT_WIDE: {
1364 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001365 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check,
1366 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001367 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1368 break;
1369 }
1370 case Instruction::IPUT_OBJECT: {
1371 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001372 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check,
1373 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001374 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1375 break;
1376 }
1377 case Instruction::IPUT_QUICK: {
1378 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001379 bool success = DoIPutQuick<Primitive::kPrimInt, transaction_active>(
1380 shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001381 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1382 break;
1383 }
Fred Shih37f05ef2014-07-16 18:38:08 -07001384 case Instruction::IPUT_BOOLEAN_QUICK: {
1385 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001386 bool success = DoIPutQuick<Primitive::kPrimBoolean, transaction_active>(
1387 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001388 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1389 break;
1390 }
1391 case Instruction::IPUT_BYTE_QUICK: {
1392 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001393 bool success = DoIPutQuick<Primitive::kPrimByte, transaction_active>(
1394 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001395 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1396 break;
1397 }
1398 case Instruction::IPUT_CHAR_QUICK: {
1399 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001400 bool success = DoIPutQuick<Primitive::kPrimChar, transaction_active>(
1401 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001402 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1403 break;
1404 }
1405 case Instruction::IPUT_SHORT_QUICK: {
1406 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001407 bool success = DoIPutQuick<Primitive::kPrimShort, transaction_active>(
1408 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001409 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1410 break;
1411 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001412 case Instruction::IPUT_WIDE_QUICK: {
1413 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001414 bool success = DoIPutQuick<Primitive::kPrimLong, transaction_active>(
1415 shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001416 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1417 break;
1418 }
1419 case Instruction::IPUT_OBJECT_QUICK: {
1420 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001421 bool success = DoIPutQuick<Primitive::kPrimNot, transaction_active>(
1422 shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001423 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1424 break;
1425 }
1426 case Instruction::SPUT_BOOLEAN: {
1427 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001428 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check,
1429 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001430 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1431 break;
1432 }
1433 case Instruction::SPUT_BYTE: {
1434 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001435 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check,
1436 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001437 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1438 break;
1439 }
1440 case Instruction::SPUT_CHAR: {
1441 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001442 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check,
1443 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001444 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1445 break;
1446 }
1447 case Instruction::SPUT_SHORT: {
1448 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001449 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check,
1450 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001451 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1452 break;
1453 }
1454 case Instruction::SPUT: {
1455 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001456 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check,
1457 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001458 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1459 break;
1460 }
1461 case Instruction::SPUT_WIDE: {
1462 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001463 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check,
1464 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001465 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1466 break;
1467 }
1468 case Instruction::SPUT_OBJECT: {
1469 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001470 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check,
1471 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001472 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1473 break;
1474 }
1475 case Instruction::INVOKE_VIRTUAL: {
1476 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001477 bool success = DoInvoke<kVirtual, false, do_access_check>(
1478 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001479 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1480 break;
1481 }
1482 case Instruction::INVOKE_VIRTUAL_RANGE: {
1483 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001484 bool success = DoInvoke<kVirtual, true, do_access_check>(
1485 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001486 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1487 break;
1488 }
1489 case Instruction::INVOKE_SUPER: {
1490 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001491 bool success = DoInvoke<kSuper, false, do_access_check>(
1492 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001493 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1494 break;
1495 }
1496 case Instruction::INVOKE_SUPER_RANGE: {
1497 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001498 bool success = DoInvoke<kSuper, true, do_access_check>(
1499 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001500 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1501 break;
1502 }
1503 case Instruction::INVOKE_DIRECT: {
1504 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001505 bool success = DoInvoke<kDirect, false, do_access_check>(
1506 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001507 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1508 break;
1509 }
1510 case Instruction::INVOKE_DIRECT_RANGE: {
1511 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001512 bool success = DoInvoke<kDirect, true, do_access_check>(
1513 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001514 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1515 break;
1516 }
1517 case Instruction::INVOKE_INTERFACE: {
1518 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001519 bool success = DoInvoke<kInterface, false, do_access_check>(
1520 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001521 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1522 break;
1523 }
1524 case Instruction::INVOKE_INTERFACE_RANGE: {
1525 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001526 bool success = DoInvoke<kInterface, true, do_access_check>(
1527 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001528 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1529 break;
1530 }
1531 case Instruction::INVOKE_STATIC: {
1532 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001533 bool success = DoInvoke<kStatic, false, do_access_check>(
1534 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001535 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1536 break;
1537 }
1538 case Instruction::INVOKE_STATIC_RANGE: {
1539 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001540 bool success = DoInvoke<kStatic, true, do_access_check>(
1541 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001542 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1543 break;
1544 }
1545 case Instruction::INVOKE_VIRTUAL_QUICK: {
1546 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001547 bool success = DoInvokeVirtualQuick<false>(
1548 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001549 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1550 break;
1551 }
1552 case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: {
1553 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001554 bool success = DoInvokeVirtualQuick<true>(
1555 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001556 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1557 break;
1558 }
Narayan Kamath9823e782016-08-03 12:46:58 +01001559 case Instruction::INVOKE_POLYMORPHIC: {
1560 PREAMBLE();
Narayan Kamath269cb432016-10-28 10:19:54 +01001561 DCHECK(Runtime::Current()->IsMethodHandlesEnabled());
Narayan Kamath9823e782016-08-03 12:46:58 +01001562 bool success = DoInvokePolymorphic<false, do_access_check>(
1563 self, shadow_frame, inst, inst_data, &result_register);
1564 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_4xx);
1565 break;
1566 }
1567 case Instruction::INVOKE_POLYMORPHIC_RANGE: {
1568 PREAMBLE();
Narayan Kamath269cb432016-10-28 10:19:54 +01001569 DCHECK(Runtime::Current()->IsMethodHandlesEnabled());
Narayan Kamath9823e782016-08-03 12:46:58 +01001570 bool success = DoInvokePolymorphic<true, do_access_check>(
1571 self, shadow_frame, inst, inst_data, &result_register);
1572 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_4xx);
1573 break;
1574 break;
1575 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001576 case Instruction::NEG_INT:
1577 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001578 shadow_frame.SetVReg(
1579 inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001580 inst = inst->Next_1xx();
1581 break;
1582 case Instruction::NOT_INT:
1583 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001584 shadow_frame.SetVReg(
1585 inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001586 inst = inst->Next_1xx();
1587 break;
1588 case Instruction::NEG_LONG:
1589 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001590 shadow_frame.SetVRegLong(
1591 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001592 inst = inst->Next_1xx();
1593 break;
1594 case Instruction::NOT_LONG:
1595 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001596 shadow_frame.SetVRegLong(
1597 inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001598 inst = inst->Next_1xx();
1599 break;
1600 case Instruction::NEG_FLOAT:
1601 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001602 shadow_frame.SetVRegFloat(
1603 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001604 inst = inst->Next_1xx();
1605 break;
1606 case Instruction::NEG_DOUBLE:
1607 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001608 shadow_frame.SetVRegDouble(
1609 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001610 inst = inst->Next_1xx();
1611 break;
1612 case Instruction::INT_TO_LONG:
1613 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001614 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
1615 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001616 inst = inst->Next_1xx();
1617 break;
1618 case Instruction::INT_TO_FLOAT:
1619 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001620 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1621 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001622 inst = inst->Next_1xx();
1623 break;
1624 case Instruction::INT_TO_DOUBLE:
1625 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001626 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1627 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001628 inst = inst->Next_1xx();
1629 break;
1630 case Instruction::LONG_TO_INT:
1631 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001632 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1633 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001634 inst = inst->Next_1xx();
1635 break;
1636 case Instruction::LONG_TO_FLOAT:
1637 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001638 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1639 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001640 inst = inst->Next_1xx();
1641 break;
1642 case Instruction::LONG_TO_DOUBLE:
1643 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001644 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1645 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001646 inst = inst->Next_1xx();
1647 break;
1648 case Instruction::FLOAT_TO_INT: {
1649 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001650 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001651 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001652 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001653 inst = inst->Next_1xx();
1654 break;
1655 }
1656 case Instruction::FLOAT_TO_LONG: {
1657 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001658 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001659 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001660 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001661 inst = inst->Next_1xx();
1662 break;
1663 }
1664 case Instruction::FLOAT_TO_DOUBLE:
1665 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001666 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1667 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001668 inst = inst->Next_1xx();
1669 break;
1670 case Instruction::DOUBLE_TO_INT: {
1671 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001672 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001673 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001674 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001675 inst = inst->Next_1xx();
1676 break;
1677 }
1678 case Instruction::DOUBLE_TO_LONG: {
1679 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001680 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001681 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001682 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001683 inst = inst->Next_1xx();
1684 break;
1685 }
1686 case Instruction::DOUBLE_TO_FLOAT:
1687 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001688 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1689 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001690 inst = inst->Next_1xx();
1691 break;
1692 case Instruction::INT_TO_BYTE:
1693 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001694 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), static_cast<int8_t>(
1695 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001696 inst = inst->Next_1xx();
1697 break;
1698 case Instruction::INT_TO_CHAR:
1699 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001700 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), static_cast<uint16_t>(
1701 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001702 inst = inst->Next_1xx();
1703 break;
1704 case Instruction::INT_TO_SHORT:
1705 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001706 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), static_cast<int16_t>(
1707 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001708 inst = inst->Next_1xx();
1709 break;
Ian Rogersf72a11d2014-10-30 15:41:08 -07001710 case Instruction::ADD_INT: {
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001711 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001712 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001713 SafeAdd(shadow_frame.GetVReg(inst->VRegB_23x()),
1714 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001715 inst = inst->Next_2xx();
1716 break;
Ian Rogersf72a11d2014-10-30 15:41:08 -07001717 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001718 case Instruction::SUB_INT:
1719 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001720 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001721 SafeSub(shadow_frame.GetVReg(inst->VRegB_23x()),
1722 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001723 inst = inst->Next_2xx();
1724 break;
1725 case Instruction::MUL_INT:
1726 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001727 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001728 SafeMul(shadow_frame.GetVReg(inst->VRegB_23x()),
1729 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001730 inst = inst->Next_2xx();
1731 break;
1732 case Instruction::DIV_INT: {
1733 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001734 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001735 shadow_frame.GetVReg(inst->VRegB_23x()),
1736 shadow_frame.GetVReg(inst->VRegC_23x()));
1737 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1738 break;
1739 }
1740 case Instruction::REM_INT: {
1741 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001742 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001743 shadow_frame.GetVReg(inst->VRegB_23x()),
1744 shadow_frame.GetVReg(inst->VRegC_23x()));
1745 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1746 break;
1747 }
1748 case Instruction::SHL_INT:
1749 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001750 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001751 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1752 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1753 inst = inst->Next_2xx();
1754 break;
1755 case Instruction::SHR_INT:
1756 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001757 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001758 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1759 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1760 inst = inst->Next_2xx();
1761 break;
1762 case Instruction::USHR_INT:
1763 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001764 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001765 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1766 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1767 inst = inst->Next_2xx();
1768 break;
1769 case Instruction::AND_INT:
1770 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001771 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001772 shadow_frame.GetVReg(inst->VRegB_23x()) &
1773 shadow_frame.GetVReg(inst->VRegC_23x()));
1774 inst = inst->Next_2xx();
1775 break;
1776 case Instruction::OR_INT:
1777 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001778 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001779 shadow_frame.GetVReg(inst->VRegB_23x()) |
1780 shadow_frame.GetVReg(inst->VRegC_23x()));
1781 inst = inst->Next_2xx();
1782 break;
1783 case Instruction::XOR_INT:
1784 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001785 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001786 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1787 shadow_frame.GetVReg(inst->VRegC_23x()));
1788 inst = inst->Next_2xx();
1789 break;
1790 case Instruction::ADD_LONG:
1791 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001792 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001793 SafeAdd(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1794 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001795 inst = inst->Next_2xx();
1796 break;
1797 case Instruction::SUB_LONG:
1798 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001799 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001800 SafeSub(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1801 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001802 inst = inst->Next_2xx();
1803 break;
1804 case Instruction::MUL_LONG:
1805 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001806 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001807 SafeMul(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1808 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001809 inst = inst->Next_2xx();
1810 break;
1811 case Instruction::DIV_LONG:
1812 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001813 DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001814 shadow_frame.GetVRegLong(inst->VRegB_23x()),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001815 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001816 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_2xx);
1817 break;
1818 case Instruction::REM_LONG:
1819 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001820 DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001821 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1822 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1823 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_2xx);
1824 break;
1825 case Instruction::AND_LONG:
1826 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001827 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001828 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1829 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1830 inst = inst->Next_2xx();
1831 break;
1832 case Instruction::OR_LONG:
1833 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001834 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001835 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1836 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1837 inst = inst->Next_2xx();
1838 break;
1839 case Instruction::XOR_LONG:
1840 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001841 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001842 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1843 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1844 inst = inst->Next_2xx();
1845 break;
1846 case Instruction::SHL_LONG:
1847 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001848 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001849 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1850 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1851 inst = inst->Next_2xx();
1852 break;
1853 case Instruction::SHR_LONG:
1854 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001855 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001856 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1857 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1858 inst = inst->Next_2xx();
1859 break;
1860 case Instruction::USHR_LONG:
1861 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001862 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001863 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1864 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1865 inst = inst->Next_2xx();
1866 break;
1867 case Instruction::ADD_FLOAT:
1868 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001869 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001870 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1871 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1872 inst = inst->Next_2xx();
1873 break;
1874 case Instruction::SUB_FLOAT:
1875 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001876 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001877 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1878 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1879 inst = inst->Next_2xx();
1880 break;
1881 case Instruction::MUL_FLOAT:
1882 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001883 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001884 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1885 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1886 inst = inst->Next_2xx();
1887 break;
1888 case Instruction::DIV_FLOAT:
1889 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001890 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001891 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1892 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1893 inst = inst->Next_2xx();
1894 break;
1895 case Instruction::REM_FLOAT:
1896 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001897 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001898 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1899 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1900 inst = inst->Next_2xx();
1901 break;
1902 case Instruction::ADD_DOUBLE:
1903 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001904 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001905 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1906 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1907 inst = inst->Next_2xx();
1908 break;
1909 case Instruction::SUB_DOUBLE:
1910 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001911 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001912 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1913 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1914 inst = inst->Next_2xx();
1915 break;
1916 case Instruction::MUL_DOUBLE:
1917 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001918 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001919 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1920 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1921 inst = inst->Next_2xx();
1922 break;
1923 case Instruction::DIV_DOUBLE:
1924 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001925 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001926 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1927 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1928 inst = inst->Next_2xx();
1929 break;
1930 case Instruction::REM_DOUBLE:
1931 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001932 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001933 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1934 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1935 inst = inst->Next_2xx();
1936 break;
1937 case Instruction::ADD_INT_2ADDR: {
1938 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001939 uint4_t vregA = inst->VRegA_12x(inst_data);
Ian Rogersf72a11d2014-10-30 15:41:08 -07001940 shadow_frame.SetVReg(vregA, SafeAdd(shadow_frame.GetVReg(vregA),
1941 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001942 inst = inst->Next_1xx();
1943 break;
1944 }
1945 case Instruction::SUB_INT_2ADDR: {
1946 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001947 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001948 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001949 SafeSub(shadow_frame.GetVReg(vregA),
1950 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001951 inst = inst->Next_1xx();
1952 break;
1953 }
1954 case Instruction::MUL_INT_2ADDR: {
1955 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001956 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001957 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001958 SafeMul(shadow_frame.GetVReg(vregA),
1959 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001960 inst = inst->Next_1xx();
1961 break;
1962 }
1963 case Instruction::DIV_INT_2ADDR: {
1964 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001965 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001966 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001967 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001968 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx);
1969 break;
1970 }
1971 case Instruction::REM_INT_2ADDR: {
1972 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001973 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001974 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001975 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001976 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx);
1977 break;
1978 }
1979 case Instruction::SHL_INT_2ADDR: {
1980 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001981 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001982 shadow_frame.SetVReg(vregA,
1983 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001984 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001985 inst = inst->Next_1xx();
1986 break;
1987 }
1988 case Instruction::SHR_INT_2ADDR: {
1989 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001990 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001991 shadow_frame.SetVReg(vregA,
1992 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001993 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001994 inst = inst->Next_1xx();
1995 break;
1996 }
1997 case Instruction::USHR_INT_2ADDR: {
1998 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001999 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002000 shadow_frame.SetVReg(vregA,
2001 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002002 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002003 inst = inst->Next_1xx();
2004 break;
2005 }
2006 case Instruction::AND_INT_2ADDR: {
2007 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002008 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002009 shadow_frame.SetVReg(vregA,
2010 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002011 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002012 inst = inst->Next_1xx();
2013 break;
2014 }
2015 case Instruction::OR_INT_2ADDR: {
2016 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002017 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002018 shadow_frame.SetVReg(vregA,
2019 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002020 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002021 inst = inst->Next_1xx();
2022 break;
2023 }
2024 case Instruction::XOR_INT_2ADDR: {
2025 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002026 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002027 shadow_frame.SetVReg(vregA,
2028 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002029 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002030 inst = inst->Next_1xx();
2031 break;
2032 }
2033 case Instruction::ADD_LONG_2ADDR: {
2034 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002035 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002036 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002037 SafeAdd(shadow_frame.GetVRegLong(vregA),
2038 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002039 inst = inst->Next_1xx();
2040 break;
2041 }
2042 case Instruction::SUB_LONG_2ADDR: {
2043 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002044 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002045 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002046 SafeSub(shadow_frame.GetVRegLong(vregA),
2047 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002048 inst = inst->Next_1xx();
2049 break;
2050 }
2051 case Instruction::MUL_LONG_2ADDR: {
2052 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002053 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002054 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002055 SafeMul(shadow_frame.GetVRegLong(vregA),
2056 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002057 inst = inst->Next_1xx();
2058 break;
2059 }
2060 case Instruction::DIV_LONG_2ADDR: {
2061 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002062 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002063 DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002064 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002065 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
2066 break;
2067 }
2068 case Instruction::REM_LONG_2ADDR: {
2069 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002070 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002071 DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002072 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002073 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
2074 break;
2075 }
2076 case Instruction::AND_LONG_2ADDR: {
2077 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002078 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002079 shadow_frame.SetVRegLong(vregA,
2080 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002081 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002082 inst = inst->Next_1xx();
2083 break;
2084 }
2085 case Instruction::OR_LONG_2ADDR: {
2086 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002087 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002088 shadow_frame.SetVRegLong(vregA,
2089 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002090 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002091 inst = inst->Next_1xx();
2092 break;
2093 }
2094 case Instruction::XOR_LONG_2ADDR: {
2095 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002096 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002097 shadow_frame.SetVRegLong(vregA,
2098 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002099 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002100 inst = inst->Next_1xx();
2101 break;
2102 }
2103 case Instruction::SHL_LONG_2ADDR: {
2104 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002105 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002106 shadow_frame.SetVRegLong(vregA,
2107 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002108 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002109 inst = inst->Next_1xx();
2110 break;
2111 }
2112 case Instruction::SHR_LONG_2ADDR: {
2113 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002114 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002115 shadow_frame.SetVRegLong(vregA,
2116 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002117 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002118 inst = inst->Next_1xx();
2119 break;
2120 }
2121 case Instruction::USHR_LONG_2ADDR: {
2122 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002123 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002124 shadow_frame.SetVRegLong(vregA,
2125 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002126 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002127 inst = inst->Next_1xx();
2128 break;
2129 }
2130 case Instruction::ADD_FLOAT_2ADDR: {
2131 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002132 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002133 shadow_frame.SetVRegFloat(vregA,
2134 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002135 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002136 inst = inst->Next_1xx();
2137 break;
2138 }
2139 case Instruction::SUB_FLOAT_2ADDR: {
2140 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002141 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002142 shadow_frame.SetVRegFloat(vregA,
2143 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002144 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002145 inst = inst->Next_1xx();
2146 break;
2147 }
2148 case Instruction::MUL_FLOAT_2ADDR: {
2149 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002150 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002151 shadow_frame.SetVRegFloat(vregA,
2152 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002153 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002154 inst = inst->Next_1xx();
2155 break;
2156 }
2157 case Instruction::DIV_FLOAT_2ADDR: {
2158 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002159 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002160 shadow_frame.SetVRegFloat(vregA,
2161 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002162 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002163 inst = inst->Next_1xx();
2164 break;
2165 }
2166 case Instruction::REM_FLOAT_2ADDR: {
2167 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002168 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002169 shadow_frame.SetVRegFloat(vregA,
2170 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002171 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002172 inst = inst->Next_1xx();
2173 break;
2174 }
2175 case Instruction::ADD_DOUBLE_2ADDR: {
2176 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002177 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002178 shadow_frame.SetVRegDouble(vregA,
2179 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002180 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002181 inst = inst->Next_1xx();
2182 break;
2183 }
2184 case Instruction::SUB_DOUBLE_2ADDR: {
2185 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002186 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002187 shadow_frame.SetVRegDouble(vregA,
2188 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002189 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002190 inst = inst->Next_1xx();
2191 break;
2192 }
2193 case Instruction::MUL_DOUBLE_2ADDR: {
2194 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002195 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002196 shadow_frame.SetVRegDouble(vregA,
2197 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002198 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002199 inst = inst->Next_1xx();
2200 break;
2201 }
2202 case Instruction::DIV_DOUBLE_2ADDR: {
2203 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002204 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002205 shadow_frame.SetVRegDouble(vregA,
2206 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002207 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002208 inst = inst->Next_1xx();
2209 break;
2210 }
2211 case Instruction::REM_DOUBLE_2ADDR: {
2212 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002213 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002214 shadow_frame.SetVRegDouble(vregA,
2215 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002216 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002217 inst = inst->Next_1xx();
2218 break;
2219 }
2220 case Instruction::ADD_INT_LIT16:
2221 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002222 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002223 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2224 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002225 inst = inst->Next_2xx();
2226 break;
Ian Rogersf72a11d2014-10-30 15:41:08 -07002227 case Instruction::RSUB_INT_LIT16:
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002228 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002229 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002230 SafeSub(inst->VRegC_22s(),
2231 shadow_frame.GetVReg(inst->VRegB_22s(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002232 inst = inst->Next_2xx();
2233 break;
2234 case Instruction::MUL_INT_LIT16:
2235 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002236 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002237 SafeMul(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2238 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002239 inst = inst->Next_2xx();
2240 break;
2241 case Instruction::DIV_INT_LIT16: {
2242 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002243 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
Mathieu Chartier2cebb242015-04-21 16:50:40 -07002244 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2245 inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002246 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2247 break;
2248 }
2249 case Instruction::REM_INT_LIT16: {
2250 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002251 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
Mathieu Chartier2cebb242015-04-21 16:50:40 -07002252 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2253 inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002254 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2255 break;
2256 }
2257 case Instruction::AND_INT_LIT16:
2258 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002259 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2260 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002261 inst->VRegC_22s());
2262 inst = inst->Next_2xx();
2263 break;
2264 case Instruction::OR_INT_LIT16:
2265 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002266 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2267 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002268 inst->VRegC_22s());
2269 inst = inst->Next_2xx();
2270 break;
2271 case Instruction::XOR_INT_LIT16:
2272 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002273 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2274 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002275 inst->VRegC_22s());
2276 inst = inst->Next_2xx();
2277 break;
2278 case Instruction::ADD_INT_LIT8:
2279 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002280 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002281 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002282 inst = inst->Next_2xx();
2283 break;
2284 case Instruction::RSUB_INT_LIT8:
2285 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002286 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002287 SafeSub(inst->VRegC_22b(), shadow_frame.GetVReg(inst->VRegB_22b())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002288 inst = inst->Next_2xx();
2289 break;
2290 case Instruction::MUL_INT_LIT8:
2291 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002292 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002293 SafeMul(shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002294 inst = inst->Next_2xx();
2295 break;
2296 case Instruction::DIV_INT_LIT8: {
2297 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002298 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002299 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
2300 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2301 break;
2302 }
2303 case Instruction::REM_INT_LIT8: {
2304 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002305 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002306 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
2307 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2308 break;
2309 }
2310 case Instruction::AND_INT_LIT8:
2311 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002312 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002313 shadow_frame.GetVReg(inst->VRegB_22b()) &
2314 inst->VRegC_22b());
2315 inst = inst->Next_2xx();
2316 break;
2317 case Instruction::OR_INT_LIT8:
2318 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002319 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002320 shadow_frame.GetVReg(inst->VRegB_22b()) |
2321 inst->VRegC_22b());
2322 inst = inst->Next_2xx();
2323 break;
2324 case Instruction::XOR_INT_LIT8:
2325 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002326 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002327 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2328 inst->VRegC_22b());
2329 inst = inst->Next_2xx();
2330 break;
2331 case Instruction::SHL_INT_LIT8:
2332 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002333 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002334 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2335 (inst->VRegC_22b() & 0x1f));
2336 inst = inst->Next_2xx();
2337 break;
2338 case Instruction::SHR_INT_LIT8:
2339 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002340 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002341 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2342 (inst->VRegC_22b() & 0x1f));
2343 inst = inst->Next_2xx();
2344 break;
2345 case Instruction::USHR_INT_LIT8:
2346 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002347 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002348 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2349 (inst->VRegC_22b() & 0x1f));
2350 inst = inst->Next_2xx();
2351 break;
2352 case Instruction::UNUSED_3E ... Instruction::UNUSED_43:
Narayan Kamath8ec3bd22016-08-03 12:46:23 +01002353 case Instruction::UNUSED_F3 ... Instruction::UNUSED_F9:
2354 case Instruction::UNUSED_FC ... Instruction::UNUSED_FF:
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002355 case Instruction::UNUSED_79:
2356 case Instruction::UNUSED_7A:
Ian Rogerse94652f2014-12-02 11:13:19 -08002357 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002358 }
buzbee1452bee2015-03-06 14:43:04 -08002359 } while (!interpret_one_instruction);
2360 // Record where we stopped.
2361 shadow_frame.SetDexPC(inst->GetDexPc(insns));
buzbeed6b48db2016-01-28 15:48:55 -08002362 return result_register;
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002363} // NOLINT(readability/fn_size)
2364
2365// Explicit definitions of ExecuteSwitchImpl.
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002366template HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002367JValue ExecuteSwitchImpl<true, false>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002368 ShadowFrame& shadow_frame, JValue result_register,
2369 bool interpret_one_instruction);
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002370template HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002371JValue ExecuteSwitchImpl<false, false>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002372 ShadowFrame& shadow_frame, JValue result_register,
2373 bool interpret_one_instruction);
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002374template
Ian Rogerse94652f2014-12-02 11:13:19 -08002375JValue ExecuteSwitchImpl<true, true>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002376 ShadowFrame& shadow_frame, JValue result_register,
2377 bool interpret_one_instruction);
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002378template
Ian Rogerse94652f2014-12-02 11:13:19 -08002379JValue ExecuteSwitchImpl<false, true>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002380 ShadowFrame& shadow_frame, JValue result_register,
2381 bool interpret_one_instruction);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002382
2383} // namespace interpreter
2384} // namespace art