blob: 37324eac82368d5d9d505777bdf28fcfab066930 [file] [log] [blame]
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "interpreter_common.h"
Ian Rogersf72a11d2014-10-30 15:41:08 -070018#include "safe_math.h"
Sebastien Hertz8ece0502013-08-07 11:26:41 +020019
20namespace art {
21namespace interpreter {
22
23// In the following macros, we expect the following local variables exist:
24// - "self": the current Thread*.
25// - "inst" : the current Instruction*.
Sebastien Hertz3b588e02013-09-11 14:33:18 +020026// - "inst_data" : the current instruction's first 16 bits.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020027// - "dex_pc": the current pc.
28// - "shadow_frame": the current shadow frame.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020029// - "currentHandlersTable": the current table of pointer to each instruction handler.
30
31// Advance to the next instruction and updates interpreter state.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020032#define ADVANCE(_offset) \
33 do { \
34 int32_t disp = static_cast<int32_t>(_offset); \
35 inst = inst->RelativeAt(disp); \
36 dex_pc = static_cast<uint32_t>(static_cast<int32_t>(dex_pc) + disp); \
37 shadow_frame.SetDexPC(dex_pc); \
Ian Rogerse94652f2014-12-02 11:13:19 -080038 TraceExecution(shadow_frame, inst, dex_pc); \
Sebastien Hertz3b588e02013-09-11 14:33:18 +020039 inst_data = inst->Fetch16(0); \
40 goto *currentHandlersTable[inst->Opcode(inst_data)]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020041 } while (false)
42
43#define HANDLE_PENDING_EXCEPTION() goto exception_pending_label
44
45#define POSSIBLY_HANDLE_PENDING_EXCEPTION(_is_exception_pending, _offset) \
46 do { \
47 if (UNLIKELY(_is_exception_pending)) { \
48 HANDLE_PENDING_EXCEPTION(); \
49 } else { \
50 ADVANCE(_offset); \
51 } \
52 } while (false)
53
Sebastien Hertzee1997a2013-09-19 14:47:09 +020054#define UPDATE_HANDLER_TABLE() \
55 currentHandlersTable = handlersTable[Runtime::Current()->GetInstrumentation()->GetInterpreterHandlerTable()]
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +020056
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080057#define BACKWARD_BRANCH_INSTRUMENTATION(offset) \
58 do { \
59 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation(); \
60 instrumentation->BackwardBranch(self, shadow_frame.GetMethod(), offset); \
61 } while (false)
62
Sebastien Hertz8ece0502013-08-07 11:26:41 +020063#define UNREACHABLE_CODE_CHECK() \
64 do { \
65 if (kIsDebugBuild) { \
66 LOG(FATAL) << "We should not be here !"; \
Ian Rogerse94652f2014-12-02 11:13:19 -080067 UNREACHABLE(); \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020068 } \
69 } while (false)
70
71#define HANDLE_INSTRUCTION_START(opcode) op_##opcode: // NOLINT(whitespace/labels)
72#define HANDLE_INSTRUCTION_END() UNREACHABLE_CODE_CHECK()
73
Sebastien Hertzee1997a2013-09-19 14:47:09 +020074/**
75 * Interpreter based on computed goto tables.
76 *
77 * Each instruction is associated to a handler. This handler is responsible for executing the
78 * instruction and jump to the next instruction's handler.
79 * In order to limit the cost of instrumentation, we have two handler tables:
80 * - the "main" handler table: it contains handlers for normal execution of each instruction without
81 * handling of instrumentation.
82 * - the "alternative" handler table: it contains alternative handlers which first handle
83 * instrumentation before jumping to the corresponding "normal" instruction's handler.
84 *
85 * When instrumentation is active, the interpreter uses the "alternative" handler table. Otherwise
86 * it uses the "main" handler table.
87 *
88 * The current handler table is the handler table being used by the interpreter. It is updated:
89 * - on backward branch (goto, if and switch instructions)
90 * - after invoke
91 * - when an exception is thrown.
92 * This allows to support an attaching debugger to an already running application for instance.
93 *
94 * For a fast handler table update, handler tables are stored in an array of handler tables. Each
95 * handler table is represented by the InterpreterHandlerTable enum which allows to associate it
96 * to an index in this array of handler tables ((see Instrumentation::GetInterpreterHandlerTable).
97 *
98 * Here's the current layout of this array of handler tables:
99 *
100 * ---------------------+---------------+
101 * | NOP | (handler for NOP instruction)
102 * +---------------+
103 * "main" | MOVE | (handler for MOVE instruction)
104 * handler table +---------------+
105 * | ... |
106 * +---------------+
107 * | UNUSED_FF | (handler for UNUSED_FF instruction)
108 * ---------------------+---------------+
109 * | NOP | (alternative handler for NOP instruction)
110 * +---------------+
111 * "alternative" | MOVE | (alternative handler for MOVE instruction)
112 * handler table +---------------+
113 * | ... |
114 * +---------------+
115 * | UNUSED_FF | (alternative handler for UNUSED_FF instruction)
116 * ---------------------+---------------+
117 *
118 */
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100119template<bool do_access_check, bool transaction_active>
Ian Rogerse94652f2014-12-02 11:13:19 -0800120JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowFrame& shadow_frame,
121 JValue result_register) {
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200122 // Define handler tables:
123 // - The main handler table contains execution handlers for each instruction.
124 // - The alternative handler table contains prelude handlers which check for thread suspend and
125 // manage instrumentation before jumping to the execution handler.
126 static const void* const handlersTable[instrumentation::kNumHandlerTables][kNumPackedOpcodes] = {
127 {
128 // Main handler table.
129#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&op_##code,
130#include "dex_instruction_list.h"
131 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
132#undef DEX_INSTRUCTION_LIST
133#undef INSTRUCTION_HANDLER
134 }, {
135 // Alternative handler table.
136#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&alt_op_##code,
137#include "dex_instruction_list.h"
138 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
139#undef DEX_INSTRUCTION_LIST
140#undef INSTRUCTION_HANDLER
141 }
142 };
143
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800144 constexpr bool do_assignability_check = do_access_check;
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200145 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
146 LOG(FATAL) << "Invalid shadow frame for interpreter use";
147 return JValue();
148 }
149 self->VerifyStack();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200150
151 uint32_t dex_pc = shadow_frame.GetDexPC();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200152 const Instruction* inst = Instruction::At(code_item->insns_ + dex_pc);
153 uint16_t inst_data;
154 const void* const* currentHandlersTable;
Sebastien Hertz8379b222014-02-24 17:38:15 +0100155 bool notified_method_entry_event = false;
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200156 UPDATE_HANDLER_TABLE();
Sebastien Hertz270a0e12015-01-16 19:49:09 +0100157 if (LIKELY(dex_pc == 0)) { // We are entering the method as opposed to deoptimizing.
158 if (kIsDebugBuild) {
159 self->AssertNoPendingException();
160 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200161 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200162 if (UNLIKELY(instrumentation->HasMethodEntryListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200163 instrumentation->MethodEnterEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200164 shadow_frame.GetMethod(), 0);
Sebastien Hertz8379b222014-02-24 17:38:15 +0100165 notified_method_entry_event = true;
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200166 }
167 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200168
169 // Jump to first instruction.
170 ADVANCE(0);
171 UNREACHABLE_CODE_CHECK();
172
173 HANDLE_INSTRUCTION_START(NOP)
174 ADVANCE(1);
175 HANDLE_INSTRUCTION_END();
176
177 HANDLE_INSTRUCTION_START(MOVE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200178 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
179 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200180 ADVANCE(1);
181 HANDLE_INSTRUCTION_END();
182
183 HANDLE_INSTRUCTION_START(MOVE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200184 shadow_frame.SetVReg(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200185 shadow_frame.GetVReg(inst->VRegB_22x()));
186 ADVANCE(2);
187 HANDLE_INSTRUCTION_END();
188
189 HANDLE_INSTRUCTION_START(MOVE_16)
190 shadow_frame.SetVReg(inst->VRegA_32x(),
191 shadow_frame.GetVReg(inst->VRegB_32x()));
192 ADVANCE(3);
193 HANDLE_INSTRUCTION_END();
194
195 HANDLE_INSTRUCTION_START(MOVE_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200196 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
197 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200198 ADVANCE(1);
199 HANDLE_INSTRUCTION_END();
200
201 HANDLE_INSTRUCTION_START(MOVE_WIDE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200202 shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200203 shadow_frame.GetVRegLong(inst->VRegB_22x()));
204 ADVANCE(2);
205 HANDLE_INSTRUCTION_END();
206
207 HANDLE_INSTRUCTION_START(MOVE_WIDE_16)
208 shadow_frame.SetVRegLong(inst->VRegA_32x(),
209 shadow_frame.GetVRegLong(inst->VRegB_32x()));
210 ADVANCE(3);
211 HANDLE_INSTRUCTION_END();
212
213 HANDLE_INSTRUCTION_START(MOVE_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200214 shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data),
215 shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200216 ADVANCE(1);
217 HANDLE_INSTRUCTION_END();
218
219 HANDLE_INSTRUCTION_START(MOVE_OBJECT_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200220 shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200221 shadow_frame.GetVRegReference(inst->VRegB_22x()));
222 ADVANCE(2);
223 HANDLE_INSTRUCTION_END();
224
225 HANDLE_INSTRUCTION_START(MOVE_OBJECT_16)
226 shadow_frame.SetVRegReference(inst->VRegA_32x(),
227 shadow_frame.GetVRegReference(inst->VRegB_32x()));
228 ADVANCE(3);
229 HANDLE_INSTRUCTION_END();
230
231 HANDLE_INSTRUCTION_START(MOVE_RESULT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200232 shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200233 ADVANCE(1);
234 HANDLE_INSTRUCTION_END();
235
236 HANDLE_INSTRUCTION_START(MOVE_RESULT_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200237 shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200238 ADVANCE(1);
239 HANDLE_INSTRUCTION_END();
240
241 HANDLE_INSTRUCTION_START(MOVE_RESULT_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200242 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200243 ADVANCE(1);
244 HANDLE_INSTRUCTION_END();
245
246 HANDLE_INSTRUCTION_START(MOVE_EXCEPTION) {
Sebastien Hertz5c004902014-05-21 10:07:42 +0200247 Throwable* exception = self->GetException(nullptr);
Sebastien Hertz270a0e12015-01-16 19:49:09 +0100248 DCHECK(exception != nullptr) << "No pending exception on MOVE_EXCEPTION instruction";
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200249 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception);
Sebastien Hertz5c004902014-05-21 10:07:42 +0200250 self->ClearException();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200251 ADVANCE(1);
252 }
253 HANDLE_INSTRUCTION_END();
254
255 HANDLE_INSTRUCTION_START(RETURN_VOID) {
256 JValue result;
Sebastien Hertz043036f2013-09-09 18:26:48 +0200257 if (do_access_check) {
258 // If access checks are required then the dex-to-dex compiler and analysis of
259 // whether the class has final fields hasn't been performed. Conservatively
260 // perform the memory barrier now.
Hans Boehm30359612014-05-21 17:46:23 -0700261 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz043036f2013-09-09 18:26:48 +0200262 }
Ian Rogers7b078e82014-09-10 14:44:24 -0700263 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200264 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200265 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200266 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200267 shadow_frame.GetMethod(), dex_pc,
268 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200269 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
270 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
271 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200272 }
273 return result;
274 }
275 HANDLE_INSTRUCTION_END();
276
277 HANDLE_INSTRUCTION_START(RETURN_VOID_BARRIER) {
Hans Boehm30359612014-05-21 17:46:23 -0700278 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200279 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700280 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200281 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200282 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200283 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200284 shadow_frame.GetMethod(), dex_pc,
285 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200286 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
287 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
288 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200289 }
290 return result;
291 }
292 HANDLE_INSTRUCTION_END();
293
294 HANDLE_INSTRUCTION_START(RETURN) {
295 JValue result;
296 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200297 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700298 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200299 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200300 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200301 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200302 shadow_frame.GetMethod(), dex_pc,
303 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200304 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
305 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
306 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200307 }
308 return result;
309 }
310 HANDLE_INSTRUCTION_END();
311
312 HANDLE_INSTRUCTION_START(RETURN_WIDE) {
313 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200314 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700315 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200316 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200317 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200318 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200319 shadow_frame.GetMethod(), dex_pc,
320 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200321 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
322 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
323 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200324 }
325 return result;
326 }
327 HANDLE_INSTRUCTION_END();
328
329 HANDLE_INSTRUCTION_START(RETURN_OBJECT) {
330 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700331 self->AllowThreadSuspension();
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700332 const uint8_t vreg_index = inst->VRegA_11x(inst_data);
333 Object* obj_result = shadow_frame.GetVRegReference(vreg_index);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700334 if (do_assignability_check && obj_result != NULL) {
Ian Rogersded66a02014-10-28 18:12:55 -0700335 Class* return_type = shadow_frame.GetMethod()->GetReturnType();
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700336 obj_result = shadow_frame.GetVRegReference(vreg_index);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700337 if (return_type == NULL) {
338 // Return the pending exception.
339 HANDLE_PENDING_EXCEPTION();
340 }
341 if (!obj_result->VerifierInstanceOf(return_type)) {
342 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700343 std::string temp1, temp2;
Jeff Haoa3faaf42013-09-03 19:07:00 -0700344 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
345 "Ljava/lang/VirtualMachineError;",
346 "Returning '%s' that is not instance of return type '%s'",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700347 obj_result->GetClass()->GetDescriptor(&temp1),
348 return_type->GetDescriptor(&temp2));
Jeff Haoa3faaf42013-09-03 19:07:00 -0700349 HANDLE_PENDING_EXCEPTION();
350 }
351 }
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700352 result.SetL(obj_result);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200353 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200354 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200355 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200356 shadow_frame.GetMethod(), dex_pc,
357 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200358 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
359 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
360 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200361 }
362 return result;
363 }
364 HANDLE_INSTRUCTION_END();
365
366 HANDLE_INSTRUCTION_START(CONST_4) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200367 uint32_t dst = inst->VRegA_11n(inst_data);
368 int32_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200369 shadow_frame.SetVReg(dst, val);
370 if (val == 0) {
371 shadow_frame.SetVRegReference(dst, NULL);
372 }
373 ADVANCE(1);
374 }
375 HANDLE_INSTRUCTION_END();
376
377 HANDLE_INSTRUCTION_START(CONST_16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200378 uint32_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200379 int32_t val = inst->VRegB_21s();
380 shadow_frame.SetVReg(dst, val);
381 if (val == 0) {
382 shadow_frame.SetVRegReference(dst, NULL);
383 }
384 ADVANCE(2);
385 }
386 HANDLE_INSTRUCTION_END();
387
388 HANDLE_INSTRUCTION_START(CONST) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200389 uint32_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200390 int32_t val = inst->VRegB_31i();
391 shadow_frame.SetVReg(dst, val);
392 if (val == 0) {
393 shadow_frame.SetVRegReference(dst, NULL);
394 }
395 ADVANCE(3);
396 }
397 HANDLE_INSTRUCTION_END();
398
399 HANDLE_INSTRUCTION_START(CONST_HIGH16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200400 uint32_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200401 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
402 shadow_frame.SetVReg(dst, val);
403 if (val == 0) {
404 shadow_frame.SetVRegReference(dst, NULL);
405 }
406 ADVANCE(2);
407 }
408 HANDLE_INSTRUCTION_END();
409
410 HANDLE_INSTRUCTION_START(CONST_WIDE_16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200411 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200412 ADVANCE(2);
413 HANDLE_INSTRUCTION_END();
414
415 HANDLE_INSTRUCTION_START(CONST_WIDE_32)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200416 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200417 ADVANCE(3);
418 HANDLE_INSTRUCTION_END();
419
420 HANDLE_INSTRUCTION_START(CONST_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200421 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200422 ADVANCE(5);
423 HANDLE_INSTRUCTION_END();
424
425 HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200426 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200427 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
428 ADVANCE(2);
429 HANDLE_INSTRUCTION_END();
430
431 HANDLE_INSTRUCTION_START(CONST_STRING) {
Ian Rogers6786a582014-10-28 12:49:06 -0700432 String* s = ResolveString(self, shadow_frame, inst->VRegB_21c());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200433 if (UNLIKELY(s == NULL)) {
434 HANDLE_PENDING_EXCEPTION();
435 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200436 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200437 ADVANCE(2);
438 }
439 }
440 HANDLE_INSTRUCTION_END();
441
442 HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
Ian Rogers6786a582014-10-28 12:49:06 -0700443 String* s = ResolveString(self, shadow_frame, inst->VRegB_31c());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200444 if (UNLIKELY(s == NULL)) {
445 HANDLE_PENDING_EXCEPTION();
446 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200447 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200448 ADVANCE(3);
449 }
450 }
451 HANDLE_INSTRUCTION_END();
452
453 HANDLE_INSTRUCTION_START(CONST_CLASS) {
454 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
455 self, false, do_access_check);
456 if (UNLIKELY(c == NULL)) {
457 HANDLE_PENDING_EXCEPTION();
458 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200459 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200460 ADVANCE(2);
461 }
462 }
463 HANDLE_INSTRUCTION_END();
464
465 HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200466 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200467 if (UNLIKELY(obj == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200468 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200469 HANDLE_PENDING_EXCEPTION();
470 } else {
471 DoMonitorEnter(self, obj);
472 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
473 }
474 }
475 HANDLE_INSTRUCTION_END();
476
477 HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200478 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200479 if (UNLIKELY(obj == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200480 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200481 HANDLE_PENDING_EXCEPTION();
482 } else {
483 DoMonitorExit(self, obj);
484 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
485 }
486 }
487 HANDLE_INSTRUCTION_END();
488
489 HANDLE_INSTRUCTION_START(CHECK_CAST) {
490 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
491 self, false, do_access_check);
492 if (UNLIKELY(c == NULL)) {
493 HANDLE_PENDING_EXCEPTION();
494 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200495 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200496 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
497 ThrowClassCastException(c, obj->GetClass());
498 HANDLE_PENDING_EXCEPTION();
499 } else {
500 ADVANCE(2);
501 }
502 }
503 }
504 HANDLE_INSTRUCTION_END();
505
506 HANDLE_INSTRUCTION_START(INSTANCE_OF) {
507 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
508 self, false, do_access_check);
509 if (UNLIKELY(c == NULL)) {
510 HANDLE_PENDING_EXCEPTION();
511 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200512 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
513 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200514 ADVANCE(2);
515 }
516 }
517 HANDLE_INSTRUCTION_END();
518
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700519 HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200520 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200521 if (UNLIKELY(array == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200522 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200523 HANDLE_PENDING_EXCEPTION();
524 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200525 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200526 ADVANCE(1);
527 }
528 }
529 HANDLE_INSTRUCTION_END();
530
531 HANDLE_INSTRUCTION_START(NEW_INSTANCE) {
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700532 Runtime* runtime = Runtime::Current();
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800533 Object* obj = AllocObjectFromCode<do_access_check, true>(
534 inst->VRegB_21c(), shadow_frame.GetMethod(), self,
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700535 runtime->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200536 if (UNLIKELY(obj == NULL)) {
537 HANDLE_PENDING_EXCEPTION();
538 } else {
Sebastien Hertz4e99b3d2014-06-24 14:35:40 +0200539 obj->GetClass()->AssertInitializedOrInitializingInThread(self);
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700540 // Don't allow finalizable objects to be allocated during a transaction since these can't be
541 // finalized without a started runtime.
542 if (transaction_active && obj->GetClass()->IsFinalizable()) {
Ian Rogers2fa98e22014-05-06 15:26:39 -0700543 AbortTransaction(self, "Allocating finalizable object in transaction: %s",
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700544 PrettyTypeOf(obj).c_str());
545 HANDLE_PENDING_EXCEPTION();
546 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200547 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200548 ADVANCE(2);
549 }
550 }
551 HANDLE_INSTRUCTION_END();
552
553 HANDLE_INSTRUCTION_START(NEW_ARRAY) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200554 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800555 Object* obj = AllocArrayFromCode<do_access_check, true>(
Andreas Gampe1cc7dba2014-12-17 18:43:01 -0800556 inst->VRegC_22c(), length, shadow_frame.GetMethod(), self,
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800557 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200558 if (UNLIKELY(obj == NULL)) {
559 HANDLE_PENDING_EXCEPTION();
560 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200561 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200562 ADVANCE(2);
563 }
564 }
565 HANDLE_INSTRUCTION_END();
566
567 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100568 bool success =
569 DoFilledNewArray<false, do_access_check, transaction_active>(inst, shadow_frame,
570 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200571 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
572 }
573 HANDLE_INSTRUCTION_END();
574
575 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100576 bool success =
577 DoFilledNewArray<true, do_access_check, transaction_active>(inst, shadow_frame,
578 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200579 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
580 }
581 HANDLE_INSTRUCTION_END();
582
583 HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200584 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Ian Rogers832336b2014-10-08 15:35:22 -0700585 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
586 const Instruction::ArrayDataPayload* payload =
587 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
588 bool success = FillArrayData(obj, payload);
589 if (transaction_active && success) {
590 RecordArrayElementsInTransaction(obj->AsArray(), payload->element_count);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200591 }
Ian Rogers832336b2014-10-08 15:35:22 -0700592 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200593 }
594 HANDLE_INSTRUCTION_END();
595
596 HANDLE_INSTRUCTION_START(THROW) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200597 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200598 if (UNLIKELY(exception == NULL)) {
599 ThrowNullPointerException(NULL, "throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700600 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
601 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700602 std::string temp;
Jeff Haoa3faaf42013-09-03 19:07:00 -0700603 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
604 "Ljava/lang/VirtualMachineError;",
605 "Throwing '%s' that is not instance of Throwable",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700606 exception->GetClass()->GetDescriptor(&temp));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200607 } else {
608 self->SetException(shadow_frame.GetCurrentLocationForThrow(), exception->AsThrowable());
609 }
610 HANDLE_PENDING_EXCEPTION();
611 }
612 HANDLE_INSTRUCTION_END();
613
614 HANDLE_INSTRUCTION_START(GOTO) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200615 int8_t offset = inst->VRegA_10t(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200616 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800617 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200618 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700619 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200620 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200621 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200622 }
623 ADVANCE(offset);
624 }
625 HANDLE_INSTRUCTION_END();
626
627 HANDLE_INSTRUCTION_START(GOTO_16) {
628 int16_t offset = inst->VRegA_20t();
629 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800630 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200631 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700632 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200633 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200634 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200635 }
636 ADVANCE(offset);
637 }
638 HANDLE_INSTRUCTION_END();
639
640 HANDLE_INSTRUCTION_START(GOTO_32) {
641 int32_t offset = inst->VRegA_30t();
642 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800643 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200644 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700645 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200646 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200647 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200648 }
649 ADVANCE(offset);
650 }
651 HANDLE_INSTRUCTION_END();
652
653 HANDLE_INSTRUCTION_START(PACKED_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200654 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200655 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800656 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200657 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700658 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200659 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200660 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200661 }
662 ADVANCE(offset);
663 }
664 HANDLE_INSTRUCTION_END();
665
666 HANDLE_INSTRUCTION_START(SPARSE_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200667 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200668 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800669 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200670 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700671 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200672 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200673 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200674 }
675 ADVANCE(offset);
676 }
677 HANDLE_INSTRUCTION_END();
678
Ian Rogers647b1a82014-10-10 11:02:11 -0700679#if defined(__clang__)
680#pragma clang diagnostic push
681#pragma clang diagnostic ignored "-Wfloat-equal"
682#endif
683
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200684 HANDLE_INSTRUCTION_START(CMPL_FLOAT) {
685 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
686 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
687 int32_t result;
688 if (val1 > val2) {
689 result = 1;
690 } else if (val1 == val2) {
691 result = 0;
692 } else {
693 result = -1;
694 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200695 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200696 ADVANCE(2);
697 }
698 HANDLE_INSTRUCTION_END();
699
700 HANDLE_INSTRUCTION_START(CMPG_FLOAT) {
701 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
702 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
703 int32_t result;
704 if (val1 < val2) {
705 result = -1;
706 } else if (val1 == val2) {
707 result = 0;
708 } else {
709 result = 1;
710 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200711 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200712 ADVANCE(2);
713 }
714 HANDLE_INSTRUCTION_END();
715
716 HANDLE_INSTRUCTION_START(CMPL_DOUBLE) {
717 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
718 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
719 int32_t result;
720 if (val1 > val2) {
721 result = 1;
722 } else if (val1 == val2) {
723 result = 0;
724 } else {
725 result = -1;
726 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200727 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200728 ADVANCE(2);
729 }
730 HANDLE_INSTRUCTION_END();
731
732 HANDLE_INSTRUCTION_START(CMPG_DOUBLE) {
733 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
734 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
735 int32_t result;
736 if (val1 < val2) {
737 result = -1;
738 } else if (val1 == val2) {
739 result = 0;
740 } else {
741 result = 1;
742 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200743 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200744 ADVANCE(2);
745 }
746 HANDLE_INSTRUCTION_END();
747
Ian Rogers647b1a82014-10-10 11:02:11 -0700748#if defined(__clang__)
749#pragma clang diagnostic pop
750#endif
751
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200752 HANDLE_INSTRUCTION_START(CMP_LONG) {
753 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
754 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
755 int32_t result;
756 if (val1 > val2) {
757 result = 1;
758 } else if (val1 == val2) {
759 result = 0;
760 } else {
761 result = -1;
762 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200763 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200764 ADVANCE(2);
765 }
766 HANDLE_INSTRUCTION_END();
767
768 HANDLE_INSTRUCTION_START(IF_EQ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200769 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200770 int16_t offset = inst->VRegC_22t();
771 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800772 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200773 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700774 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200775 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200776 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200777 }
778 ADVANCE(offset);
779 } else {
780 ADVANCE(2);
781 }
782 }
783 HANDLE_INSTRUCTION_END();
784
785 HANDLE_INSTRUCTION_START(IF_NE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200786 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) != shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200787 int16_t offset = inst->VRegC_22t();
788 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800789 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200790 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700791 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200792 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200793 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200794 }
795 ADVANCE(offset);
796 } else {
797 ADVANCE(2);
798 }
799 }
800 HANDLE_INSTRUCTION_END();
801
802 HANDLE_INSTRUCTION_START(IF_LT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200803 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) < shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200804 int16_t offset = inst->VRegC_22t();
805 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800806 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200807 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700808 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200809 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200810 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200811 }
812 ADVANCE(offset);
813 } else {
814 ADVANCE(2);
815 }
816 }
817 HANDLE_INSTRUCTION_END();
818
819 HANDLE_INSTRUCTION_START(IF_GE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200820 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200821 int16_t offset = inst->VRegC_22t();
822 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800823 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200824 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700825 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200826 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200827 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200828 }
829 ADVANCE(offset);
830 } else {
831 ADVANCE(2);
832 }
833 }
834 HANDLE_INSTRUCTION_END();
835
836 HANDLE_INSTRUCTION_START(IF_GT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200837 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200838 int16_t offset = inst->VRegC_22t();
839 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800840 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200841 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700842 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200843 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200844 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200845 }
846 ADVANCE(offset);
847 } else {
848 ADVANCE(2);
849 }
850 }
851 HANDLE_INSTRUCTION_END();
852
853 HANDLE_INSTRUCTION_START(IF_LE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200854 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200855 int16_t offset = inst->VRegC_22t();
856 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800857 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200858 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700859 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200860 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200861 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200862 }
863 ADVANCE(offset);
864 } else {
865 ADVANCE(2);
866 }
867 }
868 HANDLE_INSTRUCTION_END();
869
870 HANDLE_INSTRUCTION_START(IF_EQZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200871 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200872 int16_t offset = inst->VRegB_21t();
873 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800874 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200875 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700876 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200877 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200878 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200879 }
880 ADVANCE(offset);
881 } else {
882 ADVANCE(2);
883 }
884 }
885 HANDLE_INSTRUCTION_END();
886
887 HANDLE_INSTRUCTION_START(IF_NEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200888 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200889 int16_t offset = inst->VRegB_21t();
890 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800891 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200892 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700893 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200894 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200895 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200896 }
897 ADVANCE(offset);
898 } else {
899 ADVANCE(2);
900 }
901 }
902 HANDLE_INSTRUCTION_END();
903
904 HANDLE_INSTRUCTION_START(IF_LTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200905 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200906 int16_t offset = inst->VRegB_21t();
907 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800908 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200909 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700910 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200911 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200912 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200913 }
914 ADVANCE(offset);
915 } else {
916 ADVANCE(2);
917 }
918 }
919 HANDLE_INSTRUCTION_END();
920
921 HANDLE_INSTRUCTION_START(IF_GEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200922 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200923 int16_t offset = inst->VRegB_21t();
924 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800925 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200926 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700927 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200928 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200929 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200930 }
931 ADVANCE(offset);
932 } else {
933 ADVANCE(2);
934 }
935 }
936 HANDLE_INSTRUCTION_END();
937
938 HANDLE_INSTRUCTION_START(IF_GTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200939 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200940 int16_t offset = inst->VRegB_21t();
941 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800942 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200943 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700944 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200945 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200946 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200947 }
948 ADVANCE(offset);
949 } else {
950 ADVANCE(2);
951 }
952 }
953 HANDLE_INSTRUCTION_END();
954
955 HANDLE_INSTRUCTION_START(IF_LEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200956 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200957 int16_t offset = inst->VRegB_21t();
958 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800959 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200960 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700961 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200962 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200963 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200964 }
965 ADVANCE(offset);
966 } else {
967 ADVANCE(2);
968 }
969 }
970 HANDLE_INSTRUCTION_END();
971
972 HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
973 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
974 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200975 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200976 HANDLE_PENDING_EXCEPTION();
977 } else {
978 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
979 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100980 if (LIKELY(array->CheckIsValidIndex(index))) {
981 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200982 ADVANCE(2);
983 } else {
984 HANDLE_PENDING_EXCEPTION();
985 }
986 }
987 }
988 HANDLE_INSTRUCTION_END();
989
990 HANDLE_INSTRUCTION_START(AGET_BYTE) {
991 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
992 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200993 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200994 HANDLE_PENDING_EXCEPTION();
995 } else {
996 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
997 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100998 if (LIKELY(array->CheckIsValidIndex(index))) {
999 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001000 ADVANCE(2);
1001 } else {
1002 HANDLE_PENDING_EXCEPTION();
1003 }
1004 }
1005 }
1006 HANDLE_INSTRUCTION_END();
1007
1008 HANDLE_INSTRUCTION_START(AGET_CHAR) {
1009 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1010 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001011 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001012 HANDLE_PENDING_EXCEPTION();
1013 } else {
1014 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1015 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001016 if (LIKELY(array->CheckIsValidIndex(index))) {
1017 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001018 ADVANCE(2);
1019 } else {
1020 HANDLE_PENDING_EXCEPTION();
1021 }
1022 }
1023 }
1024 HANDLE_INSTRUCTION_END();
1025
1026 HANDLE_INSTRUCTION_START(AGET_SHORT) {
1027 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1028 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001029 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001030 HANDLE_PENDING_EXCEPTION();
1031 } else {
1032 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1033 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001034 if (LIKELY(array->CheckIsValidIndex(index))) {
1035 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001036 ADVANCE(2);
1037 } else {
1038 HANDLE_PENDING_EXCEPTION();
1039 }
1040 }
1041 }
1042 HANDLE_INSTRUCTION_END();
1043
1044 HANDLE_INSTRUCTION_START(AGET) {
1045 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1046 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001047 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001048 HANDLE_PENDING_EXCEPTION();
1049 } else {
1050 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1051 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001052 if (LIKELY(array->CheckIsValidIndex(index))) {
1053 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001054 ADVANCE(2);
1055 } else {
1056 HANDLE_PENDING_EXCEPTION();
1057 }
1058 }
1059 }
1060 HANDLE_INSTRUCTION_END();
1061
1062 HANDLE_INSTRUCTION_START(AGET_WIDE) {
1063 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1064 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001065 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001066 HANDLE_PENDING_EXCEPTION();
1067 } else {
1068 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1069 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001070 if (LIKELY(array->CheckIsValidIndex(index))) {
1071 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001072 ADVANCE(2);
1073 } else {
1074 HANDLE_PENDING_EXCEPTION();
1075 }
1076 }
1077 }
1078 HANDLE_INSTRUCTION_END();
1079
1080 HANDLE_INSTRUCTION_START(AGET_OBJECT) {
1081 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1082 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001083 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001084 HANDLE_PENDING_EXCEPTION();
1085 } else {
1086 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1087 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001088 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001089 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001090 ADVANCE(2);
1091 } else {
1092 HANDLE_PENDING_EXCEPTION();
1093 }
1094 }
1095 }
1096 HANDLE_INSTRUCTION_END();
1097
1098 HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
1099 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1100 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001101 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001102 HANDLE_PENDING_EXCEPTION();
1103 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001104 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001105 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1106 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001107 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001108 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001109 ADVANCE(2);
1110 } else {
1111 HANDLE_PENDING_EXCEPTION();
1112 }
1113 }
1114 }
1115 HANDLE_INSTRUCTION_END();
1116
1117 HANDLE_INSTRUCTION_START(APUT_BYTE) {
1118 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1119 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001120 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001121 HANDLE_PENDING_EXCEPTION();
1122 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001123 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001124 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1125 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001126 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001127 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001128 ADVANCE(2);
1129 } else {
1130 HANDLE_PENDING_EXCEPTION();
1131 }
1132 }
1133 }
1134 HANDLE_INSTRUCTION_END();
1135
1136 HANDLE_INSTRUCTION_START(APUT_CHAR) {
1137 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1138 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001139 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001140 HANDLE_PENDING_EXCEPTION();
1141 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001142 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001143 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1144 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001145 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001146 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001147 ADVANCE(2);
1148 } else {
1149 HANDLE_PENDING_EXCEPTION();
1150 }
1151 }
1152 }
1153 HANDLE_INSTRUCTION_END();
1154
1155 HANDLE_INSTRUCTION_START(APUT_SHORT) {
1156 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1157 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001158 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001159 HANDLE_PENDING_EXCEPTION();
1160 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001161 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001162 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1163 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001164 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001165 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001166 ADVANCE(2);
1167 } else {
1168 HANDLE_PENDING_EXCEPTION();
1169 }
1170 }
1171 }
1172 HANDLE_INSTRUCTION_END();
1173
1174 HANDLE_INSTRUCTION_START(APUT) {
1175 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1176 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001177 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001178 HANDLE_PENDING_EXCEPTION();
1179 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001180 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001181 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1182 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001183 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001184 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001185 ADVANCE(2);
1186 } else {
1187 HANDLE_PENDING_EXCEPTION();
1188 }
1189 }
1190 }
1191 HANDLE_INSTRUCTION_END();
1192
1193 HANDLE_INSTRUCTION_START(APUT_WIDE) {
1194 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1195 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001196 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001197 HANDLE_PENDING_EXCEPTION();
1198 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001199 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001200 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1201 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001202 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001203 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001204 ADVANCE(2);
1205 } else {
1206 HANDLE_PENDING_EXCEPTION();
1207 }
1208 }
1209 }
1210 HANDLE_INSTRUCTION_END();
1211
1212 HANDLE_INSTRUCTION_START(APUT_OBJECT) {
1213 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1214 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001215 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001216 HANDLE_PENDING_EXCEPTION();
1217 } else {
1218 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001219 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001220 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001221 if (LIKELY(array->CheckIsValidIndex(index) && array->CheckAssignable(val))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001222 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001223 ADVANCE(2);
1224 } else {
1225 HANDLE_PENDING_EXCEPTION();
1226 }
1227 }
1228 }
1229 HANDLE_INSTRUCTION_END();
1230
1231 HANDLE_INSTRUCTION_START(IGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001232 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001233 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1234 }
1235 HANDLE_INSTRUCTION_END();
1236
1237 HANDLE_INSTRUCTION_START(IGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001238 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001239 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1240 }
1241 HANDLE_INSTRUCTION_END();
1242
1243 HANDLE_INSTRUCTION_START(IGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001244 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001245 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1246 }
1247 HANDLE_INSTRUCTION_END();
1248
1249 HANDLE_INSTRUCTION_START(IGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001250 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001251 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1252 }
1253 HANDLE_INSTRUCTION_END();
1254
1255 HANDLE_INSTRUCTION_START(IGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001256 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001257 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1258 }
1259 HANDLE_INSTRUCTION_END();
1260
1261 HANDLE_INSTRUCTION_START(IGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001262 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001263 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1264 }
1265 HANDLE_INSTRUCTION_END();
1266
1267 HANDLE_INSTRUCTION_START(IGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001268 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001269 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1270 }
1271 HANDLE_INSTRUCTION_END();
1272
1273 HANDLE_INSTRUCTION_START(IGET_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001274 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001275 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1276 }
1277 HANDLE_INSTRUCTION_END();
1278
Mathieu Chartierffc605c2014-12-10 10:35:44 -08001279 HANDLE_INSTRUCTION_START(IGET_BOOLEAN_QUICK) {
1280 bool success = DoIGetQuick<Primitive::kPrimBoolean>(shadow_frame, inst, inst_data);
1281 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1282 }
1283 HANDLE_INSTRUCTION_END();
1284
1285 HANDLE_INSTRUCTION_START(IGET_BYTE_QUICK) {
1286 bool success = DoIGetQuick<Primitive::kPrimByte>(shadow_frame, inst, inst_data);
1287 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1288 }
1289 HANDLE_INSTRUCTION_END();
1290
1291 HANDLE_INSTRUCTION_START(IGET_CHAR_QUICK) {
1292 bool success = DoIGetQuick<Primitive::kPrimChar>(shadow_frame, inst, inst_data);
1293 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1294 }
1295 HANDLE_INSTRUCTION_END();
1296
1297 HANDLE_INSTRUCTION_START(IGET_SHORT_QUICK) {
1298 bool success = DoIGetQuick<Primitive::kPrimShort>(shadow_frame, inst, inst_data);
1299 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1300 }
1301 HANDLE_INSTRUCTION_END();
1302
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001303 HANDLE_INSTRUCTION_START(IGET_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001304 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001305 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1306 }
1307 HANDLE_INSTRUCTION_END();
1308
1309 HANDLE_INSTRUCTION_START(IGET_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001310 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001311 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1312 }
1313 HANDLE_INSTRUCTION_END();
1314
1315 HANDLE_INSTRUCTION_START(SGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001316 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001317 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1318 }
1319 HANDLE_INSTRUCTION_END();
1320
1321 HANDLE_INSTRUCTION_START(SGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001322 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001323 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1324 }
1325 HANDLE_INSTRUCTION_END();
1326
1327 HANDLE_INSTRUCTION_START(SGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001328 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001329 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1330 }
1331 HANDLE_INSTRUCTION_END();
1332
1333 HANDLE_INSTRUCTION_START(SGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001334 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001335 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1336 }
1337 HANDLE_INSTRUCTION_END();
1338
1339 HANDLE_INSTRUCTION_START(SGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001340 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001341 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1342 }
1343 HANDLE_INSTRUCTION_END();
1344
1345 HANDLE_INSTRUCTION_START(SGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001346 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001347 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1348 }
1349 HANDLE_INSTRUCTION_END();
1350
1351 HANDLE_INSTRUCTION_START(SGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001352 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001353 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1354 }
1355 HANDLE_INSTRUCTION_END();
1356
1357 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001358 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001359 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1360 }
1361 HANDLE_INSTRUCTION_END();
1362
1363 HANDLE_INSTRUCTION_START(IPUT_BYTE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001364 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001365 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1366 }
1367 HANDLE_INSTRUCTION_END();
1368
1369 HANDLE_INSTRUCTION_START(IPUT_CHAR) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001370 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001371 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1372 }
1373 HANDLE_INSTRUCTION_END();
1374
1375 HANDLE_INSTRUCTION_START(IPUT_SHORT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001376 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001377 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1378 }
1379 HANDLE_INSTRUCTION_END();
1380
1381 HANDLE_INSTRUCTION_START(IPUT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001382 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001383 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1384 }
1385 HANDLE_INSTRUCTION_END();
1386
1387 HANDLE_INSTRUCTION_START(IPUT_WIDE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001388 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001389 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1390 }
1391 HANDLE_INSTRUCTION_END();
1392
1393 HANDLE_INSTRUCTION_START(IPUT_OBJECT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001394 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001395 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1396 }
1397 HANDLE_INSTRUCTION_END();
1398
1399 HANDLE_INSTRUCTION_START(IPUT_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001400 bool success = DoIPutQuick<Primitive::kPrimInt, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001401 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1402 }
1403 HANDLE_INSTRUCTION_END();
1404
Fred Shih37f05ef2014-07-16 18:38:08 -07001405 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN_QUICK) {
1406 bool success = DoIPutQuick<Primitive::kPrimBoolean, transaction_active>(shadow_frame, inst, inst_data);
1407 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1408 }
1409 HANDLE_INSTRUCTION_END();
1410
1411 HANDLE_INSTRUCTION_START(IPUT_BYTE_QUICK) {
1412 bool success = DoIPutQuick<Primitive::kPrimByte, transaction_active>(shadow_frame, inst, inst_data);
1413 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1414 }
1415 HANDLE_INSTRUCTION_END();
1416
1417 HANDLE_INSTRUCTION_START(IPUT_CHAR_QUICK) {
1418 bool success = DoIPutQuick<Primitive::kPrimChar, transaction_active>(shadow_frame, inst, inst_data);
1419 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1420 }
1421 HANDLE_INSTRUCTION_END();
1422
1423 HANDLE_INSTRUCTION_START(IPUT_SHORT_QUICK) {
1424 bool success = DoIPutQuick<Primitive::kPrimShort, transaction_active>(shadow_frame, inst, inst_data);
1425 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1426 }
1427 HANDLE_INSTRUCTION_END();
1428
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001429 HANDLE_INSTRUCTION_START(IPUT_WIDE_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001430 bool success = DoIPutQuick<Primitive::kPrimLong, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001431 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1432 }
1433 HANDLE_INSTRUCTION_END();
1434
1435 HANDLE_INSTRUCTION_START(IPUT_OBJECT_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001436 bool success = DoIPutQuick<Primitive::kPrimNot, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001437 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1438 }
1439 HANDLE_INSTRUCTION_END();
1440
1441 HANDLE_INSTRUCTION_START(SPUT_BOOLEAN) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001442 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001443 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1444 }
1445 HANDLE_INSTRUCTION_END();
1446
1447 HANDLE_INSTRUCTION_START(SPUT_BYTE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001448 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001449 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1450 }
1451 HANDLE_INSTRUCTION_END();
1452
1453 HANDLE_INSTRUCTION_START(SPUT_CHAR) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001454 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001455 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1456 }
1457 HANDLE_INSTRUCTION_END();
1458
1459 HANDLE_INSTRUCTION_START(SPUT_SHORT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001460 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001461 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1462 }
1463 HANDLE_INSTRUCTION_END();
1464
1465 HANDLE_INSTRUCTION_START(SPUT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001466 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001467 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1468 }
1469 HANDLE_INSTRUCTION_END();
1470
1471 HANDLE_INSTRUCTION_START(SPUT_WIDE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001472 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001473 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1474 }
1475 HANDLE_INSTRUCTION_END();
1476
1477 HANDLE_INSTRUCTION_START(SPUT_OBJECT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001478 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001479 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1480 }
1481 HANDLE_INSTRUCTION_END();
1482
1483 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001484 bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001485 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001486 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1487 }
1488 HANDLE_INSTRUCTION_END();
1489
1490 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001491 bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001492 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001493 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1494 }
1495 HANDLE_INSTRUCTION_END();
1496
1497 HANDLE_INSTRUCTION_START(INVOKE_SUPER) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001498 bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001499 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001500 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1501 }
1502 HANDLE_INSTRUCTION_END();
1503
1504 HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001505 bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001506 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001507 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1508 }
1509 HANDLE_INSTRUCTION_END();
1510
1511 HANDLE_INSTRUCTION_START(INVOKE_DIRECT) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001512 bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001513 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001514 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1515 }
1516 HANDLE_INSTRUCTION_END();
1517
1518 HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001519 bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001520 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001521 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1522 }
1523 HANDLE_INSTRUCTION_END();
1524
1525 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001526 bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001527 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001528 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1529 }
1530 HANDLE_INSTRUCTION_END();
1531
1532 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001533 bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001534 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001535 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1536 }
1537 HANDLE_INSTRUCTION_END();
1538
1539 HANDLE_INSTRUCTION_START(INVOKE_STATIC) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001540 bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001541 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001542 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1543 }
1544 HANDLE_INSTRUCTION_END();
1545
1546 HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001547 bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001548 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001549 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1550 }
1551 HANDLE_INSTRUCTION_END();
1552
1553 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001554 bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001555 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001556 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1557 }
1558 HANDLE_INSTRUCTION_END();
1559
1560 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001561 bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001562 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001563 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1564 }
1565 HANDLE_INSTRUCTION_END();
1566
1567 HANDLE_INSTRUCTION_START(NEG_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001568 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001569 ADVANCE(1);
1570 HANDLE_INSTRUCTION_END();
1571
1572 HANDLE_INSTRUCTION_START(NOT_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001573 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001574 ADVANCE(1);
1575 HANDLE_INSTRUCTION_END();
1576
1577 HANDLE_INSTRUCTION_START(NEG_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001578 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001579 ADVANCE(1);
1580 HANDLE_INSTRUCTION_END();
1581
1582 HANDLE_INSTRUCTION_START(NOT_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001583 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001584 ADVANCE(1);
1585 HANDLE_INSTRUCTION_END();
1586
1587 HANDLE_INSTRUCTION_START(NEG_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001588 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001589 ADVANCE(1);
1590 HANDLE_INSTRUCTION_END();
1591
1592 HANDLE_INSTRUCTION_START(NEG_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001593 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001594 ADVANCE(1);
1595 HANDLE_INSTRUCTION_END();
1596
1597 HANDLE_INSTRUCTION_START(INT_TO_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001598 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001599 ADVANCE(1);
1600 HANDLE_INSTRUCTION_END();
1601
1602 HANDLE_INSTRUCTION_START(INT_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001603 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001604 ADVANCE(1);
1605 HANDLE_INSTRUCTION_END();
1606
1607 HANDLE_INSTRUCTION_START(INT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001608 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001609 ADVANCE(1);
1610 HANDLE_INSTRUCTION_END();
1611
1612 HANDLE_INSTRUCTION_START(LONG_TO_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001613 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001614 ADVANCE(1);
1615 HANDLE_INSTRUCTION_END();
1616
1617 HANDLE_INSTRUCTION_START(LONG_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001618 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001619 ADVANCE(1);
1620 HANDLE_INSTRUCTION_END();
1621
1622 HANDLE_INSTRUCTION_START(LONG_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001623 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001624 ADVANCE(1);
1625 HANDLE_INSTRUCTION_END();
1626
1627 HANDLE_INSTRUCTION_START(FLOAT_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001628 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001629 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001630 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001631 ADVANCE(1);
1632 }
1633 HANDLE_INSTRUCTION_END();
1634
1635 HANDLE_INSTRUCTION_START(FLOAT_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001636 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001637 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001638 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001639 ADVANCE(1);
1640 }
1641 HANDLE_INSTRUCTION_END();
1642
1643 HANDLE_INSTRUCTION_START(FLOAT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001644 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001645 ADVANCE(1);
1646 HANDLE_INSTRUCTION_END();
1647
1648 HANDLE_INSTRUCTION_START(DOUBLE_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001649 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001650 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001651 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001652 ADVANCE(1);
1653 }
1654 HANDLE_INSTRUCTION_END();
1655
1656 HANDLE_INSTRUCTION_START(DOUBLE_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001657 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001658 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001659 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001660 ADVANCE(1);
1661 }
1662 HANDLE_INSTRUCTION_END();
1663
1664 HANDLE_INSTRUCTION_START(DOUBLE_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001665 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001666 ADVANCE(1);
1667 HANDLE_INSTRUCTION_END();
1668
1669 HANDLE_INSTRUCTION_START(INT_TO_BYTE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001670 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1671 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001672 ADVANCE(1);
1673 HANDLE_INSTRUCTION_END();
1674
1675 HANDLE_INSTRUCTION_START(INT_TO_CHAR)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001676 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1677 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001678 ADVANCE(1);
1679 HANDLE_INSTRUCTION_END();
1680
1681 HANDLE_INSTRUCTION_START(INT_TO_SHORT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001682 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1683 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001684 ADVANCE(1);
1685 HANDLE_INSTRUCTION_END();
1686
1687 HANDLE_INSTRUCTION_START(ADD_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001688 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001689 SafeAdd(shadow_frame.GetVReg(inst->VRegB_23x()),
1690 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001691 ADVANCE(2);
1692 HANDLE_INSTRUCTION_END();
1693
1694 HANDLE_INSTRUCTION_START(SUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001695 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001696 SafeSub(shadow_frame.GetVReg(inst->VRegB_23x()),
1697 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001698 ADVANCE(2);
1699 HANDLE_INSTRUCTION_END();
1700
1701 HANDLE_INSTRUCTION_START(MUL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001702 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001703 SafeMul(shadow_frame.GetVReg(inst->VRegB_23x()),
1704 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001705 ADVANCE(2);
1706 HANDLE_INSTRUCTION_END();
1707
1708 HANDLE_INSTRUCTION_START(DIV_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001709 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
1710 shadow_frame.GetVReg(inst->VRegB_23x()),
1711 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001712 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1713 }
1714 HANDLE_INSTRUCTION_END();
1715
1716 HANDLE_INSTRUCTION_START(REM_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001717 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1718 shadow_frame.GetVReg(inst->VRegB_23x()),
1719 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001720 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1721 }
1722 HANDLE_INSTRUCTION_END();
1723
1724 HANDLE_INSTRUCTION_START(SHL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001725 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001726 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1727 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1728 ADVANCE(2);
1729 HANDLE_INSTRUCTION_END();
1730
1731 HANDLE_INSTRUCTION_START(SHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001732 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001733 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1734 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1735 ADVANCE(2);
1736 HANDLE_INSTRUCTION_END();
1737
1738 HANDLE_INSTRUCTION_START(USHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001739 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001740 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1741 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1742 ADVANCE(2);
1743 HANDLE_INSTRUCTION_END();
1744
1745 HANDLE_INSTRUCTION_START(AND_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001746 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001747 shadow_frame.GetVReg(inst->VRegB_23x()) &
1748 shadow_frame.GetVReg(inst->VRegC_23x()));
1749 ADVANCE(2);
1750 HANDLE_INSTRUCTION_END();
1751
1752 HANDLE_INSTRUCTION_START(OR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001753 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001754 shadow_frame.GetVReg(inst->VRegB_23x()) |
1755 shadow_frame.GetVReg(inst->VRegC_23x()));
1756 ADVANCE(2);
1757 HANDLE_INSTRUCTION_END();
1758
1759 HANDLE_INSTRUCTION_START(XOR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001760 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001761 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1762 shadow_frame.GetVReg(inst->VRegC_23x()));
1763 ADVANCE(2);
1764 HANDLE_INSTRUCTION_END();
1765
1766 HANDLE_INSTRUCTION_START(ADD_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001767 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001768 SafeAdd(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1769 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001770 ADVANCE(2);
1771 HANDLE_INSTRUCTION_END();
1772
1773 HANDLE_INSTRUCTION_START(SUB_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001774 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001775 SafeSub(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1776 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001777 ADVANCE(2);
1778 HANDLE_INSTRUCTION_END();
1779
1780 HANDLE_INSTRUCTION_START(MUL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001781 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001782 SafeMul(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1783 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001784 ADVANCE(2);
1785 HANDLE_INSTRUCTION_END();
1786
1787 HANDLE_INSTRUCTION_START(DIV_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001788 bool success = DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
1789 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1790 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001791 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1792 }
1793 HANDLE_INSTRUCTION_END();
1794
1795 HANDLE_INSTRUCTION_START(REM_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001796 bool success = DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1797 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1798 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001799 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1800 }
1801 HANDLE_INSTRUCTION_END();
1802
1803 HANDLE_INSTRUCTION_START(AND_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001804 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001805 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1806 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1807 ADVANCE(2);
1808 HANDLE_INSTRUCTION_END();
1809
1810 HANDLE_INSTRUCTION_START(OR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001811 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001812 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1813 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1814 ADVANCE(2);
1815 HANDLE_INSTRUCTION_END();
1816
1817 HANDLE_INSTRUCTION_START(XOR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001818 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001819 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1820 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1821 ADVANCE(2);
1822 HANDLE_INSTRUCTION_END();
1823
1824 HANDLE_INSTRUCTION_START(SHL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001825 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001826 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1827 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1828 ADVANCE(2);
1829 HANDLE_INSTRUCTION_END();
1830
1831 HANDLE_INSTRUCTION_START(SHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001832 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001833 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1834 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1835 ADVANCE(2);
1836 HANDLE_INSTRUCTION_END();
1837
1838 HANDLE_INSTRUCTION_START(USHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001839 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001840 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1841 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1842 ADVANCE(2);
1843 HANDLE_INSTRUCTION_END();
1844
1845 HANDLE_INSTRUCTION_START(ADD_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001846 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001847 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1848 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1849 ADVANCE(2);
1850 HANDLE_INSTRUCTION_END();
1851
1852 HANDLE_INSTRUCTION_START(SUB_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001853 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001854 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1855 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1856 ADVANCE(2);
1857 HANDLE_INSTRUCTION_END();
1858
1859 HANDLE_INSTRUCTION_START(MUL_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001860 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001861 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1862 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1863 ADVANCE(2);
1864 HANDLE_INSTRUCTION_END();
1865
1866 HANDLE_INSTRUCTION_START(DIV_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001867 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001868 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1869 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1870 ADVANCE(2);
1871 HANDLE_INSTRUCTION_END();
1872
1873 HANDLE_INSTRUCTION_START(REM_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001874 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001875 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1876 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1877 ADVANCE(2);
1878 HANDLE_INSTRUCTION_END();
1879
1880 HANDLE_INSTRUCTION_START(ADD_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001881 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001882 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1883 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1884 ADVANCE(2);
1885 HANDLE_INSTRUCTION_END();
1886
1887 HANDLE_INSTRUCTION_START(SUB_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001888 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001889 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1890 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1891 ADVANCE(2);
1892 HANDLE_INSTRUCTION_END();
1893
1894 HANDLE_INSTRUCTION_START(MUL_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001895 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001896 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1897 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1898 ADVANCE(2);
1899 HANDLE_INSTRUCTION_END();
1900
1901 HANDLE_INSTRUCTION_START(DIV_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001902 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001903 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1904 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1905 ADVANCE(2);
1906 HANDLE_INSTRUCTION_END();
1907
1908 HANDLE_INSTRUCTION_START(REM_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001909 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001910 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1911 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1912 ADVANCE(2);
1913 HANDLE_INSTRUCTION_END();
1914
1915 HANDLE_INSTRUCTION_START(ADD_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001916 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001917 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001918 SafeAdd(shadow_frame.GetVReg(vregA),
1919 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001920 ADVANCE(1);
1921 }
1922 HANDLE_INSTRUCTION_END();
1923
1924 HANDLE_INSTRUCTION_START(SUB_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001925 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001926 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001927 SafeSub(shadow_frame.GetVReg(vregA),
1928 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001929 ADVANCE(1);
1930 }
1931 HANDLE_INSTRUCTION_END();
1932
1933 HANDLE_INSTRUCTION_START(MUL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001934 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001935 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001936 SafeMul(shadow_frame.GetVReg(vregA),
1937 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001938 ADVANCE(1);
1939 }
1940 HANDLE_INSTRUCTION_END();
1941
1942 HANDLE_INSTRUCTION_START(DIV_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001943 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001944 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001945 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001946 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1947 }
1948 HANDLE_INSTRUCTION_END();
1949
1950 HANDLE_INSTRUCTION_START(REM_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001951 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001952 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001953 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001954 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1955 }
1956 HANDLE_INSTRUCTION_END();
1957
1958 HANDLE_INSTRUCTION_START(SHL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001959 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001960 shadow_frame.SetVReg(vregA,
1961 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001962 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001963 ADVANCE(1);
1964 }
1965 HANDLE_INSTRUCTION_END();
1966
1967 HANDLE_INSTRUCTION_START(SHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001968 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001969 shadow_frame.SetVReg(vregA,
1970 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001971 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001972 ADVANCE(1);
1973 }
1974 HANDLE_INSTRUCTION_END();
1975
1976 HANDLE_INSTRUCTION_START(USHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001977 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001978 shadow_frame.SetVReg(vregA,
1979 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001980 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001981 ADVANCE(1);
1982 }
1983 HANDLE_INSTRUCTION_END();
1984
1985 HANDLE_INSTRUCTION_START(AND_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001986 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001987 shadow_frame.SetVReg(vregA,
1988 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001989 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001990 ADVANCE(1);
1991 }
1992 HANDLE_INSTRUCTION_END();
1993
1994 HANDLE_INSTRUCTION_START(OR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001995 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001996 shadow_frame.SetVReg(vregA,
1997 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001998 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001999 ADVANCE(1);
2000 }
2001 HANDLE_INSTRUCTION_END();
2002
2003 HANDLE_INSTRUCTION_START(XOR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002004 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002005 shadow_frame.SetVReg(vregA,
2006 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002007 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002008 ADVANCE(1);
2009 }
2010 HANDLE_INSTRUCTION_END();
2011
2012 HANDLE_INSTRUCTION_START(ADD_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002013 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002014 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002015 SafeAdd(shadow_frame.GetVRegLong(vregA),
2016 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002017 ADVANCE(1);
2018 }
2019 HANDLE_INSTRUCTION_END();
2020
2021 HANDLE_INSTRUCTION_START(SUB_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002022 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002023 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002024 SafeSub(shadow_frame.GetVRegLong(vregA),
2025 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002026 ADVANCE(1);
2027 }
2028 HANDLE_INSTRUCTION_END();
2029
2030 HANDLE_INSTRUCTION_START(MUL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002031 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002032 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002033 SafeMul(shadow_frame.GetVRegLong(vregA),
2034 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002035 ADVANCE(1);
2036 }
2037 HANDLE_INSTRUCTION_END();
2038
2039 HANDLE_INSTRUCTION_START(DIV_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002040 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002041 bool success = DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002042 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002043 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2044 }
2045 HANDLE_INSTRUCTION_END();
2046
2047 HANDLE_INSTRUCTION_START(REM_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002048 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002049 bool success = DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002050 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002051 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2052 }
2053 HANDLE_INSTRUCTION_END();
2054
2055 HANDLE_INSTRUCTION_START(AND_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002056 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002057 shadow_frame.SetVRegLong(vregA,
2058 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002059 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002060 ADVANCE(1);
2061 }
2062 HANDLE_INSTRUCTION_END();
2063
2064 HANDLE_INSTRUCTION_START(OR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002065 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002066 shadow_frame.SetVRegLong(vregA,
2067 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002068 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002069 ADVANCE(1);
2070 }
2071 HANDLE_INSTRUCTION_END();
2072
2073 HANDLE_INSTRUCTION_START(XOR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002074 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002075 shadow_frame.SetVRegLong(vregA,
2076 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002077 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002078 ADVANCE(1);
2079 }
2080 HANDLE_INSTRUCTION_END();
2081
2082 HANDLE_INSTRUCTION_START(SHL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002083 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002084 shadow_frame.SetVRegLong(vregA,
2085 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002086 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002087 ADVANCE(1);
2088 }
2089 HANDLE_INSTRUCTION_END();
2090
2091 HANDLE_INSTRUCTION_START(SHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002092 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002093 shadow_frame.SetVRegLong(vregA,
2094 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002095 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002096 ADVANCE(1);
2097 }
2098 HANDLE_INSTRUCTION_END();
2099
2100 HANDLE_INSTRUCTION_START(USHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002101 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002102 shadow_frame.SetVRegLong(vregA,
2103 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002104 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002105 ADVANCE(1);
2106 }
2107 HANDLE_INSTRUCTION_END();
2108
2109 HANDLE_INSTRUCTION_START(ADD_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002110 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002111 shadow_frame.SetVRegFloat(vregA,
2112 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002113 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002114 ADVANCE(1);
2115 }
2116 HANDLE_INSTRUCTION_END();
2117
2118 HANDLE_INSTRUCTION_START(SUB_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002119 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002120 shadow_frame.SetVRegFloat(vregA,
2121 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002122 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002123 ADVANCE(1);
2124 }
2125 HANDLE_INSTRUCTION_END();
2126
2127 HANDLE_INSTRUCTION_START(MUL_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002128 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002129 shadow_frame.SetVRegFloat(vregA,
2130 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002131 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002132 ADVANCE(1);
2133 }
2134 HANDLE_INSTRUCTION_END();
2135
2136 HANDLE_INSTRUCTION_START(DIV_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002137 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002138 shadow_frame.SetVRegFloat(vregA,
2139 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002140 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002141 ADVANCE(1);
2142 }
2143 HANDLE_INSTRUCTION_END();
2144
2145 HANDLE_INSTRUCTION_START(REM_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002146 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002147 shadow_frame.SetVRegFloat(vregA,
2148 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002149 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002150 ADVANCE(1);
2151 }
2152 HANDLE_INSTRUCTION_END();
2153
2154 HANDLE_INSTRUCTION_START(ADD_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002155 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002156 shadow_frame.SetVRegDouble(vregA,
2157 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002158 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002159 ADVANCE(1);
2160 }
2161 HANDLE_INSTRUCTION_END();
2162
2163 HANDLE_INSTRUCTION_START(SUB_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002164 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002165 shadow_frame.SetVRegDouble(vregA,
2166 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002167 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002168 ADVANCE(1);
2169 }
2170 HANDLE_INSTRUCTION_END();
2171
2172 HANDLE_INSTRUCTION_START(MUL_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002173 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002174 shadow_frame.SetVRegDouble(vregA,
2175 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002176 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002177 ADVANCE(1);
2178 }
2179 HANDLE_INSTRUCTION_END();
2180
2181 HANDLE_INSTRUCTION_START(DIV_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002182 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002183 shadow_frame.SetVRegDouble(vregA,
2184 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002185 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002186 ADVANCE(1);
2187 }
2188 HANDLE_INSTRUCTION_END();
2189
2190 HANDLE_INSTRUCTION_START(REM_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002191 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002192 shadow_frame.SetVRegDouble(vregA,
2193 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002194 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002195 ADVANCE(1);
2196 }
2197 HANDLE_INSTRUCTION_END();
2198
2199 HANDLE_INSTRUCTION_START(ADD_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002200 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002201 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2202 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002203 ADVANCE(2);
2204 HANDLE_INSTRUCTION_END();
2205
2206 HANDLE_INSTRUCTION_START(RSUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002207 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002208 SafeSub(inst->VRegC_22s(),
2209 shadow_frame.GetVReg(inst->VRegB_22s(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002210 ADVANCE(2);
2211 HANDLE_INSTRUCTION_END();
2212
2213 HANDLE_INSTRUCTION_START(MUL_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002214 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002215 SafeMul(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2216 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002217 ADVANCE(2);
2218 HANDLE_INSTRUCTION_END();
2219
2220 HANDLE_INSTRUCTION_START(DIV_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002221 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
2222 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002223 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2224 }
2225 HANDLE_INSTRUCTION_END();
2226
2227 HANDLE_INSTRUCTION_START(REM_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002228 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
2229 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002230 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2231 }
2232 HANDLE_INSTRUCTION_END();
2233
2234 HANDLE_INSTRUCTION_START(AND_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002235 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2236 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002237 inst->VRegC_22s());
2238 ADVANCE(2);
2239 HANDLE_INSTRUCTION_END();
2240
2241 HANDLE_INSTRUCTION_START(OR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002242 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2243 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002244 inst->VRegC_22s());
2245 ADVANCE(2);
2246 HANDLE_INSTRUCTION_END();
2247
2248 HANDLE_INSTRUCTION_START(XOR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002249 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2250 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002251 inst->VRegC_22s());
2252 ADVANCE(2);
2253 HANDLE_INSTRUCTION_END();
2254
2255 HANDLE_INSTRUCTION_START(ADD_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002256 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002257 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22b()),
2258 inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002259 ADVANCE(2);
2260 HANDLE_INSTRUCTION_END();
2261
2262 HANDLE_INSTRUCTION_START(RSUB_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002263 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002264 SafeSub(inst->VRegC_22b(),
2265 shadow_frame.GetVReg(inst->VRegB_22b())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002266 ADVANCE(2);
2267 HANDLE_INSTRUCTION_END();
2268
2269 HANDLE_INSTRUCTION_START(MUL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002270 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002271 SafeMul(shadow_frame.GetVReg(inst->VRegB_22b()),
2272 inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002273 ADVANCE(2);
2274 HANDLE_INSTRUCTION_END();
2275
2276 HANDLE_INSTRUCTION_START(DIV_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002277 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
2278 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002279 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2280 }
2281 HANDLE_INSTRUCTION_END();
2282
2283 HANDLE_INSTRUCTION_START(REM_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002284 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
2285 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002286 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2287 }
2288 HANDLE_INSTRUCTION_END();
2289
2290 HANDLE_INSTRUCTION_START(AND_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002291 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002292 shadow_frame.GetVReg(inst->VRegB_22b()) &
2293 inst->VRegC_22b());
2294 ADVANCE(2);
2295 HANDLE_INSTRUCTION_END();
2296
2297 HANDLE_INSTRUCTION_START(OR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002298 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002299 shadow_frame.GetVReg(inst->VRegB_22b()) |
2300 inst->VRegC_22b());
2301 ADVANCE(2);
2302 HANDLE_INSTRUCTION_END();
2303
2304 HANDLE_INSTRUCTION_START(XOR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002305 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002306 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2307 inst->VRegC_22b());
2308 ADVANCE(2);
2309 HANDLE_INSTRUCTION_END();
2310
2311 HANDLE_INSTRUCTION_START(SHL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002312 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002313 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2314 (inst->VRegC_22b() & 0x1f));
2315 ADVANCE(2);
2316 HANDLE_INSTRUCTION_END();
2317
2318 HANDLE_INSTRUCTION_START(SHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002319 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002320 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2321 (inst->VRegC_22b() & 0x1f));
2322 ADVANCE(2);
2323 HANDLE_INSTRUCTION_END();
2324
2325 HANDLE_INSTRUCTION_START(USHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002326 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002327 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2328 (inst->VRegC_22b() & 0x1f));
2329 ADVANCE(2);
2330 HANDLE_INSTRUCTION_END();
2331
2332 HANDLE_INSTRUCTION_START(UNUSED_3E)
Ian Rogerse94652f2014-12-02 11:13:19 -08002333 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002334 HANDLE_INSTRUCTION_END();
2335
2336 HANDLE_INSTRUCTION_START(UNUSED_3F)
Ian Rogerse94652f2014-12-02 11:13:19 -08002337 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002338 HANDLE_INSTRUCTION_END();
2339
2340 HANDLE_INSTRUCTION_START(UNUSED_40)
Ian Rogerse94652f2014-12-02 11:13:19 -08002341 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002342 HANDLE_INSTRUCTION_END();
2343
2344 HANDLE_INSTRUCTION_START(UNUSED_41)
Ian Rogerse94652f2014-12-02 11:13:19 -08002345 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002346 HANDLE_INSTRUCTION_END();
2347
2348 HANDLE_INSTRUCTION_START(UNUSED_42)
Ian Rogerse94652f2014-12-02 11:13:19 -08002349 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002350 HANDLE_INSTRUCTION_END();
2351
2352 HANDLE_INSTRUCTION_START(UNUSED_43)
Ian Rogerse94652f2014-12-02 11:13:19 -08002353 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002354 HANDLE_INSTRUCTION_END();
2355
2356 HANDLE_INSTRUCTION_START(UNUSED_79)
Ian Rogerse94652f2014-12-02 11:13:19 -08002357 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002358 HANDLE_INSTRUCTION_END();
2359
2360 HANDLE_INSTRUCTION_START(UNUSED_7A)
Ian Rogerse94652f2014-12-02 11:13:19 -08002361 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002362 HANDLE_INSTRUCTION_END();
2363
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002364 HANDLE_INSTRUCTION_START(UNUSED_F3)
Ian Rogerse94652f2014-12-02 11:13:19 -08002365 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002366 HANDLE_INSTRUCTION_END();
2367
2368 HANDLE_INSTRUCTION_START(UNUSED_F4)
Ian Rogerse94652f2014-12-02 11:13:19 -08002369 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002370 HANDLE_INSTRUCTION_END();
2371
2372 HANDLE_INSTRUCTION_START(UNUSED_F5)
Ian Rogerse94652f2014-12-02 11:13:19 -08002373 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002374 HANDLE_INSTRUCTION_END();
2375
2376 HANDLE_INSTRUCTION_START(UNUSED_F6)
Ian Rogerse94652f2014-12-02 11:13:19 -08002377 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002378 HANDLE_INSTRUCTION_END();
2379
2380 HANDLE_INSTRUCTION_START(UNUSED_F7)
Ian Rogerse94652f2014-12-02 11:13:19 -08002381 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002382 HANDLE_INSTRUCTION_END();
2383
2384 HANDLE_INSTRUCTION_START(UNUSED_F8)
Ian Rogerse94652f2014-12-02 11:13:19 -08002385 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002386 HANDLE_INSTRUCTION_END();
2387
2388 HANDLE_INSTRUCTION_START(UNUSED_F9)
Ian Rogerse94652f2014-12-02 11:13:19 -08002389 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002390 HANDLE_INSTRUCTION_END();
2391
2392 HANDLE_INSTRUCTION_START(UNUSED_FA)
Ian Rogerse94652f2014-12-02 11:13:19 -08002393 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002394 HANDLE_INSTRUCTION_END();
2395
2396 HANDLE_INSTRUCTION_START(UNUSED_FB)
Ian Rogerse94652f2014-12-02 11:13:19 -08002397 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002398 HANDLE_INSTRUCTION_END();
2399
2400 HANDLE_INSTRUCTION_START(UNUSED_FC)
Ian Rogerse94652f2014-12-02 11:13:19 -08002401 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002402 HANDLE_INSTRUCTION_END();
2403
2404 HANDLE_INSTRUCTION_START(UNUSED_FD)
Ian Rogerse94652f2014-12-02 11:13:19 -08002405 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002406 HANDLE_INSTRUCTION_END();
2407
2408 HANDLE_INSTRUCTION_START(UNUSED_FE)
Ian Rogerse94652f2014-12-02 11:13:19 -08002409 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002410 HANDLE_INSTRUCTION_END();
2411
2412 HANDLE_INSTRUCTION_START(UNUSED_FF)
Ian Rogerse94652f2014-12-02 11:13:19 -08002413 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002414 HANDLE_INSTRUCTION_END();
2415
2416 exception_pending_label: {
2417 CHECK(self->IsExceptionPending());
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002418 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -07002419 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002420 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002421 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002422 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002423 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc,
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002424 instrumentation);
2425 if (found_dex_pc == DexFile::kDexNoIndex) {
2426 return JValue(); /* Handled in caller. */
2427 } else {
2428 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc);
2429 ADVANCE(displacement);
2430 }
2431 }
2432
Sebastien Hertz8379b222014-02-24 17:38:15 +01002433// Create alternative instruction handlers dedicated to instrumentation.
2434// Return instructions must not call Instrumentation::DexPcMovedEvent since they already call
2435// Instrumentation::MethodExited. This is to avoid posting debugger events twice for this location.
Sebastien Hertze713d932014-05-15 10:48:53 +02002436// Note: we do not use the kReturn instruction flag here (to test the instruction is a return). The
2437// compiler seems to not evaluate "(Instruction::FlagsOf(Instruction::code) & kReturn) != 0" to
2438// a constant condition that would remove the "if" statement so the test is free.
Sebastien Hertz8379b222014-02-24 17:38:15 +01002439#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
2440 alt_op_##code: { \
2441 if (Instruction::code != Instruction::RETURN_VOID && \
2442 Instruction::code != Instruction::RETURN_VOID_BARRIER && \
2443 Instruction::code != Instruction::RETURN && \
2444 Instruction::code != Instruction::RETURN_WIDE && \
2445 Instruction::code != Instruction::RETURN_OBJECT) { \
2446 if (LIKELY(!notified_method_entry_event)) { \
2447 Runtime* runtime = Runtime::Current(); \
2448 const instrumentation::Instrumentation* instrumentation = runtime->GetInstrumentation(); \
2449 if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
2450 Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_); \
2451 instrumentation->DexPcMovedEvent(self, this_object, shadow_frame.GetMethod(), dex_pc); \
2452 } \
2453 } else { \
2454 notified_method_entry_event = false; \
2455 } \
2456 } \
2457 UPDATE_HANDLER_TABLE(); \
2458 goto *handlersTable[instrumentation::kMainHandlerTable][Instruction::code]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002459 }
2460#include "dex_instruction_list.h"
2461 DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER)
2462#undef DEX_INSTRUCTION_LIST
2463#undef INSTRUMENTATION_INSTRUCTION_HANDLER
2464} // NOLINT(readability/fn_size)
2465
2466// Explicit definitions of ExecuteGotoImpl.
Sebastien Hertzc6714852013-09-30 16:42:32 +02002467template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002468JValue ExecuteGotoImpl<true, false>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002469 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertzc6714852013-09-30 16:42:32 +02002470template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002471JValue ExecuteGotoImpl<false, false>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002472 ShadowFrame& shadow_frame, JValue result_register);
2473template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
Ian Rogerse94652f2014-12-02 11:13:19 -08002474JValue ExecuteGotoImpl<true, true>(Thread* self, const DexFile::CodeItem* code_item,
2475 ShadowFrame& shadow_frame, JValue result_register);
2476template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
2477JValue ExecuteGotoImpl<false, true>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002478 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002479
2480} // namespace interpreter
2481} // namespace art