blob: d7dfcd440853d7b9a1e320ac80699353d9f95a65 [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) {
Andreas Gampe542451c2016-07-26 09:02:02 -0700288 PointerSize pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700289 ObjPtr<mirror::Class> return_type = method->GetReturnType(true /* resolve */,
290 pointer_size);
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700291 // Re-load since it might have moved.
292 obj_result = shadow_frame.GetVRegReference(ref_idx);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700293 if (return_type == nullptr) {
Jeff Haoa3faaf42013-09-03 19:07:00 -0700294 // Return the pending exception.
295 HANDLE_PENDING_EXCEPTION();
296 }
297 if (!obj_result->VerifierInstanceOf(return_type)) {
298 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700299 std::string temp1, temp2;
Orion Hodsonfef06642016-11-25 16:07:11 +0000300 self->ThrowNewExceptionF("Ljava/lang/InternalError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700301 "Returning '%s' that is not instance of return type '%s'",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700302 obj_result->GetClass()->GetDescriptor(&temp1),
303 return_type->GetDescriptor(&temp2));
Jeff Haoa3faaf42013-09-03 19:07:00 -0700304 HANDLE_PENDING_EXCEPTION();
305 }
306 }
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700307 result.SetL(obj_result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200308 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200309 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200310 shadow_frame.GetMethod(), inst->GetDexPc(insns),
311 result);
312 }
buzbee1452bee2015-03-06 14:43:04 -0800313 if (interpret_one_instruction) {
buzbee93e94f22016-04-07 13:52:48 -0700314 /* Signal mterp to return to caller */
buzbee1452bee2015-03-06 14:43:04 -0800315 shadow_frame.SetDexPC(DexFile::kDexNoIndex);
316 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200317 return result;
318 }
319 case Instruction::CONST_4: {
320 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200321 uint4_t dst = inst->VRegA_11n(inst_data);
322 int4_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200323 shadow_frame.SetVReg(dst, val);
324 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700325 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200326 }
327 inst = inst->Next_1xx();
328 break;
329 }
330 case Instruction::CONST_16: {
331 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200332 uint8_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200333 int16_t val = inst->VRegB_21s();
334 shadow_frame.SetVReg(dst, val);
335 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700336 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200337 }
338 inst = inst->Next_2xx();
339 break;
340 }
341 case Instruction::CONST: {
342 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200343 uint8_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200344 int32_t val = inst->VRegB_31i();
345 shadow_frame.SetVReg(dst, val);
346 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700347 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200348 }
349 inst = inst->Next_3xx();
350 break;
351 }
352 case Instruction::CONST_HIGH16: {
353 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200354 uint8_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200355 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
356 shadow_frame.SetVReg(dst, val);
357 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700358 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200359 }
360 inst = inst->Next_2xx();
361 break;
362 }
363 case Instruction::CONST_WIDE_16:
364 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200365 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200366 inst = inst->Next_2xx();
367 break;
368 case Instruction::CONST_WIDE_32:
369 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200370 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200371 inst = inst->Next_3xx();
372 break;
373 case Instruction::CONST_WIDE:
374 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200375 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200376 inst = inst->Next_51l();
377 break;
378 case Instruction::CONST_WIDE_HIGH16:
Sebastien Hertz3c5aec12014-06-04 09:41:21 +0200379 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200380 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200381 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
382 inst = inst->Next_2xx();
383 break;
384 case Instruction::CONST_STRING: {
385 PREAMBLE();
Andreas Gampe8a0128a2016-11-28 07:38:35 -0800386 ObjPtr<mirror::String> s = ResolveString(self,
387 shadow_frame,
388 dex::StringIndex(inst->VRegB_21c()));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700389 if (UNLIKELY(s == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200390 HANDLE_PENDING_EXCEPTION();
391 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700392 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s.Ptr());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200393 inst = inst->Next_2xx();
394 }
395 break;
396 }
397 case Instruction::CONST_STRING_JUMBO: {
398 PREAMBLE();
Andreas Gampe8a0128a2016-11-28 07:38:35 -0800399 ObjPtr<mirror::String> s = ResolveString(self,
400 shadow_frame,
401 dex::StringIndex(inst->VRegB_31c()));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700402 if (UNLIKELY(s == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200403 HANDLE_PENDING_EXCEPTION();
404 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700405 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s.Ptr());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200406 inst = inst->Next_3xx();
407 }
408 break;
409 }
410 case Instruction::CONST_CLASS: {
411 PREAMBLE();
Andreas Gampea5b09a62016-11-17 15:21:22 -0800412 ObjPtr<mirror::Class> c = ResolveVerifyAndClinit(dex::TypeIndex(inst->VRegB_21c()),
Mathieu Chartieref41db72016-10-25 15:08:01 -0700413 shadow_frame.GetMethod(),
414 self,
415 false,
416 do_access_check);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700417 if (UNLIKELY(c == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200418 HANDLE_PENDING_EXCEPTION();
419 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700420 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c.Ptr());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200421 inst = inst->Next_2xx();
422 }
423 break;
424 }
425 case Instruction::MONITOR_ENTER: {
426 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700427 ObjPtr<mirror::Object> obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700428 if (UNLIKELY(obj == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000429 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200430 HANDLE_PENDING_EXCEPTION();
431 } else {
Andreas Gampe03ec9302015-08-27 17:41:47 -0700432 DoMonitorEnter<do_assignability_check>(self, &shadow_frame, obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200433 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
434 }
435 break;
436 }
437 case Instruction::MONITOR_EXIT: {
438 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700439 ObjPtr<mirror::Object> obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700440 if (UNLIKELY(obj == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000441 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200442 HANDLE_PENDING_EXCEPTION();
443 } else {
Andreas Gampe03ec9302015-08-27 17:41:47 -0700444 DoMonitorExit<do_assignability_check>(self, &shadow_frame, obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200445 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
446 }
447 break;
448 }
449 case Instruction::CHECK_CAST: {
450 PREAMBLE();
Andreas Gampea5b09a62016-11-17 15:21:22 -0800451 ObjPtr<mirror::Class> c = ResolveVerifyAndClinit(dex::TypeIndex(inst->VRegB_21c()),
Mathieu Chartieref41db72016-10-25 15:08:01 -0700452 shadow_frame.GetMethod(),
453 self,
454 false,
455 do_access_check);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700456 if (UNLIKELY(c == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200457 HANDLE_PENDING_EXCEPTION();
458 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700459 ObjPtr<mirror::Object> obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700460 if (UNLIKELY(obj != nullptr && !obj->InstanceOf(c))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200461 ThrowClassCastException(c, obj->GetClass());
462 HANDLE_PENDING_EXCEPTION();
463 } else {
464 inst = inst->Next_2xx();
465 }
466 }
467 break;
468 }
469 case Instruction::INSTANCE_OF: {
470 PREAMBLE();
Andreas Gampea5b09a62016-11-17 15:21:22 -0800471 ObjPtr<mirror::Class> c = ResolveVerifyAndClinit(dex::TypeIndex(inst->VRegC_22c()),
Mathieu Chartieref41db72016-10-25 15:08:01 -0700472 shadow_frame.GetMethod(),
473 self,
474 false,
475 do_access_check);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700476 if (UNLIKELY(c == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200477 HANDLE_PENDING_EXCEPTION();
478 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700479 ObjPtr<mirror::Object> obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700480 shadow_frame.SetVReg(inst->VRegA_22c(inst_data),
481 (obj != nullptr && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200482 inst = inst->Next_2xx();
483 }
484 break;
485 }
486 case Instruction::ARRAY_LENGTH: {
487 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700488 ObjPtr<mirror::Object> array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700489 if (UNLIKELY(array == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000490 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200491 HANDLE_PENDING_EXCEPTION();
492 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200493 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200494 inst = inst->Next_1xx();
495 }
496 break;
497 }
498 case Instruction::NEW_INSTANCE: {
499 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700500 ObjPtr<mirror::Object> obj = nullptr;
Andreas Gampea5b09a62016-11-17 15:21:22 -0800501 ObjPtr<mirror::Class> c = ResolveVerifyAndClinit(dex::TypeIndex(inst->VRegB_21c()),
Mathieu Chartieref41db72016-10-25 15:08:01 -0700502 shadow_frame.GetMethod(),
503 self,
504 false,
505 do_access_check);
Jeff Hao848f70a2014-01-15 13:49:50 -0800506 if (LIKELY(c != nullptr)) {
507 if (UNLIKELY(c->IsStringClass())) {
508 gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
jessicahandojo3aaa37b2016-07-29 14:46:37 -0700509 obj = mirror::String::AllocEmptyString<true>(self, allocator_type);
Jeff Hao848f70a2014-01-15 13:49:50 -0800510 } else {
Nicolas Geoffray2b615ba2017-01-06 14:40:07 +0000511 obj = AllocObjectFromCode<true>(
512 c.Ptr(),
Andreas Gampea5b09a62016-11-17 15:21:22 -0800513 self,
514 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Jeff Hao848f70a2014-01-15 13:49:50 -0800515 }
516 }
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700517 if (UNLIKELY(obj == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200518 HANDLE_PENDING_EXCEPTION();
519 } else {
Sebastien Hertz4e99b3d2014-06-24 14:35:40 +0200520 obj->GetClass()->AssertInitializedOrInitializingInThread(self);
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700521 // Don't allow finalizable objects to be allocated during a transaction since these can't
522 // be finalized without a started runtime.
523 if (transaction_active && obj->GetClass()->IsFinalizable()) {
Sebastien Hertz45b15972015-04-03 16:07:05 +0200524 AbortTransactionF(self, "Allocating finalizable object in transaction: %s",
David Sehr709b0702016-10-13 09:12:37 -0700525 obj->PrettyTypeOf().c_str());
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700526 HANDLE_PENDING_EXCEPTION();
527 break;
528 }
Mathieu Chartieref41db72016-10-25 15:08:01 -0700529 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj.Ptr());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200530 inst = inst->Next_2xx();
531 }
532 break;
533 }
534 case Instruction::NEW_ARRAY: {
535 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200536 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Mathieu Chartieref41db72016-10-25 15:08:01 -0700537 ObjPtr<mirror::Object> obj = AllocArrayFromCode<do_access_check, true>(
Andreas Gampea5b09a62016-11-17 15:21:22 -0800538 dex::TypeIndex(inst->VRegC_22c()),
539 length,
540 shadow_frame.GetMethod(),
541 self,
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800542 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700543 if (UNLIKELY(obj == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200544 HANDLE_PENDING_EXCEPTION();
545 } else {
Mathieu Chartieref41db72016-10-25 15:08:01 -0700546 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj.Ptr());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200547 inst = inst->Next_2xx();
548 }
549 break;
550 }
551 case Instruction::FILLED_NEW_ARRAY: {
552 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100553 bool success =
554 DoFilledNewArray<false, do_access_check, transaction_active>(inst, shadow_frame, self,
555 &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200556 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
557 break;
558 }
559 case Instruction::FILLED_NEW_ARRAY_RANGE: {
560 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100561 bool success =
562 DoFilledNewArray<true, do_access_check, transaction_active>(inst, shadow_frame,
563 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200564 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
565 break;
566 }
567 case Instruction::FILL_ARRAY_DATA: {
568 PREAMBLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200569 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
570 const Instruction::ArrayDataPayload* payload =
571 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
Mathieu Chartieref41db72016-10-25 15:08:01 -0700572 ObjPtr<mirror::Object> obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Ian Rogers832336b2014-10-08 15:35:22 -0700573 bool success = FillArrayData(obj, payload);
574 if (!success) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200575 HANDLE_PENDING_EXCEPTION();
576 break;
577 }
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100578 if (transaction_active) {
Ian Rogers832336b2014-10-08 15:35:22 -0700579 RecordArrayElementsInTransaction(obj->AsArray(), payload->element_count);
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100580 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200581 inst = inst->Next_3xx();
582 break;
583 }
584 case Instruction::THROW: {
585 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700586 ObjPtr<mirror::Object> exception =
587 shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700588 if (UNLIKELY(exception == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000589 ThrowNullPointerException("throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700590 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
591 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700592 std::string temp;
Orion Hodsonfef06642016-11-25 16:07:11 +0000593 self->ThrowNewExceptionF("Ljava/lang/InternalError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700594 "Throwing '%s' that is not instance of Throwable",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700595 exception->GetClass()->GetDescriptor(&temp));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200596 } else {
Nicolas Geoffray14691c52015-03-05 10:40:17 +0000597 self->SetException(exception->AsThrowable());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200598 }
599 HANDLE_PENDING_EXCEPTION();
600 break;
601 }
602 case Instruction::GOTO: {
603 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200604 int8_t offset = inst->VRegA_10t(inst_data);
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000605 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200606 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800607 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200608 break;
609 }
610 case Instruction::GOTO_16: {
611 PREAMBLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200612 int16_t offset = inst->VRegA_20t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000613 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200614 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800615 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200616 break;
617 }
618 case Instruction::GOTO_32: {
619 PREAMBLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200620 int32_t offset = inst->VRegA_30t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000621 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200622 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800623 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200624 break;
625 }
626 case Instruction::PACKED_SWITCH: {
627 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200628 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000629 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200630 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800631 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200632 break;
633 }
634 case Instruction::SPARSE_SWITCH: {
635 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200636 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000637 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200638 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800639 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200640 break;
641 }
Ian Rogers647b1a82014-10-10 11:02:11 -0700642
Ian Rogers647b1a82014-10-10 11:02:11 -0700643#pragma clang diagnostic push
644#pragma clang diagnostic ignored "-Wfloat-equal"
Ian Rogers647b1a82014-10-10 11:02:11 -0700645
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200646 case Instruction::CMPL_FLOAT: {
647 PREAMBLE();
648 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
649 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
650 int32_t result;
651 if (val1 > val2) {
652 result = 1;
653 } else if (val1 == val2) {
654 result = 0;
655 } else {
656 result = -1;
657 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200658 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200659 inst = inst->Next_2xx();
660 break;
661 }
662 case Instruction::CMPG_FLOAT: {
663 PREAMBLE();
664 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
665 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
666 int32_t result;
667 if (val1 < val2) {
668 result = -1;
669 } else if (val1 == val2) {
670 result = 0;
671 } else {
672 result = 1;
673 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200674 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200675 inst = inst->Next_2xx();
676 break;
677 }
678 case Instruction::CMPL_DOUBLE: {
679 PREAMBLE();
680 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
681 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
682 int32_t result;
683 if (val1 > val2) {
684 result = 1;
685 } else if (val1 == val2) {
686 result = 0;
687 } else {
688 result = -1;
689 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200690 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200691 inst = inst->Next_2xx();
692 break;
693 }
694
695 case Instruction::CMPG_DOUBLE: {
696 PREAMBLE();
697 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
698 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
699 int32_t result;
700 if (val1 < val2) {
701 result = -1;
702 } else if (val1 == val2) {
703 result = 0;
704 } else {
705 result = 1;
706 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200707 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200708 inst = inst->Next_2xx();
709 break;
710 }
Ian Rogers647b1a82014-10-10 11:02:11 -0700711
Ian Rogers647b1a82014-10-10 11:02:11 -0700712#pragma clang diagnostic pop
Ian Rogers647b1a82014-10-10 11:02:11 -0700713
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200714 case Instruction::CMP_LONG: {
715 PREAMBLE();
716 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
717 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
718 int32_t result;
719 if (val1 > val2) {
720 result = 1;
721 } else if (val1 == val2) {
722 result = 0;
723 } else {
724 result = -1;
725 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200726 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200727 inst = inst->Next_2xx();
728 break;
729 }
730 case Instruction::IF_EQ: {
731 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700732 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) ==
733 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200734 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000735 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200736 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800737 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200738 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800739 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200740 inst = inst->Next_2xx();
741 }
742 break;
743 }
744 case Instruction::IF_NE: {
745 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700746 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) !=
747 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200748 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000749 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200750 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800751 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200752 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800753 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200754 inst = inst->Next_2xx();
755 }
756 break;
757 }
758 case Instruction::IF_LT: {
759 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700760 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <
761 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200762 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000763 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200764 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800765 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200766 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800767 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200768 inst = inst->Next_2xx();
769 }
770 break;
771 }
772 case Instruction::IF_GE: {
773 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700774 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >=
775 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200776 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000777 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200778 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800779 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200780 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800781 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200782 inst = inst->Next_2xx();
783 }
784 break;
785 }
786 case Instruction::IF_GT: {
787 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700788 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >
789 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200790 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000791 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200792 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800793 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200794 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800795 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200796 inst = inst->Next_2xx();
797 }
798 break;
799 }
800 case Instruction::IF_LE: {
801 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700802 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <=
803 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200804 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000805 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200806 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800807 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200808 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800809 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200810 inst = inst->Next_2xx();
811 }
812 break;
813 }
814 case Instruction::IF_EQZ: {
815 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200816 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200817 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000818 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200819 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800820 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200821 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800822 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200823 inst = inst->Next_2xx();
824 }
825 break;
826 }
827 case Instruction::IF_NEZ: {
828 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200829 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200830 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000831 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200832 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800833 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200834 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800835 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200836 inst = inst->Next_2xx();
837 }
838 break;
839 }
840 case Instruction::IF_LTZ: {
841 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200842 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200843 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000844 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200845 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800846 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200847 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800848 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200849 inst = inst->Next_2xx();
850 }
851 break;
852 }
853 case Instruction::IF_GEZ: {
854 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200855 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200856 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000857 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200858 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800859 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200860 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800861 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200862 inst = inst->Next_2xx();
863 }
864 break;
865 }
866 case Instruction::IF_GTZ: {
867 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200868 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200869 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000870 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200871 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800872 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200873 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800874 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200875 inst = inst->Next_2xx();
876 }
877 break;
878 }
879 case Instruction::IF_LEZ: {
880 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200881 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200882 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000883 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200884 inst = inst->RelativeAt(offset);
Andreas Gampef4f76372016-12-13 14:43:58 -0800885 HANDLE_BACKWARD_BRANCH(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200886 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800887 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200888 inst = inst->Next_2xx();
889 }
890 break;
891 }
892 case Instruction::AGET_BOOLEAN: {
893 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700894 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700895 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000896 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200897 HANDLE_PENDING_EXCEPTION();
898 break;
899 }
900 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -0700901 ObjPtr<mirror::BooleanArray> array = a->AsBooleanArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700902 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100903 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200904 inst = inst->Next_2xx();
905 } else {
906 HANDLE_PENDING_EXCEPTION();
907 }
908 break;
909 }
910 case Instruction::AGET_BYTE: {
911 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700912 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700913 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000914 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200915 HANDLE_PENDING_EXCEPTION();
916 break;
917 }
918 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -0700919 ObjPtr<mirror::ByteArray> array = a->AsByteArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700920 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100921 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200922 inst = inst->Next_2xx();
923 } else {
924 HANDLE_PENDING_EXCEPTION();
925 }
926 break;
927 }
928 case Instruction::AGET_CHAR: {
929 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700930 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700931 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000932 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200933 HANDLE_PENDING_EXCEPTION();
934 break;
935 }
936 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -0700937 ObjPtr<mirror::CharArray> array = a->AsCharArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700938 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100939 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200940 inst = inst->Next_2xx();
941 } else {
942 HANDLE_PENDING_EXCEPTION();
943 }
944 break;
945 }
946 case Instruction::AGET_SHORT: {
947 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700948 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700949 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000950 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200951 HANDLE_PENDING_EXCEPTION();
952 break;
953 }
954 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -0700955 ObjPtr<mirror::ShortArray> array = a->AsShortArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700956 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100957 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200958 inst = inst->Next_2xx();
959 } else {
960 HANDLE_PENDING_EXCEPTION();
961 }
962 break;
963 }
964 case Instruction::AGET: {
965 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700966 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700967 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000968 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200969 HANDLE_PENDING_EXCEPTION();
970 break;
971 }
972 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
David Sehr709b0702016-10-13 09:12:37 -0700973 DCHECK(a->IsIntArray() || a->IsFloatArray()) << a->PrettyTypeOf();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700974 ObjPtr<mirror::IntArray> array = ObjPtr<mirror::IntArray>::DownCast(a);
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700975 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100976 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200977 inst = inst->Next_2xx();
978 } else {
979 HANDLE_PENDING_EXCEPTION();
980 }
981 break;
982 }
983 case Instruction::AGET_WIDE: {
984 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700985 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700986 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000987 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200988 HANDLE_PENDING_EXCEPTION();
989 break;
990 }
991 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
David Sehr709b0702016-10-13 09:12:37 -0700992 DCHECK(a->IsLongArray() || a->IsDoubleArray()) << a->PrettyTypeOf();
Mathieu Chartieref41db72016-10-25 15:08:01 -0700993 ObjPtr<mirror::LongArray> array = ObjPtr<mirror::LongArray>::DownCast(a);
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700994 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100995 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200996 inst = inst->Next_2xx();
997 } else {
998 HANDLE_PENDING_EXCEPTION();
999 }
1000 break;
1001 }
1002 case Instruction::AGET_OBJECT: {
1003 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001004 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001005 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001006 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001007 HANDLE_PENDING_EXCEPTION();
1008 break;
1009 }
1010 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001011 ObjPtr<mirror::ObjectArray<mirror::Object>> array = a->AsObjectArray<mirror::Object>();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001012 if (array->CheckIsValidIndex(index)) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001013 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001014 inst = inst->Next_2xx();
1015 } else {
1016 HANDLE_PENDING_EXCEPTION();
1017 }
1018 break;
1019 }
1020 case Instruction::APUT_BOOLEAN: {
1021 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001022 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001023 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001024 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001025 HANDLE_PENDING_EXCEPTION();
1026 break;
1027 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001028 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001029 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001030 ObjPtr<mirror::BooleanArray> array = a->AsBooleanArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001031 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001032 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001033 inst = inst->Next_2xx();
1034 } else {
1035 HANDLE_PENDING_EXCEPTION();
1036 }
1037 break;
1038 }
1039 case Instruction::APUT_BYTE: {
1040 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001041 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001042 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001043 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001044 HANDLE_PENDING_EXCEPTION();
1045 break;
1046 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001047 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001048 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001049 ObjPtr<mirror::ByteArray> array = a->AsByteArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001050 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001051 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001052 inst = inst->Next_2xx();
1053 } else {
1054 HANDLE_PENDING_EXCEPTION();
1055 }
1056 break;
1057 }
1058 case Instruction::APUT_CHAR: {
1059 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001060 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001061 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001062 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001063 HANDLE_PENDING_EXCEPTION();
1064 break;
1065 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001066 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001067 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001068 ObjPtr<mirror::CharArray> array = a->AsCharArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001069 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001070 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001071 inst = inst->Next_2xx();
1072 } else {
1073 HANDLE_PENDING_EXCEPTION();
1074 }
1075 break;
1076 }
1077 case Instruction::APUT_SHORT: {
1078 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001079 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001080 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001081 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001082 HANDLE_PENDING_EXCEPTION();
1083 break;
1084 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001085 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001086 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001087 ObjPtr<mirror::ShortArray> array = a->AsShortArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001088 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001089 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001090 inst = inst->Next_2xx();
1091 } else {
1092 HANDLE_PENDING_EXCEPTION();
1093 }
1094 break;
1095 }
1096 case Instruction::APUT: {
1097 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001098 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001099 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001100 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001101 HANDLE_PENDING_EXCEPTION();
1102 break;
1103 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001104 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001105 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
David Sehr709b0702016-10-13 09:12:37 -07001106 DCHECK(a->IsIntArray() || a->IsFloatArray()) << a->PrettyTypeOf();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001107 ObjPtr<mirror::IntArray> array = ObjPtr<mirror::IntArray>::DownCast(a);
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001108 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001109 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001110 inst = inst->Next_2xx();
1111 } else {
1112 HANDLE_PENDING_EXCEPTION();
1113 }
1114 break;
1115 }
1116 case Instruction::APUT_WIDE: {
1117 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001118 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001119 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001120 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001121 HANDLE_PENDING_EXCEPTION();
1122 break;
1123 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001124 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001125 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
David Sehr709b0702016-10-13 09:12:37 -07001126 DCHECK(a->IsLongArray() || a->IsDoubleArray()) << a->PrettyTypeOf();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001127 ObjPtr<mirror::LongArray> array = ObjPtr<mirror::LongArray>::DownCast(a);
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001128 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001129 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001130 inst = inst->Next_2xx();
1131 } else {
1132 HANDLE_PENDING_EXCEPTION();
1133 }
1134 break;
1135 }
1136 case Instruction::APUT_OBJECT: {
1137 PREAMBLE();
Mathieu Chartieref41db72016-10-25 15:08:01 -07001138 ObjPtr<mirror::Object> a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001139 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001140 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001141 HANDLE_PENDING_EXCEPTION();
1142 break;
1143 }
1144 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartieref41db72016-10-25 15:08:01 -07001145 ObjPtr<mirror::Object> val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
1146 ObjPtr<mirror::ObjectArray<mirror::Object>> array = a->AsObjectArray<mirror::Object>();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001147 if (array->CheckIsValidIndex(index) && array->CheckAssignable(val)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001148 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001149 inst = inst->Next_2xx();
1150 } else {
1151 HANDLE_PENDING_EXCEPTION();
1152 }
1153 break;
1154 }
1155 case Instruction::IGET_BOOLEAN: {
1156 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001157 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(
1158 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001159 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1160 break;
1161 }
1162 case Instruction::IGET_BYTE: {
1163 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001164 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(
1165 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001166 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1167 break;
1168 }
1169 case Instruction::IGET_CHAR: {
1170 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001171 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(
1172 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001173 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1174 break;
1175 }
1176 case Instruction::IGET_SHORT: {
1177 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001178 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(
1179 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001180 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1181 break;
1182 }
1183 case Instruction::IGET: {
1184 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001185 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(
1186 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001187 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1188 break;
1189 }
1190 case Instruction::IGET_WIDE: {
1191 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001192 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(
1193 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001194 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1195 break;
1196 }
1197 case Instruction::IGET_OBJECT: {
1198 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001199 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(
1200 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001201 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1202 break;
1203 }
1204 case Instruction::IGET_QUICK: {
1205 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001206 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001207 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1208 break;
1209 }
1210 case Instruction::IGET_WIDE_QUICK: {
1211 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001212 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001213 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1214 break;
1215 }
1216 case Instruction::IGET_OBJECT_QUICK: {
1217 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001218 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001219 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1220 break;
1221 }
Mathieu Chartierffc605c2014-12-10 10:35:44 -08001222 case Instruction::IGET_BOOLEAN_QUICK: {
1223 PREAMBLE();
1224 bool success = DoIGetQuick<Primitive::kPrimBoolean>(shadow_frame, inst, inst_data);
1225 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1226 break;
1227 }
1228 case Instruction::IGET_BYTE_QUICK: {
1229 PREAMBLE();
1230 bool success = DoIGetQuick<Primitive::kPrimByte>(shadow_frame, inst, inst_data);
1231 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1232 break;
1233 }
1234 case Instruction::IGET_CHAR_QUICK: {
1235 PREAMBLE();
1236 bool success = DoIGetQuick<Primitive::kPrimChar>(shadow_frame, inst, inst_data);
1237 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1238 break;
1239 }
1240 case Instruction::IGET_SHORT_QUICK: {
1241 PREAMBLE();
1242 bool success = DoIGetQuick<Primitive::kPrimShort>(shadow_frame, inst, inst_data);
1243 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1244 break;
1245 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001246 case Instruction::SGET_BOOLEAN: {
1247 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001248 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(
1249 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001250 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1251 break;
1252 }
1253 case Instruction::SGET_BYTE: {
1254 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001255 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(
1256 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001257 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1258 break;
1259 }
1260 case Instruction::SGET_CHAR: {
1261 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001262 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(
1263 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001264 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1265 break;
1266 }
1267 case Instruction::SGET_SHORT: {
1268 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001269 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(
1270 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001271 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1272 break;
1273 }
1274 case Instruction::SGET: {
1275 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001276 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(
1277 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001278 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1279 break;
1280 }
1281 case Instruction::SGET_WIDE: {
1282 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001283 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(
1284 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001285 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1286 break;
1287 }
1288 case Instruction::SGET_OBJECT: {
1289 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001290 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(
1291 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001292 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1293 break;
1294 }
1295 case Instruction::IPUT_BOOLEAN: {
1296 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001297 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check,
1298 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001299 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1300 break;
1301 }
1302 case Instruction::IPUT_BYTE: {
1303 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001304 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check,
1305 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001306 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1307 break;
1308 }
1309 case Instruction::IPUT_CHAR: {
1310 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001311 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check,
1312 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001313 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1314 break;
1315 }
1316 case Instruction::IPUT_SHORT: {
1317 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001318 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check,
1319 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001320 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1321 break;
1322 }
1323 case Instruction::IPUT: {
1324 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001325 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check,
1326 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001327 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1328 break;
1329 }
1330 case Instruction::IPUT_WIDE: {
1331 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001332 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check,
1333 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001334 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1335 break;
1336 }
1337 case Instruction::IPUT_OBJECT: {
1338 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001339 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check,
1340 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001341 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1342 break;
1343 }
1344 case Instruction::IPUT_QUICK: {
1345 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001346 bool success = DoIPutQuick<Primitive::kPrimInt, transaction_active>(
1347 shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001348 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1349 break;
1350 }
Fred Shih37f05ef2014-07-16 18:38:08 -07001351 case Instruction::IPUT_BOOLEAN_QUICK: {
1352 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001353 bool success = DoIPutQuick<Primitive::kPrimBoolean, transaction_active>(
1354 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001355 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1356 break;
1357 }
1358 case Instruction::IPUT_BYTE_QUICK: {
1359 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001360 bool success = DoIPutQuick<Primitive::kPrimByte, transaction_active>(
1361 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001362 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1363 break;
1364 }
1365 case Instruction::IPUT_CHAR_QUICK: {
1366 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001367 bool success = DoIPutQuick<Primitive::kPrimChar, transaction_active>(
1368 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001369 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1370 break;
1371 }
1372 case Instruction::IPUT_SHORT_QUICK: {
1373 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001374 bool success = DoIPutQuick<Primitive::kPrimShort, transaction_active>(
1375 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001376 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1377 break;
1378 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001379 case Instruction::IPUT_WIDE_QUICK: {
1380 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001381 bool success = DoIPutQuick<Primitive::kPrimLong, transaction_active>(
1382 shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001383 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1384 break;
1385 }
1386 case Instruction::IPUT_OBJECT_QUICK: {
1387 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001388 bool success = DoIPutQuick<Primitive::kPrimNot, transaction_active>(
1389 shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001390 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1391 break;
1392 }
1393 case Instruction::SPUT_BOOLEAN: {
1394 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001395 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check,
1396 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001397 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1398 break;
1399 }
1400 case Instruction::SPUT_BYTE: {
1401 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001402 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check,
1403 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001404 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1405 break;
1406 }
1407 case Instruction::SPUT_CHAR: {
1408 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001409 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check,
1410 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001411 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1412 break;
1413 }
1414 case Instruction::SPUT_SHORT: {
1415 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001416 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check,
1417 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001418 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1419 break;
1420 }
1421 case Instruction::SPUT: {
1422 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001423 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check,
1424 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001425 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1426 break;
1427 }
1428 case Instruction::SPUT_WIDE: {
1429 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001430 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check,
1431 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001432 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1433 break;
1434 }
1435 case Instruction::SPUT_OBJECT: {
1436 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001437 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check,
1438 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001439 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1440 break;
1441 }
1442 case Instruction::INVOKE_VIRTUAL: {
1443 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001444 bool success = DoInvoke<kVirtual, false, do_access_check>(
1445 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001446 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1447 break;
1448 }
1449 case Instruction::INVOKE_VIRTUAL_RANGE: {
1450 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001451 bool success = DoInvoke<kVirtual, true, do_access_check>(
1452 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001453 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1454 break;
1455 }
1456 case Instruction::INVOKE_SUPER: {
1457 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001458 bool success = DoInvoke<kSuper, false, do_access_check>(
1459 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001460 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1461 break;
1462 }
1463 case Instruction::INVOKE_SUPER_RANGE: {
1464 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001465 bool success = DoInvoke<kSuper, true, do_access_check>(
1466 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001467 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1468 break;
1469 }
1470 case Instruction::INVOKE_DIRECT: {
1471 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001472 bool success = DoInvoke<kDirect, false, do_access_check>(
1473 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001474 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1475 break;
1476 }
1477 case Instruction::INVOKE_DIRECT_RANGE: {
1478 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001479 bool success = DoInvoke<kDirect, true, do_access_check>(
1480 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001481 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1482 break;
1483 }
1484 case Instruction::INVOKE_INTERFACE: {
1485 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001486 bool success = DoInvoke<kInterface, false, do_access_check>(
1487 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001488 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1489 break;
1490 }
1491 case Instruction::INVOKE_INTERFACE_RANGE: {
1492 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001493 bool success = DoInvoke<kInterface, true, do_access_check>(
1494 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001495 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1496 break;
1497 }
1498 case Instruction::INVOKE_STATIC: {
1499 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001500 bool success = DoInvoke<kStatic, false, do_access_check>(
1501 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001502 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1503 break;
1504 }
1505 case Instruction::INVOKE_STATIC_RANGE: {
1506 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001507 bool success = DoInvoke<kStatic, true, do_access_check>(
1508 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001509 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1510 break;
1511 }
1512 case Instruction::INVOKE_VIRTUAL_QUICK: {
1513 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001514 bool success = DoInvokeVirtualQuick<false>(
1515 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001516 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1517 break;
1518 }
1519 case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: {
1520 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001521 bool success = DoInvokeVirtualQuick<true>(
1522 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001523 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1524 break;
1525 }
Narayan Kamath9823e782016-08-03 12:46:58 +01001526 case Instruction::INVOKE_POLYMORPHIC: {
1527 PREAMBLE();
Narayan Kamath269cb432016-10-28 10:19:54 +01001528 DCHECK(Runtime::Current()->IsMethodHandlesEnabled());
Narayan Kamath9823e782016-08-03 12:46:58 +01001529 bool success = DoInvokePolymorphic<false, do_access_check>(
1530 self, shadow_frame, inst, inst_data, &result_register);
1531 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_4xx);
1532 break;
1533 }
1534 case Instruction::INVOKE_POLYMORPHIC_RANGE: {
1535 PREAMBLE();
Narayan Kamath269cb432016-10-28 10:19:54 +01001536 DCHECK(Runtime::Current()->IsMethodHandlesEnabled());
Narayan Kamath9823e782016-08-03 12:46:58 +01001537 bool success = DoInvokePolymorphic<true, do_access_check>(
1538 self, shadow_frame, inst, inst_data, &result_register);
1539 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_4xx);
1540 break;
Narayan Kamath9823e782016-08-03 12:46:58 +01001541 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001542 case Instruction::NEG_INT:
1543 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001544 shadow_frame.SetVReg(
1545 inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001546 inst = inst->Next_1xx();
1547 break;
1548 case Instruction::NOT_INT:
1549 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001550 shadow_frame.SetVReg(
1551 inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001552 inst = inst->Next_1xx();
1553 break;
1554 case Instruction::NEG_LONG:
1555 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001556 shadow_frame.SetVRegLong(
1557 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001558 inst = inst->Next_1xx();
1559 break;
1560 case Instruction::NOT_LONG:
1561 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001562 shadow_frame.SetVRegLong(
1563 inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001564 inst = inst->Next_1xx();
1565 break;
1566 case Instruction::NEG_FLOAT:
1567 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001568 shadow_frame.SetVRegFloat(
1569 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001570 inst = inst->Next_1xx();
1571 break;
1572 case Instruction::NEG_DOUBLE:
1573 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001574 shadow_frame.SetVRegDouble(
1575 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001576 inst = inst->Next_1xx();
1577 break;
1578 case Instruction::INT_TO_LONG:
1579 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001580 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
1581 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001582 inst = inst->Next_1xx();
1583 break;
1584 case Instruction::INT_TO_FLOAT:
1585 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001586 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1587 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001588 inst = inst->Next_1xx();
1589 break;
1590 case Instruction::INT_TO_DOUBLE:
1591 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001592 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1593 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001594 inst = inst->Next_1xx();
1595 break;
1596 case Instruction::LONG_TO_INT:
1597 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001598 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1599 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001600 inst = inst->Next_1xx();
1601 break;
1602 case Instruction::LONG_TO_FLOAT:
1603 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001604 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1605 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001606 inst = inst->Next_1xx();
1607 break;
1608 case Instruction::LONG_TO_DOUBLE:
1609 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001610 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1611 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001612 inst = inst->Next_1xx();
1613 break;
1614 case Instruction::FLOAT_TO_INT: {
1615 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001616 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001617 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001618 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001619 inst = inst->Next_1xx();
1620 break;
1621 }
1622 case Instruction::FLOAT_TO_LONG: {
1623 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001624 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001625 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001626 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001627 inst = inst->Next_1xx();
1628 break;
1629 }
1630 case Instruction::FLOAT_TO_DOUBLE:
1631 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001632 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1633 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001634 inst = inst->Next_1xx();
1635 break;
1636 case Instruction::DOUBLE_TO_INT: {
1637 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001638 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001639 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001640 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001641 inst = inst->Next_1xx();
1642 break;
1643 }
1644 case Instruction::DOUBLE_TO_LONG: {
1645 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001646 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001647 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001648 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001649 inst = inst->Next_1xx();
1650 break;
1651 }
1652 case Instruction::DOUBLE_TO_FLOAT:
1653 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001654 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1655 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001656 inst = inst->Next_1xx();
1657 break;
1658 case Instruction::INT_TO_BYTE:
1659 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001660 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), static_cast<int8_t>(
1661 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001662 inst = inst->Next_1xx();
1663 break;
1664 case Instruction::INT_TO_CHAR:
1665 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001666 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), static_cast<uint16_t>(
1667 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001668 inst = inst->Next_1xx();
1669 break;
1670 case Instruction::INT_TO_SHORT:
1671 PREAMBLE();
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001672 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), static_cast<int16_t>(
1673 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001674 inst = inst->Next_1xx();
1675 break;
Ian Rogersf72a11d2014-10-30 15:41:08 -07001676 case Instruction::ADD_INT: {
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001677 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001678 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001679 SafeAdd(shadow_frame.GetVReg(inst->VRegB_23x()),
1680 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001681 inst = inst->Next_2xx();
1682 break;
Ian Rogersf72a11d2014-10-30 15:41:08 -07001683 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001684 case Instruction::SUB_INT:
1685 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001686 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001687 SafeSub(shadow_frame.GetVReg(inst->VRegB_23x()),
1688 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001689 inst = inst->Next_2xx();
1690 break;
1691 case Instruction::MUL_INT:
1692 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001693 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001694 SafeMul(shadow_frame.GetVReg(inst->VRegB_23x()),
1695 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001696 inst = inst->Next_2xx();
1697 break;
1698 case Instruction::DIV_INT: {
1699 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001700 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001701 shadow_frame.GetVReg(inst->VRegB_23x()),
1702 shadow_frame.GetVReg(inst->VRegC_23x()));
1703 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1704 break;
1705 }
1706 case Instruction::REM_INT: {
1707 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001708 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001709 shadow_frame.GetVReg(inst->VRegB_23x()),
1710 shadow_frame.GetVReg(inst->VRegC_23x()));
1711 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1712 break;
1713 }
1714 case Instruction::SHL_INT:
1715 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001716 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001717 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1718 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1719 inst = inst->Next_2xx();
1720 break;
1721 case Instruction::SHR_INT:
1722 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001723 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001724 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1725 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1726 inst = inst->Next_2xx();
1727 break;
1728 case Instruction::USHR_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 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1732 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1733 inst = inst->Next_2xx();
1734 break;
1735 case Instruction::AND_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()));
1740 inst = inst->Next_2xx();
1741 break;
1742 case Instruction::OR_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 shadow_frame.GetVReg(inst->VRegB_23x()) |
1746 shadow_frame.GetVReg(inst->VRegC_23x()));
1747 inst = inst->Next_2xx();
1748 break;
1749 case Instruction::XOR_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::ADD_LONG:
1757 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001758 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001759 SafeAdd(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1760 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001761 inst = inst->Next_2xx();
1762 break;
1763 case Instruction::SUB_LONG:
1764 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001765 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001766 SafeSub(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1767 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001768 inst = inst->Next_2xx();
1769 break;
1770 case Instruction::MUL_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 SafeMul(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::DIV_LONG:
1778 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001779 DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001780 shadow_frame.GetVRegLong(inst->VRegB_23x()),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001781 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001782 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_2xx);
1783 break;
1784 case Instruction::REM_LONG:
1785 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001786 DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001787 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1788 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1789 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_2xx);
1790 break;
1791 case Instruction::AND_LONG:
1792 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001793 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001794 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1795 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1796 inst = inst->Next_2xx();
1797 break;
1798 case Instruction::OR_LONG:
1799 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001800 shadow_frame.SetVRegLong(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 inst = inst->Next_2xx();
1804 break;
1805 case Instruction::XOR_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::SHL_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.GetVReg(inst->VRegC_23x()) & 0x3f));
1817 inst = inst->Next_2xx();
1818 break;
1819 case Instruction::SHR_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.GetVReg(inst->VRegC_23x()) & 0x3f));
1824 inst = inst->Next_2xx();
1825 break;
1826 case Instruction::USHR_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 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1830 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1831 inst = inst->Next_2xx();
1832 break;
1833 case Instruction::ADD_FLOAT:
1834 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001835 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001836 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1837 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1838 inst = inst->Next_2xx();
1839 break;
1840 case Instruction::SUB_FLOAT:
1841 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001842 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001843 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1844 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1845 inst = inst->Next_2xx();
1846 break;
1847 case Instruction::MUL_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::DIV_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::REM_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 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1865 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1866 inst = inst->Next_2xx();
1867 break;
1868 case Instruction::ADD_DOUBLE:
1869 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001870 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001871 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1872 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1873 inst = inst->Next_2xx();
1874 break;
1875 case Instruction::SUB_DOUBLE:
1876 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001877 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001878 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1879 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1880 inst = inst->Next_2xx();
1881 break;
1882 case Instruction::MUL_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::DIV_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::REM_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 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1900 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1901 inst = inst->Next_2xx();
1902 break;
1903 case Instruction::ADD_INT_2ADDR: {
1904 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001905 uint4_t vregA = inst->VRegA_12x(inst_data);
Ian Rogersf72a11d2014-10-30 15:41:08 -07001906 shadow_frame.SetVReg(vregA, SafeAdd(shadow_frame.GetVReg(vregA),
1907 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001908 inst = inst->Next_1xx();
1909 break;
1910 }
1911 case Instruction::SUB_INT_2ADDR: {
1912 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001913 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001914 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001915 SafeSub(shadow_frame.GetVReg(vregA),
1916 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001917 inst = inst->Next_1xx();
1918 break;
1919 }
1920 case Instruction::MUL_INT_2ADDR: {
1921 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001922 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001923 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001924 SafeMul(shadow_frame.GetVReg(vregA),
1925 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001926 inst = inst->Next_1xx();
1927 break;
1928 }
1929 case Instruction::DIV_INT_2ADDR: {
1930 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001931 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001932 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001933 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001934 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx);
1935 break;
1936 }
1937 case Instruction::REM_INT_2ADDR: {
1938 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001939 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001940 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001941 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001942 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx);
1943 break;
1944 }
1945 case Instruction::SHL_INT_2ADDR: {
1946 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001947 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001948 shadow_frame.SetVReg(vregA,
1949 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001950 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001951 inst = inst->Next_1xx();
1952 break;
1953 }
1954 case Instruction::SHR_INT_2ADDR: {
1955 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001956 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001957 shadow_frame.SetVReg(vregA,
1958 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001959 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001960 inst = inst->Next_1xx();
1961 break;
1962 }
1963 case Instruction::USHR_INT_2ADDR: {
1964 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001965 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001966 shadow_frame.SetVReg(vregA,
1967 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001968 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001969 inst = inst->Next_1xx();
1970 break;
1971 }
1972 case Instruction::AND_INT_2ADDR: {
1973 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001974 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001975 shadow_frame.SetVReg(vregA,
1976 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001977 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001978 inst = inst->Next_1xx();
1979 break;
1980 }
1981 case Instruction::OR_INT_2ADDR: {
1982 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001983 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001984 shadow_frame.SetVReg(vregA,
1985 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001986 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001987 inst = inst->Next_1xx();
1988 break;
1989 }
1990 case Instruction::XOR_INT_2ADDR: {
1991 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001992 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001993 shadow_frame.SetVReg(vregA,
1994 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001995 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001996 inst = inst->Next_1xx();
1997 break;
1998 }
1999 case Instruction::ADD_LONG_2ADDR: {
2000 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002001 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002002 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002003 SafeAdd(shadow_frame.GetVRegLong(vregA),
2004 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002005 inst = inst->Next_1xx();
2006 break;
2007 }
2008 case Instruction::SUB_LONG_2ADDR: {
2009 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002010 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002011 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002012 SafeSub(shadow_frame.GetVRegLong(vregA),
2013 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002014 inst = inst->Next_1xx();
2015 break;
2016 }
2017 case Instruction::MUL_LONG_2ADDR: {
2018 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002019 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002020 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002021 SafeMul(shadow_frame.GetVRegLong(vregA),
2022 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002023 inst = inst->Next_1xx();
2024 break;
2025 }
2026 case Instruction::DIV_LONG_2ADDR: {
2027 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002028 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002029 DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002030 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002031 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
2032 break;
2033 }
2034 case Instruction::REM_LONG_2ADDR: {
2035 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002036 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002037 DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002038 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002039 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
2040 break;
2041 }
2042 case Instruction::AND_LONG_2ADDR: {
2043 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002044 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002045 shadow_frame.SetVRegLong(vregA,
2046 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002047 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002048 inst = inst->Next_1xx();
2049 break;
2050 }
2051 case Instruction::OR_LONG_2ADDR: {
2052 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002053 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002054 shadow_frame.SetVRegLong(vregA,
2055 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002056 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002057 inst = inst->Next_1xx();
2058 break;
2059 }
2060 case Instruction::XOR_LONG_2ADDR: {
2061 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002062 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002063 shadow_frame.SetVRegLong(vregA,
2064 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002065 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002066 inst = inst->Next_1xx();
2067 break;
2068 }
2069 case Instruction::SHL_LONG_2ADDR: {
2070 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002071 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002072 shadow_frame.SetVRegLong(vregA,
2073 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002074 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002075 inst = inst->Next_1xx();
2076 break;
2077 }
2078 case Instruction::SHR_LONG_2ADDR: {
2079 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002080 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002081 shadow_frame.SetVRegLong(vregA,
2082 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002083 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002084 inst = inst->Next_1xx();
2085 break;
2086 }
2087 case Instruction::USHR_LONG_2ADDR: {
2088 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002089 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002090 shadow_frame.SetVRegLong(vregA,
2091 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002092 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002093 inst = inst->Next_1xx();
2094 break;
2095 }
2096 case Instruction::ADD_FLOAT_2ADDR: {
2097 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002098 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002099 shadow_frame.SetVRegFloat(vregA,
2100 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002101 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002102 inst = inst->Next_1xx();
2103 break;
2104 }
2105 case Instruction::SUB_FLOAT_2ADDR: {
2106 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002107 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002108 shadow_frame.SetVRegFloat(vregA,
2109 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002110 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002111 inst = inst->Next_1xx();
2112 break;
2113 }
2114 case Instruction::MUL_FLOAT_2ADDR: {
2115 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002116 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002117 shadow_frame.SetVRegFloat(vregA,
2118 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002119 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002120 inst = inst->Next_1xx();
2121 break;
2122 }
2123 case Instruction::DIV_FLOAT_2ADDR: {
2124 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002125 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002126 shadow_frame.SetVRegFloat(vregA,
2127 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002128 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002129 inst = inst->Next_1xx();
2130 break;
2131 }
2132 case Instruction::REM_FLOAT_2ADDR: {
2133 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002134 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002135 shadow_frame.SetVRegFloat(vregA,
2136 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002137 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002138 inst = inst->Next_1xx();
2139 break;
2140 }
2141 case Instruction::ADD_DOUBLE_2ADDR: {
2142 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002143 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002144 shadow_frame.SetVRegDouble(vregA,
2145 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002146 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002147 inst = inst->Next_1xx();
2148 break;
2149 }
2150 case Instruction::SUB_DOUBLE_2ADDR: {
2151 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002152 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002153 shadow_frame.SetVRegDouble(vregA,
2154 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002155 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002156 inst = inst->Next_1xx();
2157 break;
2158 }
2159 case Instruction::MUL_DOUBLE_2ADDR: {
2160 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002161 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002162 shadow_frame.SetVRegDouble(vregA,
2163 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002164 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002165 inst = inst->Next_1xx();
2166 break;
2167 }
2168 case Instruction::DIV_DOUBLE_2ADDR: {
2169 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002170 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002171 shadow_frame.SetVRegDouble(vregA,
2172 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002173 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002174 inst = inst->Next_1xx();
2175 break;
2176 }
2177 case Instruction::REM_DOUBLE_2ADDR: {
2178 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002179 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002180 shadow_frame.SetVRegDouble(vregA,
2181 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002182 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002183 inst = inst->Next_1xx();
2184 break;
2185 }
2186 case Instruction::ADD_INT_LIT16:
2187 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002188 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002189 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2190 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002191 inst = inst->Next_2xx();
2192 break;
Ian Rogersf72a11d2014-10-30 15:41:08 -07002193 case Instruction::RSUB_INT_LIT16:
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002194 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002195 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002196 SafeSub(inst->VRegC_22s(),
2197 shadow_frame.GetVReg(inst->VRegB_22s(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002198 inst = inst->Next_2xx();
2199 break;
2200 case Instruction::MUL_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 SafeMul(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;
2207 case Instruction::DIV_INT_LIT16: {
2208 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002209 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
Mathieu Chartier2cebb242015-04-21 16:50:40 -07002210 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2211 inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002212 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2213 break;
2214 }
2215 case Instruction::REM_INT_LIT16: {
2216 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002217 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
Mathieu Chartier2cebb242015-04-21 16:50:40 -07002218 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2219 inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002220 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2221 break;
2222 }
2223 case Instruction::AND_INT_LIT16:
2224 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002225 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2226 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002227 inst->VRegC_22s());
2228 inst = inst->Next_2xx();
2229 break;
2230 case Instruction::OR_INT_LIT16:
2231 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002232 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2233 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002234 inst->VRegC_22s());
2235 inst = inst->Next_2xx();
2236 break;
2237 case Instruction::XOR_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::ADD_INT_LIT8:
2245 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002246 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002247 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002248 inst = inst->Next_2xx();
2249 break;
2250 case Instruction::RSUB_INT_LIT8:
2251 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002252 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002253 SafeSub(inst->VRegC_22b(), shadow_frame.GetVReg(inst->VRegB_22b())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002254 inst = inst->Next_2xx();
2255 break;
2256 case Instruction::MUL_INT_LIT8:
2257 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002258 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002259 SafeMul(shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002260 inst = inst->Next_2xx();
2261 break;
2262 case Instruction::DIV_INT_LIT8: {
2263 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002264 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002265 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
2266 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2267 break;
2268 }
2269 case Instruction::REM_INT_LIT8: {
2270 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002271 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002272 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
2273 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2274 break;
2275 }
2276 case Instruction::AND_INT_LIT8:
2277 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002278 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002279 shadow_frame.GetVReg(inst->VRegB_22b()) &
2280 inst->VRegC_22b());
2281 inst = inst->Next_2xx();
2282 break;
2283 case Instruction::OR_INT_LIT8:
2284 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002285 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002286 shadow_frame.GetVReg(inst->VRegB_22b()) |
2287 inst->VRegC_22b());
2288 inst = inst->Next_2xx();
2289 break;
2290 case Instruction::XOR_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::SHL_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() & 0x1f));
2302 inst = inst->Next_2xx();
2303 break;
2304 case Instruction::SHR_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() & 0x1f));
2309 inst = inst->Next_2xx();
2310 break;
2311 case Instruction::USHR_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 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2315 (inst->VRegC_22b() & 0x1f));
2316 inst = inst->Next_2xx();
2317 break;
2318 case Instruction::UNUSED_3E ... Instruction::UNUSED_43:
Narayan Kamath8ec3bd22016-08-03 12:46:23 +01002319 case Instruction::UNUSED_F3 ... Instruction::UNUSED_F9:
2320 case Instruction::UNUSED_FC ... Instruction::UNUSED_FF:
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002321 case Instruction::UNUSED_79:
2322 case Instruction::UNUSED_7A:
Ian Rogerse94652f2014-12-02 11:13:19 -08002323 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002324 }
buzbee1452bee2015-03-06 14:43:04 -08002325 } while (!interpret_one_instruction);
2326 // Record where we stopped.
2327 shadow_frame.SetDexPC(inst->GetDexPc(insns));
buzbeed6b48db2016-01-28 15:48:55 -08002328 return result_register;
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002329} // NOLINT(readability/fn_size)
2330
2331// Explicit definitions of ExecuteSwitchImpl.
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002332template HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002333JValue ExecuteSwitchImpl<true, false>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002334 ShadowFrame& shadow_frame, JValue result_register,
2335 bool interpret_one_instruction);
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002336template HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002337JValue ExecuteSwitchImpl<false, false>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002338 ShadowFrame& shadow_frame, JValue result_register,
2339 bool interpret_one_instruction);
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002340template
Ian Rogerse94652f2014-12-02 11:13:19 -08002341JValue ExecuteSwitchImpl<true, true>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002342 ShadowFrame& shadow_frame, JValue result_register,
2343 bool interpret_one_instruction);
Andreas Gampe5e26eb12016-08-22 17:54:17 -07002344template
Ian Rogerse94652f2014-12-02 11:13:19 -08002345JValue ExecuteSwitchImpl<false, true>(Thread* self, const DexFile::CodeItem* code_item,
buzbee1452bee2015-03-06 14:43:04 -08002346 ShadowFrame& shadow_frame, JValue result_register,
2347 bool interpret_one_instruction);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002348
2349} // namespace interpreter
2350} // namespace art