blob: 869729123dc066b07f814c5e5b8e668d114aa579 [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.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020032#define ADVANCE(_offset) \
33 do { \
34 int32_t disp = static_cast<int32_t>(_offset); \
35 inst = inst->RelativeAt(disp); \
36 dex_pc = static_cast<uint32_t>(static_cast<int32_t>(dex_pc) + disp); \
37 shadow_frame.SetDexPC(dex_pc); \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020038 TraceExecution(shadow_frame, inst, dex_pc, mh); \
Sebastien Hertz3b588e02013-09-11 14:33:18 +020039 inst_data = inst->Fetch16(0); \
40 goto *currentHandlersTable[inst->Opcode(inst_data)]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020041 } while (false)
42
43#define HANDLE_PENDING_EXCEPTION() goto exception_pending_label
44
45#define POSSIBLY_HANDLE_PENDING_EXCEPTION(_is_exception_pending, _offset) \
46 do { \
47 if (UNLIKELY(_is_exception_pending)) { \
48 HANDLE_PENDING_EXCEPTION(); \
49 } else { \
50 ADVANCE(_offset); \
51 } \
52 } while (false)
53
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +020054#define UPDATE_HANDLER_TABLE() \
55 do { \
56 if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
57 currentHandlersTable = instrumentationHandlersTable; \
58 } else { \
59 currentHandlersTable = handlersTable; \
60 } \
61 } while (false);
62
Sebastien Hertz8ece0502013-08-07 11:26:41 +020063#define UNREACHABLE_CODE_CHECK() \
64 do { \
65 if (kIsDebugBuild) { \
66 LOG(FATAL) << "We should not be here !"; \
67 } \
68 } while (false)
69
70#define HANDLE_INSTRUCTION_START(opcode) op_##opcode: // NOLINT(whitespace/labels)
71#define HANDLE_INSTRUCTION_END() UNREACHABLE_CODE_CHECK()
72
Sebastien Hertz8ece0502013-08-07 11:26:41 +020073template<bool do_access_check>
74JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item,
75 ShadowFrame& shadow_frame, JValue result_register) {
Jeff Haoa3faaf42013-09-03 19:07:00 -070076 bool do_assignability_check = do_access_check;
Sebastien Hertz8ece0502013-08-07 11:26:41 +020077 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
78 LOG(FATAL) << "Invalid shadow frame for interpreter use";
79 return JValue();
80 }
81 self->VerifyStack();
Sebastien Hertz8ece0502013-08-07 11:26:41 +020082
83 uint32_t dex_pc = shadow_frame.GetDexPC();
Sebastien Hertz947ff082013-09-17 14:10:13 +020084 const instrumentation::Instrumentation* const instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +020085 if (LIKELY(dex_pc == 0)) { // We are entering the method as opposed to deoptimizing..
86 if (UNLIKELY(instrumentation->HasMethodEntryListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +020087 instrumentation->MethodEnterEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +020088 shadow_frame.GetMethod(), 0);
89 }
90 }
Sebastien Hertz947ff082013-09-17 14:10:13 +020091 const Instruction* inst = Instruction::At(code_item->insns_ + dex_pc);
Sebastien Hertz3b588e02013-09-11 14:33:18 +020092 uint16_t inst_data;
Sebastien Hertz8ece0502013-08-07 11:26:41 +020093
94 // Define handlers table.
95 static const void* handlersTable[kNumPackedOpcodes] = {
96#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&op_##code,
97#include "dex_instruction_list.h"
98 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
99#undef DEX_INSTRUCTION_LIST
100#undef INSTRUCTION_HANDLER
101 };
102
103 static const void* instrumentationHandlersTable[kNumPackedOpcodes] = {
104#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&instrumentation_op_##code,
105#include "dex_instruction_list.h"
106 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
107#undef DEX_INSTRUCTION_LIST
108#undef INSTRUCTION_HANDLER
109 };
110
111 const void** currentHandlersTable;
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200112 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200113
114 // Jump to first instruction.
115 ADVANCE(0);
116 UNREACHABLE_CODE_CHECK();
117
118 HANDLE_INSTRUCTION_START(NOP)
119 ADVANCE(1);
120 HANDLE_INSTRUCTION_END();
121
122 HANDLE_INSTRUCTION_START(MOVE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200123 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
124 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200125 ADVANCE(1);
126 HANDLE_INSTRUCTION_END();
127
128 HANDLE_INSTRUCTION_START(MOVE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200129 shadow_frame.SetVReg(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200130 shadow_frame.GetVReg(inst->VRegB_22x()));
131 ADVANCE(2);
132 HANDLE_INSTRUCTION_END();
133
134 HANDLE_INSTRUCTION_START(MOVE_16)
135 shadow_frame.SetVReg(inst->VRegA_32x(),
136 shadow_frame.GetVReg(inst->VRegB_32x()));
137 ADVANCE(3);
138 HANDLE_INSTRUCTION_END();
139
140 HANDLE_INSTRUCTION_START(MOVE_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200141 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
142 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200143 ADVANCE(1);
144 HANDLE_INSTRUCTION_END();
145
146 HANDLE_INSTRUCTION_START(MOVE_WIDE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200147 shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200148 shadow_frame.GetVRegLong(inst->VRegB_22x()));
149 ADVANCE(2);
150 HANDLE_INSTRUCTION_END();
151
152 HANDLE_INSTRUCTION_START(MOVE_WIDE_16)
153 shadow_frame.SetVRegLong(inst->VRegA_32x(),
154 shadow_frame.GetVRegLong(inst->VRegB_32x()));
155 ADVANCE(3);
156 HANDLE_INSTRUCTION_END();
157
158 HANDLE_INSTRUCTION_START(MOVE_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200159 shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data),
160 shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200161 ADVANCE(1);
162 HANDLE_INSTRUCTION_END();
163
164 HANDLE_INSTRUCTION_START(MOVE_OBJECT_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200165 shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200166 shadow_frame.GetVRegReference(inst->VRegB_22x()));
167 ADVANCE(2);
168 HANDLE_INSTRUCTION_END();
169
170 HANDLE_INSTRUCTION_START(MOVE_OBJECT_16)
171 shadow_frame.SetVRegReference(inst->VRegA_32x(),
172 shadow_frame.GetVRegReference(inst->VRegB_32x()));
173 ADVANCE(3);
174 HANDLE_INSTRUCTION_END();
175
176 HANDLE_INSTRUCTION_START(MOVE_RESULT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200177 shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200178 ADVANCE(1);
179 HANDLE_INSTRUCTION_END();
180
181 HANDLE_INSTRUCTION_START(MOVE_RESULT_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200182 shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200183 ADVANCE(1);
184 HANDLE_INSTRUCTION_END();
185
186 HANDLE_INSTRUCTION_START(MOVE_RESULT_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200187 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200188 ADVANCE(1);
189 HANDLE_INSTRUCTION_END();
190
191 HANDLE_INSTRUCTION_START(MOVE_EXCEPTION) {
192 Throwable* exception = self->GetException(NULL);
193 self->ClearException();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200194 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200195 ADVANCE(1);
196 }
197 HANDLE_INSTRUCTION_END();
198
199 HANDLE_INSTRUCTION_START(RETURN_VOID) {
200 JValue result;
Sebastien Hertz043036f2013-09-09 18:26:48 +0200201 if (do_access_check) {
202 // If access checks are required then the dex-to-dex compiler and analysis of
203 // whether the class has final fields hasn't been performed. Conservatively
204 // perform the memory barrier now.
205 ANDROID_MEMBAR_STORE();
206 }
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200207 if (UNLIKELY(self->TestAllFlags())) {
208 CheckSuspend(self);
209 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200210 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200211 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200212 shadow_frame.GetMethod(), dex_pc,
213 result);
214 }
215 return result;
216 }
217 HANDLE_INSTRUCTION_END();
218
219 HANDLE_INSTRUCTION_START(RETURN_VOID_BARRIER) {
220 ANDROID_MEMBAR_STORE();
221 JValue result;
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200222 if (UNLIKELY(self->TestAllFlags())) {
223 CheckSuspend(self);
224 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200225 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200226 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200227 shadow_frame.GetMethod(), dex_pc,
228 result);
229 }
230 return result;
231 }
232 HANDLE_INSTRUCTION_END();
233
234 HANDLE_INSTRUCTION_START(RETURN) {
235 JValue result;
236 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200237 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200238 if (UNLIKELY(self->TestAllFlags())) {
239 CheckSuspend(self);
240 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200241 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200242 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200243 shadow_frame.GetMethod(), dex_pc,
244 result);
245 }
246 return result;
247 }
248 HANDLE_INSTRUCTION_END();
249
250 HANDLE_INSTRUCTION_START(RETURN_WIDE) {
251 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200252 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200253 if (UNLIKELY(self->TestAllFlags())) {
254 CheckSuspend(self);
255 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200256 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200257 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200258 shadow_frame.GetMethod(), dex_pc,
259 result);
260 }
261 return result;
262 }
263 HANDLE_INSTRUCTION_END();
264
265 HANDLE_INSTRUCTION_START(RETURN_OBJECT) {
266 JValue result;
Jeff Haoa3faaf42013-09-03 19:07:00 -0700267 Object* obj_result = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200268 result.SetJ(0);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700269 result.SetL(obj_result);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200270 if (UNLIKELY(self->TestAllFlags())) {
271 CheckSuspend(self);
272 }
Jeff Haoa3faaf42013-09-03 19:07:00 -0700273 if (do_assignability_check && obj_result != NULL) {
274 Class* return_type = MethodHelper(shadow_frame.GetMethod()).GetReturnType();
275 if (return_type == NULL) {
276 // Return the pending exception.
277 HANDLE_PENDING_EXCEPTION();
278 }
279 if (!obj_result->VerifierInstanceOf(return_type)) {
280 // This should never happen.
281 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
282 "Ljava/lang/VirtualMachineError;",
283 "Returning '%s' that is not instance of return type '%s'",
284 ClassHelper(obj_result->GetClass()).GetDescriptor(),
285 ClassHelper(return_type).GetDescriptor());
286 HANDLE_PENDING_EXCEPTION();
287 }
288 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200289 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200290 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200291 shadow_frame.GetMethod(), dex_pc,
292 result);
293 }
294 return result;
295 }
296 HANDLE_INSTRUCTION_END();
297
298 HANDLE_INSTRUCTION_START(CONST_4) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200299 uint32_t dst = inst->VRegA_11n(inst_data);
300 int32_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200301 shadow_frame.SetVReg(dst, val);
302 if (val == 0) {
303 shadow_frame.SetVRegReference(dst, NULL);
304 }
305 ADVANCE(1);
306 }
307 HANDLE_INSTRUCTION_END();
308
309 HANDLE_INSTRUCTION_START(CONST_16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200310 uint32_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200311 int32_t val = inst->VRegB_21s();
312 shadow_frame.SetVReg(dst, val);
313 if (val == 0) {
314 shadow_frame.SetVRegReference(dst, NULL);
315 }
316 ADVANCE(2);
317 }
318 HANDLE_INSTRUCTION_END();
319
320 HANDLE_INSTRUCTION_START(CONST) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200321 uint32_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200322 int32_t val = inst->VRegB_31i();
323 shadow_frame.SetVReg(dst, val);
324 if (val == 0) {
325 shadow_frame.SetVRegReference(dst, NULL);
326 }
327 ADVANCE(3);
328 }
329 HANDLE_INSTRUCTION_END();
330
331 HANDLE_INSTRUCTION_START(CONST_HIGH16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200332 uint32_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200333 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
334 shadow_frame.SetVReg(dst, val);
335 if (val == 0) {
336 shadow_frame.SetVRegReference(dst, NULL);
337 }
338 ADVANCE(2);
339 }
340 HANDLE_INSTRUCTION_END();
341
342 HANDLE_INSTRUCTION_START(CONST_WIDE_16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200343 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200344 ADVANCE(2);
345 HANDLE_INSTRUCTION_END();
346
347 HANDLE_INSTRUCTION_START(CONST_WIDE_32)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200348 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200349 ADVANCE(3);
350 HANDLE_INSTRUCTION_END();
351
352 HANDLE_INSTRUCTION_START(CONST_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200353 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200354 ADVANCE(5);
355 HANDLE_INSTRUCTION_END();
356
357 HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200358 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200359 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
360 ADVANCE(2);
361 HANDLE_INSTRUCTION_END();
362
363 HANDLE_INSTRUCTION_START(CONST_STRING) {
364 String* s = ResolveString(self, mh, inst->VRegB_21c());
365 if (UNLIKELY(s == NULL)) {
366 HANDLE_PENDING_EXCEPTION();
367 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200368 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200369 ADVANCE(2);
370 }
371 }
372 HANDLE_INSTRUCTION_END();
373
374 HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
375 String* s = ResolveString(self, mh, inst->VRegB_31c());
376 if (UNLIKELY(s == NULL)) {
377 HANDLE_PENDING_EXCEPTION();
378 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200379 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200380 ADVANCE(3);
381 }
382 }
383 HANDLE_INSTRUCTION_END();
384
385 HANDLE_INSTRUCTION_START(CONST_CLASS) {
386 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
387 self, false, do_access_check);
388 if (UNLIKELY(c == NULL)) {
389 HANDLE_PENDING_EXCEPTION();
390 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200391 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200392 ADVANCE(2);
393 }
394 }
395 HANDLE_INSTRUCTION_END();
396
397 HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200398 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200399 if (UNLIKELY(obj == NULL)) {
400 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
401 HANDLE_PENDING_EXCEPTION();
402 } else {
403 DoMonitorEnter(self, obj);
404 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
405 }
406 }
407 HANDLE_INSTRUCTION_END();
408
409 HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200410 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200411 if (UNLIKELY(obj == NULL)) {
412 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
413 HANDLE_PENDING_EXCEPTION();
414 } else {
415 DoMonitorExit(self, obj);
416 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
417 }
418 }
419 HANDLE_INSTRUCTION_END();
420
421 HANDLE_INSTRUCTION_START(CHECK_CAST) {
422 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
423 self, false, do_access_check);
424 if (UNLIKELY(c == NULL)) {
425 HANDLE_PENDING_EXCEPTION();
426 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200427 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200428 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
429 ThrowClassCastException(c, obj->GetClass());
430 HANDLE_PENDING_EXCEPTION();
431 } else {
432 ADVANCE(2);
433 }
434 }
435 }
436 HANDLE_INSTRUCTION_END();
437
438 HANDLE_INSTRUCTION_START(INSTANCE_OF) {
439 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
440 self, false, do_access_check);
441 if (UNLIKELY(c == NULL)) {
442 HANDLE_PENDING_EXCEPTION();
443 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200444 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
445 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200446 ADVANCE(2);
447 }
448 }
449 HANDLE_INSTRUCTION_END();
450
451 HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200452 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200453 if (UNLIKELY(array == NULL)) {
454 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
455 HANDLE_PENDING_EXCEPTION();
456 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200457 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200458 ADVANCE(1);
459 }
460 }
461 HANDLE_INSTRUCTION_END();
462
463 HANDLE_INSTRUCTION_START(NEW_INSTANCE) {
464 Object* obj = AllocObjectFromCode(inst->VRegB_21c(), shadow_frame.GetMethod(),
465 self, do_access_check);
466 if (UNLIKELY(obj == NULL)) {
467 HANDLE_PENDING_EXCEPTION();
468 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200469 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200470 ADVANCE(2);
471 }
472 }
473 HANDLE_INSTRUCTION_END();
474
475 HANDLE_INSTRUCTION_START(NEW_ARRAY) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200476 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200477 Object* obj = AllocArrayFromCode(inst->VRegC_22c(), shadow_frame.GetMethod(),
478 length, self, do_access_check);
479 if (UNLIKELY(obj == NULL)) {
480 HANDLE_PENDING_EXCEPTION();
481 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200482 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200483 ADVANCE(2);
484 }
485 }
486 HANDLE_INSTRUCTION_END();
487
488 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) {
489 bool success = DoFilledNewArray<false, do_access_check>(inst, shadow_frame,
490 self, &result_register);
491 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
492 }
493 HANDLE_INSTRUCTION_END();
494
495 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) {
496 bool success = DoFilledNewArray<true, do_access_check>(inst, shadow_frame,
497 self, &result_register);
498 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
499 }
500 HANDLE_INSTRUCTION_END();
501
502 HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200503 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200504 if (UNLIKELY(obj == NULL)) {
505 ThrowNullPointerException(NULL, "null array in FILL_ARRAY_DATA");
506 HANDLE_PENDING_EXCEPTION();
507 } else {
508 Array* array = obj->AsArray();
509 DCHECK(array->IsArrayInstance() && !array->IsObjectArray());
510 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
511 const Instruction::ArrayDataPayload* payload =
512 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
513 if (UNLIKELY(static_cast<int32_t>(payload->element_count) > array->GetLength())) {
514 self->ThrowNewExceptionF(shadow_frame.GetCurrentLocationForThrow(),
515 "Ljava/lang/ArrayIndexOutOfBoundsException;",
516 "failed FILL_ARRAY_DATA; length=%d, index=%d",
517 array->GetLength(), payload->element_count);
518 HANDLE_PENDING_EXCEPTION();
519 } else {
520 uint32_t size_in_bytes = payload->element_count * payload->element_width;
521 memcpy(array->GetRawData(payload->element_width), payload->data, size_in_bytes);
522 ADVANCE(3);
523 }
524 }
525 }
526 HANDLE_INSTRUCTION_END();
527
528 HANDLE_INSTRUCTION_START(THROW) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200529 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200530 if (UNLIKELY(exception == NULL)) {
531 ThrowNullPointerException(NULL, "throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700532 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
533 // This should never happen.
534 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
535 "Ljava/lang/VirtualMachineError;",
536 "Throwing '%s' that is not instance of Throwable",
537 ClassHelper(exception->GetClass()).GetDescriptor());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200538 } else {
539 self->SetException(shadow_frame.GetCurrentLocationForThrow(), exception->AsThrowable());
540 }
541 HANDLE_PENDING_EXCEPTION();
542 }
543 HANDLE_INSTRUCTION_END();
544
545 HANDLE_INSTRUCTION_START(GOTO) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200546 int8_t offset = inst->VRegA_10t(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200547 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200548 if (UNLIKELY(self->TestAllFlags())) {
549 CheckSuspend(self);
550 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200551 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200552 }
553 ADVANCE(offset);
554 }
555 HANDLE_INSTRUCTION_END();
556
557 HANDLE_INSTRUCTION_START(GOTO_16) {
558 int16_t offset = inst->VRegA_20t();
559 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200560 if (UNLIKELY(self->TestAllFlags())) {
561 CheckSuspend(self);
562 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200563 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200564 }
565 ADVANCE(offset);
566 }
567 HANDLE_INSTRUCTION_END();
568
569 HANDLE_INSTRUCTION_START(GOTO_32) {
570 int32_t offset = inst->VRegA_30t();
571 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200572 if (UNLIKELY(self->TestAllFlags())) {
573 CheckSuspend(self);
574 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200575 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200576 }
577 ADVANCE(offset);
578 }
579 HANDLE_INSTRUCTION_END();
580
581 HANDLE_INSTRUCTION_START(PACKED_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200582 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200583 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200584 if (UNLIKELY(self->TestAllFlags())) {
585 CheckSuspend(self);
586 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200587 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200588 }
589 ADVANCE(offset);
590 }
591 HANDLE_INSTRUCTION_END();
592
593 HANDLE_INSTRUCTION_START(SPARSE_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200594 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200595 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200596 if (UNLIKELY(self->TestAllFlags())) {
597 CheckSuspend(self);
598 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200599 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200600 }
601 ADVANCE(offset);
602 }
603 HANDLE_INSTRUCTION_END();
604
605 HANDLE_INSTRUCTION_START(CMPL_FLOAT) {
606 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
607 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
608 int32_t result;
609 if (val1 > val2) {
610 result = 1;
611 } else if (val1 == val2) {
612 result = 0;
613 } else {
614 result = -1;
615 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200616 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200617 ADVANCE(2);
618 }
619 HANDLE_INSTRUCTION_END();
620
621 HANDLE_INSTRUCTION_START(CMPG_FLOAT) {
622 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
623 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
624 int32_t result;
625 if (val1 < val2) {
626 result = -1;
627 } else if (val1 == val2) {
628 result = 0;
629 } else {
630 result = 1;
631 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200632 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200633 ADVANCE(2);
634 }
635 HANDLE_INSTRUCTION_END();
636
637 HANDLE_INSTRUCTION_START(CMPL_DOUBLE) {
638 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
639 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
640 int32_t result;
641 if (val1 > val2) {
642 result = 1;
643 } else if (val1 == val2) {
644 result = 0;
645 } else {
646 result = -1;
647 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200648 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200649 ADVANCE(2);
650 }
651 HANDLE_INSTRUCTION_END();
652
653 HANDLE_INSTRUCTION_START(CMPG_DOUBLE) {
654 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
655 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
656 int32_t result;
657 if (val1 < val2) {
658 result = -1;
659 } else if (val1 == val2) {
660 result = 0;
661 } else {
662 result = 1;
663 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200664 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200665 ADVANCE(2);
666 }
667 HANDLE_INSTRUCTION_END();
668
669 HANDLE_INSTRUCTION_START(CMP_LONG) {
670 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
671 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
672 int32_t result;
673 if (val1 > val2) {
674 result = 1;
675 } else if (val1 == val2) {
676 result = 0;
677 } else {
678 result = -1;
679 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200680 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200681 ADVANCE(2);
682 }
683 HANDLE_INSTRUCTION_END();
684
685 HANDLE_INSTRUCTION_START(IF_EQ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200686 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200687 int16_t offset = inst->VRegC_22t();
688 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200689 if (UNLIKELY(self->TestAllFlags())) {
690 CheckSuspend(self);
691 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200692 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200693 }
694 ADVANCE(offset);
695 } else {
696 ADVANCE(2);
697 }
698 }
699 HANDLE_INSTRUCTION_END();
700
701 HANDLE_INSTRUCTION_START(IF_NE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200702 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) != shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200703 int16_t offset = inst->VRegC_22t();
704 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200705 if (UNLIKELY(self->TestAllFlags())) {
706 CheckSuspend(self);
707 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200708 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200709 }
710 ADVANCE(offset);
711 } else {
712 ADVANCE(2);
713 }
714 }
715 HANDLE_INSTRUCTION_END();
716
717 HANDLE_INSTRUCTION_START(IF_LT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200718 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) < shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200719 int16_t offset = inst->VRegC_22t();
720 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200721 if (UNLIKELY(self->TestAllFlags())) {
722 CheckSuspend(self);
723 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200724 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200725 }
726 ADVANCE(offset);
727 } else {
728 ADVANCE(2);
729 }
730 }
731 HANDLE_INSTRUCTION_END();
732
733 HANDLE_INSTRUCTION_START(IF_GE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200734 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200735 int16_t offset = inst->VRegC_22t();
736 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200737 if (UNLIKELY(self->TestAllFlags())) {
738 CheckSuspend(self);
739 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200740 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200741 }
742 ADVANCE(offset);
743 } else {
744 ADVANCE(2);
745 }
746 }
747 HANDLE_INSTRUCTION_END();
748
749 HANDLE_INSTRUCTION_START(IF_GT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200750 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200751 int16_t offset = inst->VRegC_22t();
752 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200753 if (UNLIKELY(self->TestAllFlags())) {
754 CheckSuspend(self);
755 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200756 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200757 }
758 ADVANCE(offset);
759 } else {
760 ADVANCE(2);
761 }
762 }
763 HANDLE_INSTRUCTION_END();
764
765 HANDLE_INSTRUCTION_START(IF_LE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200766 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200767 int16_t offset = inst->VRegC_22t();
768 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200769 if (UNLIKELY(self->TestAllFlags())) {
770 CheckSuspend(self);
771 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200772 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200773 }
774 ADVANCE(offset);
775 } else {
776 ADVANCE(2);
777 }
778 }
779 HANDLE_INSTRUCTION_END();
780
781 HANDLE_INSTRUCTION_START(IF_EQZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200782 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200783 int16_t offset = inst->VRegB_21t();
784 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200785 if (UNLIKELY(self->TestAllFlags())) {
786 CheckSuspend(self);
787 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200788 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200789 }
790 ADVANCE(offset);
791 } else {
792 ADVANCE(2);
793 }
794 }
795 HANDLE_INSTRUCTION_END();
796
797 HANDLE_INSTRUCTION_START(IF_NEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200798 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200799 int16_t offset = inst->VRegB_21t();
800 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200801 if (UNLIKELY(self->TestAllFlags())) {
802 CheckSuspend(self);
803 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200804 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200805 }
806 ADVANCE(offset);
807 } else {
808 ADVANCE(2);
809 }
810 }
811 HANDLE_INSTRUCTION_END();
812
813 HANDLE_INSTRUCTION_START(IF_LTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200814 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200815 int16_t offset = inst->VRegB_21t();
816 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200817 if (UNLIKELY(self->TestAllFlags())) {
818 CheckSuspend(self);
819 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200820 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200821 }
822 ADVANCE(offset);
823 } else {
824 ADVANCE(2);
825 }
826 }
827 HANDLE_INSTRUCTION_END();
828
829 HANDLE_INSTRUCTION_START(IF_GEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200830 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200831 int16_t offset = inst->VRegB_21t();
832 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200833 if (UNLIKELY(self->TestAllFlags())) {
834 CheckSuspend(self);
835 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200836 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200837 }
838 ADVANCE(offset);
839 } else {
840 ADVANCE(2);
841 }
842 }
843 HANDLE_INSTRUCTION_END();
844
845 HANDLE_INSTRUCTION_START(IF_GTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200846 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200847 int16_t offset = inst->VRegB_21t();
848 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200849 if (UNLIKELY(self->TestAllFlags())) {
850 CheckSuspend(self);
851 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200852 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200853 }
854 ADVANCE(offset);
855 } else {
856 ADVANCE(2);
857 }
858 }
859 HANDLE_INSTRUCTION_END();
860
861 HANDLE_INSTRUCTION_START(IF_LEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200862 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200863 int16_t offset = inst->VRegB_21t();
864 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200865 if (UNLIKELY(self->TestAllFlags())) {
866 CheckSuspend(self);
867 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200868 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200869 }
870 ADVANCE(offset);
871 } else {
872 ADVANCE(2);
873 }
874 }
875 HANDLE_INSTRUCTION_END();
876
877 HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
878 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
879 if (UNLIKELY(a == NULL)) {
880 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
881 HANDLE_PENDING_EXCEPTION();
882 } else {
883 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
884 BooleanArray* array = a->AsBooleanArray();
885 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200886 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200887 ADVANCE(2);
888 } else {
889 HANDLE_PENDING_EXCEPTION();
890 }
891 }
892 }
893 HANDLE_INSTRUCTION_END();
894
895 HANDLE_INSTRUCTION_START(AGET_BYTE) {
896 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
897 if (UNLIKELY(a == NULL)) {
898 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
899 HANDLE_PENDING_EXCEPTION();
900 } else {
901 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
902 ByteArray* array = a->AsByteArray();
903 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200904 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200905 ADVANCE(2);
906 } else {
907 HANDLE_PENDING_EXCEPTION();
908 }
909 }
910 }
911 HANDLE_INSTRUCTION_END();
912
913 HANDLE_INSTRUCTION_START(AGET_CHAR) {
914 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
915 if (UNLIKELY(a == NULL)) {
916 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
917 HANDLE_PENDING_EXCEPTION();
918 } else {
919 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
920 CharArray* array = a->AsCharArray();
921 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200922 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200923 ADVANCE(2);
924 } else {
925 HANDLE_PENDING_EXCEPTION();
926 }
927 }
928 }
929 HANDLE_INSTRUCTION_END();
930
931 HANDLE_INSTRUCTION_START(AGET_SHORT) {
932 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
933 if (UNLIKELY(a == NULL)) {
934 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
935 HANDLE_PENDING_EXCEPTION();
936 } else {
937 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
938 ShortArray* array = a->AsShortArray();
939 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200940 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200941 ADVANCE(2);
942 } else {
943 HANDLE_PENDING_EXCEPTION();
944 }
945 }
946 }
947 HANDLE_INSTRUCTION_END();
948
949 HANDLE_INSTRUCTION_START(AGET) {
950 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
951 if (UNLIKELY(a == NULL)) {
952 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
953 HANDLE_PENDING_EXCEPTION();
954 } else {
955 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
956 IntArray* array = a->AsIntArray();
957 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200958 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200959 ADVANCE(2);
960 } else {
961 HANDLE_PENDING_EXCEPTION();
962 }
963 }
964 }
965 HANDLE_INSTRUCTION_END();
966
967 HANDLE_INSTRUCTION_START(AGET_WIDE) {
968 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
969 if (UNLIKELY(a == NULL)) {
970 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
971 HANDLE_PENDING_EXCEPTION();
972 } else {
973 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
974 LongArray* array = a->AsLongArray();
975 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200976 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200977 ADVANCE(2);
978 } else {
979 HANDLE_PENDING_EXCEPTION();
980 }
981 }
982 }
983 HANDLE_INSTRUCTION_END();
984
985 HANDLE_INSTRUCTION_START(AGET_OBJECT) {
986 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
987 if (UNLIKELY(a == NULL)) {
988 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
989 HANDLE_PENDING_EXCEPTION();
990 } else {
991 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
992 ObjectArray<Object>* array = a->AsObjectArray<Object>();
993 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200994 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200995 ADVANCE(2);
996 } else {
997 HANDLE_PENDING_EXCEPTION();
998 }
999 }
1000 }
1001 HANDLE_INSTRUCTION_END();
1002
1003 HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
1004 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1005 if (UNLIKELY(a == NULL)) {
1006 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1007 HANDLE_PENDING_EXCEPTION();
1008 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001009 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001010 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1011 BooleanArray* array = a->AsBooleanArray();
1012 if (LIKELY(array->IsValidIndex(index))) {
1013 array->GetData()[index] = val;
1014 ADVANCE(2);
1015 } else {
1016 HANDLE_PENDING_EXCEPTION();
1017 }
1018 }
1019 }
1020 HANDLE_INSTRUCTION_END();
1021
1022 HANDLE_INSTRUCTION_START(APUT_BYTE) {
1023 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1024 if (UNLIKELY(a == NULL)) {
1025 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1026 HANDLE_PENDING_EXCEPTION();
1027 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001028 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001029 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1030 ByteArray* array = a->AsByteArray();
1031 if (LIKELY(array->IsValidIndex(index))) {
1032 array->GetData()[index] = val;
1033 ADVANCE(2);
1034 } else {
1035 HANDLE_PENDING_EXCEPTION();
1036 }
1037 }
1038 }
1039 HANDLE_INSTRUCTION_END();
1040
1041 HANDLE_INSTRUCTION_START(APUT_CHAR) {
1042 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1043 if (UNLIKELY(a == NULL)) {
1044 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1045 HANDLE_PENDING_EXCEPTION();
1046 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001047 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001048 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1049 CharArray* array = a->AsCharArray();
1050 if (LIKELY(array->IsValidIndex(index))) {
1051 array->GetData()[index] = val;
1052 ADVANCE(2);
1053 } else {
1054 HANDLE_PENDING_EXCEPTION();
1055 }
1056 }
1057 }
1058 HANDLE_INSTRUCTION_END();
1059
1060 HANDLE_INSTRUCTION_START(APUT_SHORT) {
1061 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1062 if (UNLIKELY(a == NULL)) {
1063 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1064 HANDLE_PENDING_EXCEPTION();
1065 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001066 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001067 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1068 ShortArray* array = a->AsShortArray();
1069 if (LIKELY(array->IsValidIndex(index))) {
1070 array->GetData()[index] = val;
1071 ADVANCE(2);
1072 } else {
1073 HANDLE_PENDING_EXCEPTION();
1074 }
1075 }
1076 }
1077 HANDLE_INSTRUCTION_END();
1078
1079 HANDLE_INSTRUCTION_START(APUT) {
1080 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1081 if (UNLIKELY(a == NULL)) {
1082 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1083 HANDLE_PENDING_EXCEPTION();
1084 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001085 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001086 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1087 IntArray* array = a->AsIntArray();
1088 if (LIKELY(array->IsValidIndex(index))) {
1089 array->GetData()[index] = val;
1090 ADVANCE(2);
1091 } else {
1092 HANDLE_PENDING_EXCEPTION();
1093 }
1094 }
1095 }
1096 HANDLE_INSTRUCTION_END();
1097
1098 HANDLE_INSTRUCTION_START(APUT_WIDE) {
1099 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1100 if (UNLIKELY(a == NULL)) {
1101 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1102 HANDLE_PENDING_EXCEPTION();
1103 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001104 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001105 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1106 LongArray* array = a->AsLongArray();
1107 if (LIKELY(array->IsValidIndex(index))) {
1108 array->GetData()[index] = val;
1109 ADVANCE(2);
1110 } else {
1111 HANDLE_PENDING_EXCEPTION();
1112 }
1113 }
1114 }
1115 HANDLE_INSTRUCTION_END();
1116
1117 HANDLE_INSTRUCTION_START(APUT_OBJECT) {
1118 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1119 if (UNLIKELY(a == NULL)) {
1120 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1121 HANDLE_PENDING_EXCEPTION();
1122 } else {
1123 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001124 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001125 ObjectArray<Object>* array = a->AsObjectArray<Object>();
1126 if (LIKELY(array->IsValidIndex(index) && array->CheckAssignable(val))) {
1127 array->SetWithoutChecks(index, val);
1128 ADVANCE(2);
1129 } else {
1130 HANDLE_PENDING_EXCEPTION();
1131 }
1132 }
1133 }
1134 HANDLE_INSTRUCTION_END();
1135
1136 HANDLE_INSTRUCTION_START(IGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001137 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001138 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1139 }
1140 HANDLE_INSTRUCTION_END();
1141
1142 HANDLE_INSTRUCTION_START(IGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001143 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001144 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1145 }
1146 HANDLE_INSTRUCTION_END();
1147
1148 HANDLE_INSTRUCTION_START(IGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001149 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001150 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1151 }
1152 HANDLE_INSTRUCTION_END();
1153
1154 HANDLE_INSTRUCTION_START(IGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001155 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001156 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1157 }
1158 HANDLE_INSTRUCTION_END();
1159
1160 HANDLE_INSTRUCTION_START(IGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001161 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001162 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1163 }
1164 HANDLE_INSTRUCTION_END();
1165
1166 HANDLE_INSTRUCTION_START(IGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001167 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001168 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1169 }
1170 HANDLE_INSTRUCTION_END();
1171
1172 HANDLE_INSTRUCTION_START(IGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001173 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001174 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1175 }
1176 HANDLE_INSTRUCTION_END();
1177
1178 HANDLE_INSTRUCTION_START(IGET_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001179 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001180 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1181 }
1182 HANDLE_INSTRUCTION_END();
1183
1184 HANDLE_INSTRUCTION_START(IGET_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001185 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001186 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1187 }
1188 HANDLE_INSTRUCTION_END();
1189
1190 HANDLE_INSTRUCTION_START(IGET_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001191 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001192 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1193 }
1194 HANDLE_INSTRUCTION_END();
1195
1196 HANDLE_INSTRUCTION_START(SGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001197 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001198 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1199 }
1200 HANDLE_INSTRUCTION_END();
1201
1202 HANDLE_INSTRUCTION_START(SGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001203 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001204 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1205 }
1206 HANDLE_INSTRUCTION_END();
1207
1208 HANDLE_INSTRUCTION_START(SGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001209 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001210 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1211 }
1212 HANDLE_INSTRUCTION_END();
1213
1214 HANDLE_INSTRUCTION_START(SGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001215 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001216 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1217 }
1218 HANDLE_INSTRUCTION_END();
1219
1220 HANDLE_INSTRUCTION_START(SGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001221 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001222 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1223 }
1224 HANDLE_INSTRUCTION_END();
1225
1226 HANDLE_INSTRUCTION_START(SGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001227 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001228 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1229 }
1230 HANDLE_INSTRUCTION_END();
1231
1232 HANDLE_INSTRUCTION_START(SGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001233 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001234 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1235 }
1236 HANDLE_INSTRUCTION_END();
1237
1238 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001239 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001240 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1241 }
1242 HANDLE_INSTRUCTION_END();
1243
1244 HANDLE_INSTRUCTION_START(IPUT_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001245 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001246 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1247 }
1248 HANDLE_INSTRUCTION_END();
1249
1250 HANDLE_INSTRUCTION_START(IPUT_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001251 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001252 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1253 }
1254 HANDLE_INSTRUCTION_END();
1255
1256 HANDLE_INSTRUCTION_START(IPUT_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001257 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001258 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1259 }
1260 HANDLE_INSTRUCTION_END();
1261
1262 HANDLE_INSTRUCTION_START(IPUT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001263 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001264 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1265 }
1266 HANDLE_INSTRUCTION_END();
1267
1268 HANDLE_INSTRUCTION_START(IPUT_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001269 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001270 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1271 }
1272 HANDLE_INSTRUCTION_END();
1273
1274 HANDLE_INSTRUCTION_START(IPUT_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001275 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001276 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1277 }
1278 HANDLE_INSTRUCTION_END();
1279
1280 HANDLE_INSTRUCTION_START(IPUT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001281 bool success = DoIPutQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001282 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1283 }
1284 HANDLE_INSTRUCTION_END();
1285
1286 HANDLE_INSTRUCTION_START(IPUT_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001287 bool success = DoIPutQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001288 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1289 }
1290 HANDLE_INSTRUCTION_END();
1291
1292 HANDLE_INSTRUCTION_START(IPUT_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001293 bool success = DoIPutQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001294 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1295 }
1296 HANDLE_INSTRUCTION_END();
1297
1298 HANDLE_INSTRUCTION_START(SPUT_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001299 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001300 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1301 }
1302 HANDLE_INSTRUCTION_END();
1303
1304 HANDLE_INSTRUCTION_START(SPUT_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001305 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001306 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1307 }
1308 HANDLE_INSTRUCTION_END();
1309
1310 HANDLE_INSTRUCTION_START(SPUT_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001311 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001312 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1313 }
1314 HANDLE_INSTRUCTION_END();
1315
1316 HANDLE_INSTRUCTION_START(SPUT_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001317 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001318 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1319 }
1320 HANDLE_INSTRUCTION_END();
1321
1322 HANDLE_INSTRUCTION_START(SPUT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001323 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001324 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1325 }
1326 HANDLE_INSTRUCTION_END();
1327
1328 HANDLE_INSTRUCTION_START(SPUT_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001329 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001330 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1331 }
1332 HANDLE_INSTRUCTION_END();
1333
1334 HANDLE_INSTRUCTION_START(SPUT_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001335 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001336 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1337 }
1338 HANDLE_INSTRUCTION_END();
1339
1340 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001341 bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001342 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001343 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1344 }
1345 HANDLE_INSTRUCTION_END();
1346
1347 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001348 bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001349 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001350 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1351 }
1352 HANDLE_INSTRUCTION_END();
1353
1354 HANDLE_INSTRUCTION_START(INVOKE_SUPER) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001355 bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001356 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001357 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1358 }
1359 HANDLE_INSTRUCTION_END();
1360
1361 HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001362 bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001363 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001364 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1365 }
1366 HANDLE_INSTRUCTION_END();
1367
1368 HANDLE_INSTRUCTION_START(INVOKE_DIRECT) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001369 bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001370 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001371 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1372 }
1373 HANDLE_INSTRUCTION_END();
1374
1375 HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001376 bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001377 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001378 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1379 }
1380 HANDLE_INSTRUCTION_END();
1381
1382 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001383 bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001384 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001385 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1386 }
1387 HANDLE_INSTRUCTION_END();
1388
1389 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001390 bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001391 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001392 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1393 }
1394 HANDLE_INSTRUCTION_END();
1395
1396 HANDLE_INSTRUCTION_START(INVOKE_STATIC) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001397 bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001398 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001399 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1400 }
1401 HANDLE_INSTRUCTION_END();
1402
1403 HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001404 bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001405 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001406 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1407 }
1408 HANDLE_INSTRUCTION_END();
1409
1410 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001411 bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001412 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001413 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1414 }
1415 HANDLE_INSTRUCTION_END();
1416
1417 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001418 bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001419 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001420 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1421 }
1422 HANDLE_INSTRUCTION_END();
1423
1424 HANDLE_INSTRUCTION_START(NEG_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001425 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001426 ADVANCE(1);
1427 HANDLE_INSTRUCTION_END();
1428
1429 HANDLE_INSTRUCTION_START(NOT_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001430 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001431 ADVANCE(1);
1432 HANDLE_INSTRUCTION_END();
1433
1434 HANDLE_INSTRUCTION_START(NEG_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001435 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001436 ADVANCE(1);
1437 HANDLE_INSTRUCTION_END();
1438
1439 HANDLE_INSTRUCTION_START(NOT_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001440 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001441 ADVANCE(1);
1442 HANDLE_INSTRUCTION_END();
1443
1444 HANDLE_INSTRUCTION_START(NEG_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001445 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001446 ADVANCE(1);
1447 HANDLE_INSTRUCTION_END();
1448
1449 HANDLE_INSTRUCTION_START(NEG_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001450 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001451 ADVANCE(1);
1452 HANDLE_INSTRUCTION_END();
1453
1454 HANDLE_INSTRUCTION_START(INT_TO_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001455 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001456 ADVANCE(1);
1457 HANDLE_INSTRUCTION_END();
1458
1459 HANDLE_INSTRUCTION_START(INT_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001460 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001461 ADVANCE(1);
1462 HANDLE_INSTRUCTION_END();
1463
1464 HANDLE_INSTRUCTION_START(INT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001465 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001466 ADVANCE(1);
1467 HANDLE_INSTRUCTION_END();
1468
1469 HANDLE_INSTRUCTION_START(LONG_TO_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001470 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001471 ADVANCE(1);
1472 HANDLE_INSTRUCTION_END();
1473
1474 HANDLE_INSTRUCTION_START(LONG_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001475 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001476 ADVANCE(1);
1477 HANDLE_INSTRUCTION_END();
1478
1479 HANDLE_INSTRUCTION_START(LONG_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001480 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001481 ADVANCE(1);
1482 HANDLE_INSTRUCTION_END();
1483
1484 HANDLE_INSTRUCTION_START(FLOAT_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001485 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001486 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001487 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001488 ADVANCE(1);
1489 }
1490 HANDLE_INSTRUCTION_END();
1491
1492 HANDLE_INSTRUCTION_START(FLOAT_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001493 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001494 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001495 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001496 ADVANCE(1);
1497 }
1498 HANDLE_INSTRUCTION_END();
1499
1500 HANDLE_INSTRUCTION_START(FLOAT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001501 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001502 ADVANCE(1);
1503 HANDLE_INSTRUCTION_END();
1504
1505 HANDLE_INSTRUCTION_START(DOUBLE_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001506 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001507 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001508 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001509 ADVANCE(1);
1510 }
1511 HANDLE_INSTRUCTION_END();
1512
1513 HANDLE_INSTRUCTION_START(DOUBLE_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001514 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001515 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001516 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001517 ADVANCE(1);
1518 }
1519 HANDLE_INSTRUCTION_END();
1520
1521 HANDLE_INSTRUCTION_START(DOUBLE_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001522 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001523 ADVANCE(1);
1524 HANDLE_INSTRUCTION_END();
1525
1526 HANDLE_INSTRUCTION_START(INT_TO_BYTE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001527 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1528 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001529 ADVANCE(1);
1530 HANDLE_INSTRUCTION_END();
1531
1532 HANDLE_INSTRUCTION_START(INT_TO_CHAR)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001533 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1534 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001535 ADVANCE(1);
1536 HANDLE_INSTRUCTION_END();
1537
1538 HANDLE_INSTRUCTION_START(INT_TO_SHORT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001539 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1540 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001541 ADVANCE(1);
1542 HANDLE_INSTRUCTION_END();
1543
1544 HANDLE_INSTRUCTION_START(ADD_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001545 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001546 shadow_frame.GetVReg(inst->VRegB_23x()) +
1547 shadow_frame.GetVReg(inst->VRegC_23x()));
1548 ADVANCE(2);
1549 HANDLE_INSTRUCTION_END();
1550
1551 HANDLE_INSTRUCTION_START(SUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001552 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001553 shadow_frame.GetVReg(inst->VRegB_23x()) -
1554 shadow_frame.GetVReg(inst->VRegC_23x()));
1555 ADVANCE(2);
1556 HANDLE_INSTRUCTION_END();
1557
1558 HANDLE_INSTRUCTION_START(MUL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001559 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001560 shadow_frame.GetVReg(inst->VRegB_23x()) *
1561 shadow_frame.GetVReg(inst->VRegC_23x()));
1562 ADVANCE(2);
1563 HANDLE_INSTRUCTION_END();
1564
1565 HANDLE_INSTRUCTION_START(DIV_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001566 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
1567 shadow_frame.GetVReg(inst->VRegB_23x()),
1568 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001569 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1570 }
1571 HANDLE_INSTRUCTION_END();
1572
1573 HANDLE_INSTRUCTION_START(REM_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001574 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1575 shadow_frame.GetVReg(inst->VRegB_23x()),
1576 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001577 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1578 }
1579 HANDLE_INSTRUCTION_END();
1580
1581 HANDLE_INSTRUCTION_START(SHL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001582 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001583 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1584 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1585 ADVANCE(2);
1586 HANDLE_INSTRUCTION_END();
1587
1588 HANDLE_INSTRUCTION_START(SHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001589 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001590 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1591 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1592 ADVANCE(2);
1593 HANDLE_INSTRUCTION_END();
1594
1595 HANDLE_INSTRUCTION_START(USHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001596 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001597 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1598 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1599 ADVANCE(2);
1600 HANDLE_INSTRUCTION_END();
1601
1602 HANDLE_INSTRUCTION_START(AND_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001603 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001604 shadow_frame.GetVReg(inst->VRegB_23x()) &
1605 shadow_frame.GetVReg(inst->VRegC_23x()));
1606 ADVANCE(2);
1607 HANDLE_INSTRUCTION_END();
1608
1609 HANDLE_INSTRUCTION_START(OR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001610 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001611 shadow_frame.GetVReg(inst->VRegB_23x()) |
1612 shadow_frame.GetVReg(inst->VRegC_23x()));
1613 ADVANCE(2);
1614 HANDLE_INSTRUCTION_END();
1615
1616 HANDLE_INSTRUCTION_START(XOR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001617 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001618 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1619 shadow_frame.GetVReg(inst->VRegC_23x()));
1620 ADVANCE(2);
1621 HANDLE_INSTRUCTION_END();
1622
1623 HANDLE_INSTRUCTION_START(ADD_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001624 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001625 shadow_frame.GetVRegLong(inst->VRegB_23x()) +
1626 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1627 ADVANCE(2);
1628 HANDLE_INSTRUCTION_END();
1629
1630 HANDLE_INSTRUCTION_START(SUB_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001631 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001632 shadow_frame.GetVRegLong(inst->VRegB_23x()) -
1633 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1634 ADVANCE(2);
1635 HANDLE_INSTRUCTION_END();
1636
1637 HANDLE_INSTRUCTION_START(MUL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001638 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001639 shadow_frame.GetVRegLong(inst->VRegB_23x()) *
1640 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1641 ADVANCE(2);
1642 HANDLE_INSTRUCTION_END();
1643
1644 HANDLE_INSTRUCTION_START(DIV_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001645 bool success = DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
1646 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1647 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001648 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1649 }
1650 HANDLE_INSTRUCTION_END();
1651
1652 HANDLE_INSTRUCTION_START(REM_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001653 bool success = DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1654 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1655 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001656 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1657 }
1658 HANDLE_INSTRUCTION_END();
1659
1660 HANDLE_INSTRUCTION_START(AND_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001661 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001662 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1663 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1664 ADVANCE(2);
1665 HANDLE_INSTRUCTION_END();
1666
1667 HANDLE_INSTRUCTION_START(OR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001668 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001669 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1670 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1671 ADVANCE(2);
1672 HANDLE_INSTRUCTION_END();
1673
1674 HANDLE_INSTRUCTION_START(XOR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001675 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001676 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1677 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1678 ADVANCE(2);
1679 HANDLE_INSTRUCTION_END();
1680
1681 HANDLE_INSTRUCTION_START(SHL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001682 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001683 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1684 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1685 ADVANCE(2);
1686 HANDLE_INSTRUCTION_END();
1687
1688 HANDLE_INSTRUCTION_START(SHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001689 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001690 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1691 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1692 ADVANCE(2);
1693 HANDLE_INSTRUCTION_END();
1694
1695 HANDLE_INSTRUCTION_START(USHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001696 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001697 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1698 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1699 ADVANCE(2);
1700 HANDLE_INSTRUCTION_END();
1701
1702 HANDLE_INSTRUCTION_START(ADD_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001703 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001704 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1705 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1706 ADVANCE(2);
1707 HANDLE_INSTRUCTION_END();
1708
1709 HANDLE_INSTRUCTION_START(SUB_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001710 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001711 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1712 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1713 ADVANCE(2);
1714 HANDLE_INSTRUCTION_END();
1715
1716 HANDLE_INSTRUCTION_START(MUL_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001717 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001718 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1719 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1720 ADVANCE(2);
1721 HANDLE_INSTRUCTION_END();
1722
1723 HANDLE_INSTRUCTION_START(DIV_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001724 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001725 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1726 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1727 ADVANCE(2);
1728 HANDLE_INSTRUCTION_END();
1729
1730 HANDLE_INSTRUCTION_START(REM_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001731 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001732 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1733 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1734 ADVANCE(2);
1735 HANDLE_INSTRUCTION_END();
1736
1737 HANDLE_INSTRUCTION_START(ADD_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001738 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001739 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1740 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1741 ADVANCE(2);
1742 HANDLE_INSTRUCTION_END();
1743
1744 HANDLE_INSTRUCTION_START(SUB_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001745 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001746 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1747 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1748 ADVANCE(2);
1749 HANDLE_INSTRUCTION_END();
1750
1751 HANDLE_INSTRUCTION_START(MUL_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001752 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001753 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1754 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1755 ADVANCE(2);
1756 HANDLE_INSTRUCTION_END();
1757
1758 HANDLE_INSTRUCTION_START(DIV_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001759 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001760 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1761 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1762 ADVANCE(2);
1763 HANDLE_INSTRUCTION_END();
1764
1765 HANDLE_INSTRUCTION_START(REM_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001766 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001767 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1768 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1769 ADVANCE(2);
1770 HANDLE_INSTRUCTION_END();
1771
1772 HANDLE_INSTRUCTION_START(ADD_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001773 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001774 shadow_frame.SetVReg(vregA,
1775 shadow_frame.GetVReg(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001776 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001777 ADVANCE(1);
1778 }
1779 HANDLE_INSTRUCTION_END();
1780
1781 HANDLE_INSTRUCTION_START(SUB_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001782 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001783 shadow_frame.SetVReg(vregA,
1784 shadow_frame.GetVReg(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001785 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001786 ADVANCE(1);
1787 }
1788 HANDLE_INSTRUCTION_END();
1789
1790 HANDLE_INSTRUCTION_START(MUL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001791 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001792 shadow_frame.SetVReg(vregA,
1793 shadow_frame.GetVReg(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001794 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001795 ADVANCE(1);
1796 }
1797 HANDLE_INSTRUCTION_END();
1798
1799 HANDLE_INSTRUCTION_START(DIV_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001800 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001801 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001802 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001803 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1804 }
1805 HANDLE_INSTRUCTION_END();
1806
1807 HANDLE_INSTRUCTION_START(REM_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001808 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001809 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001810 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001811 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1812 }
1813 HANDLE_INSTRUCTION_END();
1814
1815 HANDLE_INSTRUCTION_START(SHL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001816 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001817 shadow_frame.SetVReg(vregA,
1818 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001819 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001820 ADVANCE(1);
1821 }
1822 HANDLE_INSTRUCTION_END();
1823
1824 HANDLE_INSTRUCTION_START(SHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001825 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001826 shadow_frame.SetVReg(vregA,
1827 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001828 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001829 ADVANCE(1);
1830 }
1831 HANDLE_INSTRUCTION_END();
1832
1833 HANDLE_INSTRUCTION_START(USHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001834 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001835 shadow_frame.SetVReg(vregA,
1836 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001837 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001838 ADVANCE(1);
1839 }
1840 HANDLE_INSTRUCTION_END();
1841
1842 HANDLE_INSTRUCTION_START(AND_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001843 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001844 shadow_frame.SetVReg(vregA,
1845 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001846 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001847 ADVANCE(1);
1848 }
1849 HANDLE_INSTRUCTION_END();
1850
1851 HANDLE_INSTRUCTION_START(OR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001852 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001853 shadow_frame.SetVReg(vregA,
1854 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001855 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001856 ADVANCE(1);
1857 }
1858 HANDLE_INSTRUCTION_END();
1859
1860 HANDLE_INSTRUCTION_START(XOR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001861 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001862 shadow_frame.SetVReg(vregA,
1863 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001864 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001865 ADVANCE(1);
1866 }
1867 HANDLE_INSTRUCTION_END();
1868
1869 HANDLE_INSTRUCTION_START(ADD_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001870 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001871 shadow_frame.SetVRegLong(vregA,
1872 shadow_frame.GetVRegLong(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001873 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001874 ADVANCE(1);
1875 }
1876 HANDLE_INSTRUCTION_END();
1877
1878 HANDLE_INSTRUCTION_START(SUB_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001879 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001880 shadow_frame.SetVRegLong(vregA,
1881 shadow_frame.GetVRegLong(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001882 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001883 ADVANCE(1);
1884 }
1885 HANDLE_INSTRUCTION_END();
1886
1887 HANDLE_INSTRUCTION_START(MUL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001888 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001889 shadow_frame.SetVRegLong(vregA,
1890 shadow_frame.GetVRegLong(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001891 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001892 ADVANCE(1);
1893 }
1894 HANDLE_INSTRUCTION_END();
1895
1896 HANDLE_INSTRUCTION_START(DIV_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001897 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001898 bool success = DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001899 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001900 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1901 }
1902 HANDLE_INSTRUCTION_END();
1903
1904 HANDLE_INSTRUCTION_START(REM_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001905 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001906 bool success = DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001907 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001908 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1909 }
1910 HANDLE_INSTRUCTION_END();
1911
1912 HANDLE_INSTRUCTION_START(AND_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001913 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001914 shadow_frame.SetVRegLong(vregA,
1915 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001916 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001917 ADVANCE(1);
1918 }
1919 HANDLE_INSTRUCTION_END();
1920
1921 HANDLE_INSTRUCTION_START(OR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001922 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001923 shadow_frame.SetVRegLong(vregA,
1924 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001925 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001926 ADVANCE(1);
1927 }
1928 HANDLE_INSTRUCTION_END();
1929
1930 HANDLE_INSTRUCTION_START(XOR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001931 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001932 shadow_frame.SetVRegLong(vregA,
1933 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001934 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001935 ADVANCE(1);
1936 }
1937 HANDLE_INSTRUCTION_END();
1938
1939 HANDLE_INSTRUCTION_START(SHL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001940 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001941 shadow_frame.SetVRegLong(vregA,
1942 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001943 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001944 ADVANCE(1);
1945 }
1946 HANDLE_INSTRUCTION_END();
1947
1948 HANDLE_INSTRUCTION_START(SHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001949 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001950 shadow_frame.SetVRegLong(vregA,
1951 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001952 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001953 ADVANCE(1);
1954 }
1955 HANDLE_INSTRUCTION_END();
1956
1957 HANDLE_INSTRUCTION_START(USHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001958 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001959 shadow_frame.SetVRegLong(vregA,
1960 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001961 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001962 ADVANCE(1);
1963 }
1964 HANDLE_INSTRUCTION_END();
1965
1966 HANDLE_INSTRUCTION_START(ADD_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001967 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001968 shadow_frame.SetVRegFloat(vregA,
1969 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001970 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001971 ADVANCE(1);
1972 }
1973 HANDLE_INSTRUCTION_END();
1974
1975 HANDLE_INSTRUCTION_START(SUB_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001976 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001977 shadow_frame.SetVRegFloat(vregA,
1978 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001979 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001980 ADVANCE(1);
1981 }
1982 HANDLE_INSTRUCTION_END();
1983
1984 HANDLE_INSTRUCTION_START(MUL_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001985 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001986 shadow_frame.SetVRegFloat(vregA,
1987 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001988 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001989 ADVANCE(1);
1990 }
1991 HANDLE_INSTRUCTION_END();
1992
1993 HANDLE_INSTRUCTION_START(DIV_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001994 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001995 shadow_frame.SetVRegFloat(vregA,
1996 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001997 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001998 ADVANCE(1);
1999 }
2000 HANDLE_INSTRUCTION_END();
2001
2002 HANDLE_INSTRUCTION_START(REM_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002003 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002004 shadow_frame.SetVRegFloat(vregA,
2005 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002006 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002007 ADVANCE(1);
2008 }
2009 HANDLE_INSTRUCTION_END();
2010
2011 HANDLE_INSTRUCTION_START(ADD_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002012 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002013 shadow_frame.SetVRegDouble(vregA,
2014 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002015 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002016 ADVANCE(1);
2017 }
2018 HANDLE_INSTRUCTION_END();
2019
2020 HANDLE_INSTRUCTION_START(SUB_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002021 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002022 shadow_frame.SetVRegDouble(vregA,
2023 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002024 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002025 ADVANCE(1);
2026 }
2027 HANDLE_INSTRUCTION_END();
2028
2029 HANDLE_INSTRUCTION_START(MUL_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002030 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002031 shadow_frame.SetVRegDouble(vregA,
2032 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002033 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002034 ADVANCE(1);
2035 }
2036 HANDLE_INSTRUCTION_END();
2037
2038 HANDLE_INSTRUCTION_START(DIV_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002039 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002040 shadow_frame.SetVRegDouble(vregA,
2041 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002042 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002043 ADVANCE(1);
2044 }
2045 HANDLE_INSTRUCTION_END();
2046
2047 HANDLE_INSTRUCTION_START(REM_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002048 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002049 shadow_frame.SetVRegDouble(vregA,
2050 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002051 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002052 ADVANCE(1);
2053 }
2054 HANDLE_INSTRUCTION_END();
2055
2056 HANDLE_INSTRUCTION_START(ADD_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002057 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2058 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) +
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002059 inst->VRegC_22s());
2060 ADVANCE(2);
2061 HANDLE_INSTRUCTION_END();
2062
2063 HANDLE_INSTRUCTION_START(RSUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002064 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002065 inst->VRegC_22s() -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002066 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002067 ADVANCE(2);
2068 HANDLE_INSTRUCTION_END();
2069
2070 HANDLE_INSTRUCTION_START(MUL_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002071 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2072 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) *
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002073 inst->VRegC_22s());
2074 ADVANCE(2);
2075 HANDLE_INSTRUCTION_END();
2076
2077 HANDLE_INSTRUCTION_START(DIV_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002078 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
2079 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002080 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2081 }
2082 HANDLE_INSTRUCTION_END();
2083
2084 HANDLE_INSTRUCTION_START(REM_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002085 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
2086 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002087 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2088 }
2089 HANDLE_INSTRUCTION_END();
2090
2091 HANDLE_INSTRUCTION_START(AND_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002092 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2093 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002094 inst->VRegC_22s());
2095 ADVANCE(2);
2096 HANDLE_INSTRUCTION_END();
2097
2098 HANDLE_INSTRUCTION_START(OR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002099 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2100 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002101 inst->VRegC_22s());
2102 ADVANCE(2);
2103 HANDLE_INSTRUCTION_END();
2104
2105 HANDLE_INSTRUCTION_START(XOR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002106 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2107 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002108 inst->VRegC_22s());
2109 ADVANCE(2);
2110 HANDLE_INSTRUCTION_END();
2111
2112 HANDLE_INSTRUCTION_START(ADD_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002113 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002114 shadow_frame.GetVReg(inst->VRegB_22b()) +
2115 inst->VRegC_22b());
2116 ADVANCE(2);
2117 HANDLE_INSTRUCTION_END();
2118
2119 HANDLE_INSTRUCTION_START(RSUB_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002120 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002121 inst->VRegC_22b() -
2122 shadow_frame.GetVReg(inst->VRegB_22b()));
2123 ADVANCE(2);
2124 HANDLE_INSTRUCTION_END();
2125
2126 HANDLE_INSTRUCTION_START(MUL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002127 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002128 shadow_frame.GetVReg(inst->VRegB_22b()) *
2129 inst->VRegC_22b());
2130 ADVANCE(2);
2131 HANDLE_INSTRUCTION_END();
2132
2133 HANDLE_INSTRUCTION_START(DIV_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002134 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
2135 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002136 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2137 }
2138 HANDLE_INSTRUCTION_END();
2139
2140 HANDLE_INSTRUCTION_START(REM_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002141 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
2142 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002143 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2144 }
2145 HANDLE_INSTRUCTION_END();
2146
2147 HANDLE_INSTRUCTION_START(AND_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002148 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002149 shadow_frame.GetVReg(inst->VRegB_22b()) &
2150 inst->VRegC_22b());
2151 ADVANCE(2);
2152 HANDLE_INSTRUCTION_END();
2153
2154 HANDLE_INSTRUCTION_START(OR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002155 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002156 shadow_frame.GetVReg(inst->VRegB_22b()) |
2157 inst->VRegC_22b());
2158 ADVANCE(2);
2159 HANDLE_INSTRUCTION_END();
2160
2161 HANDLE_INSTRUCTION_START(XOR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002162 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002163 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2164 inst->VRegC_22b());
2165 ADVANCE(2);
2166 HANDLE_INSTRUCTION_END();
2167
2168 HANDLE_INSTRUCTION_START(SHL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002169 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002170 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2171 (inst->VRegC_22b() & 0x1f));
2172 ADVANCE(2);
2173 HANDLE_INSTRUCTION_END();
2174
2175 HANDLE_INSTRUCTION_START(SHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002176 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002177 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2178 (inst->VRegC_22b() & 0x1f));
2179 ADVANCE(2);
2180 HANDLE_INSTRUCTION_END();
2181
2182 HANDLE_INSTRUCTION_START(USHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002183 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002184 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2185 (inst->VRegC_22b() & 0x1f));
2186 ADVANCE(2);
2187 HANDLE_INSTRUCTION_END();
2188
2189 HANDLE_INSTRUCTION_START(UNUSED_3E)
2190 UnexpectedOpcode(inst, mh);
2191 HANDLE_INSTRUCTION_END();
2192
2193 HANDLE_INSTRUCTION_START(UNUSED_3F)
2194 UnexpectedOpcode(inst, mh);
2195 HANDLE_INSTRUCTION_END();
2196
2197 HANDLE_INSTRUCTION_START(UNUSED_40)
2198 UnexpectedOpcode(inst, mh);
2199 HANDLE_INSTRUCTION_END();
2200
2201 HANDLE_INSTRUCTION_START(UNUSED_41)
2202 UnexpectedOpcode(inst, mh);
2203 HANDLE_INSTRUCTION_END();
2204
2205 HANDLE_INSTRUCTION_START(UNUSED_42)
2206 UnexpectedOpcode(inst, mh);
2207 HANDLE_INSTRUCTION_END();
2208
2209 HANDLE_INSTRUCTION_START(UNUSED_43)
2210 UnexpectedOpcode(inst, mh);
2211 HANDLE_INSTRUCTION_END();
2212
2213 HANDLE_INSTRUCTION_START(UNUSED_79)
2214 UnexpectedOpcode(inst, mh);
2215 HANDLE_INSTRUCTION_END();
2216
2217 HANDLE_INSTRUCTION_START(UNUSED_7A)
2218 UnexpectedOpcode(inst, mh);
2219 HANDLE_INSTRUCTION_END();
2220
2221 HANDLE_INSTRUCTION_START(UNUSED_EB)
2222 UnexpectedOpcode(inst, mh);
2223 HANDLE_INSTRUCTION_END();
2224
2225 HANDLE_INSTRUCTION_START(UNUSED_EC)
2226 UnexpectedOpcode(inst, mh);
2227 HANDLE_INSTRUCTION_END();
2228
2229 HANDLE_INSTRUCTION_START(UNUSED_ED)
2230 UnexpectedOpcode(inst, mh);
2231 HANDLE_INSTRUCTION_END();
2232
2233 HANDLE_INSTRUCTION_START(UNUSED_EE)
2234 UnexpectedOpcode(inst, mh);
2235 HANDLE_INSTRUCTION_END();
2236
2237 HANDLE_INSTRUCTION_START(UNUSED_EF)
2238 UnexpectedOpcode(inst, mh);
2239 HANDLE_INSTRUCTION_END();
2240
2241 HANDLE_INSTRUCTION_START(UNUSED_F0)
2242 UnexpectedOpcode(inst, mh);
2243 HANDLE_INSTRUCTION_END();
2244
2245 HANDLE_INSTRUCTION_START(UNUSED_F1)
2246 UnexpectedOpcode(inst, mh);
2247 HANDLE_INSTRUCTION_END();
2248
2249 HANDLE_INSTRUCTION_START(UNUSED_F2)
2250 UnexpectedOpcode(inst, mh);
2251 HANDLE_INSTRUCTION_END();
2252
2253 HANDLE_INSTRUCTION_START(UNUSED_F3)
2254 UnexpectedOpcode(inst, mh);
2255 HANDLE_INSTRUCTION_END();
2256
2257 HANDLE_INSTRUCTION_START(UNUSED_F4)
2258 UnexpectedOpcode(inst, mh);
2259 HANDLE_INSTRUCTION_END();
2260
2261 HANDLE_INSTRUCTION_START(UNUSED_F5)
2262 UnexpectedOpcode(inst, mh);
2263 HANDLE_INSTRUCTION_END();
2264
2265 HANDLE_INSTRUCTION_START(UNUSED_F6)
2266 UnexpectedOpcode(inst, mh);
2267 HANDLE_INSTRUCTION_END();
2268
2269 HANDLE_INSTRUCTION_START(UNUSED_F7)
2270 UnexpectedOpcode(inst, mh);
2271 HANDLE_INSTRUCTION_END();
2272
2273 HANDLE_INSTRUCTION_START(UNUSED_F8)
2274 UnexpectedOpcode(inst, mh);
2275 HANDLE_INSTRUCTION_END();
2276
2277 HANDLE_INSTRUCTION_START(UNUSED_F9)
2278 UnexpectedOpcode(inst, mh);
2279 HANDLE_INSTRUCTION_END();
2280
2281 HANDLE_INSTRUCTION_START(UNUSED_FA)
2282 UnexpectedOpcode(inst, mh);
2283 HANDLE_INSTRUCTION_END();
2284
2285 HANDLE_INSTRUCTION_START(UNUSED_FB)
2286 UnexpectedOpcode(inst, mh);
2287 HANDLE_INSTRUCTION_END();
2288
2289 HANDLE_INSTRUCTION_START(UNUSED_FC)
2290 UnexpectedOpcode(inst, mh);
2291 HANDLE_INSTRUCTION_END();
2292
2293 HANDLE_INSTRUCTION_START(UNUSED_FD)
2294 UnexpectedOpcode(inst, mh);
2295 HANDLE_INSTRUCTION_END();
2296
2297 HANDLE_INSTRUCTION_START(UNUSED_FE)
2298 UnexpectedOpcode(inst, mh);
2299 HANDLE_INSTRUCTION_END();
2300
2301 HANDLE_INSTRUCTION_START(UNUSED_FF)
2302 UnexpectedOpcode(inst, mh);
2303 HANDLE_INSTRUCTION_END();
2304
2305 exception_pending_label: {
2306 CHECK(self->IsExceptionPending());
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002307 if (UNLIKELY(self->TestAllFlags())) {
2308 CheckSuspend(self);
2309 }
Sebastien Hertz947ff082013-09-17 14:10:13 +02002310 Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002311 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc,
Sebastien Hertz947ff082013-09-17 14:10:13 +02002312 this_object,
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002313 instrumentation);
2314 if (found_dex_pc == DexFile::kDexNoIndex) {
2315 return JValue(); /* Handled in caller. */
2316 } else {
2317 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc);
2318 ADVANCE(displacement);
2319 }
2320 }
2321
2322 // Create alternative instruction handlers dedicated to instrumentation.
Sebastien Hertz947ff082013-09-17 14:10:13 +02002323#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
2324 instrumentation_op_##code: { \
2325 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), \
2326 shadow_frame.GetMethod(), dex_pc); \
2327 goto *handlersTable[Instruction::code]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002328 }
2329#include "dex_instruction_list.h"
2330 DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER)
2331#undef DEX_INSTRUCTION_LIST
2332#undef INSTRUMENTATION_INSTRUCTION_HANDLER
2333} // NOLINT(readability/fn_size)
2334
2335// Explicit definitions of ExecuteGotoImpl.
Sebastien Hertzc6714852013-09-30 16:42:32 +02002336template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
2337JValue ExecuteGotoImpl<true>(Thread* self, MethodHelper& mh,
2338 const DexFile::CodeItem* code_item,
2339 ShadowFrame& shadow_frame, JValue result_register);
2340template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
2341JValue ExecuteGotoImpl<false>(Thread* self, MethodHelper& mh,
2342 const DexFile::CodeItem* code_item,
2343 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002344
2345} // namespace interpreter
2346} // namespace art