blob: 018add300709a7933b69440349666c90876e0f55 [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"
18
19namespace art {
20namespace interpreter {
21
22// In the following macros, we expect the following local variables exist:
23// - "self": the current Thread*.
24// - "inst" : the current Instruction*.
Sebastien Hertz3b588e02013-09-11 14:33:18 +020025// - "inst_data" : the current instruction's first 16 bits.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020026// - "dex_pc": the current pc.
27// - "shadow_frame": the current shadow frame.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020028// - "mh": the current MethodHelper.
29// - "currentHandlersTable": the current table of pointer to each instruction handler.
30
31// Advance to the next instruction and updates interpreter state.
32// TODO: move check suspend to backward branch, return and exception handling.
33#define ADVANCE(_offset) \
34 do { \
35 int32_t disp = static_cast<int32_t>(_offset); \
36 inst = inst->RelativeAt(disp); \
37 dex_pc = static_cast<uint32_t>(static_cast<int32_t>(dex_pc) + disp); \
38 shadow_frame.SetDexPC(dex_pc); \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020039 TraceExecution(shadow_frame, inst, dex_pc, mh); \
Sebastien Hertz3b588e02013-09-11 14:33:18 +020040 inst_data = inst->Fetch16(0); \
41 goto *currentHandlersTable[inst->Opcode(inst_data)]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020042 } while (false)
43
44#define HANDLE_PENDING_EXCEPTION() goto exception_pending_label
45
46#define POSSIBLY_HANDLE_PENDING_EXCEPTION(_is_exception_pending, _offset) \
47 do { \
48 if (UNLIKELY(_is_exception_pending)) { \
49 HANDLE_PENDING_EXCEPTION(); \
50 } else { \
51 ADVANCE(_offset); \
52 } \
53 } while (false)
54
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +020055#define UPDATE_HANDLER_TABLE() \
56 do { \
57 if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
58 currentHandlersTable = instrumentationHandlersTable; \
59 } else { \
60 currentHandlersTable = handlersTable; \
61 } \
62 } while (false);
63
Sebastien Hertz8ece0502013-08-07 11:26:41 +020064#define UNREACHABLE_CODE_CHECK() \
65 do { \
66 if (kIsDebugBuild) { \
67 LOG(FATAL) << "We should not be here !"; \
68 } \
69 } while (false)
70
71#define HANDLE_INSTRUCTION_START(opcode) op_##opcode: // NOLINT(whitespace/labels)
72#define HANDLE_INSTRUCTION_END() UNREACHABLE_CODE_CHECK()
73
Sebastien Hertz8ece0502013-08-07 11:26:41 +020074template<bool do_access_check>
75JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item,
76 ShadowFrame& shadow_frame, JValue result_register) {
Jeff Haoa3faaf42013-09-03 19:07:00 -070077 bool do_assignability_check = do_access_check;
Sebastien Hertz8ece0502013-08-07 11:26:41 +020078 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
79 LOG(FATAL) << "Invalid shadow frame for interpreter use";
80 return JValue();
81 }
82 self->VerifyStack();
Sebastien Hertz8ece0502013-08-07 11:26:41 +020083
84 uint32_t dex_pc = shadow_frame.GetDexPC();
Sebastien Hertz947ff082013-09-17 14:10:13 +020085 const instrumentation::Instrumentation* const instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +020086 if (LIKELY(dex_pc == 0)) { // We are entering the method as opposed to deoptimizing..
87 if (UNLIKELY(instrumentation->HasMethodEntryListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +020088 instrumentation->MethodEnterEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +020089 shadow_frame.GetMethod(), 0);
90 }
91 }
Sebastien Hertz947ff082013-09-17 14:10:13 +020092 const Instruction* inst = Instruction::At(code_item->insns_ + dex_pc);
Sebastien Hertz3b588e02013-09-11 14:33:18 +020093 uint16_t inst_data;
Sebastien Hertz8ece0502013-08-07 11:26:41 +020094
95 // Define handlers table.
96 static const void* handlersTable[kNumPackedOpcodes] = {
97#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&op_##code,
98#include "dex_instruction_list.h"
99 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
100#undef DEX_INSTRUCTION_LIST
101#undef INSTRUCTION_HANDLER
102 };
103
104 static const void* instrumentationHandlersTable[kNumPackedOpcodes] = {
105#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&instrumentation_op_##code,
106#include "dex_instruction_list.h"
107 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
108#undef DEX_INSTRUCTION_LIST
109#undef INSTRUCTION_HANDLER
110 };
111
112 const void** currentHandlersTable;
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200113 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200114
115 // Jump to first instruction.
116 ADVANCE(0);
117 UNREACHABLE_CODE_CHECK();
118
119 HANDLE_INSTRUCTION_START(NOP)
120 ADVANCE(1);
121 HANDLE_INSTRUCTION_END();
122
123 HANDLE_INSTRUCTION_START(MOVE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200124 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
125 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200126 ADVANCE(1);
127 HANDLE_INSTRUCTION_END();
128
129 HANDLE_INSTRUCTION_START(MOVE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200130 shadow_frame.SetVReg(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200131 shadow_frame.GetVReg(inst->VRegB_22x()));
132 ADVANCE(2);
133 HANDLE_INSTRUCTION_END();
134
135 HANDLE_INSTRUCTION_START(MOVE_16)
136 shadow_frame.SetVReg(inst->VRegA_32x(),
137 shadow_frame.GetVReg(inst->VRegB_32x()));
138 ADVANCE(3);
139 HANDLE_INSTRUCTION_END();
140
141 HANDLE_INSTRUCTION_START(MOVE_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200142 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
143 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200144 ADVANCE(1);
145 HANDLE_INSTRUCTION_END();
146
147 HANDLE_INSTRUCTION_START(MOVE_WIDE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200148 shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200149 shadow_frame.GetVRegLong(inst->VRegB_22x()));
150 ADVANCE(2);
151 HANDLE_INSTRUCTION_END();
152
153 HANDLE_INSTRUCTION_START(MOVE_WIDE_16)
154 shadow_frame.SetVRegLong(inst->VRegA_32x(),
155 shadow_frame.GetVRegLong(inst->VRegB_32x()));
156 ADVANCE(3);
157 HANDLE_INSTRUCTION_END();
158
159 HANDLE_INSTRUCTION_START(MOVE_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200160 shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data),
161 shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200162 ADVANCE(1);
163 HANDLE_INSTRUCTION_END();
164
165 HANDLE_INSTRUCTION_START(MOVE_OBJECT_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200166 shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200167 shadow_frame.GetVRegReference(inst->VRegB_22x()));
168 ADVANCE(2);
169 HANDLE_INSTRUCTION_END();
170
171 HANDLE_INSTRUCTION_START(MOVE_OBJECT_16)
172 shadow_frame.SetVRegReference(inst->VRegA_32x(),
173 shadow_frame.GetVRegReference(inst->VRegB_32x()));
174 ADVANCE(3);
175 HANDLE_INSTRUCTION_END();
176
177 HANDLE_INSTRUCTION_START(MOVE_RESULT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200178 shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200179 ADVANCE(1);
180 HANDLE_INSTRUCTION_END();
181
182 HANDLE_INSTRUCTION_START(MOVE_RESULT_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200183 shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200184 ADVANCE(1);
185 HANDLE_INSTRUCTION_END();
186
187 HANDLE_INSTRUCTION_START(MOVE_RESULT_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200188 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200189 ADVANCE(1);
190 HANDLE_INSTRUCTION_END();
191
192 HANDLE_INSTRUCTION_START(MOVE_EXCEPTION) {
193 Throwable* exception = self->GetException(NULL);
194 self->ClearException();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200195 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200196 ADVANCE(1);
197 }
198 HANDLE_INSTRUCTION_END();
199
200 HANDLE_INSTRUCTION_START(RETURN_VOID) {
201 JValue result;
Sebastien Hertz043036f2013-09-09 18:26:48 +0200202 if (do_access_check) {
203 // If access checks are required then the dex-to-dex compiler and analysis of
204 // whether the class has final fields hasn't been performed. Conservatively
205 // perform the memory barrier now.
206 ANDROID_MEMBAR_STORE();
207 }
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200208 if (UNLIKELY(self->TestAllFlags())) {
209 CheckSuspend(self);
210 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200211 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200212 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200213 shadow_frame.GetMethod(), dex_pc,
214 result);
215 }
216 return result;
217 }
218 HANDLE_INSTRUCTION_END();
219
220 HANDLE_INSTRUCTION_START(RETURN_VOID_BARRIER) {
221 ANDROID_MEMBAR_STORE();
222 JValue result;
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200223 if (UNLIKELY(self->TestAllFlags())) {
224 CheckSuspend(self);
225 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200226 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200227 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200228 shadow_frame.GetMethod(), dex_pc,
229 result);
230 }
231 return result;
232 }
233 HANDLE_INSTRUCTION_END();
234
235 HANDLE_INSTRUCTION_START(RETURN) {
236 JValue result;
237 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200238 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200239 if (UNLIKELY(self->TestAllFlags())) {
240 CheckSuspend(self);
241 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200242 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200243 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200244 shadow_frame.GetMethod(), dex_pc,
245 result);
246 }
247 return result;
248 }
249 HANDLE_INSTRUCTION_END();
250
251 HANDLE_INSTRUCTION_START(RETURN_WIDE) {
252 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200253 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200254 if (UNLIKELY(self->TestAllFlags())) {
255 CheckSuspend(self);
256 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200257 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200258 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200259 shadow_frame.GetMethod(), dex_pc,
260 result);
261 }
262 return result;
263 }
264 HANDLE_INSTRUCTION_END();
265
266 HANDLE_INSTRUCTION_START(RETURN_OBJECT) {
267 JValue result;
Jeff Haoa3faaf42013-09-03 19:07:00 -0700268 Object* obj_result = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200269 result.SetJ(0);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700270 result.SetL(obj_result);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200271 if (UNLIKELY(self->TestAllFlags())) {
272 CheckSuspend(self);
273 }
Jeff Haoa3faaf42013-09-03 19:07:00 -0700274 if (do_assignability_check && obj_result != NULL) {
275 Class* return_type = MethodHelper(shadow_frame.GetMethod()).GetReturnType();
276 if (return_type == NULL) {
277 // Return the pending exception.
278 HANDLE_PENDING_EXCEPTION();
279 }
280 if (!obj_result->VerifierInstanceOf(return_type)) {
281 // This should never happen.
282 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
283 "Ljava/lang/VirtualMachineError;",
284 "Returning '%s' that is not instance of return type '%s'",
285 ClassHelper(obj_result->GetClass()).GetDescriptor(),
286 ClassHelper(return_type).GetDescriptor());
287 HANDLE_PENDING_EXCEPTION();
288 }
289 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200290 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200291 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200292 shadow_frame.GetMethod(), dex_pc,
293 result);
294 }
295 return result;
296 }
297 HANDLE_INSTRUCTION_END();
298
299 HANDLE_INSTRUCTION_START(CONST_4) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200300 uint32_t dst = inst->VRegA_11n(inst_data);
301 int32_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200302 shadow_frame.SetVReg(dst, val);
303 if (val == 0) {
304 shadow_frame.SetVRegReference(dst, NULL);
305 }
306 ADVANCE(1);
307 }
308 HANDLE_INSTRUCTION_END();
309
310 HANDLE_INSTRUCTION_START(CONST_16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200311 uint32_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200312 int32_t val = inst->VRegB_21s();
313 shadow_frame.SetVReg(dst, val);
314 if (val == 0) {
315 shadow_frame.SetVRegReference(dst, NULL);
316 }
317 ADVANCE(2);
318 }
319 HANDLE_INSTRUCTION_END();
320
321 HANDLE_INSTRUCTION_START(CONST) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200322 uint32_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200323 int32_t val = inst->VRegB_31i();
324 shadow_frame.SetVReg(dst, val);
325 if (val == 0) {
326 shadow_frame.SetVRegReference(dst, NULL);
327 }
328 ADVANCE(3);
329 }
330 HANDLE_INSTRUCTION_END();
331
332 HANDLE_INSTRUCTION_START(CONST_HIGH16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200333 uint32_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200334 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
335 shadow_frame.SetVReg(dst, val);
336 if (val == 0) {
337 shadow_frame.SetVRegReference(dst, NULL);
338 }
339 ADVANCE(2);
340 }
341 HANDLE_INSTRUCTION_END();
342
343 HANDLE_INSTRUCTION_START(CONST_WIDE_16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200344 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200345 ADVANCE(2);
346 HANDLE_INSTRUCTION_END();
347
348 HANDLE_INSTRUCTION_START(CONST_WIDE_32)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200349 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200350 ADVANCE(3);
351 HANDLE_INSTRUCTION_END();
352
353 HANDLE_INSTRUCTION_START(CONST_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200354 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200355 ADVANCE(5);
356 HANDLE_INSTRUCTION_END();
357
358 HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200359 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200360 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
361 ADVANCE(2);
362 HANDLE_INSTRUCTION_END();
363
364 HANDLE_INSTRUCTION_START(CONST_STRING) {
365 String* s = ResolveString(self, mh, inst->VRegB_21c());
366 if (UNLIKELY(s == NULL)) {
367 HANDLE_PENDING_EXCEPTION();
368 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200369 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200370 ADVANCE(2);
371 }
372 }
373 HANDLE_INSTRUCTION_END();
374
375 HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
376 String* s = ResolveString(self, mh, inst->VRegB_31c());
377 if (UNLIKELY(s == NULL)) {
378 HANDLE_PENDING_EXCEPTION();
379 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200380 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200381 ADVANCE(3);
382 }
383 }
384 HANDLE_INSTRUCTION_END();
385
386 HANDLE_INSTRUCTION_START(CONST_CLASS) {
387 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
388 self, false, do_access_check);
389 if (UNLIKELY(c == NULL)) {
390 HANDLE_PENDING_EXCEPTION();
391 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200392 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200393 ADVANCE(2);
394 }
395 }
396 HANDLE_INSTRUCTION_END();
397
398 HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200399 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200400 if (UNLIKELY(obj == NULL)) {
401 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
402 HANDLE_PENDING_EXCEPTION();
403 } else {
404 DoMonitorEnter(self, obj);
405 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
406 }
407 }
408 HANDLE_INSTRUCTION_END();
409
410 HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200411 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200412 if (UNLIKELY(obj == NULL)) {
413 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
414 HANDLE_PENDING_EXCEPTION();
415 } else {
416 DoMonitorExit(self, obj);
417 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
418 }
419 }
420 HANDLE_INSTRUCTION_END();
421
422 HANDLE_INSTRUCTION_START(CHECK_CAST) {
423 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
424 self, false, do_access_check);
425 if (UNLIKELY(c == NULL)) {
426 HANDLE_PENDING_EXCEPTION();
427 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200428 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200429 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
430 ThrowClassCastException(c, obj->GetClass());
431 HANDLE_PENDING_EXCEPTION();
432 } else {
433 ADVANCE(2);
434 }
435 }
436 }
437 HANDLE_INSTRUCTION_END();
438
439 HANDLE_INSTRUCTION_START(INSTANCE_OF) {
440 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
441 self, false, do_access_check);
442 if (UNLIKELY(c == NULL)) {
443 HANDLE_PENDING_EXCEPTION();
444 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200445 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
446 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200447 ADVANCE(2);
448 }
449 }
450 HANDLE_INSTRUCTION_END();
451
452 HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200453 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200454 if (UNLIKELY(array == NULL)) {
455 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
456 HANDLE_PENDING_EXCEPTION();
457 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200458 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200459 ADVANCE(1);
460 }
461 }
462 HANDLE_INSTRUCTION_END();
463
464 HANDLE_INSTRUCTION_START(NEW_INSTANCE) {
465 Object* obj = AllocObjectFromCode(inst->VRegB_21c(), shadow_frame.GetMethod(),
466 self, do_access_check);
467 if (UNLIKELY(obj == NULL)) {
468 HANDLE_PENDING_EXCEPTION();
469 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200470 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200471 ADVANCE(2);
472 }
473 }
474 HANDLE_INSTRUCTION_END();
475
476 HANDLE_INSTRUCTION_START(NEW_ARRAY) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200477 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200478 Object* obj = AllocArrayFromCode(inst->VRegC_22c(), shadow_frame.GetMethod(),
479 length, self, do_access_check);
480 if (UNLIKELY(obj == NULL)) {
481 HANDLE_PENDING_EXCEPTION();
482 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200483 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200484 ADVANCE(2);
485 }
486 }
487 HANDLE_INSTRUCTION_END();
488
489 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) {
490 bool success = DoFilledNewArray<false, do_access_check>(inst, shadow_frame,
491 self, &result_register);
492 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
493 }
494 HANDLE_INSTRUCTION_END();
495
496 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) {
497 bool success = DoFilledNewArray<true, do_access_check>(inst, shadow_frame,
498 self, &result_register);
499 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
500 }
501 HANDLE_INSTRUCTION_END();
502
503 HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200504 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200505 if (UNLIKELY(obj == NULL)) {
506 ThrowNullPointerException(NULL, "null array in FILL_ARRAY_DATA");
507 HANDLE_PENDING_EXCEPTION();
508 } else {
509 Array* array = obj->AsArray();
510 DCHECK(array->IsArrayInstance() && !array->IsObjectArray());
511 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
512 const Instruction::ArrayDataPayload* payload =
513 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
514 if (UNLIKELY(static_cast<int32_t>(payload->element_count) > array->GetLength())) {
515 self->ThrowNewExceptionF(shadow_frame.GetCurrentLocationForThrow(),
516 "Ljava/lang/ArrayIndexOutOfBoundsException;",
517 "failed FILL_ARRAY_DATA; length=%d, index=%d",
518 array->GetLength(), payload->element_count);
519 HANDLE_PENDING_EXCEPTION();
520 } else {
521 uint32_t size_in_bytes = payload->element_count * payload->element_width;
522 memcpy(array->GetRawData(payload->element_width), payload->data, size_in_bytes);
523 ADVANCE(3);
524 }
525 }
526 }
527 HANDLE_INSTRUCTION_END();
528
529 HANDLE_INSTRUCTION_START(THROW) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200530 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200531 if (UNLIKELY(exception == NULL)) {
532 ThrowNullPointerException(NULL, "throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700533 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
534 // This should never happen.
535 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
536 "Ljava/lang/VirtualMachineError;",
537 "Throwing '%s' that is not instance of Throwable",
538 ClassHelper(exception->GetClass()).GetDescriptor());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200539 } else {
540 self->SetException(shadow_frame.GetCurrentLocationForThrow(), exception->AsThrowable());
541 }
542 HANDLE_PENDING_EXCEPTION();
543 }
544 HANDLE_INSTRUCTION_END();
545
546 HANDLE_INSTRUCTION_START(GOTO) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200547 int8_t offset = inst->VRegA_10t(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200548 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200549 if (UNLIKELY(self->TestAllFlags())) {
550 CheckSuspend(self);
551 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200552 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200553 }
554 ADVANCE(offset);
555 }
556 HANDLE_INSTRUCTION_END();
557
558 HANDLE_INSTRUCTION_START(GOTO_16) {
559 int16_t offset = inst->VRegA_20t();
560 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200561 if (UNLIKELY(self->TestAllFlags())) {
562 CheckSuspend(self);
563 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200564 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200565 }
566 ADVANCE(offset);
567 }
568 HANDLE_INSTRUCTION_END();
569
570 HANDLE_INSTRUCTION_START(GOTO_32) {
571 int32_t offset = inst->VRegA_30t();
572 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200573 if (UNLIKELY(self->TestAllFlags())) {
574 CheckSuspend(self);
575 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200576 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200577 }
578 ADVANCE(offset);
579 }
580 HANDLE_INSTRUCTION_END();
581
582 HANDLE_INSTRUCTION_START(PACKED_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200583 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200584 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200585 if (UNLIKELY(self->TestAllFlags())) {
586 CheckSuspend(self);
587 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200588 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200589 }
590 ADVANCE(offset);
591 }
592 HANDLE_INSTRUCTION_END();
593
594 HANDLE_INSTRUCTION_START(SPARSE_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200595 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200596 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200597 if (UNLIKELY(self->TestAllFlags())) {
598 CheckSuspend(self);
599 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200600 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200601 }
602 ADVANCE(offset);
603 }
604 HANDLE_INSTRUCTION_END();
605
606 HANDLE_INSTRUCTION_START(CMPL_FLOAT) {
607 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
608 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
609 int32_t result;
610 if (val1 > val2) {
611 result = 1;
612 } else if (val1 == val2) {
613 result = 0;
614 } else {
615 result = -1;
616 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200617 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200618 ADVANCE(2);
619 }
620 HANDLE_INSTRUCTION_END();
621
622 HANDLE_INSTRUCTION_START(CMPG_FLOAT) {
623 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
624 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
625 int32_t result;
626 if (val1 < val2) {
627 result = -1;
628 } else if (val1 == val2) {
629 result = 0;
630 } else {
631 result = 1;
632 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200633 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200634 ADVANCE(2);
635 }
636 HANDLE_INSTRUCTION_END();
637
638 HANDLE_INSTRUCTION_START(CMPL_DOUBLE) {
639 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
640 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
641 int32_t result;
642 if (val1 > val2) {
643 result = 1;
644 } else if (val1 == val2) {
645 result = 0;
646 } else {
647 result = -1;
648 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200649 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200650 ADVANCE(2);
651 }
652 HANDLE_INSTRUCTION_END();
653
654 HANDLE_INSTRUCTION_START(CMPG_DOUBLE) {
655 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
656 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
657 int32_t result;
658 if (val1 < val2) {
659 result = -1;
660 } else if (val1 == val2) {
661 result = 0;
662 } else {
663 result = 1;
664 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200665 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200666 ADVANCE(2);
667 }
668 HANDLE_INSTRUCTION_END();
669
670 HANDLE_INSTRUCTION_START(CMP_LONG) {
671 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
672 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
673 int32_t result;
674 if (val1 > val2) {
675 result = 1;
676 } else if (val1 == val2) {
677 result = 0;
678 } else {
679 result = -1;
680 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200681 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200682 ADVANCE(2);
683 }
684 HANDLE_INSTRUCTION_END();
685
686 HANDLE_INSTRUCTION_START(IF_EQ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200687 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200688 int16_t offset = inst->VRegC_22t();
689 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200690 if (UNLIKELY(self->TestAllFlags())) {
691 CheckSuspend(self);
692 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200693 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200694 }
695 ADVANCE(offset);
696 } else {
697 ADVANCE(2);
698 }
699 }
700 HANDLE_INSTRUCTION_END();
701
702 HANDLE_INSTRUCTION_START(IF_NE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200703 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) != shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200704 int16_t offset = inst->VRegC_22t();
705 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200706 if (UNLIKELY(self->TestAllFlags())) {
707 CheckSuspend(self);
708 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200709 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200710 }
711 ADVANCE(offset);
712 } else {
713 ADVANCE(2);
714 }
715 }
716 HANDLE_INSTRUCTION_END();
717
718 HANDLE_INSTRUCTION_START(IF_LT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200719 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) < shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200720 int16_t offset = inst->VRegC_22t();
721 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200722 if (UNLIKELY(self->TestAllFlags())) {
723 CheckSuspend(self);
724 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200725 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200726 }
727 ADVANCE(offset);
728 } else {
729 ADVANCE(2);
730 }
731 }
732 HANDLE_INSTRUCTION_END();
733
734 HANDLE_INSTRUCTION_START(IF_GE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200735 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200736 int16_t offset = inst->VRegC_22t();
737 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200738 if (UNLIKELY(self->TestAllFlags())) {
739 CheckSuspend(self);
740 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200741 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200742 }
743 ADVANCE(offset);
744 } else {
745 ADVANCE(2);
746 }
747 }
748 HANDLE_INSTRUCTION_END();
749
750 HANDLE_INSTRUCTION_START(IF_GT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200751 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200752 int16_t offset = inst->VRegC_22t();
753 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200754 if (UNLIKELY(self->TestAllFlags())) {
755 CheckSuspend(self);
756 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200757 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200758 }
759 ADVANCE(offset);
760 } else {
761 ADVANCE(2);
762 }
763 }
764 HANDLE_INSTRUCTION_END();
765
766 HANDLE_INSTRUCTION_START(IF_LE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200767 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200768 int16_t offset = inst->VRegC_22t();
769 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200770 if (UNLIKELY(self->TestAllFlags())) {
771 CheckSuspend(self);
772 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200773 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200774 }
775 ADVANCE(offset);
776 } else {
777 ADVANCE(2);
778 }
779 }
780 HANDLE_INSTRUCTION_END();
781
782 HANDLE_INSTRUCTION_START(IF_EQZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200783 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200784 int16_t offset = inst->VRegB_21t();
785 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200786 if (UNLIKELY(self->TestAllFlags())) {
787 CheckSuspend(self);
788 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200789 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200790 }
791 ADVANCE(offset);
792 } else {
793 ADVANCE(2);
794 }
795 }
796 HANDLE_INSTRUCTION_END();
797
798 HANDLE_INSTRUCTION_START(IF_NEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200799 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200800 int16_t offset = inst->VRegB_21t();
801 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200802 if (UNLIKELY(self->TestAllFlags())) {
803 CheckSuspend(self);
804 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200805 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200806 }
807 ADVANCE(offset);
808 } else {
809 ADVANCE(2);
810 }
811 }
812 HANDLE_INSTRUCTION_END();
813
814 HANDLE_INSTRUCTION_START(IF_LTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200815 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200816 int16_t offset = inst->VRegB_21t();
817 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200818 if (UNLIKELY(self->TestAllFlags())) {
819 CheckSuspend(self);
820 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200821 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200822 }
823 ADVANCE(offset);
824 } else {
825 ADVANCE(2);
826 }
827 }
828 HANDLE_INSTRUCTION_END();
829
830 HANDLE_INSTRUCTION_START(IF_GEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200831 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200832 int16_t offset = inst->VRegB_21t();
833 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200834 if (UNLIKELY(self->TestAllFlags())) {
835 CheckSuspend(self);
836 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200837 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200838 }
839 ADVANCE(offset);
840 } else {
841 ADVANCE(2);
842 }
843 }
844 HANDLE_INSTRUCTION_END();
845
846 HANDLE_INSTRUCTION_START(IF_GTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200847 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200848 int16_t offset = inst->VRegB_21t();
849 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200850 if (UNLIKELY(self->TestAllFlags())) {
851 CheckSuspend(self);
852 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200853 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200854 }
855 ADVANCE(offset);
856 } else {
857 ADVANCE(2);
858 }
859 }
860 HANDLE_INSTRUCTION_END();
861
862 HANDLE_INSTRUCTION_START(IF_LEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200863 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200864 int16_t offset = inst->VRegB_21t();
865 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200866 if (UNLIKELY(self->TestAllFlags())) {
867 CheckSuspend(self);
868 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200869 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200870 }
871 ADVANCE(offset);
872 } else {
873 ADVANCE(2);
874 }
875 }
876 HANDLE_INSTRUCTION_END();
877
878 HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
879 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
880 if (UNLIKELY(a == NULL)) {
881 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
882 HANDLE_PENDING_EXCEPTION();
883 } else {
884 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
885 BooleanArray* array = a->AsBooleanArray();
886 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200887 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200888 ADVANCE(2);
889 } else {
890 HANDLE_PENDING_EXCEPTION();
891 }
892 }
893 }
894 HANDLE_INSTRUCTION_END();
895
896 HANDLE_INSTRUCTION_START(AGET_BYTE) {
897 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
898 if (UNLIKELY(a == NULL)) {
899 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
900 HANDLE_PENDING_EXCEPTION();
901 } else {
902 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
903 ByteArray* array = a->AsByteArray();
904 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200905 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200906 ADVANCE(2);
907 } else {
908 HANDLE_PENDING_EXCEPTION();
909 }
910 }
911 }
912 HANDLE_INSTRUCTION_END();
913
914 HANDLE_INSTRUCTION_START(AGET_CHAR) {
915 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
916 if (UNLIKELY(a == NULL)) {
917 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
918 HANDLE_PENDING_EXCEPTION();
919 } else {
920 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
921 CharArray* array = a->AsCharArray();
922 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200923 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200924 ADVANCE(2);
925 } else {
926 HANDLE_PENDING_EXCEPTION();
927 }
928 }
929 }
930 HANDLE_INSTRUCTION_END();
931
932 HANDLE_INSTRUCTION_START(AGET_SHORT) {
933 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
934 if (UNLIKELY(a == NULL)) {
935 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
936 HANDLE_PENDING_EXCEPTION();
937 } else {
938 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
939 ShortArray* array = a->AsShortArray();
940 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200941 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200942 ADVANCE(2);
943 } else {
944 HANDLE_PENDING_EXCEPTION();
945 }
946 }
947 }
948 HANDLE_INSTRUCTION_END();
949
950 HANDLE_INSTRUCTION_START(AGET) {
951 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
952 if (UNLIKELY(a == NULL)) {
953 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
954 HANDLE_PENDING_EXCEPTION();
955 } else {
956 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
957 IntArray* array = a->AsIntArray();
958 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200959 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200960 ADVANCE(2);
961 } else {
962 HANDLE_PENDING_EXCEPTION();
963 }
964 }
965 }
966 HANDLE_INSTRUCTION_END();
967
968 HANDLE_INSTRUCTION_START(AGET_WIDE) {
969 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
970 if (UNLIKELY(a == NULL)) {
971 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
972 HANDLE_PENDING_EXCEPTION();
973 } else {
974 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
975 LongArray* array = a->AsLongArray();
976 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200977 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200978 ADVANCE(2);
979 } else {
980 HANDLE_PENDING_EXCEPTION();
981 }
982 }
983 }
984 HANDLE_INSTRUCTION_END();
985
986 HANDLE_INSTRUCTION_START(AGET_OBJECT) {
987 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
988 if (UNLIKELY(a == NULL)) {
989 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
990 HANDLE_PENDING_EXCEPTION();
991 } else {
992 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
993 ObjectArray<Object>* array = a->AsObjectArray<Object>();
994 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200995 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200996 ADVANCE(2);
997 } else {
998 HANDLE_PENDING_EXCEPTION();
999 }
1000 }
1001 }
1002 HANDLE_INSTRUCTION_END();
1003
1004 HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
1005 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1006 if (UNLIKELY(a == NULL)) {
1007 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1008 HANDLE_PENDING_EXCEPTION();
1009 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001010 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001011 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1012 BooleanArray* array = a->AsBooleanArray();
1013 if (LIKELY(array->IsValidIndex(index))) {
1014 array->GetData()[index] = val;
1015 ADVANCE(2);
1016 } else {
1017 HANDLE_PENDING_EXCEPTION();
1018 }
1019 }
1020 }
1021 HANDLE_INSTRUCTION_END();
1022
1023 HANDLE_INSTRUCTION_START(APUT_BYTE) {
1024 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1025 if (UNLIKELY(a == NULL)) {
1026 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1027 HANDLE_PENDING_EXCEPTION();
1028 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001029 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001030 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1031 ByteArray* array = a->AsByteArray();
1032 if (LIKELY(array->IsValidIndex(index))) {
1033 array->GetData()[index] = val;
1034 ADVANCE(2);
1035 } else {
1036 HANDLE_PENDING_EXCEPTION();
1037 }
1038 }
1039 }
1040 HANDLE_INSTRUCTION_END();
1041
1042 HANDLE_INSTRUCTION_START(APUT_CHAR) {
1043 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1044 if (UNLIKELY(a == NULL)) {
1045 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1046 HANDLE_PENDING_EXCEPTION();
1047 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001048 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001049 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1050 CharArray* array = a->AsCharArray();
1051 if (LIKELY(array->IsValidIndex(index))) {
1052 array->GetData()[index] = val;
1053 ADVANCE(2);
1054 } else {
1055 HANDLE_PENDING_EXCEPTION();
1056 }
1057 }
1058 }
1059 HANDLE_INSTRUCTION_END();
1060
1061 HANDLE_INSTRUCTION_START(APUT_SHORT) {
1062 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1063 if (UNLIKELY(a == NULL)) {
1064 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1065 HANDLE_PENDING_EXCEPTION();
1066 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001067 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001068 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1069 ShortArray* array = a->AsShortArray();
1070 if (LIKELY(array->IsValidIndex(index))) {
1071 array->GetData()[index] = val;
1072 ADVANCE(2);
1073 } else {
1074 HANDLE_PENDING_EXCEPTION();
1075 }
1076 }
1077 }
1078 HANDLE_INSTRUCTION_END();
1079
1080 HANDLE_INSTRUCTION_START(APUT) {
1081 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1082 if (UNLIKELY(a == NULL)) {
1083 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1084 HANDLE_PENDING_EXCEPTION();
1085 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001086 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001087 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1088 IntArray* array = a->AsIntArray();
1089 if (LIKELY(array->IsValidIndex(index))) {
1090 array->GetData()[index] = val;
1091 ADVANCE(2);
1092 } else {
1093 HANDLE_PENDING_EXCEPTION();
1094 }
1095 }
1096 }
1097 HANDLE_INSTRUCTION_END();
1098
1099 HANDLE_INSTRUCTION_START(APUT_WIDE) {
1100 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1101 if (UNLIKELY(a == NULL)) {
1102 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1103 HANDLE_PENDING_EXCEPTION();
1104 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001105 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001106 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1107 LongArray* array = a->AsLongArray();
1108 if (LIKELY(array->IsValidIndex(index))) {
1109 array->GetData()[index] = val;
1110 ADVANCE(2);
1111 } else {
1112 HANDLE_PENDING_EXCEPTION();
1113 }
1114 }
1115 }
1116 HANDLE_INSTRUCTION_END();
1117
1118 HANDLE_INSTRUCTION_START(APUT_OBJECT) {
1119 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1120 if (UNLIKELY(a == NULL)) {
1121 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1122 HANDLE_PENDING_EXCEPTION();
1123 } else {
1124 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001125 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001126 ObjectArray<Object>* array = a->AsObjectArray<Object>();
1127 if (LIKELY(array->IsValidIndex(index) && array->CheckAssignable(val))) {
1128 array->SetWithoutChecks(index, val);
1129 ADVANCE(2);
1130 } else {
1131 HANDLE_PENDING_EXCEPTION();
1132 }
1133 }
1134 }
1135 HANDLE_INSTRUCTION_END();
1136
1137 HANDLE_INSTRUCTION_START(IGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001138 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001139 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1140 }
1141 HANDLE_INSTRUCTION_END();
1142
1143 HANDLE_INSTRUCTION_START(IGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001144 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001145 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1146 }
1147 HANDLE_INSTRUCTION_END();
1148
1149 HANDLE_INSTRUCTION_START(IGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001150 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001151 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1152 }
1153 HANDLE_INSTRUCTION_END();
1154
1155 HANDLE_INSTRUCTION_START(IGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001156 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001157 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1158 }
1159 HANDLE_INSTRUCTION_END();
1160
1161 HANDLE_INSTRUCTION_START(IGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001162 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001163 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1164 }
1165 HANDLE_INSTRUCTION_END();
1166
1167 HANDLE_INSTRUCTION_START(IGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001168 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001169 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1170 }
1171 HANDLE_INSTRUCTION_END();
1172
1173 HANDLE_INSTRUCTION_START(IGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001174 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001175 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1176 }
1177 HANDLE_INSTRUCTION_END();
1178
1179 HANDLE_INSTRUCTION_START(IGET_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001180 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001181 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1182 }
1183 HANDLE_INSTRUCTION_END();
1184
1185 HANDLE_INSTRUCTION_START(IGET_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001186 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001187 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1188 }
1189 HANDLE_INSTRUCTION_END();
1190
1191 HANDLE_INSTRUCTION_START(IGET_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001192 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001193 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1194 }
1195 HANDLE_INSTRUCTION_END();
1196
1197 HANDLE_INSTRUCTION_START(SGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001198 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001199 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1200 }
1201 HANDLE_INSTRUCTION_END();
1202
1203 HANDLE_INSTRUCTION_START(SGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001204 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001205 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1206 }
1207 HANDLE_INSTRUCTION_END();
1208
1209 HANDLE_INSTRUCTION_START(SGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001210 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001211 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1212 }
1213 HANDLE_INSTRUCTION_END();
1214
1215 HANDLE_INSTRUCTION_START(SGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001216 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001217 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1218 }
1219 HANDLE_INSTRUCTION_END();
1220
1221 HANDLE_INSTRUCTION_START(SGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001222 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001223 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1224 }
1225 HANDLE_INSTRUCTION_END();
1226
1227 HANDLE_INSTRUCTION_START(SGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001228 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001229 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1230 }
1231 HANDLE_INSTRUCTION_END();
1232
1233 HANDLE_INSTRUCTION_START(SGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001234 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001235 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1236 }
1237 HANDLE_INSTRUCTION_END();
1238
1239 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001240 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001241 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1242 }
1243 HANDLE_INSTRUCTION_END();
1244
1245 HANDLE_INSTRUCTION_START(IPUT_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001246 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001247 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1248 }
1249 HANDLE_INSTRUCTION_END();
1250
1251 HANDLE_INSTRUCTION_START(IPUT_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001252 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001253 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1254 }
1255 HANDLE_INSTRUCTION_END();
1256
1257 HANDLE_INSTRUCTION_START(IPUT_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001258 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001259 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1260 }
1261 HANDLE_INSTRUCTION_END();
1262
1263 HANDLE_INSTRUCTION_START(IPUT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001264 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001265 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1266 }
1267 HANDLE_INSTRUCTION_END();
1268
1269 HANDLE_INSTRUCTION_START(IPUT_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001270 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001271 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1272 }
1273 HANDLE_INSTRUCTION_END();
1274
1275 HANDLE_INSTRUCTION_START(IPUT_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001276 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001277 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1278 }
1279 HANDLE_INSTRUCTION_END();
1280
1281 HANDLE_INSTRUCTION_START(IPUT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001282 bool success = DoIPutQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001283 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1284 }
1285 HANDLE_INSTRUCTION_END();
1286
1287 HANDLE_INSTRUCTION_START(IPUT_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001288 bool success = DoIPutQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001289 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1290 }
1291 HANDLE_INSTRUCTION_END();
1292
1293 HANDLE_INSTRUCTION_START(IPUT_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001294 bool success = DoIPutQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001295 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1296 }
1297 HANDLE_INSTRUCTION_END();
1298
1299 HANDLE_INSTRUCTION_START(SPUT_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001300 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001301 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1302 }
1303 HANDLE_INSTRUCTION_END();
1304
1305 HANDLE_INSTRUCTION_START(SPUT_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001306 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001307 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1308 }
1309 HANDLE_INSTRUCTION_END();
1310
1311 HANDLE_INSTRUCTION_START(SPUT_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001312 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001313 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1314 }
1315 HANDLE_INSTRUCTION_END();
1316
1317 HANDLE_INSTRUCTION_START(SPUT_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001318 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001319 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1320 }
1321 HANDLE_INSTRUCTION_END();
1322
1323 HANDLE_INSTRUCTION_START(SPUT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001324 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001325 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1326 }
1327 HANDLE_INSTRUCTION_END();
1328
1329 HANDLE_INSTRUCTION_START(SPUT_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001330 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001331 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1332 }
1333 HANDLE_INSTRUCTION_END();
1334
1335 HANDLE_INSTRUCTION_START(SPUT_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001336 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001337 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1338 }
1339 HANDLE_INSTRUCTION_END();
1340
1341 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL) {
1342 bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001343 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001344 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1345 }
1346 HANDLE_INSTRUCTION_END();
1347
1348 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) {
1349 bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001350 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001351 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1352 }
1353 HANDLE_INSTRUCTION_END();
1354
1355 HANDLE_INSTRUCTION_START(INVOKE_SUPER) {
1356 bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001357 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001358 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1359 }
1360 HANDLE_INSTRUCTION_END();
1361
1362 HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) {
1363 bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001364 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001365 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1366 }
1367 HANDLE_INSTRUCTION_END();
1368
1369 HANDLE_INSTRUCTION_START(INVOKE_DIRECT) {
1370 bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001371 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001372 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1373 }
1374 HANDLE_INSTRUCTION_END();
1375
1376 HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) {
1377 bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001378 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001379 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1380 }
1381 HANDLE_INSTRUCTION_END();
1382
1383 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) {
1384 bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001385 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001386 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1387 }
1388 HANDLE_INSTRUCTION_END();
1389
1390 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) {
1391 bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001392 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001393 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1394 }
1395 HANDLE_INSTRUCTION_END();
1396
1397 HANDLE_INSTRUCTION_START(INVOKE_STATIC) {
1398 bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001399 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001400 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1401 }
1402 HANDLE_INSTRUCTION_END();
1403
1404 HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) {
1405 bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001406 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001407 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1408 }
1409 HANDLE_INSTRUCTION_END();
1410
1411 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) {
1412 bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001413 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001414 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1415 }
1416 HANDLE_INSTRUCTION_END();
1417
1418 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) {
1419 bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001420 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001421 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1422 }
1423 HANDLE_INSTRUCTION_END();
1424
1425 HANDLE_INSTRUCTION_START(NEG_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001426 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001427 ADVANCE(1);
1428 HANDLE_INSTRUCTION_END();
1429
1430 HANDLE_INSTRUCTION_START(NOT_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001431 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001432 ADVANCE(1);
1433 HANDLE_INSTRUCTION_END();
1434
1435 HANDLE_INSTRUCTION_START(NEG_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001436 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001437 ADVANCE(1);
1438 HANDLE_INSTRUCTION_END();
1439
1440 HANDLE_INSTRUCTION_START(NOT_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001441 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001442 ADVANCE(1);
1443 HANDLE_INSTRUCTION_END();
1444
1445 HANDLE_INSTRUCTION_START(NEG_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001446 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001447 ADVANCE(1);
1448 HANDLE_INSTRUCTION_END();
1449
1450 HANDLE_INSTRUCTION_START(NEG_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001451 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001452 ADVANCE(1);
1453 HANDLE_INSTRUCTION_END();
1454
1455 HANDLE_INSTRUCTION_START(INT_TO_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001456 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001457 ADVANCE(1);
1458 HANDLE_INSTRUCTION_END();
1459
1460 HANDLE_INSTRUCTION_START(INT_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001461 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001462 ADVANCE(1);
1463 HANDLE_INSTRUCTION_END();
1464
1465 HANDLE_INSTRUCTION_START(INT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001466 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001467 ADVANCE(1);
1468 HANDLE_INSTRUCTION_END();
1469
1470 HANDLE_INSTRUCTION_START(LONG_TO_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001471 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001472 ADVANCE(1);
1473 HANDLE_INSTRUCTION_END();
1474
1475 HANDLE_INSTRUCTION_START(LONG_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001476 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001477 ADVANCE(1);
1478 HANDLE_INSTRUCTION_END();
1479
1480 HANDLE_INSTRUCTION_START(LONG_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001481 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001482 ADVANCE(1);
1483 HANDLE_INSTRUCTION_END();
1484
1485 HANDLE_INSTRUCTION_START(FLOAT_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001486 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001487 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001488 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001489 ADVANCE(1);
1490 }
1491 HANDLE_INSTRUCTION_END();
1492
1493 HANDLE_INSTRUCTION_START(FLOAT_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001494 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001495 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001496 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001497 ADVANCE(1);
1498 }
1499 HANDLE_INSTRUCTION_END();
1500
1501 HANDLE_INSTRUCTION_START(FLOAT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001502 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001503 ADVANCE(1);
1504 HANDLE_INSTRUCTION_END();
1505
1506 HANDLE_INSTRUCTION_START(DOUBLE_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001507 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001508 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001509 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001510 ADVANCE(1);
1511 }
1512 HANDLE_INSTRUCTION_END();
1513
1514 HANDLE_INSTRUCTION_START(DOUBLE_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001515 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001516 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001517 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001518 ADVANCE(1);
1519 }
1520 HANDLE_INSTRUCTION_END();
1521
1522 HANDLE_INSTRUCTION_START(DOUBLE_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001523 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001524 ADVANCE(1);
1525 HANDLE_INSTRUCTION_END();
1526
1527 HANDLE_INSTRUCTION_START(INT_TO_BYTE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001528 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1529 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001530 ADVANCE(1);
1531 HANDLE_INSTRUCTION_END();
1532
1533 HANDLE_INSTRUCTION_START(INT_TO_CHAR)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001534 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1535 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001536 ADVANCE(1);
1537 HANDLE_INSTRUCTION_END();
1538
1539 HANDLE_INSTRUCTION_START(INT_TO_SHORT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001540 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1541 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001542 ADVANCE(1);
1543 HANDLE_INSTRUCTION_END();
1544
1545 HANDLE_INSTRUCTION_START(ADD_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001546 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001547 shadow_frame.GetVReg(inst->VRegB_23x()) +
1548 shadow_frame.GetVReg(inst->VRegC_23x()));
1549 ADVANCE(2);
1550 HANDLE_INSTRUCTION_END();
1551
1552 HANDLE_INSTRUCTION_START(SUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001553 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001554 shadow_frame.GetVReg(inst->VRegB_23x()) -
1555 shadow_frame.GetVReg(inst->VRegC_23x()));
1556 ADVANCE(2);
1557 HANDLE_INSTRUCTION_END();
1558
1559 HANDLE_INSTRUCTION_START(MUL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001560 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001561 shadow_frame.GetVReg(inst->VRegB_23x()) *
1562 shadow_frame.GetVReg(inst->VRegC_23x()));
1563 ADVANCE(2);
1564 HANDLE_INSTRUCTION_END();
1565
1566 HANDLE_INSTRUCTION_START(DIV_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001567 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
1568 shadow_frame.GetVReg(inst->VRegB_23x()),
1569 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001570 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1571 }
1572 HANDLE_INSTRUCTION_END();
1573
1574 HANDLE_INSTRUCTION_START(REM_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001575 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1576 shadow_frame.GetVReg(inst->VRegB_23x()),
1577 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001578 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1579 }
1580 HANDLE_INSTRUCTION_END();
1581
1582 HANDLE_INSTRUCTION_START(SHL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001583 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001584 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1585 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1586 ADVANCE(2);
1587 HANDLE_INSTRUCTION_END();
1588
1589 HANDLE_INSTRUCTION_START(SHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001590 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001591 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1592 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1593 ADVANCE(2);
1594 HANDLE_INSTRUCTION_END();
1595
1596 HANDLE_INSTRUCTION_START(USHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001597 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001598 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1599 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1600 ADVANCE(2);
1601 HANDLE_INSTRUCTION_END();
1602
1603 HANDLE_INSTRUCTION_START(AND_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001604 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001605 shadow_frame.GetVReg(inst->VRegB_23x()) &
1606 shadow_frame.GetVReg(inst->VRegC_23x()));
1607 ADVANCE(2);
1608 HANDLE_INSTRUCTION_END();
1609
1610 HANDLE_INSTRUCTION_START(OR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001611 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001612 shadow_frame.GetVReg(inst->VRegB_23x()) |
1613 shadow_frame.GetVReg(inst->VRegC_23x()));
1614 ADVANCE(2);
1615 HANDLE_INSTRUCTION_END();
1616
1617 HANDLE_INSTRUCTION_START(XOR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001618 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001619 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1620 shadow_frame.GetVReg(inst->VRegC_23x()));
1621 ADVANCE(2);
1622 HANDLE_INSTRUCTION_END();
1623
1624 HANDLE_INSTRUCTION_START(ADD_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001625 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001626 shadow_frame.GetVRegLong(inst->VRegB_23x()) +
1627 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1628 ADVANCE(2);
1629 HANDLE_INSTRUCTION_END();
1630
1631 HANDLE_INSTRUCTION_START(SUB_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001632 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001633 shadow_frame.GetVRegLong(inst->VRegB_23x()) -
1634 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1635 ADVANCE(2);
1636 HANDLE_INSTRUCTION_END();
1637
1638 HANDLE_INSTRUCTION_START(MUL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001639 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001640 shadow_frame.GetVRegLong(inst->VRegB_23x()) *
1641 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1642 ADVANCE(2);
1643 HANDLE_INSTRUCTION_END();
1644
1645 HANDLE_INSTRUCTION_START(DIV_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001646 bool success = DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
1647 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1648 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001649 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1650 }
1651 HANDLE_INSTRUCTION_END();
1652
1653 HANDLE_INSTRUCTION_START(REM_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001654 bool success = DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1655 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1656 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001657 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1658 }
1659 HANDLE_INSTRUCTION_END();
1660
1661 HANDLE_INSTRUCTION_START(AND_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001662 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001663 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1664 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1665 ADVANCE(2);
1666 HANDLE_INSTRUCTION_END();
1667
1668 HANDLE_INSTRUCTION_START(OR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001669 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001670 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1671 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1672 ADVANCE(2);
1673 HANDLE_INSTRUCTION_END();
1674
1675 HANDLE_INSTRUCTION_START(XOR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001676 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001677 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1678 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1679 ADVANCE(2);
1680 HANDLE_INSTRUCTION_END();
1681
1682 HANDLE_INSTRUCTION_START(SHL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001683 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001684 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1685 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1686 ADVANCE(2);
1687 HANDLE_INSTRUCTION_END();
1688
1689 HANDLE_INSTRUCTION_START(SHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001690 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001691 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1692 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1693 ADVANCE(2);
1694 HANDLE_INSTRUCTION_END();
1695
1696 HANDLE_INSTRUCTION_START(USHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001697 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001698 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1699 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1700 ADVANCE(2);
1701 HANDLE_INSTRUCTION_END();
1702
1703 HANDLE_INSTRUCTION_START(ADD_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001704 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001705 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1706 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1707 ADVANCE(2);
1708 HANDLE_INSTRUCTION_END();
1709
1710 HANDLE_INSTRUCTION_START(SUB_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001711 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001712 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1713 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1714 ADVANCE(2);
1715 HANDLE_INSTRUCTION_END();
1716
1717 HANDLE_INSTRUCTION_START(MUL_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001718 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001719 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1720 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1721 ADVANCE(2);
1722 HANDLE_INSTRUCTION_END();
1723
1724 HANDLE_INSTRUCTION_START(DIV_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001725 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001726 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1727 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1728 ADVANCE(2);
1729 HANDLE_INSTRUCTION_END();
1730
1731 HANDLE_INSTRUCTION_START(REM_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001732 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001733 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1734 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1735 ADVANCE(2);
1736 HANDLE_INSTRUCTION_END();
1737
1738 HANDLE_INSTRUCTION_START(ADD_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001739 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001740 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1741 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1742 ADVANCE(2);
1743 HANDLE_INSTRUCTION_END();
1744
1745 HANDLE_INSTRUCTION_START(SUB_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001746 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001747 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1748 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1749 ADVANCE(2);
1750 HANDLE_INSTRUCTION_END();
1751
1752 HANDLE_INSTRUCTION_START(MUL_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001753 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001754 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1755 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1756 ADVANCE(2);
1757 HANDLE_INSTRUCTION_END();
1758
1759 HANDLE_INSTRUCTION_START(DIV_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001760 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001761 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1762 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1763 ADVANCE(2);
1764 HANDLE_INSTRUCTION_END();
1765
1766 HANDLE_INSTRUCTION_START(REM_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001767 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001768 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1769 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1770 ADVANCE(2);
1771 HANDLE_INSTRUCTION_END();
1772
1773 HANDLE_INSTRUCTION_START(ADD_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001774 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001775 shadow_frame.SetVReg(vregA,
1776 shadow_frame.GetVReg(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001777 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001778 ADVANCE(1);
1779 }
1780 HANDLE_INSTRUCTION_END();
1781
1782 HANDLE_INSTRUCTION_START(SUB_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001783 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001784 shadow_frame.SetVReg(vregA,
1785 shadow_frame.GetVReg(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001786 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001787 ADVANCE(1);
1788 }
1789 HANDLE_INSTRUCTION_END();
1790
1791 HANDLE_INSTRUCTION_START(MUL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001792 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001793 shadow_frame.SetVReg(vregA,
1794 shadow_frame.GetVReg(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001795 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001796 ADVANCE(1);
1797 }
1798 HANDLE_INSTRUCTION_END();
1799
1800 HANDLE_INSTRUCTION_START(DIV_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001801 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001802 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001803 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001804 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1805 }
1806 HANDLE_INSTRUCTION_END();
1807
1808 HANDLE_INSTRUCTION_START(REM_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001809 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001810 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001811 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001812 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1813 }
1814 HANDLE_INSTRUCTION_END();
1815
1816 HANDLE_INSTRUCTION_START(SHL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001817 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001818 shadow_frame.SetVReg(vregA,
1819 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001820 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001821 ADVANCE(1);
1822 }
1823 HANDLE_INSTRUCTION_END();
1824
1825 HANDLE_INSTRUCTION_START(SHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001826 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001827 shadow_frame.SetVReg(vregA,
1828 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001829 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001830 ADVANCE(1);
1831 }
1832 HANDLE_INSTRUCTION_END();
1833
1834 HANDLE_INSTRUCTION_START(USHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001835 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001836 shadow_frame.SetVReg(vregA,
1837 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001838 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001839 ADVANCE(1);
1840 }
1841 HANDLE_INSTRUCTION_END();
1842
1843 HANDLE_INSTRUCTION_START(AND_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001844 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001845 shadow_frame.SetVReg(vregA,
1846 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001847 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001848 ADVANCE(1);
1849 }
1850 HANDLE_INSTRUCTION_END();
1851
1852 HANDLE_INSTRUCTION_START(OR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001853 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001854 shadow_frame.SetVReg(vregA,
1855 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001856 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001857 ADVANCE(1);
1858 }
1859 HANDLE_INSTRUCTION_END();
1860
1861 HANDLE_INSTRUCTION_START(XOR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001862 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001863 shadow_frame.SetVReg(vregA,
1864 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001865 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001866 ADVANCE(1);
1867 }
1868 HANDLE_INSTRUCTION_END();
1869
1870 HANDLE_INSTRUCTION_START(ADD_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001871 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001872 shadow_frame.SetVRegLong(vregA,
1873 shadow_frame.GetVRegLong(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001874 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001875 ADVANCE(1);
1876 }
1877 HANDLE_INSTRUCTION_END();
1878
1879 HANDLE_INSTRUCTION_START(SUB_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001880 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001881 shadow_frame.SetVRegLong(vregA,
1882 shadow_frame.GetVRegLong(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001883 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001884 ADVANCE(1);
1885 }
1886 HANDLE_INSTRUCTION_END();
1887
1888 HANDLE_INSTRUCTION_START(MUL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001889 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001890 shadow_frame.SetVRegLong(vregA,
1891 shadow_frame.GetVRegLong(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001892 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001893 ADVANCE(1);
1894 }
1895 HANDLE_INSTRUCTION_END();
1896
1897 HANDLE_INSTRUCTION_START(DIV_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001898 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001899 bool success = DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001900 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001901 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1902 }
1903 HANDLE_INSTRUCTION_END();
1904
1905 HANDLE_INSTRUCTION_START(REM_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001906 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001907 bool success = DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001908 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001909 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1910 }
1911 HANDLE_INSTRUCTION_END();
1912
1913 HANDLE_INSTRUCTION_START(AND_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001914 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001915 shadow_frame.SetVRegLong(vregA,
1916 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001917 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001918 ADVANCE(1);
1919 }
1920 HANDLE_INSTRUCTION_END();
1921
1922 HANDLE_INSTRUCTION_START(OR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001923 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001924 shadow_frame.SetVRegLong(vregA,
1925 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001926 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001927 ADVANCE(1);
1928 }
1929 HANDLE_INSTRUCTION_END();
1930
1931 HANDLE_INSTRUCTION_START(XOR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001932 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001933 shadow_frame.SetVRegLong(vregA,
1934 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001935 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001936 ADVANCE(1);
1937 }
1938 HANDLE_INSTRUCTION_END();
1939
1940 HANDLE_INSTRUCTION_START(SHL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001941 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001942 shadow_frame.SetVRegLong(vregA,
1943 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001944 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001945 ADVANCE(1);
1946 }
1947 HANDLE_INSTRUCTION_END();
1948
1949 HANDLE_INSTRUCTION_START(SHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001950 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001951 shadow_frame.SetVRegLong(vregA,
1952 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001953 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001954 ADVANCE(1);
1955 }
1956 HANDLE_INSTRUCTION_END();
1957
1958 HANDLE_INSTRUCTION_START(USHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001959 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001960 shadow_frame.SetVRegLong(vregA,
1961 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001962 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001963 ADVANCE(1);
1964 }
1965 HANDLE_INSTRUCTION_END();
1966
1967 HANDLE_INSTRUCTION_START(ADD_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001968 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001969 shadow_frame.SetVRegFloat(vregA,
1970 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001971 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001972 ADVANCE(1);
1973 }
1974 HANDLE_INSTRUCTION_END();
1975
1976 HANDLE_INSTRUCTION_START(SUB_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001977 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001978 shadow_frame.SetVRegFloat(vregA,
1979 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001980 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001981 ADVANCE(1);
1982 }
1983 HANDLE_INSTRUCTION_END();
1984
1985 HANDLE_INSTRUCTION_START(MUL_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001986 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001987 shadow_frame.SetVRegFloat(vregA,
1988 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001989 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001990 ADVANCE(1);
1991 }
1992 HANDLE_INSTRUCTION_END();
1993
1994 HANDLE_INSTRUCTION_START(DIV_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001995 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001996 shadow_frame.SetVRegFloat(vregA,
1997 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001998 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001999 ADVANCE(1);
2000 }
2001 HANDLE_INSTRUCTION_END();
2002
2003 HANDLE_INSTRUCTION_START(REM_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002004 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002005 shadow_frame.SetVRegFloat(vregA,
2006 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002007 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002008 ADVANCE(1);
2009 }
2010 HANDLE_INSTRUCTION_END();
2011
2012 HANDLE_INSTRUCTION_START(ADD_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002013 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002014 shadow_frame.SetVRegDouble(vregA,
2015 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002016 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002017 ADVANCE(1);
2018 }
2019 HANDLE_INSTRUCTION_END();
2020
2021 HANDLE_INSTRUCTION_START(SUB_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002022 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002023 shadow_frame.SetVRegDouble(vregA,
2024 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002025 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002026 ADVANCE(1);
2027 }
2028 HANDLE_INSTRUCTION_END();
2029
2030 HANDLE_INSTRUCTION_START(MUL_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002031 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002032 shadow_frame.SetVRegDouble(vregA,
2033 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002034 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002035 ADVANCE(1);
2036 }
2037 HANDLE_INSTRUCTION_END();
2038
2039 HANDLE_INSTRUCTION_START(DIV_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002040 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002041 shadow_frame.SetVRegDouble(vregA,
2042 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002043 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002044 ADVANCE(1);
2045 }
2046 HANDLE_INSTRUCTION_END();
2047
2048 HANDLE_INSTRUCTION_START(REM_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002049 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002050 shadow_frame.SetVRegDouble(vregA,
2051 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002052 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002053 ADVANCE(1);
2054 }
2055 HANDLE_INSTRUCTION_END();
2056
2057 HANDLE_INSTRUCTION_START(ADD_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002058 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2059 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) +
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002060 inst->VRegC_22s());
2061 ADVANCE(2);
2062 HANDLE_INSTRUCTION_END();
2063
2064 HANDLE_INSTRUCTION_START(RSUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002065 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002066 inst->VRegC_22s() -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002067 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002068 ADVANCE(2);
2069 HANDLE_INSTRUCTION_END();
2070
2071 HANDLE_INSTRUCTION_START(MUL_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002072 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2073 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) *
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002074 inst->VRegC_22s());
2075 ADVANCE(2);
2076 HANDLE_INSTRUCTION_END();
2077
2078 HANDLE_INSTRUCTION_START(DIV_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002079 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
2080 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002081 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2082 }
2083 HANDLE_INSTRUCTION_END();
2084
2085 HANDLE_INSTRUCTION_START(REM_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002086 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
2087 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002088 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2089 }
2090 HANDLE_INSTRUCTION_END();
2091
2092 HANDLE_INSTRUCTION_START(AND_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002093 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2094 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002095 inst->VRegC_22s());
2096 ADVANCE(2);
2097 HANDLE_INSTRUCTION_END();
2098
2099 HANDLE_INSTRUCTION_START(OR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002100 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2101 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002102 inst->VRegC_22s());
2103 ADVANCE(2);
2104 HANDLE_INSTRUCTION_END();
2105
2106 HANDLE_INSTRUCTION_START(XOR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002107 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2108 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002109 inst->VRegC_22s());
2110 ADVANCE(2);
2111 HANDLE_INSTRUCTION_END();
2112
2113 HANDLE_INSTRUCTION_START(ADD_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002114 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002115 shadow_frame.GetVReg(inst->VRegB_22b()) +
2116 inst->VRegC_22b());
2117 ADVANCE(2);
2118 HANDLE_INSTRUCTION_END();
2119
2120 HANDLE_INSTRUCTION_START(RSUB_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002121 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002122 inst->VRegC_22b() -
2123 shadow_frame.GetVReg(inst->VRegB_22b()));
2124 ADVANCE(2);
2125 HANDLE_INSTRUCTION_END();
2126
2127 HANDLE_INSTRUCTION_START(MUL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002128 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002129 shadow_frame.GetVReg(inst->VRegB_22b()) *
2130 inst->VRegC_22b());
2131 ADVANCE(2);
2132 HANDLE_INSTRUCTION_END();
2133
2134 HANDLE_INSTRUCTION_START(DIV_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002135 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
2136 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002137 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2138 }
2139 HANDLE_INSTRUCTION_END();
2140
2141 HANDLE_INSTRUCTION_START(REM_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002142 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
2143 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002144 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2145 }
2146 HANDLE_INSTRUCTION_END();
2147
2148 HANDLE_INSTRUCTION_START(AND_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002149 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002150 shadow_frame.GetVReg(inst->VRegB_22b()) &
2151 inst->VRegC_22b());
2152 ADVANCE(2);
2153 HANDLE_INSTRUCTION_END();
2154
2155 HANDLE_INSTRUCTION_START(OR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002156 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002157 shadow_frame.GetVReg(inst->VRegB_22b()) |
2158 inst->VRegC_22b());
2159 ADVANCE(2);
2160 HANDLE_INSTRUCTION_END();
2161
2162 HANDLE_INSTRUCTION_START(XOR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002163 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002164 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2165 inst->VRegC_22b());
2166 ADVANCE(2);
2167 HANDLE_INSTRUCTION_END();
2168
2169 HANDLE_INSTRUCTION_START(SHL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002170 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002171 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2172 (inst->VRegC_22b() & 0x1f));
2173 ADVANCE(2);
2174 HANDLE_INSTRUCTION_END();
2175
2176 HANDLE_INSTRUCTION_START(SHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002177 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002178 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2179 (inst->VRegC_22b() & 0x1f));
2180 ADVANCE(2);
2181 HANDLE_INSTRUCTION_END();
2182
2183 HANDLE_INSTRUCTION_START(USHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002184 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002185 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2186 (inst->VRegC_22b() & 0x1f));
2187 ADVANCE(2);
2188 HANDLE_INSTRUCTION_END();
2189
2190 HANDLE_INSTRUCTION_START(UNUSED_3E)
2191 UnexpectedOpcode(inst, mh);
2192 HANDLE_INSTRUCTION_END();
2193
2194 HANDLE_INSTRUCTION_START(UNUSED_3F)
2195 UnexpectedOpcode(inst, mh);
2196 HANDLE_INSTRUCTION_END();
2197
2198 HANDLE_INSTRUCTION_START(UNUSED_40)
2199 UnexpectedOpcode(inst, mh);
2200 HANDLE_INSTRUCTION_END();
2201
2202 HANDLE_INSTRUCTION_START(UNUSED_41)
2203 UnexpectedOpcode(inst, mh);
2204 HANDLE_INSTRUCTION_END();
2205
2206 HANDLE_INSTRUCTION_START(UNUSED_42)
2207 UnexpectedOpcode(inst, mh);
2208 HANDLE_INSTRUCTION_END();
2209
2210 HANDLE_INSTRUCTION_START(UNUSED_43)
2211 UnexpectedOpcode(inst, mh);
2212 HANDLE_INSTRUCTION_END();
2213
2214 HANDLE_INSTRUCTION_START(UNUSED_79)
2215 UnexpectedOpcode(inst, mh);
2216 HANDLE_INSTRUCTION_END();
2217
2218 HANDLE_INSTRUCTION_START(UNUSED_7A)
2219 UnexpectedOpcode(inst, mh);
2220 HANDLE_INSTRUCTION_END();
2221
2222 HANDLE_INSTRUCTION_START(UNUSED_EB)
2223 UnexpectedOpcode(inst, mh);
2224 HANDLE_INSTRUCTION_END();
2225
2226 HANDLE_INSTRUCTION_START(UNUSED_EC)
2227 UnexpectedOpcode(inst, mh);
2228 HANDLE_INSTRUCTION_END();
2229
2230 HANDLE_INSTRUCTION_START(UNUSED_ED)
2231 UnexpectedOpcode(inst, mh);
2232 HANDLE_INSTRUCTION_END();
2233
2234 HANDLE_INSTRUCTION_START(UNUSED_EE)
2235 UnexpectedOpcode(inst, mh);
2236 HANDLE_INSTRUCTION_END();
2237
2238 HANDLE_INSTRUCTION_START(UNUSED_EF)
2239 UnexpectedOpcode(inst, mh);
2240 HANDLE_INSTRUCTION_END();
2241
2242 HANDLE_INSTRUCTION_START(UNUSED_F0)
2243 UnexpectedOpcode(inst, mh);
2244 HANDLE_INSTRUCTION_END();
2245
2246 HANDLE_INSTRUCTION_START(UNUSED_F1)
2247 UnexpectedOpcode(inst, mh);
2248 HANDLE_INSTRUCTION_END();
2249
2250 HANDLE_INSTRUCTION_START(UNUSED_F2)
2251 UnexpectedOpcode(inst, mh);
2252 HANDLE_INSTRUCTION_END();
2253
2254 HANDLE_INSTRUCTION_START(UNUSED_F3)
2255 UnexpectedOpcode(inst, mh);
2256 HANDLE_INSTRUCTION_END();
2257
2258 HANDLE_INSTRUCTION_START(UNUSED_F4)
2259 UnexpectedOpcode(inst, mh);
2260 HANDLE_INSTRUCTION_END();
2261
2262 HANDLE_INSTRUCTION_START(UNUSED_F5)
2263 UnexpectedOpcode(inst, mh);
2264 HANDLE_INSTRUCTION_END();
2265
2266 HANDLE_INSTRUCTION_START(UNUSED_F6)
2267 UnexpectedOpcode(inst, mh);
2268 HANDLE_INSTRUCTION_END();
2269
2270 HANDLE_INSTRUCTION_START(UNUSED_F7)
2271 UnexpectedOpcode(inst, mh);
2272 HANDLE_INSTRUCTION_END();
2273
2274 HANDLE_INSTRUCTION_START(UNUSED_F8)
2275 UnexpectedOpcode(inst, mh);
2276 HANDLE_INSTRUCTION_END();
2277
2278 HANDLE_INSTRUCTION_START(UNUSED_F9)
2279 UnexpectedOpcode(inst, mh);
2280 HANDLE_INSTRUCTION_END();
2281
2282 HANDLE_INSTRUCTION_START(UNUSED_FA)
2283 UnexpectedOpcode(inst, mh);
2284 HANDLE_INSTRUCTION_END();
2285
2286 HANDLE_INSTRUCTION_START(UNUSED_FB)
2287 UnexpectedOpcode(inst, mh);
2288 HANDLE_INSTRUCTION_END();
2289
2290 HANDLE_INSTRUCTION_START(UNUSED_FC)
2291 UnexpectedOpcode(inst, mh);
2292 HANDLE_INSTRUCTION_END();
2293
2294 HANDLE_INSTRUCTION_START(UNUSED_FD)
2295 UnexpectedOpcode(inst, mh);
2296 HANDLE_INSTRUCTION_END();
2297
2298 HANDLE_INSTRUCTION_START(UNUSED_FE)
2299 UnexpectedOpcode(inst, mh);
2300 HANDLE_INSTRUCTION_END();
2301
2302 HANDLE_INSTRUCTION_START(UNUSED_FF)
2303 UnexpectedOpcode(inst, mh);
2304 HANDLE_INSTRUCTION_END();
2305
2306 exception_pending_label: {
2307 CHECK(self->IsExceptionPending());
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002308 if (UNLIKELY(self->TestAllFlags())) {
2309 CheckSuspend(self);
2310 }
Sebastien Hertz947ff082013-09-17 14:10:13 +02002311 Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002312 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc,
Sebastien Hertz947ff082013-09-17 14:10:13 +02002313 this_object,
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002314 instrumentation);
2315 if (found_dex_pc == DexFile::kDexNoIndex) {
2316 return JValue(); /* Handled in caller. */
2317 } else {
2318 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc);
2319 ADVANCE(displacement);
2320 }
2321 }
2322
2323 // Create alternative instruction handlers dedicated to instrumentation.
Sebastien Hertz947ff082013-09-17 14:10:13 +02002324#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
2325 instrumentation_op_##code: { \
2326 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), \
2327 shadow_frame.GetMethod(), dex_pc); \
2328 goto *handlersTable[Instruction::code]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002329 }
2330#include "dex_instruction_list.h"
2331 DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER)
2332#undef DEX_INSTRUCTION_LIST
2333#undef INSTRUMENTATION_INSTRUCTION_HANDLER
2334} // NOLINT(readability/fn_size)
2335
2336// Explicit definitions of ExecuteGotoImpl.
2337template JValue ExecuteGotoImpl<true>(Thread* self, MethodHelper& mh,
2338 const DexFile::CodeItem* code_item,
2339 ShadowFrame& shadow_frame, JValue result_register);
2340template JValue ExecuteGotoImpl<false>(Thread* self, MethodHelper& mh,
2341 const DexFile::CodeItem* code_item,
2342 ShadowFrame& shadow_frame, JValue result_register);
2343
2344} // namespace interpreter
2345} // namespace art