blob: 38665c7e0b54e61ff83fa2f5ee54fdda8a7c50a4 [file] [log] [blame]
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "interpreter_common.h"
Ian Rogersf72a11d2014-10-30 15:41:08 -070018#include "safe_math.h"
Sebastien Hertz8ece0502013-08-07 11:26:41 +020019
20namespace art {
21namespace interpreter {
22
23#define HANDLE_PENDING_EXCEPTION() \
24 do { \
Sebastien Hertz82aeddb2014-05-20 20:09:45 +020025 DCHECK(self->IsExceptionPending()); \
Ian Rogers7b078e82014-09-10 14:44:24 -070026 self->AllowThreadSuspension(); \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020027 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, \
28 inst->GetDexPc(insns), \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020029 instrumentation); \
30 if (found_dex_pc == DexFile::kDexNoIndex) { \
31 return JValue(); /* Handled in caller. */ \
32 } else { \
33 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc); \
34 inst = inst->RelativeAt(displacement); \
35 } \
36 } while (false)
37
38#define POSSIBLY_HANDLE_PENDING_EXCEPTION(_is_exception_pending, _next_function) \
39 do { \
40 if (UNLIKELY(_is_exception_pending)) { \
41 HANDLE_PENDING_EXCEPTION(); \
42 } else { \
43 inst = inst->_next_function(); \
44 } \
45 } while (false)
46
47// Code to run before each dex instruction.
Sebastien Hertz8379b222014-02-24 17:38:15 +010048#define PREAMBLE() \
49 do { \
50 DCHECK(!inst->IsReturn()); \
51 if (UNLIKELY(notified_method_entry_event)) { \
52 notified_method_entry_event = false; \
53 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
54 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), \
55 shadow_frame.GetMethod(), dex_pc); \
56 } \
57 } while (false)
Sebastien Hertz8ece0502013-08-07 11:26:41 +020058
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +010059template<bool do_access_check, bool transaction_active>
Ian Rogerse94652f2014-12-02 11:13:19 -080060JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertz8379b222014-02-24 17:38:15 +010061 ShadowFrame& shadow_frame, JValue result_register) {
Jeff Haoa3faaf42013-09-03 19:07:00 -070062 bool do_assignability_check = do_access_check;
Sebastien Hertz8ece0502013-08-07 11:26:41 +020063 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
64 LOG(FATAL) << "Invalid shadow frame for interpreter use";
65 return JValue();
66 }
67 self->VerifyStack();
Sebastien Hertz8ece0502013-08-07 11:26:41 +020068
69 uint32_t dex_pc = shadow_frame.GetDexPC();
Sebastien Hertz8379b222014-02-24 17:38:15 +010070 bool notified_method_entry_event = false;
Sebastien Hertz947ff082013-09-17 14:10:13 +020071 const instrumentation::Instrumentation* const instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +020072 if (LIKELY(dex_pc == 0)) { // We are entering the method as opposed to deoptimizing..
73 if (UNLIKELY(instrumentation->HasMethodEntryListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +020074 instrumentation->MethodEnterEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +020075 shadow_frame.GetMethod(), 0);
Sebastien Hertz8379b222014-02-24 17:38:15 +010076 notified_method_entry_event = true;
Sebastien Hertz8ece0502013-08-07 11:26:41 +020077 }
78 }
79 const uint16_t* const insns = code_item->insns_;
80 const Instruction* inst = Instruction::At(insns + dex_pc);
Sebastien Hertz3b588e02013-09-11 14:33:18 +020081 uint16_t inst_data;
Sebastien Hertz8ece0502013-08-07 11:26:41 +020082 while (true) {
83 dex_pc = inst->GetDexPc(insns);
84 shadow_frame.SetDexPC(dex_pc);
Ian Rogerse94652f2014-12-02 11:13:19 -080085 TraceExecution(shadow_frame, inst, dex_pc);
Sebastien Hertz3b588e02013-09-11 14:33:18 +020086 inst_data = inst->Fetch16(0);
87 switch (inst->Opcode(inst_data)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +020088 case Instruction::NOP:
89 PREAMBLE();
90 inst = inst->Next_1xx();
91 break;
92 case Instruction::MOVE:
93 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +020094 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
95 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +020096 inst = inst->Next_1xx();
97 break;
98 case Instruction::MOVE_FROM16:
99 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200100 shadow_frame.SetVReg(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200101 shadow_frame.GetVReg(inst->VRegB_22x()));
102 inst = inst->Next_2xx();
103 break;
104 case Instruction::MOVE_16:
105 PREAMBLE();
106 shadow_frame.SetVReg(inst->VRegA_32x(),
107 shadow_frame.GetVReg(inst->VRegB_32x()));
108 inst = inst->Next_3xx();
109 break;
110 case Instruction::MOVE_WIDE:
111 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200112 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
113 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200114 inst = inst->Next_1xx();
115 break;
116 case Instruction::MOVE_WIDE_FROM16:
117 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200118 shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200119 shadow_frame.GetVRegLong(inst->VRegB_22x()));
120 inst = inst->Next_2xx();
121 break;
122 case Instruction::MOVE_WIDE_16:
123 PREAMBLE();
124 shadow_frame.SetVRegLong(inst->VRegA_32x(),
125 shadow_frame.GetVRegLong(inst->VRegB_32x()));
126 inst = inst->Next_3xx();
127 break;
128 case Instruction::MOVE_OBJECT:
129 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200130 shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data),
131 shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200132 inst = inst->Next_1xx();
133 break;
134 case Instruction::MOVE_OBJECT_FROM16:
135 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200136 shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200137 shadow_frame.GetVRegReference(inst->VRegB_22x()));
138 inst = inst->Next_2xx();
139 break;
140 case Instruction::MOVE_OBJECT_16:
141 PREAMBLE();
142 shadow_frame.SetVRegReference(inst->VRegA_32x(),
143 shadow_frame.GetVRegReference(inst->VRegB_32x()));
144 inst = inst->Next_3xx();
145 break;
146 case Instruction::MOVE_RESULT:
147 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200148 shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200149 inst = inst->Next_1xx();
150 break;
151 case Instruction::MOVE_RESULT_WIDE:
152 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200153 shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200154 inst = inst->Next_1xx();
155 break;
156 case Instruction::MOVE_RESULT_OBJECT:
157 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200158 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200159 inst = inst->Next_1xx();
160 break;
161 case Instruction::MOVE_EXCEPTION: {
162 PREAMBLE();
Sebastien Hertz5c004902014-05-21 10:07:42 +0200163 Throwable* exception = self->GetException(nullptr);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200164 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception);
Sebastien Hertz5c004902014-05-21 10:07:42 +0200165 self->ClearException();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200166 inst = inst->Next_1xx();
167 break;
168 }
169 case Instruction::RETURN_VOID: {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200170 JValue result;
Sebastien Hertz043036f2013-09-09 18:26:48 +0200171 if (do_access_check) {
172 // If access checks are required then the dex-to-dex compiler and analysis of
173 // whether the class has final fields hasn't been performed. Conservatively
174 // perform the memory barrier now.
Hans Boehm30359612014-05-21 17:46:23 -0700175 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz043036f2013-09-09 18:26:48 +0200176 }
Ian Rogers7b078e82014-09-10 14:44:24 -0700177 self->AllowThreadSuspension();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200178 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200179 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200180 shadow_frame.GetMethod(), inst->GetDexPc(insns),
181 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200182 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
183 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
184 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200185 }
186 return result;
187 }
188 case Instruction::RETURN_VOID_BARRIER: {
Hans Boehm30359612014-05-21 17:46:23 -0700189 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200190 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700191 self->AllowThreadSuspension();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200192 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200193 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200194 shadow_frame.GetMethod(), inst->GetDexPc(insns),
195 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200196 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
197 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
198 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200199 }
200 return result;
201 }
202 case Instruction::RETURN: {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200203 JValue result;
204 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200205 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700206 self->AllowThreadSuspension();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200207 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200208 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200209 shadow_frame.GetMethod(), inst->GetDexPc(insns),
210 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200211 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
212 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
213 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200214 }
215 return result;
216 }
217 case Instruction::RETURN_WIDE: {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200218 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200219 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700220 self->AllowThreadSuspension();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200221 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200222 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200223 shadow_frame.GetMethod(), inst->GetDexPc(insns),
224 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200225 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
226 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
227 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200228 }
229 return result;
230 }
231 case Instruction::RETURN_OBJECT: {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200232 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700233 self->AllowThreadSuspension();
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700234 const size_t ref_idx = inst->VRegA_11x(inst_data);
235 Object* obj_result = shadow_frame.GetVRegReference(ref_idx);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700236 if (do_assignability_check && obj_result != NULL) {
Ian Rogersded66a02014-10-28 18:12:55 -0700237 Class* return_type = shadow_frame.GetMethod()->GetReturnType();
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700238 // Re-load since it might have moved.
239 obj_result = shadow_frame.GetVRegReference(ref_idx);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700240 if (return_type == NULL) {
241 // Return the pending exception.
242 HANDLE_PENDING_EXCEPTION();
243 }
244 if (!obj_result->VerifierInstanceOf(return_type)) {
245 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700246 std::string temp1, temp2;
Jeff Haoa3faaf42013-09-03 19:07:00 -0700247 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
248 "Ljava/lang/VirtualMachineError;",
249 "Returning '%s' that is not instance of return type '%s'",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700250 obj_result->GetClass()->GetDescriptor(&temp1),
251 return_type->GetDescriptor(&temp2));
Jeff Haoa3faaf42013-09-03 19:07:00 -0700252 HANDLE_PENDING_EXCEPTION();
253 }
254 }
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700255 result.SetL(obj_result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200256 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200257 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200258 shadow_frame.GetMethod(), inst->GetDexPc(insns),
259 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200260 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
261 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
262 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200263 }
264 return result;
265 }
266 case Instruction::CONST_4: {
267 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200268 uint4_t dst = inst->VRegA_11n(inst_data);
269 int4_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200270 shadow_frame.SetVReg(dst, val);
271 if (val == 0) {
272 shadow_frame.SetVRegReference(dst, NULL);
273 }
274 inst = inst->Next_1xx();
275 break;
276 }
277 case Instruction::CONST_16: {
278 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200279 uint8_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200280 int16_t val = inst->VRegB_21s();
281 shadow_frame.SetVReg(dst, val);
282 if (val == 0) {
283 shadow_frame.SetVRegReference(dst, NULL);
284 }
285 inst = inst->Next_2xx();
286 break;
287 }
288 case Instruction::CONST: {
289 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200290 uint8_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200291 int32_t val = inst->VRegB_31i();
292 shadow_frame.SetVReg(dst, val);
293 if (val == 0) {
294 shadow_frame.SetVRegReference(dst, NULL);
295 }
296 inst = inst->Next_3xx();
297 break;
298 }
299 case Instruction::CONST_HIGH16: {
300 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200301 uint8_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200302 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
303 shadow_frame.SetVReg(dst, val);
304 if (val == 0) {
305 shadow_frame.SetVRegReference(dst, NULL);
306 }
307 inst = inst->Next_2xx();
308 break;
309 }
310 case Instruction::CONST_WIDE_16:
311 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200312 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200313 inst = inst->Next_2xx();
314 break;
315 case Instruction::CONST_WIDE_32:
316 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200317 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200318 inst = inst->Next_3xx();
319 break;
320 case Instruction::CONST_WIDE:
321 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200322 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200323 inst = inst->Next_51l();
324 break;
325 case Instruction::CONST_WIDE_HIGH16:
Sebastien Hertz3c5aec12014-06-04 09:41:21 +0200326 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200327 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200328 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
329 inst = inst->Next_2xx();
330 break;
331 case Instruction::CONST_STRING: {
332 PREAMBLE();
Ian Rogers6786a582014-10-28 12:49:06 -0700333 String* s = ResolveString(self, shadow_frame, inst->VRegB_21c());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200334 if (UNLIKELY(s == NULL)) {
335 HANDLE_PENDING_EXCEPTION();
336 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200337 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200338 inst = inst->Next_2xx();
339 }
340 break;
341 }
342 case Instruction::CONST_STRING_JUMBO: {
343 PREAMBLE();
Ian Rogers6786a582014-10-28 12:49:06 -0700344 String* s = ResolveString(self, shadow_frame, inst->VRegB_31c());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200345 if (UNLIKELY(s == NULL)) {
346 HANDLE_PENDING_EXCEPTION();
347 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200348 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200349 inst = inst->Next_3xx();
350 }
351 break;
352 }
353 case Instruction::CONST_CLASS: {
354 PREAMBLE();
355 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
356 self, false, do_access_check);
357 if (UNLIKELY(c == NULL)) {
358 HANDLE_PENDING_EXCEPTION();
359 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200360 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200361 inst = inst->Next_2xx();
362 }
363 break;
364 }
365 case Instruction::MONITOR_ENTER: {
366 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200367 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200368 if (UNLIKELY(obj == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200369 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200370 HANDLE_PENDING_EXCEPTION();
371 } else {
372 DoMonitorEnter(self, obj);
373 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
374 }
375 break;
376 }
377 case Instruction::MONITOR_EXIT: {
378 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200379 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200380 if (UNLIKELY(obj == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200381 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200382 HANDLE_PENDING_EXCEPTION();
383 } else {
384 DoMonitorExit(self, obj);
385 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
386 }
387 break;
388 }
389 case Instruction::CHECK_CAST: {
390 PREAMBLE();
391 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
392 self, false, do_access_check);
393 if (UNLIKELY(c == NULL)) {
394 HANDLE_PENDING_EXCEPTION();
395 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200396 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200397 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
398 ThrowClassCastException(c, obj->GetClass());
399 HANDLE_PENDING_EXCEPTION();
400 } else {
401 inst = inst->Next_2xx();
402 }
403 }
404 break;
405 }
406 case Instruction::INSTANCE_OF: {
407 PREAMBLE();
408 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
409 self, false, do_access_check);
410 if (UNLIKELY(c == NULL)) {
411 HANDLE_PENDING_EXCEPTION();
412 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200413 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
414 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200415 inst = inst->Next_2xx();
416 }
417 break;
418 }
419 case Instruction::ARRAY_LENGTH: {
420 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200421 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200422 if (UNLIKELY(array == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200423 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200424 HANDLE_PENDING_EXCEPTION();
425 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200426 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200427 inst = inst->Next_1xx();
428 }
429 break;
430 }
431 case Instruction::NEW_INSTANCE: {
432 PREAMBLE();
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700433 Runtime* runtime = Runtime::Current();
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800434 Object* obj = AllocObjectFromCode<do_access_check, true>(
435 inst->VRegB_21c(), shadow_frame.GetMethod(), self,
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700436 runtime->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200437 if (UNLIKELY(obj == NULL)) {
438 HANDLE_PENDING_EXCEPTION();
439 } else {
Sebastien Hertz4e99b3d2014-06-24 14:35:40 +0200440 obj->GetClass()->AssertInitializedOrInitializingInThread(self);
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700441 // Don't allow finalizable objects to be allocated during a transaction since these can't
442 // be finalized without a started runtime.
443 if (transaction_active && obj->GetClass()->IsFinalizable()) {
Ian Rogers2fa98e22014-05-06 15:26:39 -0700444 AbortTransaction(self, "Allocating finalizable object in transaction: %s",
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700445 PrettyTypeOf(obj).c_str());
446 HANDLE_PENDING_EXCEPTION();
447 break;
448 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200449 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200450 inst = inst->Next_2xx();
451 }
452 break;
453 }
454 case Instruction::NEW_ARRAY: {
455 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200456 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800457 Object* obj = AllocArrayFromCode<do_access_check, true>(
Andreas Gampe1cc7dba2014-12-17 18:43:01 -0800458 inst->VRegC_22c(), length, shadow_frame.GetMethod(), self,
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800459 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200460 if (UNLIKELY(obj == NULL)) {
461 HANDLE_PENDING_EXCEPTION();
462 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200463 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200464 inst = inst->Next_2xx();
465 }
466 break;
467 }
468 case Instruction::FILLED_NEW_ARRAY: {
469 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100470 bool success =
471 DoFilledNewArray<false, do_access_check, transaction_active>(inst, shadow_frame, self,
472 &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200473 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
474 break;
475 }
476 case Instruction::FILLED_NEW_ARRAY_RANGE: {
477 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100478 bool success =
479 DoFilledNewArray<true, do_access_check, transaction_active>(inst, shadow_frame,
480 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200481 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
482 break;
483 }
484 case Instruction::FILL_ARRAY_DATA: {
485 PREAMBLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200486 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
487 const Instruction::ArrayDataPayload* payload =
488 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
Ian Rogers832336b2014-10-08 15:35:22 -0700489 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
490 bool success = FillArrayData(obj, payload);
491 if (!success) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200492 HANDLE_PENDING_EXCEPTION();
493 break;
494 }
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100495 if (transaction_active) {
Ian Rogers832336b2014-10-08 15:35:22 -0700496 RecordArrayElementsInTransaction(obj->AsArray(), payload->element_count);
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100497 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200498 inst = inst->Next_3xx();
499 break;
500 }
501 case Instruction::THROW: {
502 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200503 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200504 if (UNLIKELY(exception == NULL)) {
505 ThrowNullPointerException(NULL, "throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700506 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
507 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700508 std::string temp;
Jeff Haoa3faaf42013-09-03 19:07:00 -0700509 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
510 "Ljava/lang/VirtualMachineError;",
511 "Throwing '%s' that is not instance of Throwable",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700512 exception->GetClass()->GetDescriptor(&temp));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200513 } else {
514 self->SetException(shadow_frame.GetCurrentLocationForThrow(), exception->AsThrowable());
515 }
516 HANDLE_PENDING_EXCEPTION();
517 break;
518 }
519 case Instruction::GOTO: {
520 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200521 int8_t offset = inst->VRegA_10t(inst_data);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200522 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700523 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200524 }
525 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200526 break;
527 }
528 case Instruction::GOTO_16: {
529 PREAMBLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200530 int16_t offset = inst->VRegA_20t();
531 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700532 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200533 }
534 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200535 break;
536 }
537 case Instruction::GOTO_32: {
538 PREAMBLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200539 int32_t offset = inst->VRegA_30t();
540 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700541 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200542 }
543 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200544 break;
545 }
546 case Instruction::PACKED_SWITCH: {
547 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200548 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200549 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700550 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200551 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200552 inst = inst->RelativeAt(offset);
553 break;
554 }
555 case Instruction::SPARSE_SWITCH: {
556 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200557 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200558 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700559 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200560 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200561 inst = inst->RelativeAt(offset);
562 break;
563 }
Ian Rogers647b1a82014-10-10 11:02:11 -0700564
565#if defined(__clang__)
566#pragma clang diagnostic push
567#pragma clang diagnostic ignored "-Wfloat-equal"
568#endif
569
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200570 case Instruction::CMPL_FLOAT: {
571 PREAMBLE();
572 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
573 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
574 int32_t result;
575 if (val1 > val2) {
576 result = 1;
577 } else if (val1 == val2) {
578 result = 0;
579 } else {
580 result = -1;
581 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200582 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200583 inst = inst->Next_2xx();
584 break;
585 }
586 case Instruction::CMPG_FLOAT: {
587 PREAMBLE();
588 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
589 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
590 int32_t result;
591 if (val1 < val2) {
592 result = -1;
593 } else if (val1 == val2) {
594 result = 0;
595 } else {
596 result = 1;
597 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200598 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200599 inst = inst->Next_2xx();
600 break;
601 }
602 case Instruction::CMPL_DOUBLE: {
603 PREAMBLE();
604 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
605 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
606 int32_t result;
607 if (val1 > val2) {
608 result = 1;
609 } else if (val1 == val2) {
610 result = 0;
611 } else {
612 result = -1;
613 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200614 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200615 inst = inst->Next_2xx();
616 break;
617 }
618
619 case Instruction::CMPG_DOUBLE: {
620 PREAMBLE();
621 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
622 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
623 int32_t result;
624 if (val1 < val2) {
625 result = -1;
626 } else if (val1 == val2) {
627 result = 0;
628 } else {
629 result = 1;
630 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200631 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200632 inst = inst->Next_2xx();
633 break;
634 }
Ian Rogers647b1a82014-10-10 11:02:11 -0700635
636#if defined(__clang__)
637#pragma clang diagnostic pop
638#endif
639
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200640 case Instruction::CMP_LONG: {
641 PREAMBLE();
642 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
643 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
644 int32_t result;
645 if (val1 > val2) {
646 result = 1;
647 } else if (val1 == val2) {
648 result = 0;
649 } else {
650 result = -1;
651 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200652 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200653 inst = inst->Next_2xx();
654 break;
655 }
656 case Instruction::IF_EQ: {
657 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200658 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200659 int16_t offset = inst->VRegC_22t();
660 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700661 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200662 }
663 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200664 } else {
665 inst = inst->Next_2xx();
666 }
667 break;
668 }
669 case Instruction::IF_NE: {
670 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200671 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) != shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200672 int16_t offset = inst->VRegC_22t();
673 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700674 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200675 }
676 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200677 } else {
678 inst = inst->Next_2xx();
679 }
680 break;
681 }
682 case Instruction::IF_LT: {
683 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200684 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) < shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200685 int16_t offset = inst->VRegC_22t();
686 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700687 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200688 }
689 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200690 } else {
691 inst = inst->Next_2xx();
692 }
693 break;
694 }
695 case Instruction::IF_GE: {
696 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200697 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200698 int16_t offset = inst->VRegC_22t();
699 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700700 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200701 }
702 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200703 } else {
704 inst = inst->Next_2xx();
705 }
706 break;
707 }
708 case Instruction::IF_GT: {
709 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200710 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200711 int16_t offset = inst->VRegC_22t();
712 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700713 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200714 }
715 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200716 } else {
717 inst = inst->Next_2xx();
718 }
719 break;
720 }
721 case Instruction::IF_LE: {
722 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200723 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200724 int16_t offset = inst->VRegC_22t();
725 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700726 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200727 }
728 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200729 } else {
730 inst = inst->Next_2xx();
731 }
732 break;
733 }
734 case Instruction::IF_EQZ: {
735 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200736 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200737 int16_t offset = inst->VRegB_21t();
738 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700739 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200740 }
741 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200742 } else {
743 inst = inst->Next_2xx();
744 }
745 break;
746 }
747 case Instruction::IF_NEZ: {
748 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200749 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200750 int16_t offset = inst->VRegB_21t();
751 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700752 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200753 }
754 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200755 } else {
756 inst = inst->Next_2xx();
757 }
758 break;
759 }
760 case Instruction::IF_LTZ: {
761 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200762 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200763 int16_t offset = inst->VRegB_21t();
764 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700765 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200766 }
767 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200768 } else {
769 inst = inst->Next_2xx();
770 }
771 break;
772 }
773 case Instruction::IF_GEZ: {
774 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200775 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200776 int16_t offset = inst->VRegB_21t();
777 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700778 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200779 }
780 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200781 } else {
782 inst = inst->Next_2xx();
783 }
784 break;
785 }
786 case Instruction::IF_GTZ: {
787 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200788 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200789 int16_t offset = inst->VRegB_21t();
790 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700791 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200792 }
793 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200794 } else {
795 inst = inst->Next_2xx();
796 }
797 break;
798 }
799 case Instruction::IF_LEZ: {
800 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200801 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200802 int16_t offset = inst->VRegB_21t();
803 if (IsBackwardBranch(offset)) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700804 self->AllowThreadSuspension();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200805 }
806 inst = inst->RelativeAt(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200807 } else {
808 inst = inst->Next_2xx();
809 }
810 break;
811 }
812 case Instruction::AGET_BOOLEAN: {
813 PREAMBLE();
814 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
815 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200816 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200817 HANDLE_PENDING_EXCEPTION();
818 break;
819 }
820 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
821 BooleanArray* array = a->AsBooleanArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700822 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100823 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200824 inst = inst->Next_2xx();
825 } else {
826 HANDLE_PENDING_EXCEPTION();
827 }
828 break;
829 }
830 case Instruction::AGET_BYTE: {
831 PREAMBLE();
832 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
833 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200834 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200835 HANDLE_PENDING_EXCEPTION();
836 break;
837 }
838 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
839 ByteArray* array = a->AsByteArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700840 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100841 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200842 inst = inst->Next_2xx();
843 } else {
844 HANDLE_PENDING_EXCEPTION();
845 }
846 break;
847 }
848 case Instruction::AGET_CHAR: {
849 PREAMBLE();
850 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
851 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200852 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200853 HANDLE_PENDING_EXCEPTION();
854 break;
855 }
856 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
857 CharArray* array = a->AsCharArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700858 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100859 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200860 inst = inst->Next_2xx();
861 } else {
862 HANDLE_PENDING_EXCEPTION();
863 }
864 break;
865 }
866 case Instruction::AGET_SHORT: {
867 PREAMBLE();
868 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
869 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200870 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200871 HANDLE_PENDING_EXCEPTION();
872 break;
873 }
874 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
875 ShortArray* array = a->AsShortArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700876 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100877 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200878 inst = inst->Next_2xx();
879 } else {
880 HANDLE_PENDING_EXCEPTION();
881 }
882 break;
883 }
884 case Instruction::AGET: {
885 PREAMBLE();
886 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
887 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200888 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200889 HANDLE_PENDING_EXCEPTION();
890 break;
891 }
892 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
893 IntArray* array = a->AsIntArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700894 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100895 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200896 inst = inst->Next_2xx();
897 } else {
898 HANDLE_PENDING_EXCEPTION();
899 }
900 break;
901 }
902 case Instruction::AGET_WIDE: {
903 PREAMBLE();
904 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
905 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200906 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200907 HANDLE_PENDING_EXCEPTION();
908 break;
909 }
910 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
911 LongArray* array = a->AsLongArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700912 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzabff6432014-01-27 18:01:39 +0100913 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200914 inst = inst->Next_2xx();
915 } else {
916 HANDLE_PENDING_EXCEPTION();
917 }
918 break;
919 }
920 case Instruction::AGET_OBJECT: {
921 PREAMBLE();
922 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
923 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200924 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200925 HANDLE_PENDING_EXCEPTION();
926 break;
927 }
928 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
929 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700930 if (array->CheckIsValidIndex(index)) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200931 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200932 inst = inst->Next_2xx();
933 } else {
934 HANDLE_PENDING_EXCEPTION();
935 }
936 break;
937 }
938 case Instruction::APUT_BOOLEAN: {
939 PREAMBLE();
940 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
941 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200942 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200943 HANDLE_PENDING_EXCEPTION();
944 break;
945 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200946 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200947 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
948 BooleanArray* array = a->AsBooleanArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700949 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100950 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200951 inst = inst->Next_2xx();
952 } else {
953 HANDLE_PENDING_EXCEPTION();
954 }
955 break;
956 }
957 case Instruction::APUT_BYTE: {
958 PREAMBLE();
959 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
960 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200961 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200962 HANDLE_PENDING_EXCEPTION();
963 break;
964 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200965 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200966 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
967 ByteArray* array = a->AsByteArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700968 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100969 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200970 inst = inst->Next_2xx();
971 } else {
972 HANDLE_PENDING_EXCEPTION();
973 }
974 break;
975 }
976 case Instruction::APUT_CHAR: {
977 PREAMBLE();
978 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
979 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200980 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200981 HANDLE_PENDING_EXCEPTION();
982 break;
983 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200984 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200985 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
986 CharArray* array = a->AsCharArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700987 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100988 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200989 inst = inst->Next_2xx();
990 } else {
991 HANDLE_PENDING_EXCEPTION();
992 }
993 break;
994 }
995 case Instruction::APUT_SHORT: {
996 PREAMBLE();
997 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
998 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200999 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001000 HANDLE_PENDING_EXCEPTION();
1001 break;
1002 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001003 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001004 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1005 ShortArray* array = a->AsShortArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001006 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001007 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001008 inst = inst->Next_2xx();
1009 } else {
1010 HANDLE_PENDING_EXCEPTION();
1011 }
1012 break;
1013 }
1014 case Instruction::APUT: {
1015 PREAMBLE();
1016 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1017 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001018 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001019 HANDLE_PENDING_EXCEPTION();
1020 break;
1021 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001022 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001023 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1024 IntArray* array = a->AsIntArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001025 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001026 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001027 inst = inst->Next_2xx();
1028 } else {
1029 HANDLE_PENDING_EXCEPTION();
1030 }
1031 break;
1032 }
1033 case Instruction::APUT_WIDE: {
1034 PREAMBLE();
1035 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1036 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001037 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001038 HANDLE_PENDING_EXCEPTION();
1039 break;
1040 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001041 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001042 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1043 LongArray* array = a->AsLongArray();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001044 if (array->CheckIsValidIndex(index)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001045 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001046 inst = inst->Next_2xx();
1047 } else {
1048 HANDLE_PENDING_EXCEPTION();
1049 }
1050 break;
1051 }
1052 case Instruction::APUT_OBJECT: {
1053 PREAMBLE();
1054 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1055 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001056 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001057 HANDLE_PENDING_EXCEPTION();
1058 break;
1059 }
1060 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001061 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001062 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Ian Rogersb0fa5dc2014-04-28 16:47:08 -07001063 if (array->CheckIsValidIndex(index) && array->CheckAssignable(val)) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001064 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001065 inst = inst->Next_2xx();
1066 } else {
1067 HANDLE_PENDING_EXCEPTION();
1068 }
1069 break;
1070 }
1071 case Instruction::IGET_BOOLEAN: {
1072 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001073 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001074 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1075 break;
1076 }
1077 case Instruction::IGET_BYTE: {
1078 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001079 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001080 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1081 break;
1082 }
1083 case Instruction::IGET_CHAR: {
1084 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001085 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001086 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1087 break;
1088 }
1089 case Instruction::IGET_SHORT: {
1090 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001091 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001092 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1093 break;
1094 }
1095 case Instruction::IGET: {
1096 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001097 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001098 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1099 break;
1100 }
1101 case Instruction::IGET_WIDE: {
1102 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001103 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001104 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1105 break;
1106 }
1107 case Instruction::IGET_OBJECT: {
1108 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001109 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001110 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1111 break;
1112 }
1113 case Instruction::IGET_QUICK: {
1114 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001115 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001116 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1117 break;
1118 }
1119 case Instruction::IGET_WIDE_QUICK: {
1120 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001121 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001122 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1123 break;
1124 }
1125 case Instruction::IGET_OBJECT_QUICK: {
1126 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001127 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001128 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1129 break;
1130 }
Mathieu Chartierffc605c2014-12-10 10:35:44 -08001131 case Instruction::IGET_BOOLEAN_QUICK: {
1132 PREAMBLE();
1133 bool success = DoIGetQuick<Primitive::kPrimBoolean>(shadow_frame, inst, inst_data);
1134 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1135 break;
1136 }
1137 case Instruction::IGET_BYTE_QUICK: {
1138 PREAMBLE();
1139 bool success = DoIGetQuick<Primitive::kPrimByte>(shadow_frame, inst, inst_data);
1140 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1141 break;
1142 }
1143 case Instruction::IGET_CHAR_QUICK: {
1144 PREAMBLE();
1145 bool success = DoIGetQuick<Primitive::kPrimChar>(shadow_frame, inst, inst_data);
1146 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1147 break;
1148 }
1149 case Instruction::IGET_SHORT_QUICK: {
1150 PREAMBLE();
1151 bool success = DoIGetQuick<Primitive::kPrimShort>(shadow_frame, inst, inst_data);
1152 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1153 break;
1154 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001155 case Instruction::SGET_BOOLEAN: {
1156 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001157 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001158 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1159 break;
1160 }
1161 case Instruction::SGET_BYTE: {
1162 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001163 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001164 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1165 break;
1166 }
1167 case Instruction::SGET_CHAR: {
1168 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001169 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001170 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1171 break;
1172 }
1173 case Instruction::SGET_SHORT: {
1174 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001175 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001176 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1177 break;
1178 }
1179 case Instruction::SGET: {
1180 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001181 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001182 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1183 break;
1184 }
1185 case Instruction::SGET_WIDE: {
1186 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001187 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001188 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1189 break;
1190 }
1191 case Instruction::SGET_OBJECT: {
1192 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001193 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(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::IPUT_BOOLEAN: {
1198 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001199 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001200 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1201 break;
1202 }
1203 case Instruction::IPUT_BYTE: {
1204 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001205 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001206 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1207 break;
1208 }
1209 case Instruction::IPUT_CHAR: {
1210 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001211 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001212 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1213 break;
1214 }
1215 case Instruction::IPUT_SHORT: {
1216 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001217 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001218 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1219 break;
1220 }
1221 case Instruction::IPUT: {
1222 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001223 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001224 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1225 break;
1226 }
1227 case Instruction::IPUT_WIDE: {
1228 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001229 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001230 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1231 break;
1232 }
1233 case Instruction::IPUT_OBJECT: {
1234 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001235 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001236 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1237 break;
1238 }
1239 case Instruction::IPUT_QUICK: {
1240 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001241 bool success = DoIPutQuick<Primitive::kPrimInt, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001242 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1243 break;
1244 }
Fred Shih37f05ef2014-07-16 18:38:08 -07001245 case Instruction::IPUT_BOOLEAN_QUICK: {
1246 PREAMBLE();
1247 bool success = DoIPutQuick<Primitive::kPrimBoolean, transaction_active>(shadow_frame, inst, inst_data);
1248 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1249 break;
1250 }
1251 case Instruction::IPUT_BYTE_QUICK: {
1252 PREAMBLE();
1253 bool success = DoIPutQuick<Primitive::kPrimByte, transaction_active>(shadow_frame, inst, inst_data);
1254 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1255 break;
1256 }
1257 case Instruction::IPUT_CHAR_QUICK: {
1258 PREAMBLE();
1259 bool success = DoIPutQuick<Primitive::kPrimChar, transaction_active>(shadow_frame, inst, inst_data);
1260 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1261 break;
1262 }
1263 case Instruction::IPUT_SHORT_QUICK: {
1264 PREAMBLE();
1265 bool success = DoIPutQuick<Primitive::kPrimShort, transaction_active>(shadow_frame, inst, inst_data);
1266 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1267 break;
1268 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001269 case Instruction::IPUT_WIDE_QUICK: {
1270 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001271 bool success = DoIPutQuick<Primitive::kPrimLong, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001272 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1273 break;
1274 }
1275 case Instruction::IPUT_OBJECT_QUICK: {
1276 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001277 bool success = DoIPutQuick<Primitive::kPrimNot, transaction_active>(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::SPUT_BOOLEAN: {
1282 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001283 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001284 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1285 break;
1286 }
1287 case Instruction::SPUT_BYTE: {
1288 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001289 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001290 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1291 break;
1292 }
1293 case Instruction::SPUT_CHAR: {
1294 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001295 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001296 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1297 break;
1298 }
1299 case Instruction::SPUT_SHORT: {
1300 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001301 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001302 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1303 break;
1304 }
1305 case Instruction::SPUT: {
1306 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001307 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001308 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1309 break;
1310 }
1311 case Instruction::SPUT_WIDE: {
1312 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001313 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001314 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1315 break;
1316 }
1317 case Instruction::SPUT_OBJECT: {
1318 PREAMBLE();
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001319 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check, 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::INVOKE_VIRTUAL: {
1324 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001325 bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001326 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1327 break;
1328 }
1329 case Instruction::INVOKE_VIRTUAL_RANGE: {
1330 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001331 bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001332 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1333 break;
1334 }
1335 case Instruction::INVOKE_SUPER: {
1336 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001337 bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001338 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1339 break;
1340 }
1341 case Instruction::INVOKE_SUPER_RANGE: {
1342 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001343 bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001344 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1345 break;
1346 }
1347 case Instruction::INVOKE_DIRECT: {
1348 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001349 bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001350 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1351 break;
1352 }
1353 case Instruction::INVOKE_DIRECT_RANGE: {
1354 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001355 bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001356 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1357 break;
1358 }
1359 case Instruction::INVOKE_INTERFACE: {
1360 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001361 bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001362 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1363 break;
1364 }
1365 case Instruction::INVOKE_INTERFACE_RANGE: {
1366 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001367 bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001368 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1369 break;
1370 }
1371 case Instruction::INVOKE_STATIC: {
1372 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001373 bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001374 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1375 break;
1376 }
1377 case Instruction::INVOKE_STATIC_RANGE: {
1378 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001379 bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001380 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1381 break;
1382 }
1383 case Instruction::INVOKE_VIRTUAL_QUICK: {
1384 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001385 bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001386 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1387 break;
1388 }
1389 case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: {
1390 PREAMBLE();
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001391 bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001392 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx);
1393 break;
1394 }
1395 case Instruction::NEG_INT:
1396 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001397 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001398 inst = inst->Next_1xx();
1399 break;
1400 case Instruction::NOT_INT:
1401 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001402 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001403 inst = inst->Next_1xx();
1404 break;
1405 case Instruction::NEG_LONG:
1406 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001407 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001408 inst = inst->Next_1xx();
1409 break;
1410 case Instruction::NOT_LONG:
1411 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001412 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001413 inst = inst->Next_1xx();
1414 break;
1415 case Instruction::NEG_FLOAT:
1416 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001417 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001418 inst = inst->Next_1xx();
1419 break;
1420 case Instruction::NEG_DOUBLE:
1421 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001422 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001423 inst = inst->Next_1xx();
1424 break;
1425 case Instruction::INT_TO_LONG:
1426 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001427 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
1428 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001429 inst = inst->Next_1xx();
1430 break;
1431 case Instruction::INT_TO_FLOAT:
1432 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001433 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1434 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001435 inst = inst->Next_1xx();
1436 break;
1437 case Instruction::INT_TO_DOUBLE:
1438 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001439 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1440 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001441 inst = inst->Next_1xx();
1442 break;
1443 case Instruction::LONG_TO_INT:
1444 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001445 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1446 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001447 inst = inst->Next_1xx();
1448 break;
1449 case Instruction::LONG_TO_FLOAT:
1450 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001451 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1452 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001453 inst = inst->Next_1xx();
1454 break;
1455 case Instruction::LONG_TO_DOUBLE:
1456 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001457 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1458 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001459 inst = inst->Next_1xx();
1460 break;
1461 case Instruction::FLOAT_TO_INT: {
1462 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001463 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001464 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001465 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001466 inst = inst->Next_1xx();
1467 break;
1468 }
1469 case Instruction::FLOAT_TO_LONG: {
1470 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001471 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001472 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001473 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001474 inst = inst->Next_1xx();
1475 break;
1476 }
1477 case Instruction::FLOAT_TO_DOUBLE:
1478 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001479 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data),
1480 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001481 inst = inst->Next_1xx();
1482 break;
1483 case Instruction::DOUBLE_TO_INT: {
1484 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001485 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001486 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001487 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001488 inst = inst->Next_1xx();
1489 break;
1490 }
1491 case Instruction::DOUBLE_TO_LONG: {
1492 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001493 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001494 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001495 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001496 inst = inst->Next_1xx();
1497 break;
1498 }
1499 case Instruction::DOUBLE_TO_FLOAT:
1500 PREAMBLE();
Ian Rogers450dcb52013-09-20 17:36:02 -07001501 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data),
1502 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001503 inst = inst->Next_1xx();
1504 break;
1505 case Instruction::INT_TO_BYTE:
1506 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001507 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1508 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001509 inst = inst->Next_1xx();
1510 break;
1511 case Instruction::INT_TO_CHAR:
1512 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001513 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1514 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001515 inst = inst->Next_1xx();
1516 break;
1517 case Instruction::INT_TO_SHORT:
1518 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001519 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1520 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001521 inst = inst->Next_1xx();
1522 break;
Ian Rogersf72a11d2014-10-30 15:41:08 -07001523 case Instruction::ADD_INT: {
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001524 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001525 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001526 SafeAdd(shadow_frame.GetVReg(inst->VRegB_23x()),
1527 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001528 inst = inst->Next_2xx();
1529 break;
Ian Rogersf72a11d2014-10-30 15:41:08 -07001530 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001531 case Instruction::SUB_INT:
1532 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001533 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001534 SafeSub(shadow_frame.GetVReg(inst->VRegB_23x()),
1535 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001536 inst = inst->Next_2xx();
1537 break;
1538 case Instruction::MUL_INT:
1539 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001540 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001541 SafeMul(shadow_frame.GetVReg(inst->VRegB_23x()),
1542 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001543 inst = inst->Next_2xx();
1544 break;
1545 case Instruction::DIV_INT: {
1546 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001547 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001548 shadow_frame.GetVReg(inst->VRegB_23x()),
1549 shadow_frame.GetVReg(inst->VRegC_23x()));
1550 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1551 break;
1552 }
1553 case Instruction::REM_INT: {
1554 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001555 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001556 shadow_frame.GetVReg(inst->VRegB_23x()),
1557 shadow_frame.GetVReg(inst->VRegC_23x()));
1558 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
1559 break;
1560 }
1561 case Instruction::SHL_INT:
1562 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001563 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001564 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1565 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1566 inst = inst->Next_2xx();
1567 break;
1568 case Instruction::SHR_INT:
1569 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001570 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001571 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1572 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1573 inst = inst->Next_2xx();
1574 break;
1575 case Instruction::USHR_INT:
1576 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001577 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001578 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1579 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1580 inst = inst->Next_2xx();
1581 break;
1582 case Instruction::AND_INT:
1583 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001584 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001585 shadow_frame.GetVReg(inst->VRegB_23x()) &
1586 shadow_frame.GetVReg(inst->VRegC_23x()));
1587 inst = inst->Next_2xx();
1588 break;
1589 case Instruction::OR_INT:
1590 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001591 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001592 shadow_frame.GetVReg(inst->VRegB_23x()) |
1593 shadow_frame.GetVReg(inst->VRegC_23x()));
1594 inst = inst->Next_2xx();
1595 break;
1596 case Instruction::XOR_INT:
1597 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001598 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001599 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1600 shadow_frame.GetVReg(inst->VRegC_23x()));
1601 inst = inst->Next_2xx();
1602 break;
1603 case Instruction::ADD_LONG:
1604 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001605 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001606 SafeAdd(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1607 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001608 inst = inst->Next_2xx();
1609 break;
1610 case Instruction::SUB_LONG:
1611 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001612 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001613 SafeSub(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1614 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001615 inst = inst->Next_2xx();
1616 break;
1617 case Instruction::MUL_LONG:
1618 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001619 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001620 SafeMul(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1621 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001622 inst = inst->Next_2xx();
1623 break;
1624 case Instruction::DIV_LONG:
1625 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001626 DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001627 shadow_frame.GetVRegLong(inst->VRegB_23x()),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001628 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001629 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_2xx);
1630 break;
1631 case Instruction::REM_LONG:
1632 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001633 DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001634 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1635 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1636 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_2xx);
1637 break;
1638 case Instruction::AND_LONG:
1639 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001640 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001641 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1642 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1643 inst = inst->Next_2xx();
1644 break;
1645 case Instruction::OR_LONG:
1646 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001647 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001648 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1649 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1650 inst = inst->Next_2xx();
1651 break;
1652 case Instruction::XOR_LONG:
1653 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001654 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001655 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1656 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1657 inst = inst->Next_2xx();
1658 break;
1659 case Instruction::SHL_LONG:
1660 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001661 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001662 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1663 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1664 inst = inst->Next_2xx();
1665 break;
1666 case Instruction::SHR_LONG:
1667 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001668 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001669 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1670 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1671 inst = inst->Next_2xx();
1672 break;
1673 case Instruction::USHR_LONG:
1674 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001675 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001676 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1677 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1678 inst = inst->Next_2xx();
1679 break;
1680 case Instruction::ADD_FLOAT:
1681 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001682 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001683 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1684 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1685 inst = inst->Next_2xx();
1686 break;
1687 case Instruction::SUB_FLOAT:
1688 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001689 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001690 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1691 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1692 inst = inst->Next_2xx();
1693 break;
1694 case Instruction::MUL_FLOAT:
1695 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001696 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001697 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1698 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1699 inst = inst->Next_2xx();
1700 break;
1701 case Instruction::DIV_FLOAT:
1702 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001703 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001704 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1705 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1706 inst = inst->Next_2xx();
1707 break;
1708 case Instruction::REM_FLOAT:
1709 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001710 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001711 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1712 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1713 inst = inst->Next_2xx();
1714 break;
1715 case Instruction::ADD_DOUBLE:
1716 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001717 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001718 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1719 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1720 inst = inst->Next_2xx();
1721 break;
1722 case Instruction::SUB_DOUBLE:
1723 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001724 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001725 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1726 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1727 inst = inst->Next_2xx();
1728 break;
1729 case Instruction::MUL_DOUBLE:
1730 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001731 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001732 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1733 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1734 inst = inst->Next_2xx();
1735 break;
1736 case Instruction::DIV_DOUBLE:
1737 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001738 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001739 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1740 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1741 inst = inst->Next_2xx();
1742 break;
1743 case Instruction::REM_DOUBLE:
1744 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001745 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001746 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1747 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1748 inst = inst->Next_2xx();
1749 break;
1750 case Instruction::ADD_INT_2ADDR: {
1751 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001752 uint4_t vregA = inst->VRegA_12x(inst_data);
Ian Rogersf72a11d2014-10-30 15:41:08 -07001753 shadow_frame.SetVReg(vregA, SafeAdd(shadow_frame.GetVReg(vregA),
1754 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001755 inst = inst->Next_1xx();
1756 break;
1757 }
1758 case Instruction::SUB_INT_2ADDR: {
1759 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001760 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001761 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001762 SafeSub(shadow_frame.GetVReg(vregA),
1763 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001764 inst = inst->Next_1xx();
1765 break;
1766 }
1767 case Instruction::MUL_INT_2ADDR: {
1768 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001769 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001770 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001771 SafeMul(shadow_frame.GetVReg(vregA),
1772 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001773 inst = inst->Next_1xx();
1774 break;
1775 }
1776 case Instruction::DIV_INT_2ADDR: {
1777 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001778 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001779 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001780 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001781 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx);
1782 break;
1783 }
1784 case Instruction::REM_INT_2ADDR: {
1785 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001786 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001787 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001788 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001789 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx);
1790 break;
1791 }
1792 case Instruction::SHL_INT_2ADDR: {
1793 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001794 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001795 shadow_frame.SetVReg(vregA,
1796 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001797 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001798 inst = inst->Next_1xx();
1799 break;
1800 }
1801 case Instruction::SHR_INT_2ADDR: {
1802 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001803 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001804 shadow_frame.SetVReg(vregA,
1805 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001806 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001807 inst = inst->Next_1xx();
1808 break;
1809 }
1810 case Instruction::USHR_INT_2ADDR: {
1811 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001812 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001813 shadow_frame.SetVReg(vregA,
1814 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001815 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001816 inst = inst->Next_1xx();
1817 break;
1818 }
1819 case Instruction::AND_INT_2ADDR: {
1820 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001821 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001822 shadow_frame.SetVReg(vregA,
1823 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001824 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001825 inst = inst->Next_1xx();
1826 break;
1827 }
1828 case Instruction::OR_INT_2ADDR: {
1829 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001830 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001831 shadow_frame.SetVReg(vregA,
1832 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001833 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001834 inst = inst->Next_1xx();
1835 break;
1836 }
1837 case Instruction::XOR_INT_2ADDR: {
1838 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001839 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001840 shadow_frame.SetVReg(vregA,
1841 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001842 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001843 inst = inst->Next_1xx();
1844 break;
1845 }
1846 case Instruction::ADD_LONG_2ADDR: {
1847 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001848 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001849 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001850 SafeAdd(shadow_frame.GetVRegLong(vregA),
1851 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001852 inst = inst->Next_1xx();
1853 break;
1854 }
1855 case Instruction::SUB_LONG_2ADDR: {
1856 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001857 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001858 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001859 SafeSub(shadow_frame.GetVRegLong(vregA),
1860 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001861 inst = inst->Next_1xx();
1862 break;
1863 }
1864 case Instruction::MUL_LONG_2ADDR: {
1865 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001866 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001867 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001868 SafeMul(shadow_frame.GetVRegLong(vregA),
1869 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001870 inst = inst->Next_1xx();
1871 break;
1872 }
1873 case Instruction::DIV_LONG_2ADDR: {
1874 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001875 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001876 DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001877 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001878 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
1879 break;
1880 }
1881 case Instruction::REM_LONG_2ADDR: {
1882 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001883 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001884 DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001885 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001886 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx);
1887 break;
1888 }
1889 case Instruction::AND_LONG_2ADDR: {
1890 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001891 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001892 shadow_frame.SetVRegLong(vregA,
1893 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001894 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001895 inst = inst->Next_1xx();
1896 break;
1897 }
1898 case Instruction::OR_LONG_2ADDR: {
1899 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001900 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001901 shadow_frame.SetVRegLong(vregA,
1902 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001903 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001904 inst = inst->Next_1xx();
1905 break;
1906 }
1907 case Instruction::XOR_LONG_2ADDR: {
1908 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001909 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001910 shadow_frame.SetVRegLong(vregA,
1911 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001912 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001913 inst = inst->Next_1xx();
1914 break;
1915 }
1916 case Instruction::SHL_LONG_2ADDR: {
1917 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001918 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001919 shadow_frame.SetVRegLong(vregA,
1920 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001921 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001922 inst = inst->Next_1xx();
1923 break;
1924 }
1925 case Instruction::SHR_LONG_2ADDR: {
1926 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001927 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001928 shadow_frame.SetVRegLong(vregA,
1929 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001930 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001931 inst = inst->Next_1xx();
1932 break;
1933 }
1934 case Instruction::USHR_LONG_2ADDR: {
1935 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001936 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001937 shadow_frame.SetVRegLong(vregA,
1938 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001939 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001940 inst = inst->Next_1xx();
1941 break;
1942 }
1943 case Instruction::ADD_FLOAT_2ADDR: {
1944 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001945 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001946 shadow_frame.SetVRegFloat(vregA,
1947 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001948 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001949 inst = inst->Next_1xx();
1950 break;
1951 }
1952 case Instruction::SUB_FLOAT_2ADDR: {
1953 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001954 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001955 shadow_frame.SetVRegFloat(vregA,
1956 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001957 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001958 inst = inst->Next_1xx();
1959 break;
1960 }
1961 case Instruction::MUL_FLOAT_2ADDR: {
1962 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001963 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001964 shadow_frame.SetVRegFloat(vregA,
1965 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001966 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001967 inst = inst->Next_1xx();
1968 break;
1969 }
1970 case Instruction::DIV_FLOAT_2ADDR: {
1971 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001972 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001973 shadow_frame.SetVRegFloat(vregA,
1974 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001975 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001976 inst = inst->Next_1xx();
1977 break;
1978 }
1979 case Instruction::REM_FLOAT_2ADDR: {
1980 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001981 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001982 shadow_frame.SetVRegFloat(vregA,
1983 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001984 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001985 inst = inst->Next_1xx();
1986 break;
1987 }
1988 case Instruction::ADD_DOUBLE_2ADDR: {
1989 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001990 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001991 shadow_frame.SetVRegDouble(vregA,
1992 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001993 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001994 inst = inst->Next_1xx();
1995 break;
1996 }
1997 case Instruction::SUB_DOUBLE_2ADDR: {
1998 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001999 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002000 shadow_frame.SetVRegDouble(vregA,
2001 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002002 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002003 inst = inst->Next_1xx();
2004 break;
2005 }
2006 case Instruction::MUL_DOUBLE_2ADDR: {
2007 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002008 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002009 shadow_frame.SetVRegDouble(vregA,
2010 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002011 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002012 inst = inst->Next_1xx();
2013 break;
2014 }
2015 case Instruction::DIV_DOUBLE_2ADDR: {
2016 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002017 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002018 shadow_frame.SetVRegDouble(vregA,
2019 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002020 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002021 inst = inst->Next_1xx();
2022 break;
2023 }
2024 case Instruction::REM_DOUBLE_2ADDR: {
2025 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002026 uint4_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002027 shadow_frame.SetVRegDouble(vregA,
2028 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002029 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002030 inst = inst->Next_1xx();
2031 break;
2032 }
2033 case Instruction::ADD_INT_LIT16:
2034 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002035 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002036 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2037 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002038 inst = inst->Next_2xx();
2039 break;
Ian Rogersf72a11d2014-10-30 15:41:08 -07002040 case Instruction::RSUB_INT_LIT16:
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002041 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002042 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002043 SafeSub(inst->VRegC_22s(),
2044 shadow_frame.GetVReg(inst->VRegB_22s(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002045 inst = inst->Next_2xx();
2046 break;
2047 case Instruction::MUL_INT_LIT16:
2048 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002049 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002050 SafeMul(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2051 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002052 inst = inst->Next_2xx();
2053 break;
2054 case Instruction::DIV_INT_LIT16: {
2055 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002056 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
2057 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002058 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2059 break;
2060 }
2061 case Instruction::REM_INT_LIT16: {
2062 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002063 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
2064 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002065 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2066 break;
2067 }
2068 case Instruction::AND_INT_LIT16:
2069 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002070 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2071 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002072 inst->VRegC_22s());
2073 inst = inst->Next_2xx();
2074 break;
2075 case Instruction::OR_INT_LIT16:
2076 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002077 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2078 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002079 inst->VRegC_22s());
2080 inst = inst->Next_2xx();
2081 break;
2082 case Instruction::XOR_INT_LIT16:
2083 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002084 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2085 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002086 inst->VRegC_22s());
2087 inst = inst->Next_2xx();
2088 break;
2089 case Instruction::ADD_INT_LIT8:
2090 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002091 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002092 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002093 inst = inst->Next_2xx();
2094 break;
2095 case Instruction::RSUB_INT_LIT8:
2096 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002097 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002098 SafeSub(inst->VRegC_22b(), shadow_frame.GetVReg(inst->VRegB_22b())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002099 inst = inst->Next_2xx();
2100 break;
2101 case Instruction::MUL_INT_LIT8:
2102 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002103 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002104 SafeMul(shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002105 inst = inst->Next_2xx();
2106 break;
2107 case Instruction::DIV_INT_LIT8: {
2108 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002109 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002110 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
2111 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2112 break;
2113 }
2114 case Instruction::REM_INT_LIT8: {
2115 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002116 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002117 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
2118 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx);
2119 break;
2120 }
2121 case Instruction::AND_INT_LIT8:
2122 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002123 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002124 shadow_frame.GetVReg(inst->VRegB_22b()) &
2125 inst->VRegC_22b());
2126 inst = inst->Next_2xx();
2127 break;
2128 case Instruction::OR_INT_LIT8:
2129 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002130 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002131 shadow_frame.GetVReg(inst->VRegB_22b()) |
2132 inst->VRegC_22b());
2133 inst = inst->Next_2xx();
2134 break;
2135 case Instruction::XOR_INT_LIT8:
2136 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002137 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002138 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2139 inst->VRegC_22b());
2140 inst = inst->Next_2xx();
2141 break;
2142 case Instruction::SHL_INT_LIT8:
2143 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002144 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002145 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2146 (inst->VRegC_22b() & 0x1f));
2147 inst = inst->Next_2xx();
2148 break;
2149 case Instruction::SHR_INT_LIT8:
2150 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002151 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002152 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2153 (inst->VRegC_22b() & 0x1f));
2154 inst = inst->Next_2xx();
2155 break;
2156 case Instruction::USHR_INT_LIT8:
2157 PREAMBLE();
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002158 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002159 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2160 (inst->VRegC_22b() & 0x1f));
2161 inst = inst->Next_2xx();
2162 break;
2163 case Instruction::UNUSED_3E ... Instruction::UNUSED_43:
Mathieu Chartierffc605c2014-12-10 10:35:44 -08002164 case Instruction::UNUSED_F3 ... Instruction::UNUSED_FF:
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002165 case Instruction::UNUSED_79:
2166 case Instruction::UNUSED_7A:
Ian Rogerse94652f2014-12-02 11:13:19 -08002167 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002168 }
2169 }
2170} // NOLINT(readability/fn_size)
2171
2172// Explicit definitions of ExecuteSwitchImpl.
Sebastien Hertzc6714852013-09-30 16:42:32 +02002173template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002174JValue ExecuteSwitchImpl<true, false>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002175 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertzc6714852013-09-30 16:42:32 +02002176template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002177JValue ExecuteSwitchImpl<false, false>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002178 ShadowFrame& shadow_frame, JValue result_register);
2179template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
Ian Rogerse94652f2014-12-02 11:13:19 -08002180JValue ExecuteSwitchImpl<true, true>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002181 ShadowFrame& shadow_frame, JValue result_register);
2182template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
Ian Rogerse94652f2014-12-02 11:13:19 -08002183JValue ExecuteSwitchImpl<false, true>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002184 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002185
2186} // namespace interpreter
2187} // namespace art