blob: af0a530688143cc4bcd7b1d24fbd66da93d8b0c9 [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
Colin Crosse84e4f72015-03-18 14:01:19 -070017#if !defined(__clang__)
18// Clang 3.4 fails to build the goto interpreter implementation.
19
Sebastien Hertz8ece0502013-08-07 11:26:41 +020020#include "interpreter_common.h"
Ian Rogersf72a11d2014-10-30 15:41:08 -070021#include "safe_math.h"
Sebastien Hertz8ece0502013-08-07 11:26:41 +020022
23namespace art {
24namespace interpreter {
25
26// In the following macros, we expect the following local variables exist:
27// - "self": the current Thread*.
28// - "inst" : the current Instruction*.
Sebastien Hertz3b588e02013-09-11 14:33:18 +020029// - "inst_data" : the current instruction's first 16 bits.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020030// - "dex_pc": the current pc.
31// - "shadow_frame": the current shadow frame.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020032// - "currentHandlersTable": the current table of pointer to each instruction handler.
33
34// Advance to the next instruction and updates interpreter state.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020035#define ADVANCE(_offset) \
36 do { \
37 int32_t disp = static_cast<int32_t>(_offset); \
38 inst = inst->RelativeAt(disp); \
39 dex_pc = static_cast<uint32_t>(static_cast<int32_t>(dex_pc) + disp); \
40 shadow_frame.SetDexPC(dex_pc); \
Ian Rogerse94652f2014-12-02 11:13:19 -080041 TraceExecution(shadow_frame, inst, dex_pc); \
Sebastien Hertz3b588e02013-09-11 14:33:18 +020042 inst_data = inst->Fetch16(0); \
43 goto *currentHandlersTable[inst->Opcode(inst_data)]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020044 } while (false)
45
46#define HANDLE_PENDING_EXCEPTION() goto exception_pending_label
47
48#define POSSIBLY_HANDLE_PENDING_EXCEPTION(_is_exception_pending, _offset) \
49 do { \
50 if (UNLIKELY(_is_exception_pending)) { \
51 HANDLE_PENDING_EXCEPTION(); \
52 } else { \
53 ADVANCE(_offset); \
54 } \
55 } while (false)
56
Sebastien Hertzee1997a2013-09-19 14:47:09 +020057#define UPDATE_HANDLER_TABLE() \
58 currentHandlersTable = handlersTable[Runtime::Current()->GetInstrumentation()->GetInterpreterHandlerTable()]
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +020059
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080060#define BACKWARD_BRANCH_INSTRUMENTATION(offset) \
61 do { \
62 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation(); \
63 instrumentation->BackwardBranch(self, shadow_frame.GetMethod(), offset); \
64 } while (false)
65
Sebastien Hertz8ece0502013-08-07 11:26:41 +020066#define UNREACHABLE_CODE_CHECK() \
67 do { \
68 if (kIsDebugBuild) { \
69 LOG(FATAL) << "We should not be here !"; \
Ian Rogerse94652f2014-12-02 11:13:19 -080070 UNREACHABLE(); \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020071 } \
72 } while (false)
73
74#define HANDLE_INSTRUCTION_START(opcode) op_##opcode: // NOLINT(whitespace/labels)
75#define HANDLE_INSTRUCTION_END() UNREACHABLE_CODE_CHECK()
76
Sebastien Hertzee1997a2013-09-19 14:47:09 +020077/**
78 * Interpreter based on computed goto tables.
79 *
80 * Each instruction is associated to a handler. This handler is responsible for executing the
81 * instruction and jump to the next instruction's handler.
82 * In order to limit the cost of instrumentation, we have two handler tables:
83 * - the "main" handler table: it contains handlers for normal execution of each instruction without
84 * handling of instrumentation.
85 * - the "alternative" handler table: it contains alternative handlers which first handle
86 * instrumentation before jumping to the corresponding "normal" instruction's handler.
87 *
88 * When instrumentation is active, the interpreter uses the "alternative" handler table. Otherwise
89 * it uses the "main" handler table.
90 *
91 * The current handler table is the handler table being used by the interpreter. It is updated:
92 * - on backward branch (goto, if and switch instructions)
93 * - after invoke
94 * - when an exception is thrown.
95 * This allows to support an attaching debugger to an already running application for instance.
96 *
97 * For a fast handler table update, handler tables are stored in an array of handler tables. Each
98 * handler table is represented by the InterpreterHandlerTable enum which allows to associate it
99 * to an index in this array of handler tables ((see Instrumentation::GetInterpreterHandlerTable).
100 *
101 * Here's the current layout of this array of handler tables:
102 *
103 * ---------------------+---------------+
104 * | NOP | (handler for NOP instruction)
105 * +---------------+
106 * "main" | MOVE | (handler for MOVE instruction)
107 * handler table +---------------+
108 * | ... |
109 * +---------------+
110 * | UNUSED_FF | (handler for UNUSED_FF instruction)
111 * ---------------------+---------------+
112 * | NOP | (alternative handler for NOP instruction)
113 * +---------------+
114 * "alternative" | MOVE | (alternative handler for MOVE instruction)
115 * handler table +---------------+
116 * | ... |
117 * +---------------+
118 * | UNUSED_FF | (alternative handler for UNUSED_FF instruction)
119 * ---------------------+---------------+
120 *
121 */
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100122template<bool do_access_check, bool transaction_active>
Ian Rogerse94652f2014-12-02 11:13:19 -0800123JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowFrame& shadow_frame,
124 JValue result_register) {
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200125 // Define handler tables:
126 // - The main handler table contains execution handlers for each instruction.
127 // - The alternative handler table contains prelude handlers which check for thread suspend and
128 // manage instrumentation before jumping to the execution handler.
129 static const void* const handlersTable[instrumentation::kNumHandlerTables][kNumPackedOpcodes] = {
130 {
131 // Main handler table.
132#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&op_##code,
133#include "dex_instruction_list.h"
134 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
135#undef DEX_INSTRUCTION_LIST
136#undef INSTRUCTION_HANDLER
137 }, {
138 // Alternative handler table.
139#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&alt_op_##code,
140#include "dex_instruction_list.h"
141 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
142#undef DEX_INSTRUCTION_LIST
143#undef INSTRUCTION_HANDLER
144 }
145 };
146
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800147 constexpr bool do_assignability_check = do_access_check;
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200148 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
149 LOG(FATAL) << "Invalid shadow frame for interpreter use";
150 return JValue();
151 }
152 self->VerifyStack();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200153
154 uint32_t dex_pc = shadow_frame.GetDexPC();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200155 const Instruction* inst = Instruction::At(code_item->insns_ + dex_pc);
156 uint16_t inst_data;
157 const void* const* currentHandlersTable;
Sebastien Hertz8379b222014-02-24 17:38:15 +0100158 bool notified_method_entry_event = false;
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200159 UPDATE_HANDLER_TABLE();
Sebastien Hertz270a0e12015-01-16 19:49:09 +0100160 if (LIKELY(dex_pc == 0)) { // We are entering the method as opposed to deoptimizing.
161 if (kIsDebugBuild) {
162 self->AssertNoPendingException();
163 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200164 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200165 if (UNLIKELY(instrumentation->HasMethodEntryListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200166 instrumentation->MethodEnterEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200167 shadow_frame.GetMethod(), 0);
Sebastien Hertz8379b222014-02-24 17:38:15 +0100168 notified_method_entry_event = true;
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200169 }
170 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200171
172 // Jump to first instruction.
173 ADVANCE(0);
174 UNREACHABLE_CODE_CHECK();
175
176 HANDLE_INSTRUCTION_START(NOP)
177 ADVANCE(1);
178 HANDLE_INSTRUCTION_END();
179
180 HANDLE_INSTRUCTION_START(MOVE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200181 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
182 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200183 ADVANCE(1);
184 HANDLE_INSTRUCTION_END();
185
186 HANDLE_INSTRUCTION_START(MOVE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200187 shadow_frame.SetVReg(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200188 shadow_frame.GetVReg(inst->VRegB_22x()));
189 ADVANCE(2);
190 HANDLE_INSTRUCTION_END();
191
192 HANDLE_INSTRUCTION_START(MOVE_16)
193 shadow_frame.SetVReg(inst->VRegA_32x(),
194 shadow_frame.GetVReg(inst->VRegB_32x()));
195 ADVANCE(3);
196 HANDLE_INSTRUCTION_END();
197
198 HANDLE_INSTRUCTION_START(MOVE_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200199 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
200 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200201 ADVANCE(1);
202 HANDLE_INSTRUCTION_END();
203
204 HANDLE_INSTRUCTION_START(MOVE_WIDE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200205 shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200206 shadow_frame.GetVRegLong(inst->VRegB_22x()));
207 ADVANCE(2);
208 HANDLE_INSTRUCTION_END();
209
210 HANDLE_INSTRUCTION_START(MOVE_WIDE_16)
211 shadow_frame.SetVRegLong(inst->VRegA_32x(),
212 shadow_frame.GetVRegLong(inst->VRegB_32x()));
213 ADVANCE(3);
214 HANDLE_INSTRUCTION_END();
215
216 HANDLE_INSTRUCTION_START(MOVE_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200217 shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data),
218 shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200219 ADVANCE(1);
220 HANDLE_INSTRUCTION_END();
221
222 HANDLE_INSTRUCTION_START(MOVE_OBJECT_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200223 shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200224 shadow_frame.GetVRegReference(inst->VRegB_22x()));
225 ADVANCE(2);
226 HANDLE_INSTRUCTION_END();
227
228 HANDLE_INSTRUCTION_START(MOVE_OBJECT_16)
229 shadow_frame.SetVRegReference(inst->VRegA_32x(),
230 shadow_frame.GetVRegReference(inst->VRegB_32x()));
231 ADVANCE(3);
232 HANDLE_INSTRUCTION_END();
233
234 HANDLE_INSTRUCTION_START(MOVE_RESULT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200235 shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200236 ADVANCE(1);
237 HANDLE_INSTRUCTION_END();
238
239 HANDLE_INSTRUCTION_START(MOVE_RESULT_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200240 shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200241 ADVANCE(1);
242 HANDLE_INSTRUCTION_END();
243
244 HANDLE_INSTRUCTION_START(MOVE_RESULT_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200245 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200246 ADVANCE(1);
247 HANDLE_INSTRUCTION_END();
248
249 HANDLE_INSTRUCTION_START(MOVE_EXCEPTION) {
Nicolas Geoffray14691c52015-03-05 10:40:17 +0000250 Throwable* exception = self->GetException();
Sebastien Hertz270a0e12015-01-16 19:49:09 +0100251 DCHECK(exception != nullptr) << "No pending exception on MOVE_EXCEPTION instruction";
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200252 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception);
Sebastien Hertz5c004902014-05-21 10:07:42 +0200253 self->ClearException();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200254 ADVANCE(1);
255 }
256 HANDLE_INSTRUCTION_END();
257
258 HANDLE_INSTRUCTION_START(RETURN_VOID) {
259 JValue result;
Sebastien Hertz043036f2013-09-09 18:26:48 +0200260 if (do_access_check) {
261 // If access checks are required then the dex-to-dex compiler and analysis of
262 // whether the class has final fields hasn't been performed. Conservatively
263 // perform the memory barrier now.
Hans Boehm30359612014-05-21 17:46:23 -0700264 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz043036f2013-09-09 18:26:48 +0200265 }
Ian Rogers7b078e82014-09-10 14:44:24 -0700266 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200267 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200268 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200269 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200270 shadow_frame.GetMethod(), dex_pc,
271 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200272 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
273 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
274 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200275 }
276 return result;
277 }
278 HANDLE_INSTRUCTION_END();
279
280 HANDLE_INSTRUCTION_START(RETURN_VOID_BARRIER) {
Hans Boehm30359612014-05-21 17:46:23 -0700281 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200282 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700283 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200284 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200285 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200286 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200287 shadow_frame.GetMethod(), dex_pc,
288 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200289 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
290 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
291 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200292 }
293 return result;
294 }
295 HANDLE_INSTRUCTION_END();
296
297 HANDLE_INSTRUCTION_START(RETURN) {
298 JValue result;
299 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200300 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700301 self->AllowThreadSuspension();
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);
Sebastien Hertze713d932014-05-15 10:48:53 +0200307 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
308 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
309 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200310 }
311 return result;
312 }
313 HANDLE_INSTRUCTION_END();
314
315 HANDLE_INSTRUCTION_START(RETURN_WIDE) {
316 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200317 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700318 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200319 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200320 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200321 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200322 shadow_frame.GetMethod(), dex_pc,
323 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200324 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
325 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
326 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200327 }
328 return result;
329 }
330 HANDLE_INSTRUCTION_END();
331
332 HANDLE_INSTRUCTION_START(RETURN_OBJECT) {
333 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700334 self->AllowThreadSuspension();
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700335 const uint8_t vreg_index = inst->VRegA_11x(inst_data);
336 Object* obj_result = shadow_frame.GetVRegReference(vreg_index);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700337 if (do_assignability_check && obj_result != NULL) {
Ian Rogersded66a02014-10-28 18:12:55 -0700338 Class* return_type = shadow_frame.GetMethod()->GetReturnType();
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700339 obj_result = shadow_frame.GetVRegReference(vreg_index);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700340 if (return_type == NULL) {
341 // Return the pending exception.
342 HANDLE_PENDING_EXCEPTION();
343 }
344 if (!obj_result->VerifierInstanceOf(return_type)) {
345 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700346 std::string temp1, temp2;
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000347 self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700348 "Returning '%s' that is not instance of return type '%s'",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700349 obj_result->GetClass()->GetDescriptor(&temp1),
350 return_type->GetDescriptor(&temp2));
Jeff Haoa3faaf42013-09-03 19:07:00 -0700351 HANDLE_PENDING_EXCEPTION();
352 }
353 }
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700354 result.SetL(obj_result);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200355 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200356 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200357 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200358 shadow_frame.GetMethod(), dex_pc,
359 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200360 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
361 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
362 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200363 }
364 return result;
365 }
366 HANDLE_INSTRUCTION_END();
367
368 HANDLE_INSTRUCTION_START(CONST_4) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200369 uint32_t dst = inst->VRegA_11n(inst_data);
370 int32_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200371 shadow_frame.SetVReg(dst, val);
372 if (val == 0) {
373 shadow_frame.SetVRegReference(dst, NULL);
374 }
375 ADVANCE(1);
376 }
377 HANDLE_INSTRUCTION_END();
378
379 HANDLE_INSTRUCTION_START(CONST_16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200380 uint32_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200381 int32_t val = inst->VRegB_21s();
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) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200391 uint32_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200392 int32_t val = inst->VRegB_31i();
393 shadow_frame.SetVReg(dst, val);
394 if (val == 0) {
395 shadow_frame.SetVRegReference(dst, NULL);
396 }
397 ADVANCE(3);
398 }
399 HANDLE_INSTRUCTION_END();
400
401 HANDLE_INSTRUCTION_START(CONST_HIGH16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200402 uint32_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200403 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
404 shadow_frame.SetVReg(dst, val);
405 if (val == 0) {
406 shadow_frame.SetVRegReference(dst, NULL);
407 }
408 ADVANCE(2);
409 }
410 HANDLE_INSTRUCTION_END();
411
412 HANDLE_INSTRUCTION_START(CONST_WIDE_16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200413 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200414 ADVANCE(2);
415 HANDLE_INSTRUCTION_END();
416
417 HANDLE_INSTRUCTION_START(CONST_WIDE_32)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200418 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200419 ADVANCE(3);
420 HANDLE_INSTRUCTION_END();
421
422 HANDLE_INSTRUCTION_START(CONST_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200423 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200424 ADVANCE(5);
425 HANDLE_INSTRUCTION_END();
426
427 HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200428 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200429 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
430 ADVANCE(2);
431 HANDLE_INSTRUCTION_END();
432
433 HANDLE_INSTRUCTION_START(CONST_STRING) {
Ian Rogers6786a582014-10-28 12:49:06 -0700434 String* s = ResolveString(self, shadow_frame, inst->VRegB_21c());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200435 if (UNLIKELY(s == NULL)) {
436 HANDLE_PENDING_EXCEPTION();
437 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200438 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200439 ADVANCE(2);
440 }
441 }
442 HANDLE_INSTRUCTION_END();
443
444 HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
Ian Rogers6786a582014-10-28 12:49:06 -0700445 String* s = ResolveString(self, shadow_frame, inst->VRegB_31c());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200446 if (UNLIKELY(s == NULL)) {
447 HANDLE_PENDING_EXCEPTION();
448 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200449 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200450 ADVANCE(3);
451 }
452 }
453 HANDLE_INSTRUCTION_END();
454
455 HANDLE_INSTRUCTION_START(CONST_CLASS) {
456 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
457 self, false, do_access_check);
458 if (UNLIKELY(c == NULL)) {
459 HANDLE_PENDING_EXCEPTION();
460 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200461 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200462 ADVANCE(2);
463 }
464 }
465 HANDLE_INSTRUCTION_END();
466
467 HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200468 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200469 if (UNLIKELY(obj == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000470 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200471 HANDLE_PENDING_EXCEPTION();
472 } else {
473 DoMonitorEnter(self, obj);
474 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
475 }
476 }
477 HANDLE_INSTRUCTION_END();
478
479 HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200480 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200481 if (UNLIKELY(obj == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000482 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200483 HANDLE_PENDING_EXCEPTION();
484 } else {
485 DoMonitorExit(self, obj);
486 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
487 }
488 }
489 HANDLE_INSTRUCTION_END();
490
491 HANDLE_INSTRUCTION_START(CHECK_CAST) {
492 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
493 self, false, do_access_check);
494 if (UNLIKELY(c == NULL)) {
495 HANDLE_PENDING_EXCEPTION();
496 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200497 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200498 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
499 ThrowClassCastException(c, obj->GetClass());
500 HANDLE_PENDING_EXCEPTION();
501 } else {
502 ADVANCE(2);
503 }
504 }
505 }
506 HANDLE_INSTRUCTION_END();
507
508 HANDLE_INSTRUCTION_START(INSTANCE_OF) {
509 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
510 self, false, do_access_check);
511 if (UNLIKELY(c == NULL)) {
512 HANDLE_PENDING_EXCEPTION();
513 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200514 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
515 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200516 ADVANCE(2);
517 }
518 }
519 HANDLE_INSTRUCTION_END();
520
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700521 HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200522 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200523 if (UNLIKELY(array == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000524 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200525 HANDLE_PENDING_EXCEPTION();
526 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200527 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200528 ADVANCE(1);
529 }
530 }
531 HANDLE_INSTRUCTION_END();
532
533 HANDLE_INSTRUCTION_START(NEW_INSTANCE) {
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700534 Runtime* runtime = Runtime::Current();
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800535 Object* obj = AllocObjectFromCode<do_access_check, true>(
536 inst->VRegB_21c(), shadow_frame.GetMethod(), self,
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700537 runtime->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200538 if (UNLIKELY(obj == NULL)) {
539 HANDLE_PENDING_EXCEPTION();
540 } else {
Sebastien Hertz4e99b3d2014-06-24 14:35:40 +0200541 obj->GetClass()->AssertInitializedOrInitializingInThread(self);
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700542 // Don't allow finalizable objects to be allocated during a transaction since these can't be
543 // finalized without a started runtime.
544 if (transaction_active && obj->GetClass()->IsFinalizable()) {
Ian Rogers2fa98e22014-05-06 15:26:39 -0700545 AbortTransaction(self, "Allocating finalizable object in transaction: %s",
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700546 PrettyTypeOf(obj).c_str());
547 HANDLE_PENDING_EXCEPTION();
548 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200549 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200550 ADVANCE(2);
551 }
552 }
553 HANDLE_INSTRUCTION_END();
554
555 HANDLE_INSTRUCTION_START(NEW_ARRAY) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200556 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800557 Object* obj = AllocArrayFromCode<do_access_check, true>(
Andreas Gampe1cc7dba2014-12-17 18:43:01 -0800558 inst->VRegC_22c(), length, shadow_frame.GetMethod(), self,
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800559 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200560 if (UNLIKELY(obj == NULL)) {
561 HANDLE_PENDING_EXCEPTION();
562 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200563 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200564 ADVANCE(2);
565 }
566 }
567 HANDLE_INSTRUCTION_END();
568
569 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100570 bool success =
571 DoFilledNewArray<false, do_access_check, transaction_active>(inst, shadow_frame,
572 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200573 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
574 }
575 HANDLE_INSTRUCTION_END();
576
577 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100578 bool success =
579 DoFilledNewArray<true, do_access_check, transaction_active>(inst, shadow_frame,
580 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200581 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
582 }
583 HANDLE_INSTRUCTION_END();
584
585 HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200586 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Ian Rogers832336b2014-10-08 15:35:22 -0700587 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
588 const Instruction::ArrayDataPayload* payload =
589 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
590 bool success = FillArrayData(obj, payload);
591 if (transaction_active && success) {
592 RecordArrayElementsInTransaction(obj->AsArray(), payload->element_count);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200593 }
Ian Rogers832336b2014-10-08 15:35:22 -0700594 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200595 }
596 HANDLE_INSTRUCTION_END();
597
598 HANDLE_INSTRUCTION_START(THROW) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200599 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200600 if (UNLIKELY(exception == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000601 ThrowNullPointerException("throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700602 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
603 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700604 std::string temp;
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000605 self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700606 "Throwing '%s' that is not instance of Throwable",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700607 exception->GetClass()->GetDescriptor(&temp));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200608 } else {
Nicolas Geoffray14691c52015-03-05 10:40:17 +0000609 self->SetException(exception->AsThrowable());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200610 }
611 HANDLE_PENDING_EXCEPTION();
612 }
613 HANDLE_INSTRUCTION_END();
614
615 HANDLE_INSTRUCTION_START(GOTO) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200616 int8_t offset = inst->VRegA_10t(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200617 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800618 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200619 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700620 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200621 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200622 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200623 }
624 ADVANCE(offset);
625 }
626 HANDLE_INSTRUCTION_END();
627
628 HANDLE_INSTRUCTION_START(GOTO_16) {
629 int16_t offset = inst->VRegA_20t();
630 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800631 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200632 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700633 self->CheckSuspend();
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(GOTO_32) {
642 int32_t offset = inst->VRegA_30t();
643 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800644 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200645 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700646 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200647 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200648 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200649 }
650 ADVANCE(offset);
651 }
652 HANDLE_INSTRUCTION_END();
653
654 HANDLE_INSTRUCTION_START(PACKED_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200655 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200656 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800657 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200658 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700659 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200660 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200661 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200662 }
663 ADVANCE(offset);
664 }
665 HANDLE_INSTRUCTION_END();
666
667 HANDLE_INSTRUCTION_START(SPARSE_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200668 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200669 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800670 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200671 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700672 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200673 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200674 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200675 }
676 ADVANCE(offset);
677 }
678 HANDLE_INSTRUCTION_END();
679
Ian Rogers647b1a82014-10-10 11:02:11 -0700680#if defined(__clang__)
681#pragma clang diagnostic push
682#pragma clang diagnostic ignored "-Wfloat-equal"
683#endif
684
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200685 HANDLE_INSTRUCTION_START(CMPL_FLOAT) {
686 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
687 float val2 = shadow_frame.GetVRegFloat(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_FLOAT) {
702 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
703 float val2 = shadow_frame.GetVRegFloat(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(CMPL_DOUBLE) {
718 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
719 double val2 = shadow_frame.GetVRegDouble(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(CMPG_DOUBLE) {
734 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
735 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
736 int32_t result;
737 if (val1 < val2) {
738 result = -1;
739 } else if (val1 == val2) {
740 result = 0;
741 } else {
742 result = 1;
743 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200744 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200745 ADVANCE(2);
746 }
747 HANDLE_INSTRUCTION_END();
748
Ian Rogers647b1a82014-10-10 11:02:11 -0700749#if defined(__clang__)
750#pragma clang diagnostic pop
751#endif
752
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200753 HANDLE_INSTRUCTION_START(CMP_LONG) {
754 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
755 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
756 int32_t result;
757 if (val1 > val2) {
758 result = 1;
759 } else if (val1 == val2) {
760 result = 0;
761 } else {
762 result = -1;
763 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200764 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200765 ADVANCE(2);
766 }
767 HANDLE_INSTRUCTION_END();
768
769 HANDLE_INSTRUCTION_START(IF_EQ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200770 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200771 int16_t offset = inst->VRegC_22t();
772 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800773 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200774 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700775 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200776 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200777 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200778 }
779 ADVANCE(offset);
780 } else {
781 ADVANCE(2);
782 }
783 }
784 HANDLE_INSTRUCTION_END();
785
786 HANDLE_INSTRUCTION_START(IF_NE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200787 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) != shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200788 int16_t offset = inst->VRegC_22t();
789 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800790 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200791 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700792 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200793 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200794 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200795 }
796 ADVANCE(offset);
797 } else {
798 ADVANCE(2);
799 }
800 }
801 HANDLE_INSTRUCTION_END();
802
803 HANDLE_INSTRUCTION_START(IF_LT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200804 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) < shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200805 int16_t offset = inst->VRegC_22t();
806 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800807 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200808 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700809 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200810 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200811 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200812 }
813 ADVANCE(offset);
814 } else {
815 ADVANCE(2);
816 }
817 }
818 HANDLE_INSTRUCTION_END();
819
820 HANDLE_INSTRUCTION_START(IF_GE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200821 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200822 int16_t offset = inst->VRegC_22t();
823 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800824 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200825 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700826 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200827 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200828 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200829 }
830 ADVANCE(offset);
831 } else {
832 ADVANCE(2);
833 }
834 }
835 HANDLE_INSTRUCTION_END();
836
837 HANDLE_INSTRUCTION_START(IF_GT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200838 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200839 int16_t offset = inst->VRegC_22t();
840 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800841 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200842 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700843 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200844 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200845 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200846 }
847 ADVANCE(offset);
848 } else {
849 ADVANCE(2);
850 }
851 }
852 HANDLE_INSTRUCTION_END();
853
854 HANDLE_INSTRUCTION_START(IF_LE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200855 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200856 int16_t offset = inst->VRegC_22t();
857 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800858 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200859 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700860 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200861 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200862 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200863 }
864 ADVANCE(offset);
865 } else {
866 ADVANCE(2);
867 }
868 }
869 HANDLE_INSTRUCTION_END();
870
871 HANDLE_INSTRUCTION_START(IF_EQZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200872 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200873 int16_t offset = inst->VRegB_21t();
874 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800875 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200876 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700877 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200878 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200879 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200880 }
881 ADVANCE(offset);
882 } else {
883 ADVANCE(2);
884 }
885 }
886 HANDLE_INSTRUCTION_END();
887
888 HANDLE_INSTRUCTION_START(IF_NEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200889 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200890 int16_t offset = inst->VRegB_21t();
891 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800892 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200893 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700894 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200895 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200896 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200897 }
898 ADVANCE(offset);
899 } else {
900 ADVANCE(2);
901 }
902 }
903 HANDLE_INSTRUCTION_END();
904
905 HANDLE_INSTRUCTION_START(IF_LTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200906 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200907 int16_t offset = inst->VRegB_21t();
908 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800909 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200910 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700911 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200912 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200913 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200914 }
915 ADVANCE(offset);
916 } else {
917 ADVANCE(2);
918 }
919 }
920 HANDLE_INSTRUCTION_END();
921
922 HANDLE_INSTRUCTION_START(IF_GEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200923 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200924 int16_t offset = inst->VRegB_21t();
925 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800926 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200927 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700928 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200929 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200930 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200931 }
932 ADVANCE(offset);
933 } else {
934 ADVANCE(2);
935 }
936 }
937 HANDLE_INSTRUCTION_END();
938
939 HANDLE_INSTRUCTION_START(IF_GTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200940 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200941 int16_t offset = inst->VRegB_21t();
942 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800943 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200944 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700945 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200946 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200947 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200948 }
949 ADVANCE(offset);
950 } else {
951 ADVANCE(2);
952 }
953 }
954 HANDLE_INSTRUCTION_END();
955
956 HANDLE_INSTRUCTION_START(IF_LEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200957 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200958 int16_t offset = inst->VRegB_21t();
959 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800960 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200961 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700962 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200963 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200964 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200965 }
966 ADVANCE(offset);
967 } else {
968 ADVANCE(2);
969 }
970 }
971 HANDLE_INSTRUCTION_END();
972
973 HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
974 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
975 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000976 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200977 HANDLE_PENDING_EXCEPTION();
978 } else {
979 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
980 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100981 if (LIKELY(array->CheckIsValidIndex(index))) {
982 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200983 ADVANCE(2);
984 } else {
985 HANDLE_PENDING_EXCEPTION();
986 }
987 }
988 }
989 HANDLE_INSTRUCTION_END();
990
991 HANDLE_INSTRUCTION_START(AGET_BYTE) {
992 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
993 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000994 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200995 HANDLE_PENDING_EXCEPTION();
996 } else {
997 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
998 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100999 if (LIKELY(array->CheckIsValidIndex(index))) {
1000 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001001 ADVANCE(2);
1002 } else {
1003 HANDLE_PENDING_EXCEPTION();
1004 }
1005 }
1006 }
1007 HANDLE_INSTRUCTION_END();
1008
1009 HANDLE_INSTRUCTION_START(AGET_CHAR) {
1010 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1011 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001012 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001013 HANDLE_PENDING_EXCEPTION();
1014 } else {
1015 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1016 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001017 if (LIKELY(array->CheckIsValidIndex(index))) {
1018 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001019 ADVANCE(2);
1020 } else {
1021 HANDLE_PENDING_EXCEPTION();
1022 }
1023 }
1024 }
1025 HANDLE_INSTRUCTION_END();
1026
1027 HANDLE_INSTRUCTION_START(AGET_SHORT) {
1028 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1029 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001030 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001031 HANDLE_PENDING_EXCEPTION();
1032 } else {
1033 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1034 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001035 if (LIKELY(array->CheckIsValidIndex(index))) {
1036 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001037 ADVANCE(2);
1038 } else {
1039 HANDLE_PENDING_EXCEPTION();
1040 }
1041 }
1042 }
1043 HANDLE_INSTRUCTION_END();
1044
1045 HANDLE_INSTRUCTION_START(AGET) {
1046 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1047 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001048 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001049 HANDLE_PENDING_EXCEPTION();
1050 } else {
1051 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1052 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001053 if (LIKELY(array->CheckIsValidIndex(index))) {
1054 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001055 ADVANCE(2);
1056 } else {
1057 HANDLE_PENDING_EXCEPTION();
1058 }
1059 }
1060 }
1061 HANDLE_INSTRUCTION_END();
1062
1063 HANDLE_INSTRUCTION_START(AGET_WIDE) {
1064 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1065 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001066 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001067 HANDLE_PENDING_EXCEPTION();
1068 } else {
1069 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1070 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001071 if (LIKELY(array->CheckIsValidIndex(index))) {
1072 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001073 ADVANCE(2);
1074 } else {
1075 HANDLE_PENDING_EXCEPTION();
1076 }
1077 }
1078 }
1079 HANDLE_INSTRUCTION_END();
1080
1081 HANDLE_INSTRUCTION_START(AGET_OBJECT) {
1082 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1083 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001084 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001085 HANDLE_PENDING_EXCEPTION();
1086 } else {
1087 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1088 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001089 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001090 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001091 ADVANCE(2);
1092 } else {
1093 HANDLE_PENDING_EXCEPTION();
1094 }
1095 }
1096 }
1097 HANDLE_INSTRUCTION_END();
1098
1099 HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
1100 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1101 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001102 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001103 HANDLE_PENDING_EXCEPTION();
1104 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001105 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001106 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1107 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001108 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001109 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001110 ADVANCE(2);
1111 } else {
1112 HANDLE_PENDING_EXCEPTION();
1113 }
1114 }
1115 }
1116 HANDLE_INSTRUCTION_END();
1117
1118 HANDLE_INSTRUCTION_START(APUT_BYTE) {
1119 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1120 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001121 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001122 HANDLE_PENDING_EXCEPTION();
1123 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001124 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001125 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1126 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001127 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001128 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001129 ADVANCE(2);
1130 } else {
1131 HANDLE_PENDING_EXCEPTION();
1132 }
1133 }
1134 }
1135 HANDLE_INSTRUCTION_END();
1136
1137 HANDLE_INSTRUCTION_START(APUT_CHAR) {
1138 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1139 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001140 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001141 HANDLE_PENDING_EXCEPTION();
1142 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001143 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001144 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1145 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001146 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001147 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001148 ADVANCE(2);
1149 } else {
1150 HANDLE_PENDING_EXCEPTION();
1151 }
1152 }
1153 }
1154 HANDLE_INSTRUCTION_END();
1155
1156 HANDLE_INSTRUCTION_START(APUT_SHORT) {
1157 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1158 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001159 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001160 HANDLE_PENDING_EXCEPTION();
1161 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001162 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001163 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1164 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001165 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001166 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001167 ADVANCE(2);
1168 } else {
1169 HANDLE_PENDING_EXCEPTION();
1170 }
1171 }
1172 }
1173 HANDLE_INSTRUCTION_END();
1174
1175 HANDLE_INSTRUCTION_START(APUT) {
1176 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1177 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001178 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001179 HANDLE_PENDING_EXCEPTION();
1180 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001181 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001182 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1183 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001184 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001185 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001186 ADVANCE(2);
1187 } else {
1188 HANDLE_PENDING_EXCEPTION();
1189 }
1190 }
1191 }
1192 HANDLE_INSTRUCTION_END();
1193
1194 HANDLE_INSTRUCTION_START(APUT_WIDE) {
1195 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1196 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001197 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001198 HANDLE_PENDING_EXCEPTION();
1199 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001200 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001201 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1202 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001203 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001204 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001205 ADVANCE(2);
1206 } else {
1207 HANDLE_PENDING_EXCEPTION();
1208 }
1209 }
1210 }
1211 HANDLE_INSTRUCTION_END();
1212
1213 HANDLE_INSTRUCTION_START(APUT_OBJECT) {
1214 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1215 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001216 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001217 HANDLE_PENDING_EXCEPTION();
1218 } else {
1219 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001220 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001221 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001222 if (LIKELY(array->CheckIsValidIndex(index) && array->CheckAssignable(val))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001223 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001224 ADVANCE(2);
1225 } else {
1226 HANDLE_PENDING_EXCEPTION();
1227 }
1228 }
1229 }
1230 HANDLE_INSTRUCTION_END();
1231
1232 HANDLE_INSTRUCTION_START(IGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001233 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001234 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1235 }
1236 HANDLE_INSTRUCTION_END();
1237
1238 HANDLE_INSTRUCTION_START(IGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001239 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001240 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1241 }
1242 HANDLE_INSTRUCTION_END();
1243
1244 HANDLE_INSTRUCTION_START(IGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001245 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, 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(IGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001251 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, 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(IGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001257 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, 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(IGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001263 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, 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(IGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001269 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, 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(IGET_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001275 bool success = DoIGetQuick<Primitive::kPrimInt>(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
Mathieu Chartierffc605c2014-12-10 10:35:44 -08001280 HANDLE_INSTRUCTION_START(IGET_BOOLEAN_QUICK) {
1281 bool success = DoIGetQuick<Primitive::kPrimBoolean>(shadow_frame, inst, inst_data);
1282 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1283 }
1284 HANDLE_INSTRUCTION_END();
1285
1286 HANDLE_INSTRUCTION_START(IGET_BYTE_QUICK) {
1287 bool success = DoIGetQuick<Primitive::kPrimByte>(shadow_frame, inst, inst_data);
1288 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1289 }
1290 HANDLE_INSTRUCTION_END();
1291
1292 HANDLE_INSTRUCTION_START(IGET_CHAR_QUICK) {
1293 bool success = DoIGetQuick<Primitive::kPrimChar>(shadow_frame, inst, inst_data);
1294 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1295 }
1296 HANDLE_INSTRUCTION_END();
1297
1298 HANDLE_INSTRUCTION_START(IGET_SHORT_QUICK) {
1299 bool success = DoIGetQuick<Primitive::kPrimShort>(shadow_frame, inst, inst_data);
1300 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1301 }
1302 HANDLE_INSTRUCTION_END();
1303
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001304 HANDLE_INSTRUCTION_START(IGET_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001305 bool success = DoIGetQuick<Primitive::kPrimLong>(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(IGET_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001311 bool success = DoIGetQuick<Primitive::kPrimNot>(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(SGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001317 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, 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(SGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001323 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, 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(SGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001329 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001330 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1331 }
1332 HANDLE_INSTRUCTION_END();
1333
1334 HANDLE_INSTRUCTION_START(SGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001335 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001336 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1337 }
1338 HANDLE_INSTRUCTION_END();
1339
1340 HANDLE_INSTRUCTION_START(SGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001341 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(self, 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(SGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001347 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, 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(SGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001353 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, 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(IPUT_BOOLEAN) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001359 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(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(IPUT_BYTE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001365 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(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(IPUT_CHAR) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001371 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(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(IPUT_SHORT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001377 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(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(IPUT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001383 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(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(IPUT_WIDE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001389 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001390 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1391 }
1392 HANDLE_INSTRUCTION_END();
1393
1394 HANDLE_INSTRUCTION_START(IPUT_OBJECT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001395 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001396 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1397 }
1398 HANDLE_INSTRUCTION_END();
1399
1400 HANDLE_INSTRUCTION_START(IPUT_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001401 bool success = DoIPutQuick<Primitive::kPrimInt, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001402 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1403 }
1404 HANDLE_INSTRUCTION_END();
1405
Fred Shih37f05ef2014-07-16 18:38:08 -07001406 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN_QUICK) {
1407 bool success = DoIPutQuick<Primitive::kPrimBoolean, transaction_active>(shadow_frame, inst, inst_data);
1408 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1409 }
1410 HANDLE_INSTRUCTION_END();
1411
1412 HANDLE_INSTRUCTION_START(IPUT_BYTE_QUICK) {
1413 bool success = DoIPutQuick<Primitive::kPrimByte, transaction_active>(shadow_frame, inst, inst_data);
1414 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1415 }
1416 HANDLE_INSTRUCTION_END();
1417
1418 HANDLE_INSTRUCTION_START(IPUT_CHAR_QUICK) {
1419 bool success = DoIPutQuick<Primitive::kPrimChar, transaction_active>(shadow_frame, inst, inst_data);
1420 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1421 }
1422 HANDLE_INSTRUCTION_END();
1423
1424 HANDLE_INSTRUCTION_START(IPUT_SHORT_QUICK) {
1425 bool success = DoIPutQuick<Primitive::kPrimShort, transaction_active>(shadow_frame, inst, inst_data);
1426 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1427 }
1428 HANDLE_INSTRUCTION_END();
1429
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001430 HANDLE_INSTRUCTION_START(IPUT_WIDE_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001431 bool success = DoIPutQuick<Primitive::kPrimLong, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001432 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1433 }
1434 HANDLE_INSTRUCTION_END();
1435
1436 HANDLE_INSTRUCTION_START(IPUT_OBJECT_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001437 bool success = DoIPutQuick<Primitive::kPrimNot, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001438 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1439 }
1440 HANDLE_INSTRUCTION_END();
1441
1442 HANDLE_INSTRUCTION_START(SPUT_BOOLEAN) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001443 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001444 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1445 }
1446 HANDLE_INSTRUCTION_END();
1447
1448 HANDLE_INSTRUCTION_START(SPUT_BYTE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001449 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001450 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1451 }
1452 HANDLE_INSTRUCTION_END();
1453
1454 HANDLE_INSTRUCTION_START(SPUT_CHAR) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001455 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001456 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1457 }
1458 HANDLE_INSTRUCTION_END();
1459
1460 HANDLE_INSTRUCTION_START(SPUT_SHORT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001461 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001462 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1463 }
1464 HANDLE_INSTRUCTION_END();
1465
1466 HANDLE_INSTRUCTION_START(SPUT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001467 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001468 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1469 }
1470 HANDLE_INSTRUCTION_END();
1471
1472 HANDLE_INSTRUCTION_START(SPUT_WIDE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001473 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001474 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1475 }
1476 HANDLE_INSTRUCTION_END();
1477
1478 HANDLE_INSTRUCTION_START(SPUT_OBJECT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001479 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001480 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1481 }
1482 HANDLE_INSTRUCTION_END();
1483
1484 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001485 bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001486 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001487 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1488 }
1489 HANDLE_INSTRUCTION_END();
1490
1491 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001492 bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001493 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001494 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1495 }
1496 HANDLE_INSTRUCTION_END();
1497
1498 HANDLE_INSTRUCTION_START(INVOKE_SUPER) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001499 bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001500 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001501 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1502 }
1503 HANDLE_INSTRUCTION_END();
1504
1505 HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001506 bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001507 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001508 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1509 }
1510 HANDLE_INSTRUCTION_END();
1511
1512 HANDLE_INSTRUCTION_START(INVOKE_DIRECT) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001513 bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001514 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001515 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1516 }
1517 HANDLE_INSTRUCTION_END();
1518
1519 HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001520 bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001521 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001522 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1523 }
1524 HANDLE_INSTRUCTION_END();
1525
1526 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001527 bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001528 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001529 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1530 }
1531 HANDLE_INSTRUCTION_END();
1532
1533 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001534 bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001535 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001536 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1537 }
1538 HANDLE_INSTRUCTION_END();
1539
1540 HANDLE_INSTRUCTION_START(INVOKE_STATIC) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001541 bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001542 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001543 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1544 }
1545 HANDLE_INSTRUCTION_END();
1546
1547 HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001548 bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001549 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001550 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1551 }
1552 HANDLE_INSTRUCTION_END();
1553
1554 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001555 bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001556 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001557 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1558 }
1559 HANDLE_INSTRUCTION_END();
1560
1561 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001562 bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001563 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001564 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1565 }
1566 HANDLE_INSTRUCTION_END();
1567
1568 HANDLE_INSTRUCTION_START(NEG_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001569 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001570 ADVANCE(1);
1571 HANDLE_INSTRUCTION_END();
1572
1573 HANDLE_INSTRUCTION_START(NOT_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001574 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001575 ADVANCE(1);
1576 HANDLE_INSTRUCTION_END();
1577
1578 HANDLE_INSTRUCTION_START(NEG_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001579 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001580 ADVANCE(1);
1581 HANDLE_INSTRUCTION_END();
1582
1583 HANDLE_INSTRUCTION_START(NOT_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001584 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001585 ADVANCE(1);
1586 HANDLE_INSTRUCTION_END();
1587
1588 HANDLE_INSTRUCTION_START(NEG_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001589 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001590 ADVANCE(1);
1591 HANDLE_INSTRUCTION_END();
1592
1593 HANDLE_INSTRUCTION_START(NEG_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001594 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001595 ADVANCE(1);
1596 HANDLE_INSTRUCTION_END();
1597
1598 HANDLE_INSTRUCTION_START(INT_TO_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001599 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001600 ADVANCE(1);
1601 HANDLE_INSTRUCTION_END();
1602
1603 HANDLE_INSTRUCTION_START(INT_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001604 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001605 ADVANCE(1);
1606 HANDLE_INSTRUCTION_END();
1607
1608 HANDLE_INSTRUCTION_START(INT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001609 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001610 ADVANCE(1);
1611 HANDLE_INSTRUCTION_END();
1612
1613 HANDLE_INSTRUCTION_START(LONG_TO_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001614 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001615 ADVANCE(1);
1616 HANDLE_INSTRUCTION_END();
1617
1618 HANDLE_INSTRUCTION_START(LONG_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001619 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001620 ADVANCE(1);
1621 HANDLE_INSTRUCTION_END();
1622
1623 HANDLE_INSTRUCTION_START(LONG_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001624 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001625 ADVANCE(1);
1626 HANDLE_INSTRUCTION_END();
1627
1628 HANDLE_INSTRUCTION_START(FLOAT_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001629 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001630 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001631 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001632 ADVANCE(1);
1633 }
1634 HANDLE_INSTRUCTION_END();
1635
1636 HANDLE_INSTRUCTION_START(FLOAT_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001637 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001638 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001639 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001640 ADVANCE(1);
1641 }
1642 HANDLE_INSTRUCTION_END();
1643
1644 HANDLE_INSTRUCTION_START(FLOAT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001645 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001646 ADVANCE(1);
1647 HANDLE_INSTRUCTION_END();
1648
1649 HANDLE_INSTRUCTION_START(DOUBLE_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001650 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001651 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001652 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001653 ADVANCE(1);
1654 }
1655 HANDLE_INSTRUCTION_END();
1656
1657 HANDLE_INSTRUCTION_START(DOUBLE_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001658 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001659 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001660 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001661 ADVANCE(1);
1662 }
1663 HANDLE_INSTRUCTION_END();
1664
1665 HANDLE_INSTRUCTION_START(DOUBLE_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001666 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001667 ADVANCE(1);
1668 HANDLE_INSTRUCTION_END();
1669
1670 HANDLE_INSTRUCTION_START(INT_TO_BYTE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001671 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1672 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001673 ADVANCE(1);
1674 HANDLE_INSTRUCTION_END();
1675
1676 HANDLE_INSTRUCTION_START(INT_TO_CHAR)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001677 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1678 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001679 ADVANCE(1);
1680 HANDLE_INSTRUCTION_END();
1681
1682 HANDLE_INSTRUCTION_START(INT_TO_SHORT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001683 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1684 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001685 ADVANCE(1);
1686 HANDLE_INSTRUCTION_END();
1687
1688 HANDLE_INSTRUCTION_START(ADD_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001689 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001690 SafeAdd(shadow_frame.GetVReg(inst->VRegB_23x()),
1691 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001692 ADVANCE(2);
1693 HANDLE_INSTRUCTION_END();
1694
1695 HANDLE_INSTRUCTION_START(SUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001696 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001697 SafeSub(shadow_frame.GetVReg(inst->VRegB_23x()),
1698 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001699 ADVANCE(2);
1700 HANDLE_INSTRUCTION_END();
1701
1702 HANDLE_INSTRUCTION_START(MUL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001703 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001704 SafeMul(shadow_frame.GetVReg(inst->VRegB_23x()),
1705 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001706 ADVANCE(2);
1707 HANDLE_INSTRUCTION_END();
1708
1709 HANDLE_INSTRUCTION_START(DIV_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001710 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
1711 shadow_frame.GetVReg(inst->VRegB_23x()),
1712 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001713 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1714 }
1715 HANDLE_INSTRUCTION_END();
1716
1717 HANDLE_INSTRUCTION_START(REM_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001718 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1719 shadow_frame.GetVReg(inst->VRegB_23x()),
1720 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001721 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1722 }
1723 HANDLE_INSTRUCTION_END();
1724
1725 HANDLE_INSTRUCTION_START(SHL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001726 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001727 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1728 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1729 ADVANCE(2);
1730 HANDLE_INSTRUCTION_END();
1731
1732 HANDLE_INSTRUCTION_START(SHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001733 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001734 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1735 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1736 ADVANCE(2);
1737 HANDLE_INSTRUCTION_END();
1738
1739 HANDLE_INSTRUCTION_START(USHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001740 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001741 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1742 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1743 ADVANCE(2);
1744 HANDLE_INSTRUCTION_END();
1745
1746 HANDLE_INSTRUCTION_START(AND_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001747 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001748 shadow_frame.GetVReg(inst->VRegB_23x()) &
1749 shadow_frame.GetVReg(inst->VRegC_23x()));
1750 ADVANCE(2);
1751 HANDLE_INSTRUCTION_END();
1752
1753 HANDLE_INSTRUCTION_START(OR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001754 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001755 shadow_frame.GetVReg(inst->VRegB_23x()) |
1756 shadow_frame.GetVReg(inst->VRegC_23x()));
1757 ADVANCE(2);
1758 HANDLE_INSTRUCTION_END();
1759
1760 HANDLE_INSTRUCTION_START(XOR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001761 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001762 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1763 shadow_frame.GetVReg(inst->VRegC_23x()));
1764 ADVANCE(2);
1765 HANDLE_INSTRUCTION_END();
1766
1767 HANDLE_INSTRUCTION_START(ADD_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001768 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001769 SafeAdd(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1770 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001771 ADVANCE(2);
1772 HANDLE_INSTRUCTION_END();
1773
1774 HANDLE_INSTRUCTION_START(SUB_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001775 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001776 SafeSub(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1777 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001778 ADVANCE(2);
1779 HANDLE_INSTRUCTION_END();
1780
1781 HANDLE_INSTRUCTION_START(MUL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001782 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001783 SafeMul(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1784 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001785 ADVANCE(2);
1786 HANDLE_INSTRUCTION_END();
1787
1788 HANDLE_INSTRUCTION_START(DIV_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001789 bool success = DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
1790 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1791 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001792 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1793 }
1794 HANDLE_INSTRUCTION_END();
1795
1796 HANDLE_INSTRUCTION_START(REM_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001797 bool success = DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1798 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1799 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001800 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1801 }
1802 HANDLE_INSTRUCTION_END();
1803
1804 HANDLE_INSTRUCTION_START(AND_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001805 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001806 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1807 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1808 ADVANCE(2);
1809 HANDLE_INSTRUCTION_END();
1810
1811 HANDLE_INSTRUCTION_START(OR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001812 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001813 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1814 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1815 ADVANCE(2);
1816 HANDLE_INSTRUCTION_END();
1817
1818 HANDLE_INSTRUCTION_START(XOR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001819 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001820 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1821 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1822 ADVANCE(2);
1823 HANDLE_INSTRUCTION_END();
1824
1825 HANDLE_INSTRUCTION_START(SHL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001826 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001827 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1828 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1829 ADVANCE(2);
1830 HANDLE_INSTRUCTION_END();
1831
1832 HANDLE_INSTRUCTION_START(SHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001833 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001834 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1835 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1836 ADVANCE(2);
1837 HANDLE_INSTRUCTION_END();
1838
1839 HANDLE_INSTRUCTION_START(USHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001840 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001841 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1842 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1843 ADVANCE(2);
1844 HANDLE_INSTRUCTION_END();
1845
1846 HANDLE_INSTRUCTION_START(ADD_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001847 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001848 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1849 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1850 ADVANCE(2);
1851 HANDLE_INSTRUCTION_END();
1852
1853 HANDLE_INSTRUCTION_START(SUB_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001854 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001855 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1856 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1857 ADVANCE(2);
1858 HANDLE_INSTRUCTION_END();
1859
1860 HANDLE_INSTRUCTION_START(MUL_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001861 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001862 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1863 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1864 ADVANCE(2);
1865 HANDLE_INSTRUCTION_END();
1866
1867 HANDLE_INSTRUCTION_START(DIV_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001868 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001869 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1870 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1871 ADVANCE(2);
1872 HANDLE_INSTRUCTION_END();
1873
1874 HANDLE_INSTRUCTION_START(REM_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001875 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001876 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1877 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1878 ADVANCE(2);
1879 HANDLE_INSTRUCTION_END();
1880
1881 HANDLE_INSTRUCTION_START(ADD_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001882 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001883 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1884 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1885 ADVANCE(2);
1886 HANDLE_INSTRUCTION_END();
1887
1888 HANDLE_INSTRUCTION_START(SUB_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001889 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001890 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1891 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1892 ADVANCE(2);
1893 HANDLE_INSTRUCTION_END();
1894
1895 HANDLE_INSTRUCTION_START(MUL_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001896 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001897 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1898 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1899 ADVANCE(2);
1900 HANDLE_INSTRUCTION_END();
1901
1902 HANDLE_INSTRUCTION_START(DIV_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001903 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001904 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1905 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1906 ADVANCE(2);
1907 HANDLE_INSTRUCTION_END();
1908
1909 HANDLE_INSTRUCTION_START(REM_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001910 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001911 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1912 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1913 ADVANCE(2);
1914 HANDLE_INSTRUCTION_END();
1915
1916 HANDLE_INSTRUCTION_START(ADD_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001917 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001918 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001919 SafeAdd(shadow_frame.GetVReg(vregA),
1920 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001921 ADVANCE(1);
1922 }
1923 HANDLE_INSTRUCTION_END();
1924
1925 HANDLE_INSTRUCTION_START(SUB_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001926 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001927 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001928 SafeSub(shadow_frame.GetVReg(vregA),
1929 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001930 ADVANCE(1);
1931 }
1932 HANDLE_INSTRUCTION_END();
1933
1934 HANDLE_INSTRUCTION_START(MUL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001935 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001936 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001937 SafeMul(shadow_frame.GetVReg(vregA),
1938 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001939 ADVANCE(1);
1940 }
1941 HANDLE_INSTRUCTION_END();
1942
1943 HANDLE_INSTRUCTION_START(DIV_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001944 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001945 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001946 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001947 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1948 }
1949 HANDLE_INSTRUCTION_END();
1950
1951 HANDLE_INSTRUCTION_START(REM_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001952 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001953 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001954 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001955 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1956 }
1957 HANDLE_INSTRUCTION_END();
1958
1959 HANDLE_INSTRUCTION_START(SHL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001960 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001961 shadow_frame.SetVReg(vregA,
1962 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001963 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001964 ADVANCE(1);
1965 }
1966 HANDLE_INSTRUCTION_END();
1967
1968 HANDLE_INSTRUCTION_START(SHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001969 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001970 shadow_frame.SetVReg(vregA,
1971 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001972 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001973 ADVANCE(1);
1974 }
1975 HANDLE_INSTRUCTION_END();
1976
1977 HANDLE_INSTRUCTION_START(USHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001978 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001979 shadow_frame.SetVReg(vregA,
1980 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001981 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001982 ADVANCE(1);
1983 }
1984 HANDLE_INSTRUCTION_END();
1985
1986 HANDLE_INSTRUCTION_START(AND_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001987 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001988 shadow_frame.SetVReg(vregA,
1989 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001990 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001991 ADVANCE(1);
1992 }
1993 HANDLE_INSTRUCTION_END();
1994
1995 HANDLE_INSTRUCTION_START(OR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001996 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001997 shadow_frame.SetVReg(vregA,
1998 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001999 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002000 ADVANCE(1);
2001 }
2002 HANDLE_INSTRUCTION_END();
2003
2004 HANDLE_INSTRUCTION_START(XOR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002005 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002006 shadow_frame.SetVReg(vregA,
2007 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002008 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002009 ADVANCE(1);
2010 }
2011 HANDLE_INSTRUCTION_END();
2012
2013 HANDLE_INSTRUCTION_START(ADD_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002014 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002015 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002016 SafeAdd(shadow_frame.GetVRegLong(vregA),
2017 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002018 ADVANCE(1);
2019 }
2020 HANDLE_INSTRUCTION_END();
2021
2022 HANDLE_INSTRUCTION_START(SUB_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002023 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002024 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002025 SafeSub(shadow_frame.GetVRegLong(vregA),
2026 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002027 ADVANCE(1);
2028 }
2029 HANDLE_INSTRUCTION_END();
2030
2031 HANDLE_INSTRUCTION_START(MUL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002032 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002033 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002034 SafeMul(shadow_frame.GetVRegLong(vregA),
2035 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002036 ADVANCE(1);
2037 }
2038 HANDLE_INSTRUCTION_END();
2039
2040 HANDLE_INSTRUCTION_START(DIV_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002041 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002042 bool success = DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002043 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002044 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2045 }
2046 HANDLE_INSTRUCTION_END();
2047
2048 HANDLE_INSTRUCTION_START(REM_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002049 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002050 bool success = DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002051 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002052 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2053 }
2054 HANDLE_INSTRUCTION_END();
2055
2056 HANDLE_INSTRUCTION_START(AND_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002057 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002058 shadow_frame.SetVRegLong(vregA,
2059 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002060 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002061 ADVANCE(1);
2062 }
2063 HANDLE_INSTRUCTION_END();
2064
2065 HANDLE_INSTRUCTION_START(OR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002066 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002067 shadow_frame.SetVRegLong(vregA,
2068 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002069 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002070 ADVANCE(1);
2071 }
2072 HANDLE_INSTRUCTION_END();
2073
2074 HANDLE_INSTRUCTION_START(XOR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002075 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002076 shadow_frame.SetVRegLong(vregA,
2077 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002078 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002079 ADVANCE(1);
2080 }
2081 HANDLE_INSTRUCTION_END();
2082
2083 HANDLE_INSTRUCTION_START(SHL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002084 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002085 shadow_frame.SetVRegLong(vregA,
2086 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002087 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002088 ADVANCE(1);
2089 }
2090 HANDLE_INSTRUCTION_END();
2091
2092 HANDLE_INSTRUCTION_START(SHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002093 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002094 shadow_frame.SetVRegLong(vregA,
2095 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002096 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002097 ADVANCE(1);
2098 }
2099 HANDLE_INSTRUCTION_END();
2100
2101 HANDLE_INSTRUCTION_START(USHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002102 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002103 shadow_frame.SetVRegLong(vregA,
2104 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002105 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002106 ADVANCE(1);
2107 }
2108 HANDLE_INSTRUCTION_END();
2109
2110 HANDLE_INSTRUCTION_START(ADD_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002111 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002112 shadow_frame.SetVRegFloat(vregA,
2113 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002114 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002115 ADVANCE(1);
2116 }
2117 HANDLE_INSTRUCTION_END();
2118
2119 HANDLE_INSTRUCTION_START(SUB_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002120 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002121 shadow_frame.SetVRegFloat(vregA,
2122 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002123 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002124 ADVANCE(1);
2125 }
2126 HANDLE_INSTRUCTION_END();
2127
2128 HANDLE_INSTRUCTION_START(MUL_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002129 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002130 shadow_frame.SetVRegFloat(vregA,
2131 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002132 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002133 ADVANCE(1);
2134 }
2135 HANDLE_INSTRUCTION_END();
2136
2137 HANDLE_INSTRUCTION_START(DIV_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002138 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002139 shadow_frame.SetVRegFloat(vregA,
2140 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002141 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002142 ADVANCE(1);
2143 }
2144 HANDLE_INSTRUCTION_END();
2145
2146 HANDLE_INSTRUCTION_START(REM_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002147 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002148 shadow_frame.SetVRegFloat(vregA,
2149 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002150 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002151 ADVANCE(1);
2152 }
2153 HANDLE_INSTRUCTION_END();
2154
2155 HANDLE_INSTRUCTION_START(ADD_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002156 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002157 shadow_frame.SetVRegDouble(vregA,
2158 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002159 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002160 ADVANCE(1);
2161 }
2162 HANDLE_INSTRUCTION_END();
2163
2164 HANDLE_INSTRUCTION_START(SUB_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002165 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002166 shadow_frame.SetVRegDouble(vregA,
2167 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002168 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002169 ADVANCE(1);
2170 }
2171 HANDLE_INSTRUCTION_END();
2172
2173 HANDLE_INSTRUCTION_START(MUL_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002174 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002175 shadow_frame.SetVRegDouble(vregA,
2176 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002177 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002178 ADVANCE(1);
2179 }
2180 HANDLE_INSTRUCTION_END();
2181
2182 HANDLE_INSTRUCTION_START(DIV_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002183 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002184 shadow_frame.SetVRegDouble(vregA,
2185 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002186 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002187 ADVANCE(1);
2188 }
2189 HANDLE_INSTRUCTION_END();
2190
2191 HANDLE_INSTRUCTION_START(REM_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002192 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002193 shadow_frame.SetVRegDouble(vregA,
2194 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002195 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002196 ADVANCE(1);
2197 }
2198 HANDLE_INSTRUCTION_END();
2199
2200 HANDLE_INSTRUCTION_START(ADD_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002201 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002202 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2203 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002204 ADVANCE(2);
2205 HANDLE_INSTRUCTION_END();
2206
2207 HANDLE_INSTRUCTION_START(RSUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002208 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002209 SafeSub(inst->VRegC_22s(),
2210 shadow_frame.GetVReg(inst->VRegB_22s(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002211 ADVANCE(2);
2212 HANDLE_INSTRUCTION_END();
2213
2214 HANDLE_INSTRUCTION_START(MUL_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002215 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002216 SafeMul(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2217 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002218 ADVANCE(2);
2219 HANDLE_INSTRUCTION_END();
2220
2221 HANDLE_INSTRUCTION_START(DIV_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002222 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
2223 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002224 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2225 }
2226 HANDLE_INSTRUCTION_END();
2227
2228 HANDLE_INSTRUCTION_START(REM_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002229 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
2230 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002231 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2232 }
2233 HANDLE_INSTRUCTION_END();
2234
2235 HANDLE_INSTRUCTION_START(AND_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002236 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2237 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002238 inst->VRegC_22s());
2239 ADVANCE(2);
2240 HANDLE_INSTRUCTION_END();
2241
2242 HANDLE_INSTRUCTION_START(OR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002243 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2244 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002245 inst->VRegC_22s());
2246 ADVANCE(2);
2247 HANDLE_INSTRUCTION_END();
2248
2249 HANDLE_INSTRUCTION_START(XOR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002250 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2251 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002252 inst->VRegC_22s());
2253 ADVANCE(2);
2254 HANDLE_INSTRUCTION_END();
2255
2256 HANDLE_INSTRUCTION_START(ADD_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002257 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002258 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22b()),
2259 inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002260 ADVANCE(2);
2261 HANDLE_INSTRUCTION_END();
2262
2263 HANDLE_INSTRUCTION_START(RSUB_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002264 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002265 SafeSub(inst->VRegC_22b(),
2266 shadow_frame.GetVReg(inst->VRegB_22b())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002267 ADVANCE(2);
2268 HANDLE_INSTRUCTION_END();
2269
2270 HANDLE_INSTRUCTION_START(MUL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002271 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002272 SafeMul(shadow_frame.GetVReg(inst->VRegB_22b()),
2273 inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002274 ADVANCE(2);
2275 HANDLE_INSTRUCTION_END();
2276
2277 HANDLE_INSTRUCTION_START(DIV_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002278 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
2279 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002280 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2281 }
2282 HANDLE_INSTRUCTION_END();
2283
2284 HANDLE_INSTRUCTION_START(REM_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002285 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
2286 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002287 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2288 }
2289 HANDLE_INSTRUCTION_END();
2290
2291 HANDLE_INSTRUCTION_START(AND_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002292 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002293 shadow_frame.GetVReg(inst->VRegB_22b()) &
2294 inst->VRegC_22b());
2295 ADVANCE(2);
2296 HANDLE_INSTRUCTION_END();
2297
2298 HANDLE_INSTRUCTION_START(OR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002299 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002300 shadow_frame.GetVReg(inst->VRegB_22b()) |
2301 inst->VRegC_22b());
2302 ADVANCE(2);
2303 HANDLE_INSTRUCTION_END();
2304
2305 HANDLE_INSTRUCTION_START(XOR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002306 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002307 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2308 inst->VRegC_22b());
2309 ADVANCE(2);
2310 HANDLE_INSTRUCTION_END();
2311
2312 HANDLE_INSTRUCTION_START(SHL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002313 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002314 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2315 (inst->VRegC_22b() & 0x1f));
2316 ADVANCE(2);
2317 HANDLE_INSTRUCTION_END();
2318
2319 HANDLE_INSTRUCTION_START(SHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002320 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002321 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2322 (inst->VRegC_22b() & 0x1f));
2323 ADVANCE(2);
2324 HANDLE_INSTRUCTION_END();
2325
2326 HANDLE_INSTRUCTION_START(USHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002327 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002328 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2329 (inst->VRegC_22b() & 0x1f));
2330 ADVANCE(2);
2331 HANDLE_INSTRUCTION_END();
2332
2333 HANDLE_INSTRUCTION_START(UNUSED_3E)
Ian Rogerse94652f2014-12-02 11:13:19 -08002334 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002335 HANDLE_INSTRUCTION_END();
2336
2337 HANDLE_INSTRUCTION_START(UNUSED_3F)
Ian Rogerse94652f2014-12-02 11:13:19 -08002338 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002339 HANDLE_INSTRUCTION_END();
2340
2341 HANDLE_INSTRUCTION_START(UNUSED_40)
Ian Rogerse94652f2014-12-02 11:13:19 -08002342 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002343 HANDLE_INSTRUCTION_END();
2344
2345 HANDLE_INSTRUCTION_START(UNUSED_41)
Ian Rogerse94652f2014-12-02 11:13:19 -08002346 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002347 HANDLE_INSTRUCTION_END();
2348
2349 HANDLE_INSTRUCTION_START(UNUSED_42)
Ian Rogerse94652f2014-12-02 11:13:19 -08002350 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002351 HANDLE_INSTRUCTION_END();
2352
2353 HANDLE_INSTRUCTION_START(UNUSED_43)
Ian Rogerse94652f2014-12-02 11:13:19 -08002354 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002355 HANDLE_INSTRUCTION_END();
2356
2357 HANDLE_INSTRUCTION_START(UNUSED_79)
Ian Rogerse94652f2014-12-02 11:13:19 -08002358 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002359 HANDLE_INSTRUCTION_END();
2360
2361 HANDLE_INSTRUCTION_START(UNUSED_7A)
Ian Rogerse94652f2014-12-02 11:13:19 -08002362 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002363 HANDLE_INSTRUCTION_END();
2364
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002365 HANDLE_INSTRUCTION_START(UNUSED_F3)
Ian Rogerse94652f2014-12-02 11:13:19 -08002366 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002367 HANDLE_INSTRUCTION_END();
2368
2369 HANDLE_INSTRUCTION_START(UNUSED_F4)
Ian Rogerse94652f2014-12-02 11:13:19 -08002370 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002371 HANDLE_INSTRUCTION_END();
2372
2373 HANDLE_INSTRUCTION_START(UNUSED_F5)
Ian Rogerse94652f2014-12-02 11:13:19 -08002374 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002375 HANDLE_INSTRUCTION_END();
2376
2377 HANDLE_INSTRUCTION_START(UNUSED_F6)
Ian Rogerse94652f2014-12-02 11:13:19 -08002378 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002379 HANDLE_INSTRUCTION_END();
2380
2381 HANDLE_INSTRUCTION_START(UNUSED_F7)
Ian Rogerse94652f2014-12-02 11:13:19 -08002382 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002383 HANDLE_INSTRUCTION_END();
2384
2385 HANDLE_INSTRUCTION_START(UNUSED_F8)
Ian Rogerse94652f2014-12-02 11:13:19 -08002386 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002387 HANDLE_INSTRUCTION_END();
2388
2389 HANDLE_INSTRUCTION_START(UNUSED_F9)
Ian Rogerse94652f2014-12-02 11:13:19 -08002390 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002391 HANDLE_INSTRUCTION_END();
2392
2393 HANDLE_INSTRUCTION_START(UNUSED_FA)
Ian Rogerse94652f2014-12-02 11:13:19 -08002394 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002395 HANDLE_INSTRUCTION_END();
2396
2397 HANDLE_INSTRUCTION_START(UNUSED_FB)
Ian Rogerse94652f2014-12-02 11:13:19 -08002398 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002399 HANDLE_INSTRUCTION_END();
2400
2401 HANDLE_INSTRUCTION_START(UNUSED_FC)
Ian Rogerse94652f2014-12-02 11:13:19 -08002402 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002403 HANDLE_INSTRUCTION_END();
2404
2405 HANDLE_INSTRUCTION_START(UNUSED_FD)
Ian Rogerse94652f2014-12-02 11:13:19 -08002406 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002407 HANDLE_INSTRUCTION_END();
2408
2409 HANDLE_INSTRUCTION_START(UNUSED_FE)
Ian Rogerse94652f2014-12-02 11:13:19 -08002410 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002411 HANDLE_INSTRUCTION_END();
2412
2413 HANDLE_INSTRUCTION_START(UNUSED_FF)
Ian Rogerse94652f2014-12-02 11:13:19 -08002414 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002415 HANDLE_INSTRUCTION_END();
2416
2417 exception_pending_label: {
2418 CHECK(self->IsExceptionPending());
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002419 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -07002420 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002421 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002422 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002423 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002424 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc,
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002425 instrumentation);
2426 if (found_dex_pc == DexFile::kDexNoIndex) {
2427 return JValue(); /* Handled in caller. */
2428 } else {
2429 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc);
2430 ADVANCE(displacement);
2431 }
2432 }
2433
Sebastien Hertz8379b222014-02-24 17:38:15 +01002434// Create alternative instruction handlers dedicated to instrumentation.
2435// Return instructions must not call Instrumentation::DexPcMovedEvent since they already call
2436// Instrumentation::MethodExited. This is to avoid posting debugger events twice for this location.
Sebastien Hertze713d932014-05-15 10:48:53 +02002437// Note: we do not use the kReturn instruction flag here (to test the instruction is a return). The
2438// compiler seems to not evaluate "(Instruction::FlagsOf(Instruction::code) & kReturn) != 0" to
2439// a constant condition that would remove the "if" statement so the test is free.
Sebastien Hertz8379b222014-02-24 17:38:15 +01002440#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
2441 alt_op_##code: { \
2442 if (Instruction::code != Instruction::RETURN_VOID && \
2443 Instruction::code != Instruction::RETURN_VOID_BARRIER && \
2444 Instruction::code != Instruction::RETURN && \
2445 Instruction::code != Instruction::RETURN_WIDE && \
2446 Instruction::code != Instruction::RETURN_OBJECT) { \
2447 if (LIKELY(!notified_method_entry_event)) { \
2448 Runtime* runtime = Runtime::Current(); \
2449 const instrumentation::Instrumentation* instrumentation = runtime->GetInstrumentation(); \
2450 if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
2451 Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_); \
2452 instrumentation->DexPcMovedEvent(self, this_object, shadow_frame.GetMethod(), dex_pc); \
2453 } \
2454 } else { \
2455 notified_method_entry_event = false; \
2456 } \
2457 } \
2458 UPDATE_HANDLER_TABLE(); \
2459 goto *handlersTable[instrumentation::kMainHandlerTable][Instruction::code]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002460 }
2461#include "dex_instruction_list.h"
2462 DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER)
2463#undef DEX_INSTRUCTION_LIST
2464#undef INSTRUMENTATION_INSTRUCTION_HANDLER
2465} // NOLINT(readability/fn_size)
2466
2467// Explicit definitions of ExecuteGotoImpl.
Sebastien Hertzc6714852013-09-30 16:42:32 +02002468template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002469JValue ExecuteGotoImpl<true, false>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002470 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertzc6714852013-09-30 16:42:32 +02002471template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002472JValue ExecuteGotoImpl<false, false>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002473 ShadowFrame& shadow_frame, JValue result_register);
2474template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
Ian Rogerse94652f2014-12-02 11:13:19 -08002475JValue ExecuteGotoImpl<true, true>(Thread* self, const DexFile::CodeItem* code_item,
2476 ShadowFrame& shadow_frame, JValue result_register);
2477template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
2478JValue ExecuteGotoImpl<false, true>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002479 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002480
2481} // namespace interpreter
2482} // namespace art
Colin Crosse84e4f72015-03-18 14:01:19 -07002483
2484#endif