blob: b191dd79a115af07099e6468bdb6fc628e9f5e09 [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
Andreas Gampef4f76372016-12-13 14:43:58 -080095#define HANDLE_BACKWARD_BRANCH(offset) \
96 do { \
97 if (IsBackwardBranch(offset)) { \
98 HOTNESS_UPDATE(); \
99 /* Record new dex pc early to have consistent suspend point at loop header. */ \
100 shadow_frame.SetDexPC(inst->GetDexPc(insns)); \
101 self->AllowThreadSuspension(); \
102 } \
103 } while (false)
104
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100105template<bool do_access_check, bool transaction_active>
Ian Rogerse94652f2014-12-02 11:13:19 -0800106JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -0800107 ShadowFrame& shadow_frame, JValue result_register,
108 bool interpret_one_instruction) {
Igor Murashkinc449e8b2015-06-10 15:56:42 -0700109 constexpr bool do_assignability_check = do_access_check;
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200110 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
111 LOG(FATAL) << "Invalid shadow frame for interpreter use";
112 return JValue();
113 }
114 self->VerifyStack();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200115
116 uint32_t dex_pc = shadow_frame.GetDexPC();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700117 const auto* const instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200118 const uint16_t* const insns = code_item->insns_;
119 const Instruction* inst = Instruction::At(insns + dex_pc);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200120 uint16_t inst_data;
Bill Buzbee1d011d92016-04-04 16:59:29 +0000121 ArtMethod* method = shadow_frame.GetMethod();
122 jit::Jit* jit = Runtime::Current()->GetJit();
Igor Murashkin6918bf12015-09-27 19:19:06 -0700123
buzbee1452bee2015-03-06 14:43:04 -0800124 do {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200125 dex_pc = inst->GetDexPc(insns);
126 shadow_frame.SetDexPC(dex_pc);
Ian Rogerse94652f2014-12-02 11:13:19 -0800127 TraceExecution(shadow_frame, inst, dex_pc);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200128 inst_data = inst->Fetch16(0);
129 switch (inst->Opcode(inst_data)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200130 case Instruction::NOP:
131 PREAMBLE();
132 inst = inst->Next_1xx();
133 break;
134 case Instruction::MOVE:
135 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200136 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
137 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200138 inst = inst->Next_1xx();
139 break;
140 case Instruction::MOVE_FROM16:
141 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200142 shadow_frame.SetVReg(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200143 shadow_frame.GetVReg(inst->VRegB_22x()));
144 inst = inst->Next_2xx();
145 break;
146 case Instruction::MOVE_16:
147 PREAMBLE();
148 shadow_frame.SetVReg(inst->VRegA_32x(),
149 shadow_frame.GetVReg(inst->VRegB_32x()));
150 inst = inst->Next_3xx();
151 break;
152 case Instruction::MOVE_WIDE:
153 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200154 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
155 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200156 inst = inst->Next_1xx();
157 break;
158 case Instruction::MOVE_WIDE_FROM16:
159 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200160 shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200161 shadow_frame.GetVRegLong(inst->VRegB_22x()));
162 inst = inst->Next_2xx();
163 break;
164 case Instruction::MOVE_WIDE_16:
165 PREAMBLE();
166 shadow_frame.SetVRegLong(inst->VRegA_32x(),
167 shadow_frame.GetVRegLong(inst->VRegB_32x()));
168 inst = inst->Next_3xx();
169 break;
170 case Instruction::MOVE_OBJECT:
171 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200172 shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data),
173 shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200174 inst = inst->Next_1xx();
175 break;
176 case Instruction::MOVE_OBJECT_FROM16:
177 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200178 shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200179 shadow_frame.GetVRegReference(inst->VRegB_22x()));
180 inst = inst->Next_2xx();
181 break;
182 case Instruction::MOVE_OBJECT_16:
183 PREAMBLE();
184 shadow_frame.SetVRegReference(inst->VRegA_32x(),
185 shadow_frame.GetVRegReference(inst->VRegB_32x()));
186 inst = inst->Next_3xx();
187 break;
188 case Instruction::MOVE_RESULT:
189 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200190 shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200191 inst = inst->Next_1xx();
192 break;
193 case Instruction::MOVE_RESULT_WIDE:
194 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200195 shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200196 inst = inst->Next_1xx();
197 break;
198 case Instruction::MOVE_RESULT_OBJECT:
199 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200200 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200201 inst = inst->Next_1xx();
202 break;
203 case Instruction::MOVE_EXCEPTION: {
204 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700205 ObjPtr<mirror::Throwable> exception = self->GetException();
Sebastien Hertz270a0e12015-01-16 19:49:09 +0100206 DCHECK(exception != nullptr) << "No pending exception on MOVE_EXCEPTION instruction";
Mathieu Chartieref41db72016-10-25 15:08:01 -0700207 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception.Ptr());
Sebastien Hertz5c004902014-05-21 10:07:42 +0200208 self->ClearException();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200209 inst = inst->Next_1xx();
210 break;
211 }
Mathieu Chartierd7cbf8a2015-03-19 12:43:20 -0700212 case Instruction::RETURN_VOID_NO_BARRIER: {
Sebastien Hertz9d6bf692015-04-10 12:12:33 +0200213 PREAMBLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200214 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700215 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700216 HANDLE_MONITOR_CHECKS();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200217 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200218 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200219 shadow_frame.GetMethod(), inst->GetDexPc(insns),
220 result);
221 }
buzbee1452bee2015-03-06 14:43:04 -0800222 if (interpret_one_instruction) {
buzbee93e94f22016-04-07 13:52:48 -0700223 /* Signal mterp to return to caller */
buzbee1452bee2015-03-06 14:43:04 -0800224 shadow_frame.SetDexPC(DexFile::kDexNoIndex);
225 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200226 return result;
227 }
Mathieu Chartierd7cbf8a2015-03-19 12:43:20 -0700228 case Instruction::RETURN_VOID: {
Sebastien Hertz9d6bf692015-04-10 12:12:33 +0200229 PREAMBLE();
Hans Boehm30359612014-05-21 17:46:23 -0700230 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200231 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700232 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700233 HANDLE_MONITOR_CHECKS();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200234 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200235 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200236 shadow_frame.GetMethod(), inst->GetDexPc(insns),
237 result);
238 }
buzbee1452bee2015-03-06 14:43:04 -0800239 if (interpret_one_instruction) {
buzbee93e94f22016-04-07 13:52:48 -0700240 /* Signal mterp to return to caller */
buzbee1452bee2015-03-06 14:43:04 -0800241 shadow_frame.SetDexPC(DexFile::kDexNoIndex);
242 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200243 return result;
244 }
245 case Instruction::RETURN: {
Sebastien Hertz9d6bf692015-04-10 12:12:33 +0200246 PREAMBLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200247 JValue result;
248 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200249 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700250 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700251 HANDLE_MONITOR_CHECKS();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200252 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200253 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200254 shadow_frame.GetMethod(), inst->GetDexPc(insns),
255 result);
256 }
buzbee1452bee2015-03-06 14:43:04 -0800257 if (interpret_one_instruction) {
buzbee93e94f22016-04-07 13:52:48 -0700258 /* Signal mterp to return to caller */
buzbee1452bee2015-03-06 14:43:04 -0800259 shadow_frame.SetDexPC(DexFile::kDexNoIndex);
260 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200261 return result;
262 }
263 case Instruction::RETURN_WIDE: {
Sebastien Hertz9d6bf692015-04-10 12:12:33 +0200264 PREAMBLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200265 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200266 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700267 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700268 HANDLE_MONITOR_CHECKS();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200269 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200270 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200271 shadow_frame.GetMethod(), inst->GetDexPc(insns),
272 result);
273 }
buzbee1452bee2015-03-06 14:43:04 -0800274 if (interpret_one_instruction) {
buzbee93e94f22016-04-07 13:52:48 -0700275 /* Signal mterp to return to caller */
buzbee1452bee2015-03-06 14:43:04 -0800276 shadow_frame.SetDexPC(DexFile::kDexNoIndex);
277 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200278 return result;
279 }
280 case Instruction::RETURN_OBJECT: {
Sebastien Hertz9d6bf692015-04-10 12:12:33 +0200281 PREAMBLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200282 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700283 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700284 HANDLE_MONITOR_CHECKS();
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700285 const size_t ref_idx = inst->VRegA_11x(inst_data);
Mathieu Chartieref41db72016-10-25 15:08:01 -0700286 ObjPtr<mirror::Object> obj_result = shadow_frame.GetVRegReference(ref_idx);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700287 if (do_assignability_check && obj_result != nullptr) {
Vladimir Marko942fd312017-01-16 20:52:19 +0000288 ObjPtr<mirror::Class> return_type = method->GetReturnType(true /* resolve */);
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700289 // Re-load since it might have moved.
290 obj_result = shadow_frame.GetVRegReference(ref_idx);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700291 if (return_type == nullptr) {
Jeff Haoa3faaf42013-09-03 19:07:00 -0700292 // Return the pending exception.
293 HANDLE_PENDING_EXCEPTION();
294 }
295 if (!obj_result->VerifierInstanceOf(return_type)) {
296 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700297 std::string temp1, temp2;
Orion Hodsonfef06642016-11-25 16:07:11 +0000298 self->ThrowNewExceptionF("Ljava/lang/InternalError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700299 "Returning '%s' that is not instance of return type '%s'",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700300 obj_result->GetClass()->GetDescriptor(&temp1),
301 return_type->GetDescriptor(&temp2));
Jeff Haoa3faaf42013-09-03 19:07:00 -0700302 HANDLE_PENDING_EXCEPTION();
303 }
304 }
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700305 result.SetL(obj_result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200306 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200307 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200308 shadow_frame.GetMethod(), inst->GetDexPc(insns),
309 result);
310 }
buzbee1452bee2015-03-06 14:43:04 -0800311 if (interpret_one_instruction) {
buzbee93e94f22016-04-07 13:52:48 -0700312 /* Signal mterp to return to caller */
buzbee1452bee2015-03-06 14:43:04 -0800313 shadow_frame.SetDexPC(DexFile::kDexNoIndex);
314 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200315 return result;
316 }
317 case Instruction::CONST_4: {
318 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200319 uint4_t dst = inst->VRegA_11n(inst_data);
320 int4_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200321 shadow_frame.SetVReg(dst, val);
322 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700323 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200324 }
325 inst = inst->Next_1xx();
326 break;
327 }
328 case Instruction::CONST_16: {
329 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200330 uint8_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200331 int16_t val = inst->VRegB_21s();
332 shadow_frame.SetVReg(dst, val);
333 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700334 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200335 }
336 inst = inst->Next_2xx();
337 break;
338 }
339 case Instruction::CONST: {
340 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200341 uint8_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200342 int32_t val = inst->VRegB_31i();
343 shadow_frame.SetVReg(dst, val);
344 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700345 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200346 }
347 inst = inst->Next_3xx();
348 break;
349 }
350 case Instruction::CONST_HIGH16: {
351 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200352 uint8_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200353 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
354 shadow_frame.SetVReg(dst, val);
355 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700356 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200357 }
358 inst = inst->Next_2xx();
359 break;
360 }
361 case Instruction::CONST_WIDE_16:
362 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200363 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200364 inst = inst->Next_2xx();
365 break;
366 case Instruction::CONST_WIDE_32:
367 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200368 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200369 inst = inst->Next_3xx();
370 break;
371 case Instruction::CONST_WIDE:
372 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200373 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200374 inst = inst->Next_51l();
375 break;
376 case Instruction::CONST_WIDE_HIGH16:
Sebastien Hertz3c5aec12014-06-04 09:41:21 +0200377 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200378 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200379 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
380 inst = inst->Next_2xx();
381 break;
382 case Instruction::CONST_STRING: {
383 PREAMBLE();
Andreas Gampe8a0128a2016-11-28 07:38:35 -0800384 ObjPtr<mirror::String> s = ResolveString(self,
385 shadow_frame,
386 dex::StringIndex(inst->VRegB_21c()));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700387 if (UNLIKELY(s == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200388 HANDLE_PENDING_EXCEPTION();
389 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700390 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s.Ptr());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200391 inst = inst->Next_2xx();
392 }
393 break;
394 }
395 case Instruction::CONST_STRING_JUMBO: {
396 PREAMBLE();
Andreas Gampe8a0128a2016-11-28 07:38:35 -0800397 ObjPtr<mirror::String> s = ResolveString(self,
398 shadow_frame,
399 dex::StringIndex(inst->VRegB_31c()));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700400 if (UNLIKELY(s == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200401 HANDLE_PENDING_EXCEPTION();
402 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700403 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s.Ptr());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200404 inst = inst->Next_3xx();
405 }
406 break;
407 }
408 case Instruction::CONST_CLASS: {
409 PREAMBLE();
Andreas Gampea5b09a62016-11-17 15:21:22 -0800410 ObjPtr<mirror::Class> c = ResolveVerifyAndClinit(dex::TypeIndex(inst->VRegB_21c()),
Mathieu Chartieref41db72016-10-25 15:08:01 -0700411 shadow_frame.GetMethod(),
412 self,
413 false,
414 do_access_check);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700415 if (UNLIKELY(c == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200416 HANDLE_PENDING_EXCEPTION();
417 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700418 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c.Ptr());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200419 inst = inst->Next_2xx();
420 }
421 break;
422 }
423 case Instruction::MONITOR_ENTER: {
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 DoMonitorEnter<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::MONITOR_EXIT: {
436 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700437 ObjPtr<mirror::Object> obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700438 if (UNLIKELY(obj == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000439 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200440 HANDLE_PENDING_EXCEPTION();
441 } else {
Andreas Gampe03ec9302015-08-27 17:41:47 -0700442 DoMonitorExit<do_assignability_check>(self, &shadow_frame, obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200443 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
444 }
445 break;
446 }
447 case Instruction::CHECK_CAST: {
448 PREAMBLE();
Andreas Gampea5b09a62016-11-17 15:21:22 -0800449 ObjPtr<mirror::Class> c = ResolveVerifyAndClinit(dex::TypeIndex(inst->VRegB_21c()),
Mathieu Chartieref41db72016-10-25 15:08:01 -0700450 shadow_frame.GetMethod(),
451 self,
452 false,
453 do_access_check);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700454 if (UNLIKELY(c == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200455 HANDLE_PENDING_EXCEPTION();
456 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700457 ObjPtr<mirror::Object> obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700458 if (UNLIKELY(obj != nullptr && !obj->InstanceOf(c))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200459 ThrowClassCastException(c, obj->GetClass());
460 HANDLE_PENDING_EXCEPTION();
461 } else {
462 inst = inst->Next_2xx();
463 }
464 }
465 break;
466 }
467 case Instruction::INSTANCE_OF: {
468 PREAMBLE();
Andreas Gampea5b09a62016-11-17 15:21:22 -0800469 ObjPtr<mirror::Class> c = ResolveVerifyAndClinit(dex::TypeIndex(inst->VRegC_22c()),
Mathieu Chartieref41db72016-10-25 15:08:01 -0700470 shadow_frame.GetMethod(),
471 self,
472 false,
473 do_access_check);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700474 if (UNLIKELY(c == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200475 HANDLE_PENDING_EXCEPTION();
476 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700477 ObjPtr<mirror::Object> obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700478 shadow_frame.SetVReg(inst->VRegA_22c(inst_data),
479 (obj != nullptr && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200480 inst = inst->Next_2xx();
481 }
482 break;
483 }
484 case Instruction::ARRAY_LENGTH: {
485 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700486 ObjPtr<mirror::Object> array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700487 if (UNLIKELY(array == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000488 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200489 HANDLE_PENDING_EXCEPTION();
490 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200491 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200492 inst = inst->Next_1xx();
493 }
494 break;
495 }
496 case Instruction::NEW_INSTANCE: {
497 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700498 ObjPtr<mirror::Object> obj = nullptr;
Andreas Gampea5b09a62016-11-17 15:21:22 -0800499 ObjPtr<mirror::Class> c = ResolveVerifyAndClinit(dex::TypeIndex(inst->VRegB_21c()),
Mathieu Chartieref41db72016-10-25 15:08:01 -0700500 shadow_frame.GetMethod(),
501 self,
502 false,
503 do_access_check);
Jeff Hao848f70a2014-01-15 13:49:50 -0800504 if (LIKELY(c != nullptr)) {
505 if (UNLIKELY(c->IsStringClass())) {
506 gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
jessicahandojo3aaa37b2016-07-29 14:46:37 -0700507 obj = mirror::String::AllocEmptyString<true>(self, allocator_type);
Jeff Hao848f70a2014-01-15 13:49:50 -0800508 } else {
Nicolas Geoffray0d3998b2017-01-12 15:35:12 +0000509 obj = AllocObjectFromCode<true>(
510 c.Ptr(),
Andreas Gampea5b09a62016-11-17 15:21:22 -0800511 self,
512 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Jeff Hao848f70a2014-01-15 13:49:50 -0800513 }
514 }
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700515 if (UNLIKELY(obj == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200516 HANDLE_PENDING_EXCEPTION();
517 } else {
Sebastien Hertz4e99b3d2014-06-24 14:35:40 +0200518 obj->GetClass()->AssertInitializedOrInitializingInThread(self);
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700519 // Don't allow finalizable objects to be allocated during a transaction since these can't
520 // be finalized without a started runtime.
521 if (transaction_active && obj->GetClass()->IsFinalizable()) {
Sebastien Hertz45b15972015-04-03 16:07:05 +0200522 AbortTransactionF(self, "Allocating finalizable object in transaction: %s",
David Sehr709b0702016-10-13 09:12:37 -0700523 obj->PrettyTypeOf().c_str());
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700524 HANDLE_PENDING_EXCEPTION();
525 break;
526 }
Mathieu Chartieref41db72016-10-25 15:08:01 -0700527 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj.Ptr());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200528 inst = inst->Next_2xx();
529 }
530 break;
531 }
532 case Instruction::NEW_ARRAY: {
533 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200534 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Mathieu Chartieref41db72016-10-25 15:08:01 -0700535 ObjPtr<mirror::Object> obj = AllocArrayFromCode<do_access_check, true>(
Andreas Gampea5b09a62016-11-17 15:21:22 -0800536 dex::TypeIndex(inst->VRegC_22c()),
537 length,
538 shadow_frame.GetMethod(),
539 self,
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800540 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700541 if (UNLIKELY(obj == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200542 HANDLE_PENDING_EXCEPTION();
543 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700544 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj.Ptr());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200545 inst = inst->Next_2xx();
546 }
547 break;
548 }
549 case Instruction::FILLED_NEW_ARRAY: {
550 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100551 bool success =
552 DoFilledNewArray<false, do_access_check, transaction_active>(inst, shadow_frame, self,
553 &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200554 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
555 break;
556 }
557 case Instruction::FILLED_NEW_ARRAY_RANGE: {
558 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100559 bool success =
560 DoFilledNewArray<true, do_access_check, transaction_active>(inst, shadow_frame,
561 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200562 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
563 break;
564 }
565 case Instruction::FILL_ARRAY_DATA: {
566 PREAMBLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200567 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
568 const Instruction::ArrayDataPayload* payload =
569 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
Mathieu Chartieref41db72016-10-25 15:08:01 -0700570 ObjPtr<mirror::Object> obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Ian Rogers832336b2014-10-08 15:35:22 -0700571 bool success = FillArrayData(obj, payload);
572 if (!success) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200573 HANDLE_PENDING_EXCEPTION();
574 break;
575 }
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100576 if (transaction_active) {
Ian Rogers832336b2014-10-08 15:35:22 -0700577 RecordArrayElementsInTransaction(obj->AsArray(), payload->element_count);
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100578 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200579 inst = inst->Next_3xx();
580 break;
581 }
582 case Instruction::THROW: {
583 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700584 ObjPtr<mirror::Object> exception =
585 shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700586 if (UNLIKELY(exception == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000587 ThrowNullPointerException("throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700588 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
589 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700590 std::string temp;
Orion Hodsonfef06642016-11-25 16:07:11 +0000591 self->ThrowNewExceptionF("Ljava/lang/InternalError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700592 "Throwing '%s' that is not instance of Throwable",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700593 exception->GetClass()->GetDescriptor(&temp));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200594 } else {
Nicolas Geoffray14691c52015-03-05 10:40:17 +0000595 self->SetException(exception->AsThrowable());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200596 }
597 HANDLE_PENDING_EXCEPTION();
598 break;
599 }
600 case Instruction::GOTO: {
601 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200602 int8_t offset = inst->VRegA_10t(inst_data);
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000603 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200604 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800605 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200606 break;
607 }
608 case Instruction::GOTO_16: {
609 PREAMBLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200610 int16_t offset = inst->VRegA_20t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000611 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200612 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800613 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200614 break;
615 }
616 case Instruction::GOTO_32: {
617 PREAMBLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200618 int32_t offset = inst->VRegA_30t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000619 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200620 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800621 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200622 break;
623 }
624 case Instruction::PACKED_SWITCH: {
625 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200626 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000627 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200628 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800629 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200630 break;
631 }
632 case Instruction::SPARSE_SWITCH: {
633 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200634 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000635 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200636 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800637 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200638 break;
639 }
Ian Rogers647b1a82014-10-10 11:02:11 -0700640
Ian Rogers647b1a82014-10-10 11:02:11 -0700641#pragma clang diagnostic push
642#pragma clang diagnostic ignored "-Wfloat-equal"
Ian Rogers647b1a82014-10-10 11:02:11 -0700643
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200644 case Instruction::CMPL_FLOAT: {
645 PREAMBLE();
646 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
647 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
648 int32_t result;
649 if (val1 > val2) {
650 result = 1;
651 } else if (val1 == val2) {
652 result = 0;
653 } else {
654 result = -1;
655 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200656 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200657 inst = inst->Next_2xx();
658 break;
659 }
660 case Instruction::CMPG_FLOAT: {
661 PREAMBLE();
662 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
663 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
664 int32_t result;
665 if (val1 < val2) {
666 result = -1;
667 } else if (val1 == val2) {
668 result = 0;
669 } else {
670 result = 1;
671 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200672 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200673 inst = inst->Next_2xx();
674 break;
675 }
676 case Instruction::CMPL_DOUBLE: {
677 PREAMBLE();
678 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
679 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
680 int32_t result;
681 if (val1 > val2) {
682 result = 1;
683 } else if (val1 == val2) {
684 result = 0;
685 } else {
686 result = -1;
687 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200688 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200689 inst = inst->Next_2xx();
690 break;
691 }
692
693 case Instruction::CMPG_DOUBLE: {
694 PREAMBLE();
695 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
696 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
697 int32_t result;
698 if (val1 < val2) {
699 result = -1;
700 } else if (val1 == val2) {
701 result = 0;
702 } else {
703 result = 1;
704 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200705 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200706 inst = inst->Next_2xx();
707 break;
708 }
Ian Rogers647b1a82014-10-10 11:02:11 -0700709
Ian Rogers647b1a82014-10-10 11:02:11 -0700710#pragma clang diagnostic pop
Ian Rogers647b1a82014-10-10 11:02:11 -0700711
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200712 case Instruction::CMP_LONG: {
713 PREAMBLE();
714 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
715 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
716 int32_t result;
717 if (val1 > val2) {
718 result = 1;
719 } else if (val1 == val2) {
720 result = 0;
721 } else {
722 result = -1;
723 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200724 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200725 inst = inst->Next_2xx();
726 break;
727 }
728 case Instruction::IF_EQ: {
729 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700730 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) ==
731 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200732 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000733 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200734 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800735 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200736 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800737 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200738 inst = inst->Next_2xx();
739 }
740 break;
741 }
742 case Instruction::IF_NE: {
743 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700744 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) !=
745 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200746 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000747 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200748 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800749 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200750 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800751 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200752 inst = inst->Next_2xx();
753 }
754 break;
755 }
756 case Instruction::IF_LT: {
757 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700758 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <
759 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200760 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000761 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200762 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800763 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200764 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800765 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200766 inst = inst->Next_2xx();
767 }
768 break;
769 }
770 case Instruction::IF_GE: {
771 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700772 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >=
773 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200774 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000775 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200776 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800777 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200778 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800779 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200780 inst = inst->Next_2xx();
781 }
782 break;
783 }
784 case Instruction::IF_GT: {
785 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700786 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >
787 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200788 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000789 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200790 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800791 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200792 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800793 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200794 inst = inst->Next_2xx();
795 }
796 break;
797 }
798 case Instruction::IF_LE: {
799 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700800 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <=
801 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200802 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000803 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200804 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800805 HANDLE_BACKWARD_BRANCH(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_EQZ: {
813 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200814 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200815 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000816 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200817 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800818 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200819 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800820 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200821 inst = inst->Next_2xx();
822 }
823 break;
824 }
825 case Instruction::IF_NEZ: {
826 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200827 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200828 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000829 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200830 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800831 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200832 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800833 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200834 inst = inst->Next_2xx();
835 }
836 break;
837 }
838 case Instruction::IF_LTZ: {
839 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200840 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200841 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000842 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200843 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800844 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200845 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800846 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200847 inst = inst->Next_2xx();
848 }
849 break;
850 }
851 case Instruction::IF_GEZ: {
852 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200853 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200854 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000855 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200856 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800857 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200858 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800859 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200860 inst = inst->Next_2xx();
861 }
862 break;
863 }
864 case Instruction::IF_GTZ: {
865 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200866 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200867 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000868 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200869 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800870 HANDLE_BACKWARD_BRANCH(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_LEZ: {
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 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800883 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200884 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800885 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200886 inst = inst->Next_2xx();
887 }
888 break;
889 }
890 case Instruction::AGET_BOOLEAN: {
891 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700892 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700893 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000894 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200895 HANDLE_PENDING_EXCEPTION();
896 break;
897 }
898 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -0700899 ObjPtr<mirror::BooleanArray> array = a->AsBooleanArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700900 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100901 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200902 inst = inst->Next_2xx();
903 } else {
904 HANDLE_PENDING_EXCEPTION();
905 }
906 break;
907 }
908 case Instruction::AGET_BYTE: {
909 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700910 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700911 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000912 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200913 HANDLE_PENDING_EXCEPTION();
914 break;
915 }
916 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -0700917 ObjPtr<mirror::ByteArray> array = a->AsByteArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700918 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100919 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200920 inst = inst->Next_2xx();
921 } else {
922 HANDLE_PENDING_EXCEPTION();
923 }
924 break;
925 }
926 case Instruction::AGET_CHAR: {
927 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700928 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700929 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000930 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200931 HANDLE_PENDING_EXCEPTION();
932 break;
933 }
934 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -0700935 ObjPtr<mirror::CharArray> array = a->AsCharArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700936 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100937 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200938 inst = inst->Next_2xx();
939 } else {
940 HANDLE_PENDING_EXCEPTION();
941 }
942 break;
943 }
944 case Instruction::AGET_SHORT: {
945 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700946 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700947 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000948 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200949 HANDLE_PENDING_EXCEPTION();
950 break;
951 }
952 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -0700953 ObjPtr<mirror::ShortArray> array = a->AsShortArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700954 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100955 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200956 inst = inst->Next_2xx();
957 } else {
958 HANDLE_PENDING_EXCEPTION();
959 }
960 break;
961 }
962 case Instruction::AGET: {
963 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700964 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700965 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000966 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200967 HANDLE_PENDING_EXCEPTION();
968 break;
969 }
970 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
David Sehr709b0702016-10-13 09:12:37 -0700971 DCHECK(a->IsIntArray() || a->IsFloatArray()) << a->PrettyTypeOf();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700972 ObjPtr<mirror::IntArray> array = ObjPtr<mirror::IntArray>::DownCast(a);
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700973 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100974 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200975 inst = inst->Next_2xx();
976 } else {
977 HANDLE_PENDING_EXCEPTION();
978 }
979 break;
980 }
981 case Instruction::AGET_WIDE: {
982 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700983 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700984 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000985 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200986 HANDLE_PENDING_EXCEPTION();
987 break;
988 }
989 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
David Sehr709b0702016-10-13 09:12:37 -0700990 DCHECK(a->IsLongArray() || a->IsDoubleArray()) << a->PrettyTypeOf();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700991 ObjPtr<mirror::LongArray> array = ObjPtr<mirror::LongArray>::DownCast(a);
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700992 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100993 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200994 inst = inst->Next_2xx();
995 } else {
996 HANDLE_PENDING_EXCEPTION();
997 }
998 break;
999 }
1000 case Instruction::AGET_OBJECT: {
1001 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001002 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001003 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001004 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001005 HANDLE_PENDING_EXCEPTION();
1006 break;
1007 }
1008 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001009 ObjPtr<mirror::ObjectArray<mirror::Object>> array = a->AsObjectArray<mirror::Object>();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001010 if (array->CheckIsValidIndex(index)) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001011 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001012 inst = inst->Next_2xx();
1013 } else {
1014 HANDLE_PENDING_EXCEPTION();
1015 }
1016 break;
1017 }
1018 case Instruction::APUT_BOOLEAN: {
1019 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001020 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001021 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001022 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001023 HANDLE_PENDING_EXCEPTION();
1024 break;
1025 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001026 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001027 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001028 ObjPtr<mirror::BooleanArray> array = a->AsBooleanArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001029 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001030 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001031 inst = inst->Next_2xx();
1032 } else {
1033 HANDLE_PENDING_EXCEPTION();
1034 }
1035 break;
1036 }
1037 case Instruction::APUT_BYTE: {
1038 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001039 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001040 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001041 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001042 HANDLE_PENDING_EXCEPTION();
1043 break;
1044 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001045 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001046 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001047 ObjPtr<mirror::ByteArray> array = a->AsByteArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001048 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001049 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001050 inst = inst->Next_2xx();
1051 } else {
1052 HANDLE_PENDING_EXCEPTION();
1053 }
1054 break;
1055 }
1056 case Instruction::APUT_CHAR: {
1057 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001058 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001059 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001060 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001061 HANDLE_PENDING_EXCEPTION();
1062 break;
1063 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001064 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001065 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001066 ObjPtr<mirror::CharArray> array = a->AsCharArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001067 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001068 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001069 inst = inst->Next_2xx();
1070 } else {
1071 HANDLE_PENDING_EXCEPTION();
1072 }
1073 break;
1074 }
1075 case Instruction::APUT_SHORT: {
1076 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001077 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001078 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001079 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001080 HANDLE_PENDING_EXCEPTION();
1081 break;
1082 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001083 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001084 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001085 ObjPtr<mirror::ShortArray> array = a->AsShortArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001086 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001087 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001088 inst = inst->Next_2xx();
1089 } else {
1090 HANDLE_PENDING_EXCEPTION();
1091 }
1092 break;
1093 }
1094 case Instruction::APUT: {
1095 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001096 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001097 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001098 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001099 HANDLE_PENDING_EXCEPTION();
1100 break;
1101 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001102 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001103 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
David Sehr709b0702016-10-13 09:12:37 -07001104 DCHECK(a->IsIntArray() || a->IsFloatArray()) << a->PrettyTypeOf();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001105 ObjPtr<mirror::IntArray> array = ObjPtr<mirror::IntArray>::DownCast(a);
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001106 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001107 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001108 inst = inst->Next_2xx();
1109 } else {
1110 HANDLE_PENDING_EXCEPTION();
1111 }
1112 break;
1113 }
1114 case Instruction::APUT_WIDE: {
1115 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001116 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001117 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001118 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001119 HANDLE_PENDING_EXCEPTION();
1120 break;
1121 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001122 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001123 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
David Sehr709b0702016-10-13 09:12:37 -07001124 DCHECK(a->IsLongArray() || a->IsDoubleArray()) << a->PrettyTypeOf();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001125 ObjPtr<mirror::LongArray> array = ObjPtr<mirror::LongArray>::DownCast(a);
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001126 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001127 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001128 inst = inst->Next_2xx();
1129 } else {
1130 HANDLE_PENDING_EXCEPTION();
1131 }
1132 break;
1133 }
1134 case Instruction::APUT_OBJECT: {
1135 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001136 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001137 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001138 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001139 HANDLE_PENDING_EXCEPTION();
1140 break;
1141 }
1142 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001143 ObjPtr<mirror::Object> val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
1144 ObjPtr<mirror::ObjectArray<mirror::Object>> array = a->AsObjectArray<mirror::Object>();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001145 if (array->CheckIsValidIndex(index) && array->CheckAssignable(val)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001146 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001147 inst = inst->Next_2xx();
1148 } else {
1149 HANDLE_PENDING_EXCEPTION();
1150 }
1151 break;
1152 }
1153 case Instruction::IGET_BOOLEAN: {
1154 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001155 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(
1156 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001157 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1158 break;
1159 }
1160 case Instruction::IGET_BYTE: {
1161 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001162 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(
1163 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001164 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1165 break;
1166 }
1167 case Instruction::IGET_CHAR: {
1168 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001169 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(
1170 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001171 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1172 break;
1173 }
1174 case Instruction::IGET_SHORT: {
1175 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001176 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(
1177 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001178 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1179 break;
1180 }
1181 case Instruction::IGET: {
1182 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001183 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(
1184 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001185 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1186 break;
1187 }
1188 case Instruction::IGET_WIDE: {
1189 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001190 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, 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_OBJECT: {
1196 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001197 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, 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_QUICK: {
1203 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001204 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001205 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1206 break;
1207 }
1208 case Instruction::IGET_WIDE_QUICK: {
1209 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001210 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001211 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1212 break;
1213 }
1214 case Instruction::IGET_OBJECT_QUICK: {
1215 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001216 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001217 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1218 break;
1219 }
Mathieu Chartierffc605c2014-12-10 10:35:44 -08001220 case Instruction::IGET_BOOLEAN_QUICK: {
1221 PREAMBLE();
1222 bool success = DoIGetQuick<Primitive::kPrimBoolean>(shadow_frame, inst, inst_data);
1223 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1224 break;
1225 }
1226 case Instruction::IGET_BYTE_QUICK: {
1227 PREAMBLE();
1228 bool success = DoIGetQuick<Primitive::kPrimByte>(shadow_frame, inst, inst_data);
1229 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1230 break;
1231 }
1232 case Instruction::IGET_CHAR_QUICK: {
1233 PREAMBLE();
1234 bool success = DoIGetQuick<Primitive::kPrimChar>(shadow_frame, inst, inst_data);
1235 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1236 break;
1237 }
1238 case Instruction::IGET_SHORT_QUICK: {
1239 PREAMBLE();
1240 bool success = DoIGetQuick<Primitive::kPrimShort>(shadow_frame, inst, inst_data);
1241 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1242 break;
1243 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001244 case Instruction::SGET_BOOLEAN: {
1245 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001246 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(
1247 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001248 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1249 break;
1250 }
1251 case Instruction::SGET_BYTE: {
1252 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001253 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(
1254 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001255 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1256 break;
1257 }
1258 case Instruction::SGET_CHAR: {
1259 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001260 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(
1261 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001262 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1263 break;
1264 }
1265 case Instruction::SGET_SHORT: {
1266 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001267 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(
1268 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001269 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1270 break;
1271 }
1272 case Instruction::SGET: {
1273 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001274 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(
1275 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001276 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1277 break;
1278 }
1279 case Instruction::SGET_WIDE: {
1280 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001281 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, 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_OBJECT: {
1287 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001288 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, 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::IPUT_BOOLEAN: {
1294 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001295 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check,
1296 transaction_active>(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::IPUT_BYTE: {
1301 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001302 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check,
1303 transaction_active>(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::IPUT_CHAR: {
1308 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001309 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check,
1310 transaction_active>(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::IPUT_SHORT: {
1315 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001316 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check,
1317 transaction_active>(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::IPUT: {
1322 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001323 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check,
1324 transaction_active>(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_WIDE: {
1329 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001330 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, 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_OBJECT: {
1336 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001337 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, 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_QUICK: {
1343 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001344 bool success = DoIPutQuick<Primitive::kPrimInt, transaction_active>(
1345 shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001346 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1347 break;
1348 }
Fred Shih37f05ef2014-07-16 18:38:08 -07001349 case Instruction::IPUT_BOOLEAN_QUICK: {
1350 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001351 bool success = DoIPutQuick<Primitive::kPrimBoolean, transaction_active>(
1352 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001353 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1354 break;
1355 }
1356 case Instruction::IPUT_BYTE_QUICK: {
1357 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001358 bool success = DoIPutQuick<Primitive::kPrimByte, transaction_active>(
1359 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001360 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1361 break;
1362 }
1363 case Instruction::IPUT_CHAR_QUICK: {
1364 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001365 bool success = DoIPutQuick<Primitive::kPrimChar, transaction_active>(
1366 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001367 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1368 break;
1369 }
1370 case Instruction::IPUT_SHORT_QUICK: {
1371 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001372 bool success = DoIPutQuick<Primitive::kPrimShort, transaction_active>(
1373 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001374 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1375 break;
1376 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001377 case Instruction::IPUT_WIDE_QUICK: {
1378 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001379 bool success = DoIPutQuick<Primitive::kPrimLong, 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 }
1384 case Instruction::IPUT_OBJECT_QUICK: {
1385 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001386 bool success = DoIPutQuick<Primitive::kPrimNot, transaction_active>(
1387 shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001388 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1389 break;
1390 }
1391 case Instruction::SPUT_BOOLEAN: {
1392 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001393 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check,
1394 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001395 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1396 break;
1397 }
1398 case Instruction::SPUT_BYTE: {
1399 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001400 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check,
1401 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001402 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1403 break;
1404 }
1405 case Instruction::SPUT_CHAR: {
1406 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001407 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check,
1408 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001409 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1410 break;
1411 }
1412 case Instruction::SPUT_SHORT: {
1413 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001414 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check,
1415 transaction_active>(self, 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::SPUT: {
1420 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001421 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check,
1422 transaction_active>(self, 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_WIDE: {
1427 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001428 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, 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_OBJECT: {
1434 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001435 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, 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::INVOKE_VIRTUAL: {
1441 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001442 bool success = DoInvoke<kVirtual, false, do_access_check>(
1443 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001444 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1445 break;
1446 }
1447 case Instruction::INVOKE_VIRTUAL_RANGE: {
1448 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001449 bool success = DoInvoke<kVirtual, true, do_access_check>(
1450 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001451 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1452 break;
1453 }
1454 case Instruction::INVOKE_SUPER: {
1455 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001456 bool success = DoInvoke<kSuper, false, do_access_check>(
1457 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001458 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1459 break;
1460 }
1461 case Instruction::INVOKE_SUPER_RANGE: {
1462 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001463 bool success = DoInvoke<kSuper, true, do_access_check>(
1464 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001465 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1466 break;
1467 }
1468 case Instruction::INVOKE_DIRECT: {
1469 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001470 bool success = DoInvoke<kDirect, false, do_access_check>(
1471 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001472 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1473 break;
1474 }
1475 case Instruction::INVOKE_DIRECT_RANGE: {
1476 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001477 bool success = DoInvoke<kDirect, true, 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_INTERFACE: {
1483 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001484 bool success = DoInvoke<kInterface, false, 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_INTERFACE_RANGE: {
1490 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001491 bool success = DoInvoke<kInterface, true, 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_STATIC: {
1497 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001498 bool success = DoInvoke<kStatic, false, 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_STATIC_RANGE: {
1504 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001505 bool success = DoInvoke<kStatic, true, 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_VIRTUAL_QUICK: {
1511 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001512 bool success = DoInvokeVirtualQuick<false>(
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_VIRTUAL_RANGE_QUICK: {
1518 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001519 bool success = DoInvokeVirtualQuick<true>(
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 }
Narayan Kamath9823e782016-08-03 12:46:58 +01001524 case Instruction::INVOKE_POLYMORPHIC: {
1525 PREAMBLE();
Narayan Kamath269cb432016-10-28 10:19:54 +01001526 DCHECK(Runtime::Current()->IsMethodHandlesEnabled());
Orion Hodsonc069a302017-01-18 09:23:12 +00001527 bool success = DoInvokePolymorphic<false /* is_range */>(
Narayan Kamath9823e782016-08-03 12:46:58 +01001528 self, shadow_frame, inst, inst_data, &result_register);
1529 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_4xx);
1530 break;
1531 }
1532 case Instruction::INVOKE_POLYMORPHIC_RANGE: {
1533 PREAMBLE();
Narayan Kamath269cb432016-10-28 10:19:54 +01001534 DCHECK(Runtime::Current()->IsMethodHandlesEnabled());
Orion Hodsonc069a302017-01-18 09:23:12 +00001535 bool success = DoInvokePolymorphic<true /* is_range */>(
Narayan Kamath9823e782016-08-03 12:46:58 +01001536 self, shadow_frame, inst, inst_data, &result_register);
1537 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_4xx);
1538 break;
Narayan Kamath9823e782016-08-03 12:46:58 +01001539 }
Orion Hodsonc069a302017-01-18 09:23:12 +00001540 case Instruction::INVOKE_CUSTOM: {
1541 PREAMBLE();
1542 DCHECK(Runtime::Current()->IsMethodHandlesEnabled());
1543 bool success = DoInvokeCustom<false /* is_range */>(
1544 self, shadow_frame, inst, inst_data, &result_register);
1545 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1546 break;
1547 }
1548 case Instruction::INVOKE_CUSTOM_RANGE: {
1549 PREAMBLE();
1550 DCHECK(Runtime::Current()->IsMethodHandlesEnabled());
1551 bool success = DoInvokeCustom<true /* is_range */>(
1552 self, shadow_frame, inst, inst_data, &result_register);
1553 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1554 break;
1555 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001556 case Instruction::NEG_INT:
1557 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001558 shadow_frame.SetVReg(
1559 inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001560 inst = inst->Next_1xx();
1561 break;
1562 case Instruction::NOT_INT:
1563 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001564 shadow_frame.SetVReg(
1565 inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001566 inst = inst->Next_1xx();
1567 break;
1568 case Instruction::NEG_LONG:
1569 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001570 shadow_frame.SetVRegLong(
1571 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001572 inst = inst->Next_1xx();
1573 break;
1574 case Instruction::NOT_LONG:
1575 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001576 shadow_frame.SetVRegLong(
1577 inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001578 inst = inst->Next_1xx();
1579 break;
1580 case Instruction::NEG_FLOAT:
1581 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001582 shadow_frame.SetVRegFloat(
1583 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001584 inst = inst->Next_1xx();
1585 break;
1586 case Instruction::NEG_DOUBLE:
1587 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001588 shadow_frame.SetVRegDouble(
1589 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001590 inst = inst->Next_1xx();
1591 break;
1592 case Instruction::INT_TO_LONG:
1593 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001594 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
1595 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001596 inst = inst->Next_1xx();
1597 break;
1598 case Instruction::INT_TO_FLOAT:
1599 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001600 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1601 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001602 inst = inst->Next_1xx();
1603 break;
1604 case Instruction::INT_TO_DOUBLE:
1605 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001606 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1607 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001608 inst = inst->Next_1xx();
1609 break;
1610 case Instruction::LONG_TO_INT:
1611 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001612 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1613 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001614 inst = inst->Next_1xx();
1615 break;
1616 case Instruction::LONG_TO_FLOAT:
1617 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001618 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1619 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001620 inst = inst->Next_1xx();
1621 break;
1622 case Instruction::LONG_TO_DOUBLE:
1623 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001624 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1625 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001626 inst = inst->Next_1xx();
1627 break;
1628 case Instruction::FLOAT_TO_INT: {
1629 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001630 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001631 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001632 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001633 inst = inst->Next_1xx();
1634 break;
1635 }
1636 case Instruction::FLOAT_TO_LONG: {
1637 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001638 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001639 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001640 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001641 inst = inst->Next_1xx();
1642 break;
1643 }
1644 case Instruction::FLOAT_TO_DOUBLE:
1645 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001646 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1647 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001648 inst = inst->Next_1xx();
1649 break;
1650 case Instruction::DOUBLE_TO_INT: {
1651 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001652 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001653 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001654 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001655 inst = inst->Next_1xx();
1656 break;
1657 }
1658 case Instruction::DOUBLE_TO_LONG: {
1659 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001660 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001661 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001662 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001663 inst = inst->Next_1xx();
1664 break;
1665 }
1666 case Instruction::DOUBLE_TO_FLOAT:
1667 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001668 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1669 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001670 inst = inst->Next_1xx();
1671 break;
1672 case Instruction::INT_TO_BYTE:
1673 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001674 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), static_cast<int8_t>(
1675 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001676 inst = inst->Next_1xx();
1677 break;
1678 case Instruction::INT_TO_CHAR:
1679 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001680 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), static_cast<uint16_t>(
1681 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001682 inst = inst->Next_1xx();
1683 break;
1684 case Instruction::INT_TO_SHORT:
1685 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001686 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), static_cast<int16_t>(
1687 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001688 inst = inst->Next_1xx();
1689 break;
Ian Rogersf72a11d2014-10-30 15:41:08 -07001690 case Instruction::ADD_INT: {
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001691 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001692 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001693 SafeAdd(shadow_frame.GetVReg(inst->VRegB_23x()),
1694 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001695 inst = inst->Next_2xx();
1696 break;
Ian Rogersf72a11d2014-10-30 15:41:08 -07001697 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001698 case Instruction::SUB_INT:
1699 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001700 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001701 SafeSub(shadow_frame.GetVReg(inst->VRegB_23x()),
1702 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001703 inst = inst->Next_2xx();
1704 break;
1705 case Instruction::MUL_INT:
1706 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001707 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001708 SafeMul(shadow_frame.GetVReg(inst->VRegB_23x()),
1709 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001710 inst = inst->Next_2xx();
1711 break;
1712 case Instruction::DIV_INT: {
1713 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001714 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001715 shadow_frame.GetVReg(inst->VRegB_23x()),
1716 shadow_frame.GetVReg(inst->VRegC_23x()));
1717 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1718 break;
1719 }
1720 case Instruction::REM_INT: {
1721 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001722 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001723 shadow_frame.GetVReg(inst->VRegB_23x()),
1724 shadow_frame.GetVReg(inst->VRegC_23x()));
1725 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1726 break;
1727 }
1728 case Instruction::SHL_INT:
1729 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001730 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001731 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1732 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1733 inst = inst->Next_2xx();
1734 break;
1735 case Instruction::SHR_INT:
1736 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001737 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001738 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1739 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1740 inst = inst->Next_2xx();
1741 break;
1742 case Instruction::USHR_INT:
1743 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001744 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001745 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1746 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1747 inst = inst->Next_2xx();
1748 break;
1749 case Instruction::AND_INT:
1750 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001751 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001752 shadow_frame.GetVReg(inst->VRegB_23x()) &
1753 shadow_frame.GetVReg(inst->VRegC_23x()));
1754 inst = inst->Next_2xx();
1755 break;
1756 case Instruction::OR_INT:
1757 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001758 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001759 shadow_frame.GetVReg(inst->VRegB_23x()) |
1760 shadow_frame.GetVReg(inst->VRegC_23x()));
1761 inst = inst->Next_2xx();
1762 break;
1763 case Instruction::XOR_INT:
1764 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001765 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001766 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1767 shadow_frame.GetVReg(inst->VRegC_23x()));
1768 inst = inst->Next_2xx();
1769 break;
1770 case Instruction::ADD_LONG:
1771 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001772 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001773 SafeAdd(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1774 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001775 inst = inst->Next_2xx();
1776 break;
1777 case Instruction::SUB_LONG:
1778 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001779 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001780 SafeSub(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1781 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001782 inst = inst->Next_2xx();
1783 break;
1784 case Instruction::MUL_LONG:
1785 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001786 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001787 SafeMul(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1788 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001789 inst = inst->Next_2xx();
1790 break;
1791 case Instruction::DIV_LONG:
1792 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001793 DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001794 shadow_frame.GetVRegLong(inst->VRegB_23x()),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001795 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001796 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_2xx);
1797 break;
1798 case Instruction::REM_LONG:
1799 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001800 DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001801 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1802 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1803 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_2xx);
1804 break;
1805 case Instruction::AND_LONG:
1806 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001807 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001808 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1809 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1810 inst = inst->Next_2xx();
1811 break;
1812 case Instruction::OR_LONG:
1813 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001814 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001815 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1816 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1817 inst = inst->Next_2xx();
1818 break;
1819 case Instruction::XOR_LONG:
1820 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001821 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001822 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1823 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1824 inst = inst->Next_2xx();
1825 break;
1826 case Instruction::SHL_LONG:
1827 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001828 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001829 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1830 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1831 inst = inst->Next_2xx();
1832 break;
1833 case Instruction::SHR_LONG:
1834 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001835 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001836 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1837 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1838 inst = inst->Next_2xx();
1839 break;
1840 case Instruction::USHR_LONG:
1841 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001842 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001843 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1844 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1845 inst = inst->Next_2xx();
1846 break;
1847 case Instruction::ADD_FLOAT:
1848 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001849 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001850 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1851 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1852 inst = inst->Next_2xx();
1853 break;
1854 case Instruction::SUB_FLOAT:
1855 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001856 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001857 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1858 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1859 inst = inst->Next_2xx();
1860 break;
1861 case Instruction::MUL_FLOAT:
1862 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001863 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001864 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1865 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1866 inst = inst->Next_2xx();
1867 break;
1868 case Instruction::DIV_FLOAT:
1869 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001870 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001871 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1872 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1873 inst = inst->Next_2xx();
1874 break;
1875 case Instruction::REM_FLOAT:
1876 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001877 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001878 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1879 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1880 inst = inst->Next_2xx();
1881 break;
1882 case Instruction::ADD_DOUBLE:
1883 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001884 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001885 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1886 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1887 inst = inst->Next_2xx();
1888 break;
1889 case Instruction::SUB_DOUBLE:
1890 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001891 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001892 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1893 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1894 inst = inst->Next_2xx();
1895 break;
1896 case Instruction::MUL_DOUBLE:
1897 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001898 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001899 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1900 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1901 inst = inst->Next_2xx();
1902 break;
1903 case Instruction::DIV_DOUBLE:
1904 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001905 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001906 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1907 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1908 inst = inst->Next_2xx();
1909 break;
1910 case Instruction::REM_DOUBLE:
1911 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001912 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001913 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1914 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1915 inst = inst->Next_2xx();
1916 break;
1917 case Instruction::ADD_INT_2ADDR: {
1918 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001919 uint4_t vregA = inst->VRegA_12x(inst_data);
Ian Rogersf72a11d2014-10-30 15:41:08 -07001920 shadow_frame.SetVReg(vregA, SafeAdd(shadow_frame.GetVReg(vregA),
1921 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001922 inst = inst->Next_1xx();
1923 break;
1924 }
1925 case Instruction::SUB_INT_2ADDR: {
1926 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001927 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001928 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001929 SafeSub(shadow_frame.GetVReg(vregA),
1930 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001931 inst = inst->Next_1xx();
1932 break;
1933 }
1934 case Instruction::MUL_INT_2ADDR: {
1935 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001936 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001937 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001938 SafeMul(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::DIV_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 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001947 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001948 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx);
1949 break;
1950 }
1951 case Instruction::REM_INT_2ADDR: {
1952 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001953 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001954 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001955 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001956 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx);
1957 break;
1958 }
1959 case Instruction::SHL_INT_2ADDR: {
1960 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001961 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001962 shadow_frame.SetVReg(vregA,
1963 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001964 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001965 inst = inst->Next_1xx();
1966 break;
1967 }
1968 case Instruction::SHR_INT_2ADDR: {
1969 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001970 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001971 shadow_frame.SetVReg(vregA,
1972 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001973 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001974 inst = inst->Next_1xx();
1975 break;
1976 }
1977 case Instruction::USHR_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 static_cast<uint32_t>(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::AND_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)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001992 inst = inst->Next_1xx();
1993 break;
1994 }
1995 case Instruction::OR_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 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002000 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002001 inst = inst->Next_1xx();
2002 break;
2003 }
2004 case Instruction::XOR_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::ADD_LONG_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.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002017 SafeAdd(shadow_frame.GetVRegLong(vregA),
2018 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002019 inst = inst->Next_1xx();
2020 break;
2021 }
2022 case Instruction::SUB_LONG_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.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002026 SafeSub(shadow_frame.GetVRegLong(vregA),
2027 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002028 inst = inst->Next_1xx();
2029 break;
2030 }
2031 case Instruction::MUL_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 SafeMul(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::DIV_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 DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002044 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002045 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
2046 break;
2047 }
2048 case Instruction::REM_LONG_2ADDR: {
2049 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002050 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002051 DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002052 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002053 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
2054 break;
2055 }
2056 case Instruction::AND_LONG_2ADDR: {
2057 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002058 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002059 shadow_frame.SetVRegLong(vregA,
2060 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002061 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002062 inst = inst->Next_1xx();
2063 break;
2064 }
2065 case Instruction::OR_LONG_2ADDR: {
2066 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002067 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002068 shadow_frame.SetVRegLong(vregA,
2069 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 inst = inst->Next_1xx();
2072 break;
2073 }
2074 case Instruction::XOR_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::SHL_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.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002089 inst = inst->Next_1xx();
2090 break;
2091 }
2092 case Instruction::SHR_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.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002098 inst = inst->Next_1xx();
2099 break;
2100 }
2101 case Instruction::USHR_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 static_cast<uint64_t>(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::ADD_FLOAT_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.SetVRegFloat(vregA,
2114 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002115 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002116 inst = inst->Next_1xx();
2117 break;
2118 }
2119 case Instruction::SUB_FLOAT_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.SetVRegFloat(vregA,
2123 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002124 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002125 inst = inst->Next_1xx();
2126 break;
2127 }
2128 case Instruction::MUL_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::DIV_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::REM_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 fmodf(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::ADD_DOUBLE_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.SetVRegDouble(vregA,
2159 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002160 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002161 inst = inst->Next_1xx();
2162 break;
2163 }
2164 case Instruction::SUB_DOUBLE_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.SetVRegDouble(vregA,
2168 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002169 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002170 inst = inst->Next_1xx();
2171 break;
2172 }
2173 case Instruction::MUL_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::DIV_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::REM_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 fmod(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::ADD_INT_LIT16:
2201 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002202 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002203 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2204 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002205 inst = inst->Next_2xx();
2206 break;
Ian Rogersf72a11d2014-10-30 15:41:08 -07002207 case Instruction::RSUB_INT_LIT16:
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002208 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002209 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002210 SafeSub(inst->VRegC_22s(),
2211 shadow_frame.GetVReg(inst->VRegB_22s(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002212 inst = inst->Next_2xx();
2213 break;
2214 case Instruction::MUL_INT_LIT16:
2215 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002216 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002217 SafeMul(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2218 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002219 inst = inst->Next_2xx();
2220 break;
2221 case Instruction::DIV_INT_LIT16: {
2222 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002223 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
Mathieu Chartier2cebb242015-04-21 16:50:40 -07002224 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2225 inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002226 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2227 break;
2228 }
2229 case Instruction::REM_INT_LIT16: {
2230 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002231 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
Mathieu Chartier2cebb242015-04-21 16:50:40 -07002232 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2233 inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002234 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2235 break;
2236 }
2237 case Instruction::AND_INT_LIT16:
2238 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002239 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2240 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002241 inst->VRegC_22s());
2242 inst = inst->Next_2xx();
2243 break;
2244 case Instruction::OR_INT_LIT16:
2245 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002246 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2247 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002248 inst->VRegC_22s());
2249 inst = inst->Next_2xx();
2250 break;
2251 case Instruction::XOR_INT_LIT16:
2252 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002253 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2254 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002255 inst->VRegC_22s());
2256 inst = inst->Next_2xx();
2257 break;
2258 case Instruction::ADD_INT_LIT8:
2259 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002260 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002261 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002262 inst = inst->Next_2xx();
2263 break;
2264 case Instruction::RSUB_INT_LIT8:
2265 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002266 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002267 SafeSub(inst->VRegC_22b(), shadow_frame.GetVReg(inst->VRegB_22b())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002268 inst = inst->Next_2xx();
2269 break;
2270 case Instruction::MUL_INT_LIT8:
2271 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002272 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002273 SafeMul(shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002274 inst = inst->Next_2xx();
2275 break;
2276 case Instruction::DIV_INT_LIT8: {
2277 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002278 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002279 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
2280 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2281 break;
2282 }
2283 case Instruction::REM_INT_LIT8: {
2284 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002285 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002286 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
2287 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2288 break;
2289 }
2290 case Instruction::AND_INT_LIT8:
2291 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002292 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002293 shadow_frame.GetVReg(inst->VRegB_22b()) &
2294 inst->VRegC_22b());
2295 inst = inst->Next_2xx();
2296 break;
2297 case Instruction::OR_INT_LIT8:
2298 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002299 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002300 shadow_frame.GetVReg(inst->VRegB_22b()) |
2301 inst->VRegC_22b());
2302 inst = inst->Next_2xx();
2303 break;
2304 case Instruction::XOR_INT_LIT8:
2305 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002306 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002307 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2308 inst->VRegC_22b());
2309 inst = inst->Next_2xx();
2310 break;
2311 case Instruction::SHL_INT_LIT8:
2312 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002313 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002314 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2315 (inst->VRegC_22b() & 0x1f));
2316 inst = inst->Next_2xx();
2317 break;
2318 case Instruction::SHR_INT_LIT8:
2319 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002320 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002321 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2322 (inst->VRegC_22b() & 0x1f));
2323 inst = inst->Next_2xx();
2324 break;
2325 case Instruction::USHR_INT_LIT8:
2326 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002327 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002328 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2329 (inst->VRegC_22b() & 0x1f));
2330 inst = inst->Next_2xx();
2331 break;
2332 case Instruction::UNUSED_3E ... Instruction::UNUSED_43:
Narayan Kamath8ec3bd22016-08-03 12:46:23 +01002333 case Instruction::UNUSED_F3 ... Instruction::UNUSED_F9:
Orion Hodsonc069a302017-01-18 09:23:12 +00002334 case Instruction::UNUSED_FE ... Instruction::UNUSED_FF:
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002335 case Instruction::UNUSED_79:
2336 case Instruction::UNUSED_7A:
Ian Rogerse94652f2014-12-02 11:13:19 -08002337 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002338 }
buzbee1452bee2015-03-06 14:43:04 -08002339 } while (!interpret_one_instruction);
2340 // Record where we stopped.
2341 shadow_frame.SetDexPC(inst->GetDexPc(insns));
buzbeed6b48db2016-01-28 15:48:55 -08002342 return result_register;
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002343} // NOLINT(readability/fn_size)
2344
2345// Explicit definitions of ExecuteSwitchImpl.
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002346template HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002347JValue ExecuteSwitchImpl<true, false>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002348 ShadowFrame& shadow_frame, JValue result_register,
2349 bool interpret_one_instruction);
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002350template HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002351JValue ExecuteSwitchImpl<false, false>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002352 ShadowFrame& shadow_frame, JValue result_register,
2353 bool interpret_one_instruction);
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002354template
Ian Rogerse94652f2014-12-02 11:13:19 -08002355JValue ExecuteSwitchImpl<true, true>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002356 ShadowFrame& shadow_frame, JValue result_register,
2357 bool interpret_one_instruction);
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002358template
Ian Rogerse94652f2014-12-02 11:13:19 -08002359JValue ExecuteSwitchImpl<false, true>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002360 ShadowFrame& shadow_frame, JValue result_register,
2361 bool interpret_one_instruction);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002362
2363} // namespace interpreter
2364} // namespace art