blob: 43bc9bd1620676f16bc1a87db1228df780265a10 [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();
1561 bool success = DoInvokePolymorphic<false, do_access_check>(
1562 self, shadow_frame, inst, inst_data, &result_register);
1563 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_4xx);
1564 break;
1565 }
1566 case Instruction::INVOKE_POLYMORPHIC_RANGE: {
1567 PREAMBLE();
1568 bool success = DoInvokePolymorphic<true, do_access_check>(
1569 self, shadow_frame, inst, inst_data, &result_register);
1570 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_4xx);
1571 break;
1572 break;
1573 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001574 case Instruction::NEG_INT:
1575 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001576 shadow_frame.SetVReg(
1577 inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001578 inst = inst->Next_1xx();
1579 break;
1580 case Instruction::NOT_INT:
1581 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001582 shadow_frame.SetVReg(
1583 inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001584 inst = inst->Next_1xx();
1585 break;
1586 case Instruction::NEG_LONG:
1587 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001588 shadow_frame.SetVRegLong(
1589 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001590 inst = inst->Next_1xx();
1591 break;
1592 case Instruction::NOT_LONG:
1593 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001594 shadow_frame.SetVRegLong(
1595 inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001596 inst = inst->Next_1xx();
1597 break;
1598 case Instruction::NEG_FLOAT:
1599 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001600 shadow_frame.SetVRegFloat(
1601 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001602 inst = inst->Next_1xx();
1603 break;
1604 case Instruction::NEG_DOUBLE:
1605 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001606 shadow_frame.SetVRegDouble(
1607 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001608 inst = inst->Next_1xx();
1609 break;
1610 case Instruction::INT_TO_LONG:
1611 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001612 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
1613 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001614 inst = inst->Next_1xx();
1615 break;
1616 case Instruction::INT_TO_FLOAT:
1617 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001618 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1619 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001620 inst = inst->Next_1xx();
1621 break;
1622 case Instruction::INT_TO_DOUBLE:
1623 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001624 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1625 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001626 inst = inst->Next_1xx();
1627 break;
1628 case Instruction::LONG_TO_INT:
1629 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001630 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1631 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001632 inst = inst->Next_1xx();
1633 break;
1634 case Instruction::LONG_TO_FLOAT:
1635 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001636 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1637 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001638 inst = inst->Next_1xx();
1639 break;
1640 case Instruction::LONG_TO_DOUBLE:
1641 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001642 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1643 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001644 inst = inst->Next_1xx();
1645 break;
1646 case Instruction::FLOAT_TO_INT: {
1647 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001648 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001649 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001650 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001651 inst = inst->Next_1xx();
1652 break;
1653 }
1654 case Instruction::FLOAT_TO_LONG: {
1655 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001656 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001657 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001658 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001659 inst = inst->Next_1xx();
1660 break;
1661 }
1662 case Instruction::FLOAT_TO_DOUBLE:
1663 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001664 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1665 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001666 inst = inst->Next_1xx();
1667 break;
1668 case Instruction::DOUBLE_TO_INT: {
1669 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001670 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001671 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001672 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001673 inst = inst->Next_1xx();
1674 break;
1675 }
1676 case Instruction::DOUBLE_TO_LONG: {
1677 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001678 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001679 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001680 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001681 inst = inst->Next_1xx();
1682 break;
1683 }
1684 case Instruction::DOUBLE_TO_FLOAT:
1685 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001686 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1687 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001688 inst = inst->Next_1xx();
1689 break;
1690 case Instruction::INT_TO_BYTE:
1691 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001692 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), static_cast<int8_t>(
1693 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001694 inst = inst->Next_1xx();
1695 break;
1696 case Instruction::INT_TO_CHAR:
1697 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001698 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), static_cast<uint16_t>(
1699 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001700 inst = inst->Next_1xx();
1701 break;
1702 case Instruction::INT_TO_SHORT:
1703 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001704 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), static_cast<int16_t>(
1705 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001706 inst = inst->Next_1xx();
1707 break;
Ian Rogersf72a11d2014-10-30 15:41:08 -07001708 case Instruction::ADD_INT: {
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001709 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001710 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001711 SafeAdd(shadow_frame.GetVReg(inst->VRegB_23x()),
1712 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001713 inst = inst->Next_2xx();
1714 break;
Ian Rogersf72a11d2014-10-30 15:41:08 -07001715 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001716 case Instruction::SUB_INT:
1717 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001718 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001719 SafeSub(shadow_frame.GetVReg(inst->VRegB_23x()),
1720 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001721 inst = inst->Next_2xx();
1722 break;
1723 case Instruction::MUL_INT:
1724 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001725 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001726 SafeMul(shadow_frame.GetVReg(inst->VRegB_23x()),
1727 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001728 inst = inst->Next_2xx();
1729 break;
1730 case Instruction::DIV_INT: {
1731 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001732 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001733 shadow_frame.GetVReg(inst->VRegB_23x()),
1734 shadow_frame.GetVReg(inst->VRegC_23x()));
1735 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1736 break;
1737 }
1738 case Instruction::REM_INT: {
1739 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001740 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001741 shadow_frame.GetVReg(inst->VRegB_23x()),
1742 shadow_frame.GetVReg(inst->VRegC_23x()));
1743 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1744 break;
1745 }
1746 case Instruction::SHL_INT:
1747 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001748 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001749 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1750 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1751 inst = inst->Next_2xx();
1752 break;
1753 case Instruction::SHR_INT:
1754 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001755 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001756 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1757 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1758 inst = inst->Next_2xx();
1759 break;
1760 case Instruction::USHR_INT:
1761 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001762 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001763 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1764 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1765 inst = inst->Next_2xx();
1766 break;
1767 case Instruction::AND_INT:
1768 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001769 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001770 shadow_frame.GetVReg(inst->VRegB_23x()) &
1771 shadow_frame.GetVReg(inst->VRegC_23x()));
1772 inst = inst->Next_2xx();
1773 break;
1774 case Instruction::OR_INT:
1775 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001776 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001777 shadow_frame.GetVReg(inst->VRegB_23x()) |
1778 shadow_frame.GetVReg(inst->VRegC_23x()));
1779 inst = inst->Next_2xx();
1780 break;
1781 case Instruction::XOR_INT:
1782 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001783 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001784 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1785 shadow_frame.GetVReg(inst->VRegC_23x()));
1786 inst = inst->Next_2xx();
1787 break;
1788 case Instruction::ADD_LONG:
1789 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001790 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001791 SafeAdd(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1792 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001793 inst = inst->Next_2xx();
1794 break;
1795 case Instruction::SUB_LONG:
1796 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001797 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001798 SafeSub(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1799 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001800 inst = inst->Next_2xx();
1801 break;
1802 case Instruction::MUL_LONG:
1803 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001804 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001805 SafeMul(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1806 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001807 inst = inst->Next_2xx();
1808 break;
1809 case Instruction::DIV_LONG:
1810 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001811 DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001812 shadow_frame.GetVRegLong(inst->VRegB_23x()),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001813 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001814 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_2xx);
1815 break;
1816 case Instruction::REM_LONG:
1817 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001818 DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001819 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1820 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1821 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_2xx);
1822 break;
1823 case Instruction::AND_LONG:
1824 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001825 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001826 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1827 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1828 inst = inst->Next_2xx();
1829 break;
1830 case Instruction::OR_LONG:
1831 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001832 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001833 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1834 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1835 inst = inst->Next_2xx();
1836 break;
1837 case Instruction::XOR_LONG:
1838 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001839 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001840 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1841 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1842 inst = inst->Next_2xx();
1843 break;
1844 case Instruction::SHL_LONG:
1845 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001846 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001847 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1848 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1849 inst = inst->Next_2xx();
1850 break;
1851 case Instruction::SHR_LONG:
1852 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001853 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001854 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1855 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1856 inst = inst->Next_2xx();
1857 break;
1858 case Instruction::USHR_LONG:
1859 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001860 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001861 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1862 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1863 inst = inst->Next_2xx();
1864 break;
1865 case Instruction::ADD_FLOAT:
1866 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001867 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001868 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1869 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1870 inst = inst->Next_2xx();
1871 break;
1872 case Instruction::SUB_FLOAT:
1873 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001874 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001875 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1876 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1877 inst = inst->Next_2xx();
1878 break;
1879 case Instruction::MUL_FLOAT:
1880 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001881 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001882 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1883 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1884 inst = inst->Next_2xx();
1885 break;
1886 case Instruction::DIV_FLOAT:
1887 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001888 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001889 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1890 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1891 inst = inst->Next_2xx();
1892 break;
1893 case Instruction::REM_FLOAT:
1894 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001895 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001896 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1897 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1898 inst = inst->Next_2xx();
1899 break;
1900 case Instruction::ADD_DOUBLE:
1901 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001902 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001903 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1904 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1905 inst = inst->Next_2xx();
1906 break;
1907 case Instruction::SUB_DOUBLE:
1908 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001909 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001910 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1911 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1912 inst = inst->Next_2xx();
1913 break;
1914 case Instruction::MUL_DOUBLE:
1915 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001916 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001917 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1918 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1919 inst = inst->Next_2xx();
1920 break;
1921 case Instruction::DIV_DOUBLE:
1922 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001923 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001924 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1925 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1926 inst = inst->Next_2xx();
1927 break;
1928 case Instruction::REM_DOUBLE:
1929 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001930 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001931 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1932 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1933 inst = inst->Next_2xx();
1934 break;
1935 case Instruction::ADD_INT_2ADDR: {
1936 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001937 uint4_t vregA = inst->VRegA_12x(inst_data);
Ian Rogersf72a11d2014-10-30 15:41:08 -07001938 shadow_frame.SetVReg(vregA, SafeAdd(shadow_frame.GetVReg(vregA),
1939 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001940 inst = inst->Next_1xx();
1941 break;
1942 }
1943 case Instruction::SUB_INT_2ADDR: {
1944 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001945 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001946 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001947 SafeSub(shadow_frame.GetVReg(vregA),
1948 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001949 inst = inst->Next_1xx();
1950 break;
1951 }
1952 case Instruction::MUL_INT_2ADDR: {
1953 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001954 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001955 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001956 SafeMul(shadow_frame.GetVReg(vregA),
1957 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001958 inst = inst->Next_1xx();
1959 break;
1960 }
1961 case Instruction::DIV_INT_2ADDR: {
1962 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001963 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001964 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001965 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001966 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx);
1967 break;
1968 }
1969 case Instruction::REM_INT_2ADDR: {
1970 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001971 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001972 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001973 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001974 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx);
1975 break;
1976 }
1977 case Instruction::SHL_INT_2ADDR: {
1978 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001979 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001980 shadow_frame.SetVReg(vregA,
1981 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001982 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001983 inst = inst->Next_1xx();
1984 break;
1985 }
1986 case Instruction::SHR_INT_2ADDR: {
1987 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001988 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001989 shadow_frame.SetVReg(vregA,
1990 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001991 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001992 inst = inst->Next_1xx();
1993 break;
1994 }
1995 case Instruction::USHR_INT_2ADDR: {
1996 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001997 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001998 shadow_frame.SetVReg(vregA,
1999 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002000 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002001 inst = inst->Next_1xx();
2002 break;
2003 }
2004 case Instruction::AND_INT_2ADDR: {
2005 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002006 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002007 shadow_frame.SetVReg(vregA,
2008 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002009 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002010 inst = inst->Next_1xx();
2011 break;
2012 }
2013 case Instruction::OR_INT_2ADDR: {
2014 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002015 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002016 shadow_frame.SetVReg(vregA,
2017 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002018 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002019 inst = inst->Next_1xx();
2020 break;
2021 }
2022 case Instruction::XOR_INT_2ADDR: {
2023 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002024 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002025 shadow_frame.SetVReg(vregA,
2026 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002027 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002028 inst = inst->Next_1xx();
2029 break;
2030 }
2031 case Instruction::ADD_LONG_2ADDR: {
2032 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002033 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002034 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002035 SafeAdd(shadow_frame.GetVRegLong(vregA),
2036 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002037 inst = inst->Next_1xx();
2038 break;
2039 }
2040 case Instruction::SUB_LONG_2ADDR: {
2041 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002042 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002043 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002044 SafeSub(shadow_frame.GetVRegLong(vregA),
2045 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002046 inst = inst->Next_1xx();
2047 break;
2048 }
2049 case Instruction::MUL_LONG_2ADDR: {
2050 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002051 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002052 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002053 SafeMul(shadow_frame.GetVRegLong(vregA),
2054 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002055 inst = inst->Next_1xx();
2056 break;
2057 }
2058 case Instruction::DIV_LONG_2ADDR: {
2059 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002060 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002061 DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002062 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002063 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
2064 break;
2065 }
2066 case Instruction::REM_LONG_2ADDR: {
2067 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002068 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002069 DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002070 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002071 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
2072 break;
2073 }
2074 case Instruction::AND_LONG_2ADDR: {
2075 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002076 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002077 shadow_frame.SetVRegLong(vregA,
2078 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002079 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002080 inst = inst->Next_1xx();
2081 break;
2082 }
2083 case Instruction::OR_LONG_2ADDR: {
2084 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002085 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002086 shadow_frame.SetVRegLong(vregA,
2087 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002088 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002089 inst = inst->Next_1xx();
2090 break;
2091 }
2092 case Instruction::XOR_LONG_2ADDR: {
2093 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002094 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002095 shadow_frame.SetVRegLong(vregA,
2096 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002097 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002098 inst = inst->Next_1xx();
2099 break;
2100 }
2101 case Instruction::SHL_LONG_2ADDR: {
2102 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002103 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002104 shadow_frame.SetVRegLong(vregA,
2105 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002106 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002107 inst = inst->Next_1xx();
2108 break;
2109 }
2110 case Instruction::SHR_LONG_2ADDR: {
2111 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002112 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002113 shadow_frame.SetVRegLong(vregA,
2114 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002115 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002116 inst = inst->Next_1xx();
2117 break;
2118 }
2119 case Instruction::USHR_LONG_2ADDR: {
2120 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002121 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002122 shadow_frame.SetVRegLong(vregA,
2123 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002124 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002125 inst = inst->Next_1xx();
2126 break;
2127 }
2128 case Instruction::ADD_FLOAT_2ADDR: {
2129 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002130 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002131 shadow_frame.SetVRegFloat(vregA,
2132 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002133 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002134 inst = inst->Next_1xx();
2135 break;
2136 }
2137 case Instruction::SUB_FLOAT_2ADDR: {
2138 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002139 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002140 shadow_frame.SetVRegFloat(vregA,
2141 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002142 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002143 inst = inst->Next_1xx();
2144 break;
2145 }
2146 case Instruction::MUL_FLOAT_2ADDR: {
2147 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002148 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002149 shadow_frame.SetVRegFloat(vregA,
2150 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002151 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002152 inst = inst->Next_1xx();
2153 break;
2154 }
2155 case Instruction::DIV_FLOAT_2ADDR: {
2156 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002157 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002158 shadow_frame.SetVRegFloat(vregA,
2159 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002160 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002161 inst = inst->Next_1xx();
2162 break;
2163 }
2164 case Instruction::REM_FLOAT_2ADDR: {
2165 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002166 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002167 shadow_frame.SetVRegFloat(vregA,
2168 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002169 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002170 inst = inst->Next_1xx();
2171 break;
2172 }
2173 case Instruction::ADD_DOUBLE_2ADDR: {
2174 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002175 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002176 shadow_frame.SetVRegDouble(vregA,
2177 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002178 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002179 inst = inst->Next_1xx();
2180 break;
2181 }
2182 case Instruction::SUB_DOUBLE_2ADDR: {
2183 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002184 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002185 shadow_frame.SetVRegDouble(vregA,
2186 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002187 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002188 inst = inst->Next_1xx();
2189 break;
2190 }
2191 case Instruction::MUL_DOUBLE_2ADDR: {
2192 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002193 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002194 shadow_frame.SetVRegDouble(vregA,
2195 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002196 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002197 inst = inst->Next_1xx();
2198 break;
2199 }
2200 case Instruction::DIV_DOUBLE_2ADDR: {
2201 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002202 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002203 shadow_frame.SetVRegDouble(vregA,
2204 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002205 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002206 inst = inst->Next_1xx();
2207 break;
2208 }
2209 case Instruction::REM_DOUBLE_2ADDR: {
2210 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002211 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002212 shadow_frame.SetVRegDouble(vregA,
2213 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002214 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002215 inst = inst->Next_1xx();
2216 break;
2217 }
2218 case Instruction::ADD_INT_LIT16:
2219 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002220 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002221 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2222 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002223 inst = inst->Next_2xx();
2224 break;
Ian Rogersf72a11d2014-10-30 15:41:08 -07002225 case Instruction::RSUB_INT_LIT16:
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002226 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002227 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002228 SafeSub(inst->VRegC_22s(),
2229 shadow_frame.GetVReg(inst->VRegB_22s(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002230 inst = inst->Next_2xx();
2231 break;
2232 case Instruction::MUL_INT_LIT16:
2233 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002234 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002235 SafeMul(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2236 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002237 inst = inst->Next_2xx();
2238 break;
2239 case Instruction::DIV_INT_LIT16: {
2240 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002241 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
Mathieu Chartier2cebb242015-04-21 16:50:40 -07002242 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2243 inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002244 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2245 break;
2246 }
2247 case Instruction::REM_INT_LIT16: {
2248 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002249 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
Mathieu Chartier2cebb242015-04-21 16:50:40 -07002250 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2251 inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002252 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2253 break;
2254 }
2255 case Instruction::AND_INT_LIT16:
2256 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002257 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2258 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002259 inst->VRegC_22s());
2260 inst = inst->Next_2xx();
2261 break;
2262 case Instruction::OR_INT_LIT16:
2263 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002264 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2265 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002266 inst->VRegC_22s());
2267 inst = inst->Next_2xx();
2268 break;
2269 case Instruction::XOR_INT_LIT16:
2270 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002271 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2272 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002273 inst->VRegC_22s());
2274 inst = inst->Next_2xx();
2275 break;
2276 case Instruction::ADD_INT_LIT8:
2277 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002278 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002279 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002280 inst = inst->Next_2xx();
2281 break;
2282 case Instruction::RSUB_INT_LIT8:
2283 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002284 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002285 SafeSub(inst->VRegC_22b(), shadow_frame.GetVReg(inst->VRegB_22b())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002286 inst = inst->Next_2xx();
2287 break;
2288 case Instruction::MUL_INT_LIT8:
2289 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002290 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002291 SafeMul(shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002292 inst = inst->Next_2xx();
2293 break;
2294 case Instruction::DIV_INT_LIT8: {
2295 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002296 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002297 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
2298 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2299 break;
2300 }
2301 case Instruction::REM_INT_LIT8: {
2302 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002303 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002304 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
2305 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2306 break;
2307 }
2308 case Instruction::AND_INT_LIT8:
2309 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002310 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002311 shadow_frame.GetVReg(inst->VRegB_22b()) &
2312 inst->VRegC_22b());
2313 inst = inst->Next_2xx();
2314 break;
2315 case Instruction::OR_INT_LIT8:
2316 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002317 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002318 shadow_frame.GetVReg(inst->VRegB_22b()) |
2319 inst->VRegC_22b());
2320 inst = inst->Next_2xx();
2321 break;
2322 case Instruction::XOR_INT_LIT8:
2323 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002324 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002325 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2326 inst->VRegC_22b());
2327 inst = inst->Next_2xx();
2328 break;
2329 case Instruction::SHL_INT_LIT8:
2330 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002331 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002332 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2333 (inst->VRegC_22b() & 0x1f));
2334 inst = inst->Next_2xx();
2335 break;
2336 case Instruction::SHR_INT_LIT8:
2337 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002338 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002339 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2340 (inst->VRegC_22b() & 0x1f));
2341 inst = inst->Next_2xx();
2342 break;
2343 case Instruction::USHR_INT_LIT8:
2344 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002345 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002346 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2347 (inst->VRegC_22b() & 0x1f));
2348 inst = inst->Next_2xx();
2349 break;
2350 case Instruction::UNUSED_3E ... Instruction::UNUSED_43:
Narayan Kamath8ec3bd22016-08-03 12:46:23 +01002351 case Instruction::UNUSED_F3 ... Instruction::UNUSED_F9:
2352 case Instruction::UNUSED_FC ... Instruction::UNUSED_FF:
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002353 case Instruction::UNUSED_79:
2354 case Instruction::UNUSED_7A:
Ian Rogerse94652f2014-12-02 11:13:19 -08002355 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002356 }
buzbee1452bee2015-03-06 14:43:04 -08002357 } while (!interpret_one_instruction);
2358 // Record where we stopped.
2359 shadow_frame.SetDexPC(inst->GetDexPc(insns));
buzbeed6b48db2016-01-28 15:48:55 -08002360 return result_register;
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002361} // NOLINT(readability/fn_size)
2362
2363// Explicit definitions of ExecuteSwitchImpl.
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002364template HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002365JValue ExecuteSwitchImpl<true, false>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002366 ShadowFrame& shadow_frame, JValue result_register,
2367 bool interpret_one_instruction);
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002368template HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002369JValue ExecuteSwitchImpl<false, false>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002370 ShadowFrame& shadow_frame, JValue result_register,
2371 bool interpret_one_instruction);
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002372template
Ian Rogerse94652f2014-12-02 11:13:19 -08002373JValue ExecuteSwitchImpl<true, true>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002374 ShadowFrame& shadow_frame, JValue result_register,
2375 bool interpret_one_instruction);
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002376template
Ian Rogerse94652f2014-12-02 11:13:19 -08002377JValue ExecuteSwitchImpl<false, true>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002378 ShadowFrame& shadow_frame, JValue result_register,
2379 bool interpret_one_instruction);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002380
2381} // namespace interpreter
2382} // namespace art