blob: 608cd41b4f8054c4ddf8d2f661824e0b6c1a8d32 [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 Hertzee1997a2013-09-19 14:47:09 +020054#define UPDATE_HANDLER_TABLE() \
55 currentHandlersTable = handlersTable[Runtime::Current()->GetInstrumentation()->GetInterpreterHandlerTable()]
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +020056
Sebastien Hertz8ece0502013-08-07 11:26:41 +020057#define UNREACHABLE_CODE_CHECK() \
58 do { \
59 if (kIsDebugBuild) { \
60 LOG(FATAL) << "We should not be here !"; \
61 } \
62 } while (false)
63
64#define HANDLE_INSTRUCTION_START(opcode) op_##opcode: // NOLINT(whitespace/labels)
65#define HANDLE_INSTRUCTION_END() UNREACHABLE_CODE_CHECK()
66
Sebastien Hertzee1997a2013-09-19 14:47:09 +020067/**
68 * Interpreter based on computed goto tables.
69 *
70 * Each instruction is associated to a handler. This handler is responsible for executing the
71 * instruction and jump to the next instruction's handler.
72 * In order to limit the cost of instrumentation, we have two handler tables:
73 * - the "main" handler table: it contains handlers for normal execution of each instruction without
74 * handling of instrumentation.
75 * - the "alternative" handler table: it contains alternative handlers which first handle
76 * instrumentation before jumping to the corresponding "normal" instruction's handler.
77 *
78 * When instrumentation is active, the interpreter uses the "alternative" handler table. Otherwise
79 * it uses the "main" handler table.
80 *
81 * The current handler table is the handler table being used by the interpreter. It is updated:
82 * - on backward branch (goto, if and switch instructions)
83 * - after invoke
84 * - when an exception is thrown.
85 * This allows to support an attaching debugger to an already running application for instance.
86 *
87 * For a fast handler table update, handler tables are stored in an array of handler tables. Each
88 * handler table is represented by the InterpreterHandlerTable enum which allows to associate it
89 * to an index in this array of handler tables ((see Instrumentation::GetInterpreterHandlerTable).
90 *
91 * Here's the current layout of this array of handler tables:
92 *
93 * ---------------------+---------------+
94 * | NOP | (handler for NOP instruction)
95 * +---------------+
96 * "main" | MOVE | (handler for MOVE instruction)
97 * handler table +---------------+
98 * | ... |
99 * +---------------+
100 * | UNUSED_FF | (handler for UNUSED_FF instruction)
101 * ---------------------+---------------+
102 * | NOP | (alternative handler for NOP instruction)
103 * +---------------+
104 * "alternative" | MOVE | (alternative handler for MOVE instruction)
105 * handler table +---------------+
106 * | ... |
107 * +---------------+
108 * | UNUSED_FF | (alternative handler for UNUSED_FF instruction)
109 * ---------------------+---------------+
110 *
111 */
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200112template<bool do_access_check>
113JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item,
114 ShadowFrame& shadow_frame, JValue result_register) {
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200115 // Define handler tables:
116 // - The main handler table contains execution handlers for each instruction.
117 // - The alternative handler table contains prelude handlers which check for thread suspend and
118 // manage instrumentation before jumping to the execution handler.
119 static const void* const handlersTable[instrumentation::kNumHandlerTables][kNumPackedOpcodes] = {
120 {
121 // Main handler table.
122#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&op_##code,
123#include "dex_instruction_list.h"
124 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
125#undef DEX_INSTRUCTION_LIST
126#undef INSTRUCTION_HANDLER
127 }, {
128 // Alternative handler table.
129#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&alt_op_##code,
130#include "dex_instruction_list.h"
131 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
132#undef DEX_INSTRUCTION_LIST
133#undef INSTRUCTION_HANDLER
134 }
135 };
136
137 const bool do_assignability_check = do_access_check;
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200138 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
139 LOG(FATAL) << "Invalid shadow frame for interpreter use";
140 return JValue();
141 }
142 self->VerifyStack();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200143
144 uint32_t dex_pc = shadow_frame.GetDexPC();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200145 const Instruction* inst = Instruction::At(code_item->insns_ + dex_pc);
146 uint16_t inst_data;
147 const void* const* currentHandlersTable;
148 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200149 if (LIKELY(dex_pc == 0)) { // We are entering the method as opposed to deoptimizing..
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200150 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200151 if (UNLIKELY(instrumentation->HasMethodEntryListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200152 instrumentation->MethodEnterEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200153 shadow_frame.GetMethod(), 0);
154 }
155 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200156
157 // Jump to first instruction.
158 ADVANCE(0);
159 UNREACHABLE_CODE_CHECK();
160
161 HANDLE_INSTRUCTION_START(NOP)
162 ADVANCE(1);
163 HANDLE_INSTRUCTION_END();
164
165 HANDLE_INSTRUCTION_START(MOVE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200166 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
167 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200168 ADVANCE(1);
169 HANDLE_INSTRUCTION_END();
170
171 HANDLE_INSTRUCTION_START(MOVE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200172 shadow_frame.SetVReg(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200173 shadow_frame.GetVReg(inst->VRegB_22x()));
174 ADVANCE(2);
175 HANDLE_INSTRUCTION_END();
176
177 HANDLE_INSTRUCTION_START(MOVE_16)
178 shadow_frame.SetVReg(inst->VRegA_32x(),
179 shadow_frame.GetVReg(inst->VRegB_32x()));
180 ADVANCE(3);
181 HANDLE_INSTRUCTION_END();
182
183 HANDLE_INSTRUCTION_START(MOVE_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200184 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
185 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200186 ADVANCE(1);
187 HANDLE_INSTRUCTION_END();
188
189 HANDLE_INSTRUCTION_START(MOVE_WIDE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200190 shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200191 shadow_frame.GetVRegLong(inst->VRegB_22x()));
192 ADVANCE(2);
193 HANDLE_INSTRUCTION_END();
194
195 HANDLE_INSTRUCTION_START(MOVE_WIDE_16)
196 shadow_frame.SetVRegLong(inst->VRegA_32x(),
197 shadow_frame.GetVRegLong(inst->VRegB_32x()));
198 ADVANCE(3);
199 HANDLE_INSTRUCTION_END();
200
201 HANDLE_INSTRUCTION_START(MOVE_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200202 shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data),
203 shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200204 ADVANCE(1);
205 HANDLE_INSTRUCTION_END();
206
207 HANDLE_INSTRUCTION_START(MOVE_OBJECT_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200208 shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200209 shadow_frame.GetVRegReference(inst->VRegB_22x()));
210 ADVANCE(2);
211 HANDLE_INSTRUCTION_END();
212
213 HANDLE_INSTRUCTION_START(MOVE_OBJECT_16)
214 shadow_frame.SetVRegReference(inst->VRegA_32x(),
215 shadow_frame.GetVRegReference(inst->VRegB_32x()));
216 ADVANCE(3);
217 HANDLE_INSTRUCTION_END();
218
219 HANDLE_INSTRUCTION_START(MOVE_RESULT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200220 shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200221 ADVANCE(1);
222 HANDLE_INSTRUCTION_END();
223
224 HANDLE_INSTRUCTION_START(MOVE_RESULT_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200225 shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200226 ADVANCE(1);
227 HANDLE_INSTRUCTION_END();
228
229 HANDLE_INSTRUCTION_START(MOVE_RESULT_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200230 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200231 ADVANCE(1);
232 HANDLE_INSTRUCTION_END();
233
234 HANDLE_INSTRUCTION_START(MOVE_EXCEPTION) {
235 Throwable* exception = self->GetException(NULL);
236 self->ClearException();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200237 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200238 ADVANCE(1);
239 }
240 HANDLE_INSTRUCTION_END();
241
242 HANDLE_INSTRUCTION_START(RETURN_VOID) {
243 JValue result;
Sebastien Hertz043036f2013-09-09 18:26:48 +0200244 if (do_access_check) {
245 // If access checks are required then the dex-to-dex compiler and analysis of
246 // whether the class has final fields hasn't been performed. Conservatively
247 // perform the memory barrier now.
248 ANDROID_MEMBAR_STORE();
249 }
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200250 if (UNLIKELY(self->TestAllFlags())) {
251 CheckSuspend(self);
252 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200253 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200254 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200255 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200256 shadow_frame.GetMethod(), dex_pc,
257 result);
258 }
259 return result;
260 }
261 HANDLE_INSTRUCTION_END();
262
263 HANDLE_INSTRUCTION_START(RETURN_VOID_BARRIER) {
264 ANDROID_MEMBAR_STORE();
265 JValue result;
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200266 if (UNLIKELY(self->TestAllFlags())) {
267 CheckSuspend(self);
268 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200269 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200270 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200271 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200272 shadow_frame.GetMethod(), dex_pc,
273 result);
274 }
275 return result;
276 }
277 HANDLE_INSTRUCTION_END();
278
279 HANDLE_INSTRUCTION_START(RETURN) {
280 JValue result;
281 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200282 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200283 if (UNLIKELY(self->TestAllFlags())) {
284 CheckSuspend(self);
285 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200286 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200287 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200288 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200289 shadow_frame.GetMethod(), dex_pc,
290 result);
291 }
292 return result;
293 }
294 HANDLE_INSTRUCTION_END();
295
296 HANDLE_INSTRUCTION_START(RETURN_WIDE) {
297 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200298 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200299 if (UNLIKELY(self->TestAllFlags())) {
300 CheckSuspend(self);
301 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200302 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200303 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200304 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200305 shadow_frame.GetMethod(), dex_pc,
306 result);
307 }
308 return result;
309 }
310 HANDLE_INSTRUCTION_END();
311
312 HANDLE_INSTRUCTION_START(RETURN_OBJECT) {
313 JValue result;
Jeff Haoa3faaf42013-09-03 19:07:00 -0700314 Object* obj_result = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200315 result.SetJ(0);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700316 result.SetL(obj_result);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200317 if (UNLIKELY(self->TestAllFlags())) {
318 CheckSuspend(self);
319 }
Jeff Haoa3faaf42013-09-03 19:07:00 -0700320 if (do_assignability_check && obj_result != NULL) {
321 Class* return_type = MethodHelper(shadow_frame.GetMethod()).GetReturnType();
322 if (return_type == NULL) {
323 // Return the pending exception.
324 HANDLE_PENDING_EXCEPTION();
325 }
326 if (!obj_result->VerifierInstanceOf(return_type)) {
327 // This should never happen.
328 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
329 "Ljava/lang/VirtualMachineError;",
330 "Returning '%s' that is not instance of return type '%s'",
331 ClassHelper(obj_result->GetClass()).GetDescriptor(),
332 ClassHelper(return_type).GetDescriptor());
333 HANDLE_PENDING_EXCEPTION();
334 }
335 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200336 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200337 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200338 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200339 shadow_frame.GetMethod(), dex_pc,
340 result);
341 }
342 return result;
343 }
344 HANDLE_INSTRUCTION_END();
345
346 HANDLE_INSTRUCTION_START(CONST_4) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200347 uint32_t dst = inst->VRegA_11n(inst_data);
348 int32_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200349 shadow_frame.SetVReg(dst, val);
350 if (val == 0) {
351 shadow_frame.SetVRegReference(dst, NULL);
352 }
353 ADVANCE(1);
354 }
355 HANDLE_INSTRUCTION_END();
356
357 HANDLE_INSTRUCTION_START(CONST_16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200358 uint32_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200359 int32_t val = inst->VRegB_21s();
360 shadow_frame.SetVReg(dst, val);
361 if (val == 0) {
362 shadow_frame.SetVRegReference(dst, NULL);
363 }
364 ADVANCE(2);
365 }
366 HANDLE_INSTRUCTION_END();
367
368 HANDLE_INSTRUCTION_START(CONST) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200369 uint32_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200370 int32_t val = inst->VRegB_31i();
371 shadow_frame.SetVReg(dst, val);
372 if (val == 0) {
373 shadow_frame.SetVRegReference(dst, NULL);
374 }
375 ADVANCE(3);
376 }
377 HANDLE_INSTRUCTION_END();
378
379 HANDLE_INSTRUCTION_START(CONST_HIGH16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200380 uint32_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200381 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
382 shadow_frame.SetVReg(dst, val);
383 if (val == 0) {
384 shadow_frame.SetVRegReference(dst, NULL);
385 }
386 ADVANCE(2);
387 }
388 HANDLE_INSTRUCTION_END();
389
390 HANDLE_INSTRUCTION_START(CONST_WIDE_16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200391 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200392 ADVANCE(2);
393 HANDLE_INSTRUCTION_END();
394
395 HANDLE_INSTRUCTION_START(CONST_WIDE_32)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200396 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200397 ADVANCE(3);
398 HANDLE_INSTRUCTION_END();
399
400 HANDLE_INSTRUCTION_START(CONST_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200401 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200402 ADVANCE(5);
403 HANDLE_INSTRUCTION_END();
404
405 HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200406 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200407 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
408 ADVANCE(2);
409 HANDLE_INSTRUCTION_END();
410
411 HANDLE_INSTRUCTION_START(CONST_STRING) {
412 String* s = ResolveString(self, mh, inst->VRegB_21c());
413 if (UNLIKELY(s == NULL)) {
414 HANDLE_PENDING_EXCEPTION();
415 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200416 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200417 ADVANCE(2);
418 }
419 }
420 HANDLE_INSTRUCTION_END();
421
422 HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
423 String* s = ResolveString(self, mh, inst->VRegB_31c());
424 if (UNLIKELY(s == NULL)) {
425 HANDLE_PENDING_EXCEPTION();
426 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200427 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200428 ADVANCE(3);
429 }
430 }
431 HANDLE_INSTRUCTION_END();
432
433 HANDLE_INSTRUCTION_START(CONST_CLASS) {
434 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
435 self, false, do_access_check);
436 if (UNLIKELY(c == NULL)) {
437 HANDLE_PENDING_EXCEPTION();
438 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200439 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200440 ADVANCE(2);
441 }
442 }
443 HANDLE_INSTRUCTION_END();
444
445 HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200446 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200447 if (UNLIKELY(obj == NULL)) {
448 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
449 HANDLE_PENDING_EXCEPTION();
450 } else {
451 DoMonitorEnter(self, obj);
452 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
453 }
454 }
455 HANDLE_INSTRUCTION_END();
456
457 HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200458 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200459 if (UNLIKELY(obj == NULL)) {
460 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
461 HANDLE_PENDING_EXCEPTION();
462 } else {
463 DoMonitorExit(self, obj);
464 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
465 }
466 }
467 HANDLE_INSTRUCTION_END();
468
469 HANDLE_INSTRUCTION_START(CHECK_CAST) {
470 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
471 self, false, do_access_check);
472 if (UNLIKELY(c == NULL)) {
473 HANDLE_PENDING_EXCEPTION();
474 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200475 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200476 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
477 ThrowClassCastException(c, obj->GetClass());
478 HANDLE_PENDING_EXCEPTION();
479 } else {
480 ADVANCE(2);
481 }
482 }
483 }
484 HANDLE_INSTRUCTION_END();
485
486 HANDLE_INSTRUCTION_START(INSTANCE_OF) {
487 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
488 self, false, do_access_check);
489 if (UNLIKELY(c == NULL)) {
490 HANDLE_PENDING_EXCEPTION();
491 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200492 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
493 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200494 ADVANCE(2);
495 }
496 }
497 HANDLE_INSTRUCTION_END();
498
499 HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200500 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200501 if (UNLIKELY(array == NULL)) {
502 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
503 HANDLE_PENDING_EXCEPTION();
504 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200505 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200506 ADVANCE(1);
507 }
508 }
509 HANDLE_INSTRUCTION_END();
510
511 HANDLE_INSTRUCTION_START(NEW_INSTANCE) {
Hiroshi Yamauchi253ea072013-10-02 12:44:17 -0700512 Object* obj = AllocObjectFromCodeInstrumented(inst->VRegB_21c(), shadow_frame.GetMethod(),
513 self, do_access_check);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200514 if (UNLIKELY(obj == NULL)) {
515 HANDLE_PENDING_EXCEPTION();
516 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200517 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200518 ADVANCE(2);
519 }
520 }
521 HANDLE_INSTRUCTION_END();
522
523 HANDLE_INSTRUCTION_START(NEW_ARRAY) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200524 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Hiroshi Yamauchi253ea072013-10-02 12:44:17 -0700525 Object* obj = AllocArrayFromCodeInstrumented(inst->VRegC_22c(), shadow_frame.GetMethod(),
526 length, self, do_access_check);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200527 if (UNLIKELY(obj == NULL)) {
528 HANDLE_PENDING_EXCEPTION();
529 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200530 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200531 ADVANCE(2);
532 }
533 }
534 HANDLE_INSTRUCTION_END();
535
536 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) {
537 bool success = DoFilledNewArray<false, do_access_check>(inst, shadow_frame,
538 self, &result_register);
539 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
540 }
541 HANDLE_INSTRUCTION_END();
542
543 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) {
544 bool success = DoFilledNewArray<true, do_access_check>(inst, shadow_frame,
545 self, &result_register);
546 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
547 }
548 HANDLE_INSTRUCTION_END();
549
550 HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200551 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200552 if (UNLIKELY(obj == NULL)) {
553 ThrowNullPointerException(NULL, "null array in FILL_ARRAY_DATA");
554 HANDLE_PENDING_EXCEPTION();
555 } else {
556 Array* array = obj->AsArray();
557 DCHECK(array->IsArrayInstance() && !array->IsObjectArray());
558 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
559 const Instruction::ArrayDataPayload* payload =
560 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
561 if (UNLIKELY(static_cast<int32_t>(payload->element_count) > array->GetLength())) {
562 self->ThrowNewExceptionF(shadow_frame.GetCurrentLocationForThrow(),
563 "Ljava/lang/ArrayIndexOutOfBoundsException;",
564 "failed FILL_ARRAY_DATA; length=%d, index=%d",
565 array->GetLength(), payload->element_count);
566 HANDLE_PENDING_EXCEPTION();
567 } else {
568 uint32_t size_in_bytes = payload->element_count * payload->element_width;
569 memcpy(array->GetRawData(payload->element_width), payload->data, size_in_bytes);
570 ADVANCE(3);
571 }
572 }
573 }
574 HANDLE_INSTRUCTION_END();
575
576 HANDLE_INSTRUCTION_START(THROW) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200577 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200578 if (UNLIKELY(exception == NULL)) {
579 ThrowNullPointerException(NULL, "throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700580 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
581 // This should never happen.
582 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
583 "Ljava/lang/VirtualMachineError;",
584 "Throwing '%s' that is not instance of Throwable",
585 ClassHelper(exception->GetClass()).GetDescriptor());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200586 } else {
587 self->SetException(shadow_frame.GetCurrentLocationForThrow(), exception->AsThrowable());
588 }
589 HANDLE_PENDING_EXCEPTION();
590 }
591 HANDLE_INSTRUCTION_END();
592
593 HANDLE_INSTRUCTION_START(GOTO) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200594 int8_t offset = inst->VRegA_10t(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);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200598 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200599 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200600 }
601 ADVANCE(offset);
602 }
603 HANDLE_INSTRUCTION_END();
604
605 HANDLE_INSTRUCTION_START(GOTO_16) {
606 int16_t offset = inst->VRegA_20t();
607 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200608 if (UNLIKELY(self->TestAllFlags())) {
609 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200610 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200611 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200612 }
613 ADVANCE(offset);
614 }
615 HANDLE_INSTRUCTION_END();
616
617 HANDLE_INSTRUCTION_START(GOTO_32) {
618 int32_t offset = inst->VRegA_30t();
619 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200620 if (UNLIKELY(self->TestAllFlags())) {
621 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200622 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200623 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200624 }
625 ADVANCE(offset);
626 }
627 HANDLE_INSTRUCTION_END();
628
629 HANDLE_INSTRUCTION_START(PACKED_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200630 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200631 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200632 if (UNLIKELY(self->TestAllFlags())) {
633 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200634 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200635 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200636 }
637 ADVANCE(offset);
638 }
639 HANDLE_INSTRUCTION_END();
640
641 HANDLE_INSTRUCTION_START(SPARSE_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200642 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200643 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200644 if (UNLIKELY(self->TestAllFlags())) {
645 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200646 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200647 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200648 }
649 ADVANCE(offset);
650 }
651 HANDLE_INSTRUCTION_END();
652
653 HANDLE_INSTRUCTION_START(CMPL_FLOAT) {
654 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
655 float val2 = shadow_frame.GetVRegFloat(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(CMPG_FLOAT) {
670 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
671 float val2 = shadow_frame.GetVRegFloat(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(CMPL_DOUBLE) {
686 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
687 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
688 int32_t result;
689 if (val1 > val2) {
690 result = 1;
691 } else if (val1 == val2) {
692 result = 0;
693 } else {
694 result = -1;
695 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200696 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200697 ADVANCE(2);
698 }
699 HANDLE_INSTRUCTION_END();
700
701 HANDLE_INSTRUCTION_START(CMPG_DOUBLE) {
702 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
703 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
704 int32_t result;
705 if (val1 < val2) {
706 result = -1;
707 } else if (val1 == val2) {
708 result = 0;
709 } else {
710 result = 1;
711 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200712 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200713 ADVANCE(2);
714 }
715 HANDLE_INSTRUCTION_END();
716
717 HANDLE_INSTRUCTION_START(CMP_LONG) {
718 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
719 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
720 int32_t result;
721 if (val1 > val2) {
722 result = 1;
723 } else if (val1 == val2) {
724 result = 0;
725 } else {
726 result = -1;
727 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200728 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200729 ADVANCE(2);
730 }
731 HANDLE_INSTRUCTION_END();
732
733 HANDLE_INSTRUCTION_START(IF_EQ) {
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);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200739 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200740 }
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_NE) {
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);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200755 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200756 }
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_LT) {
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);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200771 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200772 }
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_GE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200782 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200783 int16_t offset = inst->VRegC_22t();
784 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200785 if (UNLIKELY(self->TestAllFlags())) {
786 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200787 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200788 }
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_GT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200798 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200799 int16_t offset = inst->VRegC_22t();
800 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200801 if (UNLIKELY(self->TestAllFlags())) {
802 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200803 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200804 }
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_LE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200814 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200815 int16_t offset = inst->VRegC_22t();
816 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200817 if (UNLIKELY(self->TestAllFlags())) {
818 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200819 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200820 }
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_EQZ) {
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);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200835 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200836 }
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_NEZ) {
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);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200851 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200852 }
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_LTZ) {
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);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200867 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200868 }
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(IF_GEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200878 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200879 int16_t offset = inst->VRegB_21t();
880 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200881 if (UNLIKELY(self->TestAllFlags())) {
882 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200883 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200884 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200885 }
886 ADVANCE(offset);
887 } else {
888 ADVANCE(2);
889 }
890 }
891 HANDLE_INSTRUCTION_END();
892
893 HANDLE_INSTRUCTION_START(IF_GTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200894 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200895 int16_t offset = inst->VRegB_21t();
896 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200897 if (UNLIKELY(self->TestAllFlags())) {
898 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200899 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200900 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200901 }
902 ADVANCE(offset);
903 } else {
904 ADVANCE(2);
905 }
906 }
907 HANDLE_INSTRUCTION_END();
908
909 HANDLE_INSTRUCTION_START(IF_LEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200910 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200911 int16_t offset = inst->VRegB_21t();
912 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200913 if (UNLIKELY(self->TestAllFlags())) {
914 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200915 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200916 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200917 }
918 ADVANCE(offset);
919 } else {
920 ADVANCE(2);
921 }
922 }
923 HANDLE_INSTRUCTION_END();
924
925 HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
926 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
927 if (UNLIKELY(a == NULL)) {
928 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
929 HANDLE_PENDING_EXCEPTION();
930 } else {
931 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
932 BooleanArray* array = a->AsBooleanArray();
933 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200934 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200935 ADVANCE(2);
936 } else {
937 HANDLE_PENDING_EXCEPTION();
938 }
939 }
940 }
941 HANDLE_INSTRUCTION_END();
942
943 HANDLE_INSTRUCTION_START(AGET_BYTE) {
944 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
945 if (UNLIKELY(a == NULL)) {
946 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
947 HANDLE_PENDING_EXCEPTION();
948 } else {
949 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
950 ByteArray* array = a->AsByteArray();
951 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200952 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200953 ADVANCE(2);
954 } else {
955 HANDLE_PENDING_EXCEPTION();
956 }
957 }
958 }
959 HANDLE_INSTRUCTION_END();
960
961 HANDLE_INSTRUCTION_START(AGET_CHAR) {
962 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
963 if (UNLIKELY(a == NULL)) {
964 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
965 HANDLE_PENDING_EXCEPTION();
966 } else {
967 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
968 CharArray* array = a->AsCharArray();
969 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200970 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200971 ADVANCE(2);
972 } else {
973 HANDLE_PENDING_EXCEPTION();
974 }
975 }
976 }
977 HANDLE_INSTRUCTION_END();
978
979 HANDLE_INSTRUCTION_START(AGET_SHORT) {
980 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
981 if (UNLIKELY(a == NULL)) {
982 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
983 HANDLE_PENDING_EXCEPTION();
984 } else {
985 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
986 ShortArray* array = a->AsShortArray();
987 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200988 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200989 ADVANCE(2);
990 } else {
991 HANDLE_PENDING_EXCEPTION();
992 }
993 }
994 }
995 HANDLE_INSTRUCTION_END();
996
997 HANDLE_INSTRUCTION_START(AGET) {
998 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
999 if (UNLIKELY(a == NULL)) {
1000 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1001 HANDLE_PENDING_EXCEPTION();
1002 } else {
1003 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1004 IntArray* array = a->AsIntArray();
1005 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001006 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001007 ADVANCE(2);
1008 } else {
1009 HANDLE_PENDING_EXCEPTION();
1010 }
1011 }
1012 }
1013 HANDLE_INSTRUCTION_END();
1014
1015 HANDLE_INSTRUCTION_START(AGET_WIDE) {
1016 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1017 if (UNLIKELY(a == NULL)) {
1018 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1019 HANDLE_PENDING_EXCEPTION();
1020 } else {
1021 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1022 LongArray* array = a->AsLongArray();
1023 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001024 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001025 ADVANCE(2);
1026 } else {
1027 HANDLE_PENDING_EXCEPTION();
1028 }
1029 }
1030 }
1031 HANDLE_INSTRUCTION_END();
1032
1033 HANDLE_INSTRUCTION_START(AGET_OBJECT) {
1034 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1035 if (UNLIKELY(a == NULL)) {
1036 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1037 HANDLE_PENDING_EXCEPTION();
1038 } else {
1039 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1040 ObjectArray<Object>* array = a->AsObjectArray<Object>();
1041 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001042 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001043 ADVANCE(2);
1044 } else {
1045 HANDLE_PENDING_EXCEPTION();
1046 }
1047 }
1048 }
1049 HANDLE_INSTRUCTION_END();
1050
1051 HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
1052 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1053 if (UNLIKELY(a == NULL)) {
1054 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1055 HANDLE_PENDING_EXCEPTION();
1056 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001057 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001058 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1059 BooleanArray* array = a->AsBooleanArray();
1060 if (LIKELY(array->IsValidIndex(index))) {
1061 array->GetData()[index] = val;
1062 ADVANCE(2);
1063 } else {
1064 HANDLE_PENDING_EXCEPTION();
1065 }
1066 }
1067 }
1068 HANDLE_INSTRUCTION_END();
1069
1070 HANDLE_INSTRUCTION_START(APUT_BYTE) {
1071 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1072 if (UNLIKELY(a == NULL)) {
1073 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1074 HANDLE_PENDING_EXCEPTION();
1075 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001076 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001077 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1078 ByteArray* array = a->AsByteArray();
1079 if (LIKELY(array->IsValidIndex(index))) {
1080 array->GetData()[index] = val;
1081 ADVANCE(2);
1082 } else {
1083 HANDLE_PENDING_EXCEPTION();
1084 }
1085 }
1086 }
1087 HANDLE_INSTRUCTION_END();
1088
1089 HANDLE_INSTRUCTION_START(APUT_CHAR) {
1090 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1091 if (UNLIKELY(a == NULL)) {
1092 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1093 HANDLE_PENDING_EXCEPTION();
1094 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001095 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001096 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1097 CharArray* array = a->AsCharArray();
1098 if (LIKELY(array->IsValidIndex(index))) {
1099 array->GetData()[index] = val;
1100 ADVANCE(2);
1101 } else {
1102 HANDLE_PENDING_EXCEPTION();
1103 }
1104 }
1105 }
1106 HANDLE_INSTRUCTION_END();
1107
1108 HANDLE_INSTRUCTION_START(APUT_SHORT) {
1109 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1110 if (UNLIKELY(a == NULL)) {
1111 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1112 HANDLE_PENDING_EXCEPTION();
1113 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001114 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001115 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1116 ShortArray* array = a->AsShortArray();
1117 if (LIKELY(array->IsValidIndex(index))) {
1118 array->GetData()[index] = val;
1119 ADVANCE(2);
1120 } else {
1121 HANDLE_PENDING_EXCEPTION();
1122 }
1123 }
1124 }
1125 HANDLE_INSTRUCTION_END();
1126
1127 HANDLE_INSTRUCTION_START(APUT) {
1128 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1129 if (UNLIKELY(a == NULL)) {
1130 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1131 HANDLE_PENDING_EXCEPTION();
1132 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001133 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001134 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1135 IntArray* array = a->AsIntArray();
1136 if (LIKELY(array->IsValidIndex(index))) {
1137 array->GetData()[index] = val;
1138 ADVANCE(2);
1139 } else {
1140 HANDLE_PENDING_EXCEPTION();
1141 }
1142 }
1143 }
1144 HANDLE_INSTRUCTION_END();
1145
1146 HANDLE_INSTRUCTION_START(APUT_WIDE) {
1147 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1148 if (UNLIKELY(a == NULL)) {
1149 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1150 HANDLE_PENDING_EXCEPTION();
1151 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001152 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001153 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1154 LongArray* array = a->AsLongArray();
1155 if (LIKELY(array->IsValidIndex(index))) {
1156 array->GetData()[index] = val;
1157 ADVANCE(2);
1158 } else {
1159 HANDLE_PENDING_EXCEPTION();
1160 }
1161 }
1162 }
1163 HANDLE_INSTRUCTION_END();
1164
1165 HANDLE_INSTRUCTION_START(APUT_OBJECT) {
1166 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1167 if (UNLIKELY(a == NULL)) {
1168 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1169 HANDLE_PENDING_EXCEPTION();
1170 } else {
1171 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001172 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001173 ObjectArray<Object>* array = a->AsObjectArray<Object>();
1174 if (LIKELY(array->IsValidIndex(index) && array->CheckAssignable(val))) {
1175 array->SetWithoutChecks(index, val);
1176 ADVANCE(2);
1177 } else {
1178 HANDLE_PENDING_EXCEPTION();
1179 }
1180 }
1181 }
1182 HANDLE_INSTRUCTION_END();
1183
1184 HANDLE_INSTRUCTION_START(IGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001185 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, 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_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001191 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, 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(IGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001197 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, 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(IGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001203 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, 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(IGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001209 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, 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(IGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001215 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, 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(IGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001221 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, 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(IGET_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001227 bool success = DoIGetQuick<Primitive::kPrimInt>(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(IGET_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001233 bool success = DoIGetQuick<Primitive::kPrimLong>(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(IGET_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001239 bool success = DoIGetQuick<Primitive::kPrimNot>(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(SGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001245 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, 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(SGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001251 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, 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(SGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001257 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, 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(SGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001263 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, 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(SGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001269 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, 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(SGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001275 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, 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(SGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001281 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(self, 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_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001287 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check>(self, 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_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001293 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check>(self, 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(IPUT_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001299 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, 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(IPUT_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001305 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, 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(IPUT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001311 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, 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(IPUT_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001317 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, 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(IPUT_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001323 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, 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(IPUT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001329 bool success = DoIPutQuick<Primitive::kPrimInt>(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(IPUT_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001335 bool success = DoIPutQuick<Primitive::kPrimLong>(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(IPUT_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001341 bool success = DoIPutQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001342 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1343 }
1344 HANDLE_INSTRUCTION_END();
1345
1346 HANDLE_INSTRUCTION_START(SPUT_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001347 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001348 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1349 }
1350 HANDLE_INSTRUCTION_END();
1351
1352 HANDLE_INSTRUCTION_START(SPUT_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001353 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001354 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1355 }
1356 HANDLE_INSTRUCTION_END();
1357
1358 HANDLE_INSTRUCTION_START(SPUT_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001359 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001360 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1361 }
1362 HANDLE_INSTRUCTION_END();
1363
1364 HANDLE_INSTRUCTION_START(SPUT_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001365 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001366 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1367 }
1368 HANDLE_INSTRUCTION_END();
1369
1370 HANDLE_INSTRUCTION_START(SPUT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001371 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001372 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1373 }
1374 HANDLE_INSTRUCTION_END();
1375
1376 HANDLE_INSTRUCTION_START(SPUT_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001377 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001378 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1379 }
1380 HANDLE_INSTRUCTION_END();
1381
1382 HANDLE_INSTRUCTION_START(SPUT_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001383 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001384 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1385 }
1386 HANDLE_INSTRUCTION_END();
1387
1388 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001389 bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001390 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001391 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1392 }
1393 HANDLE_INSTRUCTION_END();
1394
1395 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001396 bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001397 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001398 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1399 }
1400 HANDLE_INSTRUCTION_END();
1401
1402 HANDLE_INSTRUCTION_START(INVOKE_SUPER) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001403 bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001404 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001405 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1406 }
1407 HANDLE_INSTRUCTION_END();
1408
1409 HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001410 bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001411 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001412 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1413 }
1414 HANDLE_INSTRUCTION_END();
1415
1416 HANDLE_INSTRUCTION_START(INVOKE_DIRECT) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001417 bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001418 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001419 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1420 }
1421 HANDLE_INSTRUCTION_END();
1422
1423 HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001424 bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001425 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001426 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1427 }
1428 HANDLE_INSTRUCTION_END();
1429
1430 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001431 bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001432 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001433 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1434 }
1435 HANDLE_INSTRUCTION_END();
1436
1437 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001438 bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001439 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001440 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1441 }
1442 HANDLE_INSTRUCTION_END();
1443
1444 HANDLE_INSTRUCTION_START(INVOKE_STATIC) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001445 bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001446 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001447 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1448 }
1449 HANDLE_INSTRUCTION_END();
1450
1451 HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001452 bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001453 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001454 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1455 }
1456 HANDLE_INSTRUCTION_END();
1457
1458 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001459 bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001460 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001461 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1462 }
1463 HANDLE_INSTRUCTION_END();
1464
1465 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001466 bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001467 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001468 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1469 }
1470 HANDLE_INSTRUCTION_END();
1471
1472 HANDLE_INSTRUCTION_START(NEG_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001473 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001474 ADVANCE(1);
1475 HANDLE_INSTRUCTION_END();
1476
1477 HANDLE_INSTRUCTION_START(NOT_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001478 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001479 ADVANCE(1);
1480 HANDLE_INSTRUCTION_END();
1481
1482 HANDLE_INSTRUCTION_START(NEG_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001483 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001484 ADVANCE(1);
1485 HANDLE_INSTRUCTION_END();
1486
1487 HANDLE_INSTRUCTION_START(NOT_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001488 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001489 ADVANCE(1);
1490 HANDLE_INSTRUCTION_END();
1491
1492 HANDLE_INSTRUCTION_START(NEG_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001493 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001494 ADVANCE(1);
1495 HANDLE_INSTRUCTION_END();
1496
1497 HANDLE_INSTRUCTION_START(NEG_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001498 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001499 ADVANCE(1);
1500 HANDLE_INSTRUCTION_END();
1501
1502 HANDLE_INSTRUCTION_START(INT_TO_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001503 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001504 ADVANCE(1);
1505 HANDLE_INSTRUCTION_END();
1506
1507 HANDLE_INSTRUCTION_START(INT_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001508 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001509 ADVANCE(1);
1510 HANDLE_INSTRUCTION_END();
1511
1512 HANDLE_INSTRUCTION_START(INT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001513 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001514 ADVANCE(1);
1515 HANDLE_INSTRUCTION_END();
1516
1517 HANDLE_INSTRUCTION_START(LONG_TO_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001518 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001519 ADVANCE(1);
1520 HANDLE_INSTRUCTION_END();
1521
1522 HANDLE_INSTRUCTION_START(LONG_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001523 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001524 ADVANCE(1);
1525 HANDLE_INSTRUCTION_END();
1526
1527 HANDLE_INSTRUCTION_START(LONG_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001528 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001529 ADVANCE(1);
1530 HANDLE_INSTRUCTION_END();
1531
1532 HANDLE_INSTRUCTION_START(FLOAT_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001533 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001534 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001535 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001536 ADVANCE(1);
1537 }
1538 HANDLE_INSTRUCTION_END();
1539
1540 HANDLE_INSTRUCTION_START(FLOAT_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001541 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001542 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001543 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001544 ADVANCE(1);
1545 }
1546 HANDLE_INSTRUCTION_END();
1547
1548 HANDLE_INSTRUCTION_START(FLOAT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001549 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001550 ADVANCE(1);
1551 HANDLE_INSTRUCTION_END();
1552
1553 HANDLE_INSTRUCTION_START(DOUBLE_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001554 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001555 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001556 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001557 ADVANCE(1);
1558 }
1559 HANDLE_INSTRUCTION_END();
1560
1561 HANDLE_INSTRUCTION_START(DOUBLE_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001562 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001563 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001564 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001565 ADVANCE(1);
1566 }
1567 HANDLE_INSTRUCTION_END();
1568
1569 HANDLE_INSTRUCTION_START(DOUBLE_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001570 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001571 ADVANCE(1);
1572 HANDLE_INSTRUCTION_END();
1573
1574 HANDLE_INSTRUCTION_START(INT_TO_BYTE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001575 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1576 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001577 ADVANCE(1);
1578 HANDLE_INSTRUCTION_END();
1579
1580 HANDLE_INSTRUCTION_START(INT_TO_CHAR)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001581 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1582 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001583 ADVANCE(1);
1584 HANDLE_INSTRUCTION_END();
1585
1586 HANDLE_INSTRUCTION_START(INT_TO_SHORT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001587 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1588 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001589 ADVANCE(1);
1590 HANDLE_INSTRUCTION_END();
1591
1592 HANDLE_INSTRUCTION_START(ADD_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001593 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001594 shadow_frame.GetVReg(inst->VRegB_23x()) +
1595 shadow_frame.GetVReg(inst->VRegC_23x()));
1596 ADVANCE(2);
1597 HANDLE_INSTRUCTION_END();
1598
1599 HANDLE_INSTRUCTION_START(SUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001600 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001601 shadow_frame.GetVReg(inst->VRegB_23x()) -
1602 shadow_frame.GetVReg(inst->VRegC_23x()));
1603 ADVANCE(2);
1604 HANDLE_INSTRUCTION_END();
1605
1606 HANDLE_INSTRUCTION_START(MUL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001607 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001608 shadow_frame.GetVReg(inst->VRegB_23x()) *
1609 shadow_frame.GetVReg(inst->VRegC_23x()));
1610 ADVANCE(2);
1611 HANDLE_INSTRUCTION_END();
1612
1613 HANDLE_INSTRUCTION_START(DIV_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001614 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
1615 shadow_frame.GetVReg(inst->VRegB_23x()),
1616 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001617 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1618 }
1619 HANDLE_INSTRUCTION_END();
1620
1621 HANDLE_INSTRUCTION_START(REM_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001622 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1623 shadow_frame.GetVReg(inst->VRegB_23x()),
1624 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001625 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1626 }
1627 HANDLE_INSTRUCTION_END();
1628
1629 HANDLE_INSTRUCTION_START(SHL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001630 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001631 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1632 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1633 ADVANCE(2);
1634 HANDLE_INSTRUCTION_END();
1635
1636 HANDLE_INSTRUCTION_START(SHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001637 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001638 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1639 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1640 ADVANCE(2);
1641 HANDLE_INSTRUCTION_END();
1642
1643 HANDLE_INSTRUCTION_START(USHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001644 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001645 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1646 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1647 ADVANCE(2);
1648 HANDLE_INSTRUCTION_END();
1649
1650 HANDLE_INSTRUCTION_START(AND_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001651 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001652 shadow_frame.GetVReg(inst->VRegB_23x()) &
1653 shadow_frame.GetVReg(inst->VRegC_23x()));
1654 ADVANCE(2);
1655 HANDLE_INSTRUCTION_END();
1656
1657 HANDLE_INSTRUCTION_START(OR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001658 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001659 shadow_frame.GetVReg(inst->VRegB_23x()) |
1660 shadow_frame.GetVReg(inst->VRegC_23x()));
1661 ADVANCE(2);
1662 HANDLE_INSTRUCTION_END();
1663
1664 HANDLE_INSTRUCTION_START(XOR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001665 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001666 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1667 shadow_frame.GetVReg(inst->VRegC_23x()));
1668 ADVANCE(2);
1669 HANDLE_INSTRUCTION_END();
1670
1671 HANDLE_INSTRUCTION_START(ADD_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001672 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001673 shadow_frame.GetVRegLong(inst->VRegB_23x()) +
1674 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1675 ADVANCE(2);
1676 HANDLE_INSTRUCTION_END();
1677
1678 HANDLE_INSTRUCTION_START(SUB_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001679 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001680 shadow_frame.GetVRegLong(inst->VRegB_23x()) -
1681 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1682 ADVANCE(2);
1683 HANDLE_INSTRUCTION_END();
1684
1685 HANDLE_INSTRUCTION_START(MUL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001686 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001687 shadow_frame.GetVRegLong(inst->VRegB_23x()) *
1688 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1689 ADVANCE(2);
1690 HANDLE_INSTRUCTION_END();
1691
1692 HANDLE_INSTRUCTION_START(DIV_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001693 bool success = DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
1694 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1695 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001696 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1697 }
1698 HANDLE_INSTRUCTION_END();
1699
1700 HANDLE_INSTRUCTION_START(REM_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001701 bool success = DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1702 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1703 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001704 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1705 }
1706 HANDLE_INSTRUCTION_END();
1707
1708 HANDLE_INSTRUCTION_START(AND_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001709 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001710 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1711 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1712 ADVANCE(2);
1713 HANDLE_INSTRUCTION_END();
1714
1715 HANDLE_INSTRUCTION_START(OR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001716 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001717 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1718 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1719 ADVANCE(2);
1720 HANDLE_INSTRUCTION_END();
1721
1722 HANDLE_INSTRUCTION_START(XOR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001723 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001724 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1725 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1726 ADVANCE(2);
1727 HANDLE_INSTRUCTION_END();
1728
1729 HANDLE_INSTRUCTION_START(SHL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001730 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001731 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1732 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1733 ADVANCE(2);
1734 HANDLE_INSTRUCTION_END();
1735
1736 HANDLE_INSTRUCTION_START(SHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001737 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001738 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1739 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1740 ADVANCE(2);
1741 HANDLE_INSTRUCTION_END();
1742
1743 HANDLE_INSTRUCTION_START(USHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001744 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001745 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1746 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1747 ADVANCE(2);
1748 HANDLE_INSTRUCTION_END();
1749
1750 HANDLE_INSTRUCTION_START(ADD_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001751 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001752 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1753 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1754 ADVANCE(2);
1755 HANDLE_INSTRUCTION_END();
1756
1757 HANDLE_INSTRUCTION_START(SUB_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001758 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001759 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1760 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1761 ADVANCE(2);
1762 HANDLE_INSTRUCTION_END();
1763
1764 HANDLE_INSTRUCTION_START(MUL_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001765 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001766 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1767 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1768 ADVANCE(2);
1769 HANDLE_INSTRUCTION_END();
1770
1771 HANDLE_INSTRUCTION_START(DIV_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001772 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001773 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1774 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1775 ADVANCE(2);
1776 HANDLE_INSTRUCTION_END();
1777
1778 HANDLE_INSTRUCTION_START(REM_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001779 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001780 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1781 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1782 ADVANCE(2);
1783 HANDLE_INSTRUCTION_END();
1784
1785 HANDLE_INSTRUCTION_START(ADD_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001786 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001787 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1788 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1789 ADVANCE(2);
1790 HANDLE_INSTRUCTION_END();
1791
1792 HANDLE_INSTRUCTION_START(SUB_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001793 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001794 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1795 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1796 ADVANCE(2);
1797 HANDLE_INSTRUCTION_END();
1798
1799 HANDLE_INSTRUCTION_START(MUL_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001800 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001801 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1802 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1803 ADVANCE(2);
1804 HANDLE_INSTRUCTION_END();
1805
1806 HANDLE_INSTRUCTION_START(DIV_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001807 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001808 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1809 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1810 ADVANCE(2);
1811 HANDLE_INSTRUCTION_END();
1812
1813 HANDLE_INSTRUCTION_START(REM_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001814 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001815 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1816 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1817 ADVANCE(2);
1818 HANDLE_INSTRUCTION_END();
1819
1820 HANDLE_INSTRUCTION_START(ADD_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001821 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001822 shadow_frame.SetVReg(vregA,
1823 shadow_frame.GetVReg(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001824 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001825 ADVANCE(1);
1826 }
1827 HANDLE_INSTRUCTION_END();
1828
1829 HANDLE_INSTRUCTION_START(SUB_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001830 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001831 shadow_frame.SetVReg(vregA,
1832 shadow_frame.GetVReg(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001833 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001834 ADVANCE(1);
1835 }
1836 HANDLE_INSTRUCTION_END();
1837
1838 HANDLE_INSTRUCTION_START(MUL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001839 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001840 shadow_frame.SetVReg(vregA,
1841 shadow_frame.GetVReg(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001842 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001843 ADVANCE(1);
1844 }
1845 HANDLE_INSTRUCTION_END();
1846
1847 HANDLE_INSTRUCTION_START(DIV_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001848 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001849 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001850 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001851 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1852 }
1853 HANDLE_INSTRUCTION_END();
1854
1855 HANDLE_INSTRUCTION_START(REM_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001856 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001857 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001858 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001859 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1860 }
1861 HANDLE_INSTRUCTION_END();
1862
1863 HANDLE_INSTRUCTION_START(SHL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001864 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001865 shadow_frame.SetVReg(vregA,
1866 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001867 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001868 ADVANCE(1);
1869 }
1870 HANDLE_INSTRUCTION_END();
1871
1872 HANDLE_INSTRUCTION_START(SHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001873 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001874 shadow_frame.SetVReg(vregA,
1875 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001876 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001877 ADVANCE(1);
1878 }
1879 HANDLE_INSTRUCTION_END();
1880
1881 HANDLE_INSTRUCTION_START(USHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001882 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001883 shadow_frame.SetVReg(vregA,
1884 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001885 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001886 ADVANCE(1);
1887 }
1888 HANDLE_INSTRUCTION_END();
1889
1890 HANDLE_INSTRUCTION_START(AND_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001891 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001892 shadow_frame.SetVReg(vregA,
1893 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001894 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001895 ADVANCE(1);
1896 }
1897 HANDLE_INSTRUCTION_END();
1898
1899 HANDLE_INSTRUCTION_START(OR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001900 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001901 shadow_frame.SetVReg(vregA,
1902 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001903 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001904 ADVANCE(1);
1905 }
1906 HANDLE_INSTRUCTION_END();
1907
1908 HANDLE_INSTRUCTION_START(XOR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001909 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001910 shadow_frame.SetVReg(vregA,
1911 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001912 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001913 ADVANCE(1);
1914 }
1915 HANDLE_INSTRUCTION_END();
1916
1917 HANDLE_INSTRUCTION_START(ADD_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001918 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001919 shadow_frame.SetVRegLong(vregA,
1920 shadow_frame.GetVRegLong(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001921 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001922 ADVANCE(1);
1923 }
1924 HANDLE_INSTRUCTION_END();
1925
1926 HANDLE_INSTRUCTION_START(SUB_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001927 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001928 shadow_frame.SetVRegLong(vregA,
1929 shadow_frame.GetVRegLong(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001930 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001931 ADVANCE(1);
1932 }
1933 HANDLE_INSTRUCTION_END();
1934
1935 HANDLE_INSTRUCTION_START(MUL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001936 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001937 shadow_frame.SetVRegLong(vregA,
1938 shadow_frame.GetVRegLong(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001939 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001940 ADVANCE(1);
1941 }
1942 HANDLE_INSTRUCTION_END();
1943
1944 HANDLE_INSTRUCTION_START(DIV_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001945 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001946 bool success = DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001947 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001948 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1949 }
1950 HANDLE_INSTRUCTION_END();
1951
1952 HANDLE_INSTRUCTION_START(REM_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001953 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001954 bool success = DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001955 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001956 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1957 }
1958 HANDLE_INSTRUCTION_END();
1959
1960 HANDLE_INSTRUCTION_START(AND_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001961 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001962 shadow_frame.SetVRegLong(vregA,
1963 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001964 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001965 ADVANCE(1);
1966 }
1967 HANDLE_INSTRUCTION_END();
1968
1969 HANDLE_INSTRUCTION_START(OR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001970 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001971 shadow_frame.SetVRegLong(vregA,
1972 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001973 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001974 ADVANCE(1);
1975 }
1976 HANDLE_INSTRUCTION_END();
1977
1978 HANDLE_INSTRUCTION_START(XOR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001979 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001980 shadow_frame.SetVRegLong(vregA,
1981 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001982 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001983 ADVANCE(1);
1984 }
1985 HANDLE_INSTRUCTION_END();
1986
1987 HANDLE_INSTRUCTION_START(SHL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001988 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001989 shadow_frame.SetVRegLong(vregA,
1990 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001991 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001992 ADVANCE(1);
1993 }
1994 HANDLE_INSTRUCTION_END();
1995
1996 HANDLE_INSTRUCTION_START(SHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001997 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001998 shadow_frame.SetVRegLong(vregA,
1999 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002000 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002001 ADVANCE(1);
2002 }
2003 HANDLE_INSTRUCTION_END();
2004
2005 HANDLE_INSTRUCTION_START(USHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002006 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002007 shadow_frame.SetVRegLong(vregA,
2008 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002009 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002010 ADVANCE(1);
2011 }
2012 HANDLE_INSTRUCTION_END();
2013
2014 HANDLE_INSTRUCTION_START(ADD_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002015 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002016 shadow_frame.SetVRegFloat(vregA,
2017 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002018 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002019 ADVANCE(1);
2020 }
2021 HANDLE_INSTRUCTION_END();
2022
2023 HANDLE_INSTRUCTION_START(SUB_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002024 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002025 shadow_frame.SetVRegFloat(vregA,
2026 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002027 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002028 ADVANCE(1);
2029 }
2030 HANDLE_INSTRUCTION_END();
2031
2032 HANDLE_INSTRUCTION_START(MUL_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002033 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002034 shadow_frame.SetVRegFloat(vregA,
2035 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002036 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002037 ADVANCE(1);
2038 }
2039 HANDLE_INSTRUCTION_END();
2040
2041 HANDLE_INSTRUCTION_START(DIV_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002042 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002043 shadow_frame.SetVRegFloat(vregA,
2044 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002045 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002046 ADVANCE(1);
2047 }
2048 HANDLE_INSTRUCTION_END();
2049
2050 HANDLE_INSTRUCTION_START(REM_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002051 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002052 shadow_frame.SetVRegFloat(vregA,
2053 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002054 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002055 ADVANCE(1);
2056 }
2057 HANDLE_INSTRUCTION_END();
2058
2059 HANDLE_INSTRUCTION_START(ADD_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002060 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002061 shadow_frame.SetVRegDouble(vregA,
2062 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002063 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002064 ADVANCE(1);
2065 }
2066 HANDLE_INSTRUCTION_END();
2067
2068 HANDLE_INSTRUCTION_START(SUB_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002069 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002070 shadow_frame.SetVRegDouble(vregA,
2071 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002072 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002073 ADVANCE(1);
2074 }
2075 HANDLE_INSTRUCTION_END();
2076
2077 HANDLE_INSTRUCTION_START(MUL_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002078 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002079 shadow_frame.SetVRegDouble(vregA,
2080 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002081 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002082 ADVANCE(1);
2083 }
2084 HANDLE_INSTRUCTION_END();
2085
2086 HANDLE_INSTRUCTION_START(DIV_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002087 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002088 shadow_frame.SetVRegDouble(vregA,
2089 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002090 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002091 ADVANCE(1);
2092 }
2093 HANDLE_INSTRUCTION_END();
2094
2095 HANDLE_INSTRUCTION_START(REM_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002096 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002097 shadow_frame.SetVRegDouble(vregA,
2098 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002099 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002100 ADVANCE(1);
2101 }
2102 HANDLE_INSTRUCTION_END();
2103
2104 HANDLE_INSTRUCTION_START(ADD_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002105 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2106 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) +
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002107 inst->VRegC_22s());
2108 ADVANCE(2);
2109 HANDLE_INSTRUCTION_END();
2110
2111 HANDLE_INSTRUCTION_START(RSUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002112 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002113 inst->VRegC_22s() -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002114 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002115 ADVANCE(2);
2116 HANDLE_INSTRUCTION_END();
2117
2118 HANDLE_INSTRUCTION_START(MUL_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002119 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2120 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) *
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002121 inst->VRegC_22s());
2122 ADVANCE(2);
2123 HANDLE_INSTRUCTION_END();
2124
2125 HANDLE_INSTRUCTION_START(DIV_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002126 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
2127 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002128 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2129 }
2130 HANDLE_INSTRUCTION_END();
2131
2132 HANDLE_INSTRUCTION_START(REM_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002133 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
2134 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002135 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2136 }
2137 HANDLE_INSTRUCTION_END();
2138
2139 HANDLE_INSTRUCTION_START(AND_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002140 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2141 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002142 inst->VRegC_22s());
2143 ADVANCE(2);
2144 HANDLE_INSTRUCTION_END();
2145
2146 HANDLE_INSTRUCTION_START(OR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002147 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2148 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002149 inst->VRegC_22s());
2150 ADVANCE(2);
2151 HANDLE_INSTRUCTION_END();
2152
2153 HANDLE_INSTRUCTION_START(XOR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002154 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2155 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002156 inst->VRegC_22s());
2157 ADVANCE(2);
2158 HANDLE_INSTRUCTION_END();
2159
2160 HANDLE_INSTRUCTION_START(ADD_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002161 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002162 shadow_frame.GetVReg(inst->VRegB_22b()) +
2163 inst->VRegC_22b());
2164 ADVANCE(2);
2165 HANDLE_INSTRUCTION_END();
2166
2167 HANDLE_INSTRUCTION_START(RSUB_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002168 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002169 inst->VRegC_22b() -
2170 shadow_frame.GetVReg(inst->VRegB_22b()));
2171 ADVANCE(2);
2172 HANDLE_INSTRUCTION_END();
2173
2174 HANDLE_INSTRUCTION_START(MUL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002175 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002176 shadow_frame.GetVReg(inst->VRegB_22b()) *
2177 inst->VRegC_22b());
2178 ADVANCE(2);
2179 HANDLE_INSTRUCTION_END();
2180
2181 HANDLE_INSTRUCTION_START(DIV_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002182 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
2183 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002184 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2185 }
2186 HANDLE_INSTRUCTION_END();
2187
2188 HANDLE_INSTRUCTION_START(REM_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002189 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
2190 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002191 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2192 }
2193 HANDLE_INSTRUCTION_END();
2194
2195 HANDLE_INSTRUCTION_START(AND_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002196 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002197 shadow_frame.GetVReg(inst->VRegB_22b()) &
2198 inst->VRegC_22b());
2199 ADVANCE(2);
2200 HANDLE_INSTRUCTION_END();
2201
2202 HANDLE_INSTRUCTION_START(OR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002203 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002204 shadow_frame.GetVReg(inst->VRegB_22b()) |
2205 inst->VRegC_22b());
2206 ADVANCE(2);
2207 HANDLE_INSTRUCTION_END();
2208
2209 HANDLE_INSTRUCTION_START(XOR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002210 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002211 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2212 inst->VRegC_22b());
2213 ADVANCE(2);
2214 HANDLE_INSTRUCTION_END();
2215
2216 HANDLE_INSTRUCTION_START(SHL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002217 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002218 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2219 (inst->VRegC_22b() & 0x1f));
2220 ADVANCE(2);
2221 HANDLE_INSTRUCTION_END();
2222
2223 HANDLE_INSTRUCTION_START(SHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002224 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002225 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2226 (inst->VRegC_22b() & 0x1f));
2227 ADVANCE(2);
2228 HANDLE_INSTRUCTION_END();
2229
2230 HANDLE_INSTRUCTION_START(USHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002231 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002232 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2233 (inst->VRegC_22b() & 0x1f));
2234 ADVANCE(2);
2235 HANDLE_INSTRUCTION_END();
2236
2237 HANDLE_INSTRUCTION_START(UNUSED_3E)
2238 UnexpectedOpcode(inst, mh);
2239 HANDLE_INSTRUCTION_END();
2240
2241 HANDLE_INSTRUCTION_START(UNUSED_3F)
2242 UnexpectedOpcode(inst, mh);
2243 HANDLE_INSTRUCTION_END();
2244
2245 HANDLE_INSTRUCTION_START(UNUSED_40)
2246 UnexpectedOpcode(inst, mh);
2247 HANDLE_INSTRUCTION_END();
2248
2249 HANDLE_INSTRUCTION_START(UNUSED_41)
2250 UnexpectedOpcode(inst, mh);
2251 HANDLE_INSTRUCTION_END();
2252
2253 HANDLE_INSTRUCTION_START(UNUSED_42)
2254 UnexpectedOpcode(inst, mh);
2255 HANDLE_INSTRUCTION_END();
2256
2257 HANDLE_INSTRUCTION_START(UNUSED_43)
2258 UnexpectedOpcode(inst, mh);
2259 HANDLE_INSTRUCTION_END();
2260
2261 HANDLE_INSTRUCTION_START(UNUSED_79)
2262 UnexpectedOpcode(inst, mh);
2263 HANDLE_INSTRUCTION_END();
2264
2265 HANDLE_INSTRUCTION_START(UNUSED_7A)
2266 UnexpectedOpcode(inst, mh);
2267 HANDLE_INSTRUCTION_END();
2268
2269 HANDLE_INSTRUCTION_START(UNUSED_EB)
2270 UnexpectedOpcode(inst, mh);
2271 HANDLE_INSTRUCTION_END();
2272
2273 HANDLE_INSTRUCTION_START(UNUSED_EC)
2274 UnexpectedOpcode(inst, mh);
2275 HANDLE_INSTRUCTION_END();
2276
2277 HANDLE_INSTRUCTION_START(UNUSED_ED)
2278 UnexpectedOpcode(inst, mh);
2279 HANDLE_INSTRUCTION_END();
2280
2281 HANDLE_INSTRUCTION_START(UNUSED_EE)
2282 UnexpectedOpcode(inst, mh);
2283 HANDLE_INSTRUCTION_END();
2284
2285 HANDLE_INSTRUCTION_START(UNUSED_EF)
2286 UnexpectedOpcode(inst, mh);
2287 HANDLE_INSTRUCTION_END();
2288
2289 HANDLE_INSTRUCTION_START(UNUSED_F0)
2290 UnexpectedOpcode(inst, mh);
2291 HANDLE_INSTRUCTION_END();
2292
2293 HANDLE_INSTRUCTION_START(UNUSED_F1)
2294 UnexpectedOpcode(inst, mh);
2295 HANDLE_INSTRUCTION_END();
2296
2297 HANDLE_INSTRUCTION_START(UNUSED_F2)
2298 UnexpectedOpcode(inst, mh);
2299 HANDLE_INSTRUCTION_END();
2300
2301 HANDLE_INSTRUCTION_START(UNUSED_F3)
2302 UnexpectedOpcode(inst, mh);
2303 HANDLE_INSTRUCTION_END();
2304
2305 HANDLE_INSTRUCTION_START(UNUSED_F4)
2306 UnexpectedOpcode(inst, mh);
2307 HANDLE_INSTRUCTION_END();
2308
2309 HANDLE_INSTRUCTION_START(UNUSED_F5)
2310 UnexpectedOpcode(inst, mh);
2311 HANDLE_INSTRUCTION_END();
2312
2313 HANDLE_INSTRUCTION_START(UNUSED_F6)
2314 UnexpectedOpcode(inst, mh);
2315 HANDLE_INSTRUCTION_END();
2316
2317 HANDLE_INSTRUCTION_START(UNUSED_F7)
2318 UnexpectedOpcode(inst, mh);
2319 HANDLE_INSTRUCTION_END();
2320
2321 HANDLE_INSTRUCTION_START(UNUSED_F8)
2322 UnexpectedOpcode(inst, mh);
2323 HANDLE_INSTRUCTION_END();
2324
2325 HANDLE_INSTRUCTION_START(UNUSED_F9)
2326 UnexpectedOpcode(inst, mh);
2327 HANDLE_INSTRUCTION_END();
2328
2329 HANDLE_INSTRUCTION_START(UNUSED_FA)
2330 UnexpectedOpcode(inst, mh);
2331 HANDLE_INSTRUCTION_END();
2332
2333 HANDLE_INSTRUCTION_START(UNUSED_FB)
2334 UnexpectedOpcode(inst, mh);
2335 HANDLE_INSTRUCTION_END();
2336
2337 HANDLE_INSTRUCTION_START(UNUSED_FC)
2338 UnexpectedOpcode(inst, mh);
2339 HANDLE_INSTRUCTION_END();
2340
2341 HANDLE_INSTRUCTION_START(UNUSED_FD)
2342 UnexpectedOpcode(inst, mh);
2343 HANDLE_INSTRUCTION_END();
2344
2345 HANDLE_INSTRUCTION_START(UNUSED_FE)
2346 UnexpectedOpcode(inst, mh);
2347 HANDLE_INSTRUCTION_END();
2348
2349 HANDLE_INSTRUCTION_START(UNUSED_FF)
2350 UnexpectedOpcode(inst, mh);
2351 HANDLE_INSTRUCTION_END();
2352
2353 exception_pending_label: {
2354 CHECK(self->IsExceptionPending());
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002355 if (UNLIKELY(self->TestAllFlags())) {
2356 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002357 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002358 }
Sebastien Hertz947ff082013-09-17 14:10:13 +02002359 Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_);
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002360 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002361 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc,
Sebastien Hertz947ff082013-09-17 14:10:13 +02002362 this_object,
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002363 instrumentation);
2364 if (found_dex_pc == DexFile::kDexNoIndex) {
2365 return JValue(); /* Handled in caller. */
2366 } else {
2367 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc);
2368 ADVANCE(displacement);
2369 }
2370 }
2371
2372 // Create alternative instruction handlers dedicated to instrumentation.
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002373#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
2374 alt_op_##code: { \
2375 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation(); \
2376 if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
2377 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), \
2378 shadow_frame.GetMethod(), dex_pc); \
2379 } \
2380 UPDATE_HANDLER_TABLE(); \
2381 goto *handlersTable[instrumentation::kMainHandlerTable][Instruction::code]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002382 }
2383#include "dex_instruction_list.h"
2384 DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER)
2385#undef DEX_INSTRUCTION_LIST
2386#undef INSTRUMENTATION_INSTRUCTION_HANDLER
2387} // NOLINT(readability/fn_size)
2388
2389// Explicit definitions of ExecuteGotoImpl.
Sebastien Hertzc6714852013-09-30 16:42:32 +02002390template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
2391JValue ExecuteGotoImpl<true>(Thread* self, MethodHelper& mh,
2392 const DexFile::CodeItem* code_item,
2393 ShadowFrame& shadow_frame, JValue result_register);
2394template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
2395JValue ExecuteGotoImpl<false>(Thread* self, MethodHelper& mh,
2396 const DexFile::CodeItem* code_item,
2397 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002398
2399} // namespace interpreter
2400} // namespace art