blob: 5f97f941fb781f15f637cbfed94b9dcb1f7f4fca [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) {
Nicolas Geoffray14691c52015-03-05 10:40:17 +0000247 Throwable* exception = self->GetException();
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;
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000344 self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700345 "Returning '%s' that is not instance of return type '%s'",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700346 obj_result->GetClass()->GetDescriptor(&temp1),
347 return_type->GetDescriptor(&temp2));
Jeff Haoa3faaf42013-09-03 19:07:00 -0700348 HANDLE_PENDING_EXCEPTION();
349 }
350 }
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700351 result.SetL(obj_result);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200352 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200353 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200354 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200355 shadow_frame.GetMethod(), dex_pc,
356 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200357 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
358 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
359 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200360 }
361 return result;
362 }
363 HANDLE_INSTRUCTION_END();
364
365 HANDLE_INSTRUCTION_START(CONST_4) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200366 uint32_t dst = inst->VRegA_11n(inst_data);
367 int32_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200368 shadow_frame.SetVReg(dst, val);
369 if (val == 0) {
370 shadow_frame.SetVRegReference(dst, NULL);
371 }
372 ADVANCE(1);
373 }
374 HANDLE_INSTRUCTION_END();
375
376 HANDLE_INSTRUCTION_START(CONST_16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200377 uint32_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200378 int32_t val = inst->VRegB_21s();
379 shadow_frame.SetVReg(dst, val);
380 if (val == 0) {
381 shadow_frame.SetVRegReference(dst, NULL);
382 }
383 ADVANCE(2);
384 }
385 HANDLE_INSTRUCTION_END();
386
387 HANDLE_INSTRUCTION_START(CONST) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200388 uint32_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200389 int32_t val = inst->VRegB_31i();
390 shadow_frame.SetVReg(dst, val);
391 if (val == 0) {
392 shadow_frame.SetVRegReference(dst, NULL);
393 }
394 ADVANCE(3);
395 }
396 HANDLE_INSTRUCTION_END();
397
398 HANDLE_INSTRUCTION_START(CONST_HIGH16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200399 uint32_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200400 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
401 shadow_frame.SetVReg(dst, val);
402 if (val == 0) {
403 shadow_frame.SetVRegReference(dst, NULL);
404 }
405 ADVANCE(2);
406 }
407 HANDLE_INSTRUCTION_END();
408
409 HANDLE_INSTRUCTION_START(CONST_WIDE_16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200410 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200411 ADVANCE(2);
412 HANDLE_INSTRUCTION_END();
413
414 HANDLE_INSTRUCTION_START(CONST_WIDE_32)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200415 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200416 ADVANCE(3);
417 HANDLE_INSTRUCTION_END();
418
419 HANDLE_INSTRUCTION_START(CONST_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200420 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200421 ADVANCE(5);
422 HANDLE_INSTRUCTION_END();
423
424 HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200425 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200426 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
427 ADVANCE(2);
428 HANDLE_INSTRUCTION_END();
429
430 HANDLE_INSTRUCTION_START(CONST_STRING) {
Ian Rogers6786a582014-10-28 12:49:06 -0700431 String* s = ResolveString(self, shadow_frame, inst->VRegB_21c());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200432 if (UNLIKELY(s == NULL)) {
433 HANDLE_PENDING_EXCEPTION();
434 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200435 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200436 ADVANCE(2);
437 }
438 }
439 HANDLE_INSTRUCTION_END();
440
441 HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
Ian Rogers6786a582014-10-28 12:49:06 -0700442 String* s = ResolveString(self, shadow_frame, inst->VRegB_31c());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200443 if (UNLIKELY(s == NULL)) {
444 HANDLE_PENDING_EXCEPTION();
445 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200446 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200447 ADVANCE(3);
448 }
449 }
450 HANDLE_INSTRUCTION_END();
451
452 HANDLE_INSTRUCTION_START(CONST_CLASS) {
453 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
454 self, false, do_access_check);
455 if (UNLIKELY(c == NULL)) {
456 HANDLE_PENDING_EXCEPTION();
457 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200458 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200459 ADVANCE(2);
460 }
461 }
462 HANDLE_INSTRUCTION_END();
463
464 HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200465 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200466 if (UNLIKELY(obj == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000467 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200468 HANDLE_PENDING_EXCEPTION();
469 } else {
470 DoMonitorEnter(self, obj);
471 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
472 }
473 }
474 HANDLE_INSTRUCTION_END();
475
476 HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200477 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200478 if (UNLIKELY(obj == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000479 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200480 HANDLE_PENDING_EXCEPTION();
481 } else {
482 DoMonitorExit(self, obj);
483 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
484 }
485 }
486 HANDLE_INSTRUCTION_END();
487
488 HANDLE_INSTRUCTION_START(CHECK_CAST) {
489 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
490 self, false, do_access_check);
491 if (UNLIKELY(c == NULL)) {
492 HANDLE_PENDING_EXCEPTION();
493 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200494 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200495 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
496 ThrowClassCastException(c, obj->GetClass());
497 HANDLE_PENDING_EXCEPTION();
498 } else {
499 ADVANCE(2);
500 }
501 }
502 }
503 HANDLE_INSTRUCTION_END();
504
505 HANDLE_INSTRUCTION_START(INSTANCE_OF) {
506 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
507 self, false, do_access_check);
508 if (UNLIKELY(c == NULL)) {
509 HANDLE_PENDING_EXCEPTION();
510 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200511 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
512 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200513 ADVANCE(2);
514 }
515 }
516 HANDLE_INSTRUCTION_END();
517
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700518 HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200519 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200520 if (UNLIKELY(array == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000521 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200522 HANDLE_PENDING_EXCEPTION();
523 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200524 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200525 ADVANCE(1);
526 }
527 }
528 HANDLE_INSTRUCTION_END();
529
530 HANDLE_INSTRUCTION_START(NEW_INSTANCE) {
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700531 Runtime* runtime = Runtime::Current();
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800532 Object* obj = AllocObjectFromCode<do_access_check, true>(
533 inst->VRegB_21c(), shadow_frame.GetMethod(), self,
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700534 runtime->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200535 if (UNLIKELY(obj == NULL)) {
536 HANDLE_PENDING_EXCEPTION();
537 } else {
Sebastien Hertz4e99b3d2014-06-24 14:35:40 +0200538 obj->GetClass()->AssertInitializedOrInitializingInThread(self);
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700539 // Don't allow finalizable objects to be allocated during a transaction since these can't be
540 // finalized without a started runtime.
541 if (transaction_active && obj->GetClass()->IsFinalizable()) {
Ian Rogers2fa98e22014-05-06 15:26:39 -0700542 AbortTransaction(self, "Allocating finalizable object in transaction: %s",
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700543 PrettyTypeOf(obj).c_str());
544 HANDLE_PENDING_EXCEPTION();
545 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200546 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200547 ADVANCE(2);
548 }
549 }
550 HANDLE_INSTRUCTION_END();
551
552 HANDLE_INSTRUCTION_START(NEW_ARRAY) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200553 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800554 Object* obj = AllocArrayFromCode<do_access_check, true>(
Andreas Gampe1cc7dba2014-12-17 18:43:01 -0800555 inst->VRegC_22c(), length, shadow_frame.GetMethod(), self,
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800556 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200557 if (UNLIKELY(obj == NULL)) {
558 HANDLE_PENDING_EXCEPTION();
559 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200560 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200561 ADVANCE(2);
562 }
563 }
564 HANDLE_INSTRUCTION_END();
565
566 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100567 bool success =
568 DoFilledNewArray<false, do_access_check, transaction_active>(inst, shadow_frame,
569 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200570 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
571 }
572 HANDLE_INSTRUCTION_END();
573
574 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100575 bool success =
576 DoFilledNewArray<true, do_access_check, transaction_active>(inst, shadow_frame,
577 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200578 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
579 }
580 HANDLE_INSTRUCTION_END();
581
582 HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200583 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Ian Rogers832336b2014-10-08 15:35:22 -0700584 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
585 const Instruction::ArrayDataPayload* payload =
586 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
587 bool success = FillArrayData(obj, payload);
588 if (transaction_active && success) {
589 RecordArrayElementsInTransaction(obj->AsArray(), payload->element_count);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200590 }
Ian Rogers832336b2014-10-08 15:35:22 -0700591 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200592 }
593 HANDLE_INSTRUCTION_END();
594
595 HANDLE_INSTRUCTION_START(THROW) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200596 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200597 if (UNLIKELY(exception == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000598 ThrowNullPointerException("throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700599 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
600 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700601 std::string temp;
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000602 self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700603 "Throwing '%s' that is not instance of Throwable",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700604 exception->GetClass()->GetDescriptor(&temp));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200605 } else {
Nicolas Geoffray14691c52015-03-05 10:40:17 +0000606 self->SetException(exception->AsThrowable());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200607 }
608 HANDLE_PENDING_EXCEPTION();
609 }
610 HANDLE_INSTRUCTION_END();
611
612 HANDLE_INSTRUCTION_START(GOTO) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200613 int8_t offset = inst->VRegA_10t(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200614 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800615 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200616 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700617 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200618 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200619 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200620 }
621 ADVANCE(offset);
622 }
623 HANDLE_INSTRUCTION_END();
624
625 HANDLE_INSTRUCTION_START(GOTO_16) {
626 int16_t offset = inst->VRegA_20t();
627 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800628 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200629 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700630 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200631 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200632 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200633 }
634 ADVANCE(offset);
635 }
636 HANDLE_INSTRUCTION_END();
637
638 HANDLE_INSTRUCTION_START(GOTO_32) {
639 int32_t offset = inst->VRegA_30t();
640 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800641 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200642 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700643 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200644 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200645 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200646 }
647 ADVANCE(offset);
648 }
649 HANDLE_INSTRUCTION_END();
650
651 HANDLE_INSTRUCTION_START(PACKED_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200652 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200653 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800654 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200655 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700656 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200657 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200658 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200659 }
660 ADVANCE(offset);
661 }
662 HANDLE_INSTRUCTION_END();
663
664 HANDLE_INSTRUCTION_START(SPARSE_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200665 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200666 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800667 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200668 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700669 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200670 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200671 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200672 }
673 ADVANCE(offset);
674 }
675 HANDLE_INSTRUCTION_END();
676
Ian Rogers647b1a82014-10-10 11:02:11 -0700677#if defined(__clang__)
678#pragma clang diagnostic push
679#pragma clang diagnostic ignored "-Wfloat-equal"
680#endif
681
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200682 HANDLE_INSTRUCTION_START(CMPL_FLOAT) {
683 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
684 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
685 int32_t result;
686 if (val1 > val2) {
687 result = 1;
688 } else if (val1 == val2) {
689 result = 0;
690 } else {
691 result = -1;
692 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200693 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200694 ADVANCE(2);
695 }
696 HANDLE_INSTRUCTION_END();
697
698 HANDLE_INSTRUCTION_START(CMPG_FLOAT) {
699 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
700 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
701 int32_t result;
702 if (val1 < val2) {
703 result = -1;
704 } else if (val1 == val2) {
705 result = 0;
706 } else {
707 result = 1;
708 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200709 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200710 ADVANCE(2);
711 }
712 HANDLE_INSTRUCTION_END();
713
714 HANDLE_INSTRUCTION_START(CMPL_DOUBLE) {
715 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
716 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
717 int32_t result;
718 if (val1 > val2) {
719 result = 1;
720 } else if (val1 == val2) {
721 result = 0;
722 } else {
723 result = -1;
724 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200725 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200726 ADVANCE(2);
727 }
728 HANDLE_INSTRUCTION_END();
729
730 HANDLE_INSTRUCTION_START(CMPG_DOUBLE) {
731 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
732 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
733 int32_t result;
734 if (val1 < val2) {
735 result = -1;
736 } else if (val1 == val2) {
737 result = 0;
738 } else {
739 result = 1;
740 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200741 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200742 ADVANCE(2);
743 }
744 HANDLE_INSTRUCTION_END();
745
Ian Rogers647b1a82014-10-10 11:02:11 -0700746#if defined(__clang__)
747#pragma clang diagnostic pop
748#endif
749
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200750 HANDLE_INSTRUCTION_START(CMP_LONG) {
751 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
752 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
753 int32_t result;
754 if (val1 > val2) {
755 result = 1;
756 } else if (val1 == val2) {
757 result = 0;
758 } else {
759 result = -1;
760 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200761 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200762 ADVANCE(2);
763 }
764 HANDLE_INSTRUCTION_END();
765
766 HANDLE_INSTRUCTION_START(IF_EQ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200767 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200768 int16_t offset = inst->VRegC_22t();
769 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800770 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200771 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700772 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200773 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200774 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200775 }
776 ADVANCE(offset);
777 } else {
778 ADVANCE(2);
779 }
780 }
781 HANDLE_INSTRUCTION_END();
782
783 HANDLE_INSTRUCTION_START(IF_NE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200784 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) != shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200785 int16_t offset = inst->VRegC_22t();
786 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800787 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200788 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700789 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200790 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200791 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200792 }
793 ADVANCE(offset);
794 } else {
795 ADVANCE(2);
796 }
797 }
798 HANDLE_INSTRUCTION_END();
799
800 HANDLE_INSTRUCTION_START(IF_LT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200801 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) < shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200802 int16_t offset = inst->VRegC_22t();
803 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800804 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200805 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700806 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200807 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200808 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200809 }
810 ADVANCE(offset);
811 } else {
812 ADVANCE(2);
813 }
814 }
815 HANDLE_INSTRUCTION_END();
816
817 HANDLE_INSTRUCTION_START(IF_GE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200818 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200819 int16_t offset = inst->VRegC_22t();
820 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800821 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200822 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700823 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200824 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200825 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200826 }
827 ADVANCE(offset);
828 } else {
829 ADVANCE(2);
830 }
831 }
832 HANDLE_INSTRUCTION_END();
833
834 HANDLE_INSTRUCTION_START(IF_GT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200835 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200836 int16_t offset = inst->VRegC_22t();
837 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800838 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200839 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700840 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200841 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200842 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200843 }
844 ADVANCE(offset);
845 } else {
846 ADVANCE(2);
847 }
848 }
849 HANDLE_INSTRUCTION_END();
850
851 HANDLE_INSTRUCTION_START(IF_LE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200852 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200853 int16_t offset = inst->VRegC_22t();
854 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800855 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200856 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700857 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200858 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200859 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200860 }
861 ADVANCE(offset);
862 } else {
863 ADVANCE(2);
864 }
865 }
866 HANDLE_INSTRUCTION_END();
867
868 HANDLE_INSTRUCTION_START(IF_EQZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200869 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200870 int16_t offset = inst->VRegB_21t();
871 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800872 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200873 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700874 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200875 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200876 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200877 }
878 ADVANCE(offset);
879 } else {
880 ADVANCE(2);
881 }
882 }
883 HANDLE_INSTRUCTION_END();
884
885 HANDLE_INSTRUCTION_START(IF_NEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200886 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200887 int16_t offset = inst->VRegB_21t();
888 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800889 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200890 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700891 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200892 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200893 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200894 }
895 ADVANCE(offset);
896 } else {
897 ADVANCE(2);
898 }
899 }
900 HANDLE_INSTRUCTION_END();
901
902 HANDLE_INSTRUCTION_START(IF_LTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200903 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200904 int16_t offset = inst->VRegB_21t();
905 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800906 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200907 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700908 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200909 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200910 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200911 }
912 ADVANCE(offset);
913 } else {
914 ADVANCE(2);
915 }
916 }
917 HANDLE_INSTRUCTION_END();
918
919 HANDLE_INSTRUCTION_START(IF_GEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200920 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200921 int16_t offset = inst->VRegB_21t();
922 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800923 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200924 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700925 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200926 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200927 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200928 }
929 ADVANCE(offset);
930 } else {
931 ADVANCE(2);
932 }
933 }
934 HANDLE_INSTRUCTION_END();
935
936 HANDLE_INSTRUCTION_START(IF_GTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200937 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200938 int16_t offset = inst->VRegB_21t();
939 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800940 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200941 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700942 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200943 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200944 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200945 }
946 ADVANCE(offset);
947 } else {
948 ADVANCE(2);
949 }
950 }
951 HANDLE_INSTRUCTION_END();
952
953 HANDLE_INSTRUCTION_START(IF_LEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200954 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200955 int16_t offset = inst->VRegB_21t();
956 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800957 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200958 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700959 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200960 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200961 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200962 }
963 ADVANCE(offset);
964 } else {
965 ADVANCE(2);
966 }
967 }
968 HANDLE_INSTRUCTION_END();
969
970 HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
971 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
972 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000973 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200974 HANDLE_PENDING_EXCEPTION();
975 } else {
976 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
977 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100978 if (LIKELY(array->CheckIsValidIndex(index))) {
979 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200980 ADVANCE(2);
981 } else {
982 HANDLE_PENDING_EXCEPTION();
983 }
984 }
985 }
986 HANDLE_INSTRUCTION_END();
987
988 HANDLE_INSTRUCTION_START(AGET_BYTE) {
989 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
990 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000991 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200992 HANDLE_PENDING_EXCEPTION();
993 } else {
994 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
995 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100996 if (LIKELY(array->CheckIsValidIndex(index))) {
997 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200998 ADVANCE(2);
999 } else {
1000 HANDLE_PENDING_EXCEPTION();
1001 }
1002 }
1003 }
1004 HANDLE_INSTRUCTION_END();
1005
1006 HANDLE_INSTRUCTION_START(AGET_CHAR) {
1007 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1008 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001009 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001010 HANDLE_PENDING_EXCEPTION();
1011 } else {
1012 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1013 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001014 if (LIKELY(array->CheckIsValidIndex(index))) {
1015 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001016 ADVANCE(2);
1017 } else {
1018 HANDLE_PENDING_EXCEPTION();
1019 }
1020 }
1021 }
1022 HANDLE_INSTRUCTION_END();
1023
1024 HANDLE_INSTRUCTION_START(AGET_SHORT) {
1025 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1026 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001027 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001028 HANDLE_PENDING_EXCEPTION();
1029 } else {
1030 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1031 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001032 if (LIKELY(array->CheckIsValidIndex(index))) {
1033 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001034 ADVANCE(2);
1035 } else {
1036 HANDLE_PENDING_EXCEPTION();
1037 }
1038 }
1039 }
1040 HANDLE_INSTRUCTION_END();
1041
1042 HANDLE_INSTRUCTION_START(AGET) {
1043 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1044 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001045 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001046 HANDLE_PENDING_EXCEPTION();
1047 } else {
1048 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1049 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001050 if (LIKELY(array->CheckIsValidIndex(index))) {
1051 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001052 ADVANCE(2);
1053 } else {
1054 HANDLE_PENDING_EXCEPTION();
1055 }
1056 }
1057 }
1058 HANDLE_INSTRUCTION_END();
1059
1060 HANDLE_INSTRUCTION_START(AGET_WIDE) {
1061 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1062 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001063 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001064 HANDLE_PENDING_EXCEPTION();
1065 } else {
1066 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1067 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001068 if (LIKELY(array->CheckIsValidIndex(index))) {
1069 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001070 ADVANCE(2);
1071 } else {
1072 HANDLE_PENDING_EXCEPTION();
1073 }
1074 }
1075 }
1076 HANDLE_INSTRUCTION_END();
1077
1078 HANDLE_INSTRUCTION_START(AGET_OBJECT) {
1079 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1080 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001081 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001082 HANDLE_PENDING_EXCEPTION();
1083 } else {
1084 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1085 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001086 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001087 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001088 ADVANCE(2);
1089 } else {
1090 HANDLE_PENDING_EXCEPTION();
1091 }
1092 }
1093 }
1094 HANDLE_INSTRUCTION_END();
1095
1096 HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
1097 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1098 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001099 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001100 HANDLE_PENDING_EXCEPTION();
1101 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001102 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001103 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1104 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001105 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001106 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001107 ADVANCE(2);
1108 } else {
1109 HANDLE_PENDING_EXCEPTION();
1110 }
1111 }
1112 }
1113 HANDLE_INSTRUCTION_END();
1114
1115 HANDLE_INSTRUCTION_START(APUT_BYTE) {
1116 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1117 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001118 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001119 HANDLE_PENDING_EXCEPTION();
1120 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001121 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001122 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1123 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001124 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001125 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001126 ADVANCE(2);
1127 } else {
1128 HANDLE_PENDING_EXCEPTION();
1129 }
1130 }
1131 }
1132 HANDLE_INSTRUCTION_END();
1133
1134 HANDLE_INSTRUCTION_START(APUT_CHAR) {
1135 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1136 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001137 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001138 HANDLE_PENDING_EXCEPTION();
1139 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001140 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001141 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1142 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001143 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001144 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001145 ADVANCE(2);
1146 } else {
1147 HANDLE_PENDING_EXCEPTION();
1148 }
1149 }
1150 }
1151 HANDLE_INSTRUCTION_END();
1152
1153 HANDLE_INSTRUCTION_START(APUT_SHORT) {
1154 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1155 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001156 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001157 HANDLE_PENDING_EXCEPTION();
1158 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001159 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001160 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1161 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001162 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001163 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001164 ADVANCE(2);
1165 } else {
1166 HANDLE_PENDING_EXCEPTION();
1167 }
1168 }
1169 }
1170 HANDLE_INSTRUCTION_END();
1171
1172 HANDLE_INSTRUCTION_START(APUT) {
1173 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1174 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001175 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001176 HANDLE_PENDING_EXCEPTION();
1177 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001178 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001179 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1180 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001181 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001182 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001183 ADVANCE(2);
1184 } else {
1185 HANDLE_PENDING_EXCEPTION();
1186 }
1187 }
1188 }
1189 HANDLE_INSTRUCTION_END();
1190
1191 HANDLE_INSTRUCTION_START(APUT_WIDE) {
1192 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1193 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001194 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001195 HANDLE_PENDING_EXCEPTION();
1196 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001197 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001198 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1199 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001200 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001201 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001202 ADVANCE(2);
1203 } else {
1204 HANDLE_PENDING_EXCEPTION();
1205 }
1206 }
1207 }
1208 HANDLE_INSTRUCTION_END();
1209
1210 HANDLE_INSTRUCTION_START(APUT_OBJECT) {
1211 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1212 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001213 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001214 HANDLE_PENDING_EXCEPTION();
1215 } else {
1216 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001217 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001218 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001219 if (LIKELY(array->CheckIsValidIndex(index) && array->CheckAssignable(val))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001220 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001221 ADVANCE(2);
1222 } else {
1223 HANDLE_PENDING_EXCEPTION();
1224 }
1225 }
1226 }
1227 HANDLE_INSTRUCTION_END();
1228
1229 HANDLE_INSTRUCTION_START(IGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001230 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001231 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1232 }
1233 HANDLE_INSTRUCTION_END();
1234
1235 HANDLE_INSTRUCTION_START(IGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001236 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001237 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1238 }
1239 HANDLE_INSTRUCTION_END();
1240
1241 HANDLE_INSTRUCTION_START(IGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001242 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001243 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1244 }
1245 HANDLE_INSTRUCTION_END();
1246
1247 HANDLE_INSTRUCTION_START(IGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001248 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001249 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1250 }
1251 HANDLE_INSTRUCTION_END();
1252
1253 HANDLE_INSTRUCTION_START(IGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001254 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001255 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1256 }
1257 HANDLE_INSTRUCTION_END();
1258
1259 HANDLE_INSTRUCTION_START(IGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001260 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001261 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1262 }
1263 HANDLE_INSTRUCTION_END();
1264
1265 HANDLE_INSTRUCTION_START(IGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001266 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001267 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1268 }
1269 HANDLE_INSTRUCTION_END();
1270
1271 HANDLE_INSTRUCTION_START(IGET_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001272 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001273 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1274 }
1275 HANDLE_INSTRUCTION_END();
1276
Mathieu Chartierffc605c2014-12-10 10:35:44 -08001277 HANDLE_INSTRUCTION_START(IGET_BOOLEAN_QUICK) {
1278 bool success = DoIGetQuick<Primitive::kPrimBoolean>(shadow_frame, inst, inst_data);
1279 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1280 }
1281 HANDLE_INSTRUCTION_END();
1282
1283 HANDLE_INSTRUCTION_START(IGET_BYTE_QUICK) {
1284 bool success = DoIGetQuick<Primitive::kPrimByte>(shadow_frame, inst, inst_data);
1285 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1286 }
1287 HANDLE_INSTRUCTION_END();
1288
1289 HANDLE_INSTRUCTION_START(IGET_CHAR_QUICK) {
1290 bool success = DoIGetQuick<Primitive::kPrimChar>(shadow_frame, inst, inst_data);
1291 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1292 }
1293 HANDLE_INSTRUCTION_END();
1294
1295 HANDLE_INSTRUCTION_START(IGET_SHORT_QUICK) {
1296 bool success = DoIGetQuick<Primitive::kPrimShort>(shadow_frame, inst, inst_data);
1297 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1298 }
1299 HANDLE_INSTRUCTION_END();
1300
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001301 HANDLE_INSTRUCTION_START(IGET_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001302 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001303 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1304 }
1305 HANDLE_INSTRUCTION_END();
1306
1307 HANDLE_INSTRUCTION_START(IGET_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001308 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001309 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1310 }
1311 HANDLE_INSTRUCTION_END();
1312
1313 HANDLE_INSTRUCTION_START(SGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001314 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001315 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1316 }
1317 HANDLE_INSTRUCTION_END();
1318
1319 HANDLE_INSTRUCTION_START(SGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001320 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001321 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1322 }
1323 HANDLE_INSTRUCTION_END();
1324
1325 HANDLE_INSTRUCTION_START(SGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001326 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001327 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1328 }
1329 HANDLE_INSTRUCTION_END();
1330
1331 HANDLE_INSTRUCTION_START(SGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001332 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001333 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1334 }
1335 HANDLE_INSTRUCTION_END();
1336
1337 HANDLE_INSTRUCTION_START(SGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001338 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001339 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1340 }
1341 HANDLE_INSTRUCTION_END();
1342
1343 HANDLE_INSTRUCTION_START(SGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001344 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001345 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1346 }
1347 HANDLE_INSTRUCTION_END();
1348
1349 HANDLE_INSTRUCTION_START(SGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001350 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001351 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1352 }
1353 HANDLE_INSTRUCTION_END();
1354
1355 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001356 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001357 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1358 }
1359 HANDLE_INSTRUCTION_END();
1360
1361 HANDLE_INSTRUCTION_START(IPUT_BYTE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001362 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001363 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1364 }
1365 HANDLE_INSTRUCTION_END();
1366
1367 HANDLE_INSTRUCTION_START(IPUT_CHAR) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001368 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001369 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1370 }
1371 HANDLE_INSTRUCTION_END();
1372
1373 HANDLE_INSTRUCTION_START(IPUT_SHORT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001374 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001375 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1376 }
1377 HANDLE_INSTRUCTION_END();
1378
1379 HANDLE_INSTRUCTION_START(IPUT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001380 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001381 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1382 }
1383 HANDLE_INSTRUCTION_END();
1384
1385 HANDLE_INSTRUCTION_START(IPUT_WIDE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001386 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001387 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1388 }
1389 HANDLE_INSTRUCTION_END();
1390
1391 HANDLE_INSTRUCTION_START(IPUT_OBJECT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001392 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001393 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1394 }
1395 HANDLE_INSTRUCTION_END();
1396
1397 HANDLE_INSTRUCTION_START(IPUT_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001398 bool success = DoIPutQuick<Primitive::kPrimInt, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001399 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1400 }
1401 HANDLE_INSTRUCTION_END();
1402
Fred Shih37f05ef2014-07-16 18:38:08 -07001403 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN_QUICK) {
1404 bool success = DoIPutQuick<Primitive::kPrimBoolean, transaction_active>(shadow_frame, inst, inst_data);
1405 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1406 }
1407 HANDLE_INSTRUCTION_END();
1408
1409 HANDLE_INSTRUCTION_START(IPUT_BYTE_QUICK) {
1410 bool success = DoIPutQuick<Primitive::kPrimByte, transaction_active>(shadow_frame, inst, inst_data);
1411 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1412 }
1413 HANDLE_INSTRUCTION_END();
1414
1415 HANDLE_INSTRUCTION_START(IPUT_CHAR_QUICK) {
1416 bool success = DoIPutQuick<Primitive::kPrimChar, transaction_active>(shadow_frame, inst, inst_data);
1417 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1418 }
1419 HANDLE_INSTRUCTION_END();
1420
1421 HANDLE_INSTRUCTION_START(IPUT_SHORT_QUICK) {
1422 bool success = DoIPutQuick<Primitive::kPrimShort, transaction_active>(shadow_frame, inst, inst_data);
1423 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1424 }
1425 HANDLE_INSTRUCTION_END();
1426
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001427 HANDLE_INSTRUCTION_START(IPUT_WIDE_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001428 bool success = DoIPutQuick<Primitive::kPrimLong, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001429 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1430 }
1431 HANDLE_INSTRUCTION_END();
1432
1433 HANDLE_INSTRUCTION_START(IPUT_OBJECT_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001434 bool success = DoIPutQuick<Primitive::kPrimNot, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001435 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1436 }
1437 HANDLE_INSTRUCTION_END();
1438
1439 HANDLE_INSTRUCTION_START(SPUT_BOOLEAN) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001440 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001441 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1442 }
1443 HANDLE_INSTRUCTION_END();
1444
1445 HANDLE_INSTRUCTION_START(SPUT_BYTE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001446 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001447 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1448 }
1449 HANDLE_INSTRUCTION_END();
1450
1451 HANDLE_INSTRUCTION_START(SPUT_CHAR) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001452 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001453 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1454 }
1455 HANDLE_INSTRUCTION_END();
1456
1457 HANDLE_INSTRUCTION_START(SPUT_SHORT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001458 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001459 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1460 }
1461 HANDLE_INSTRUCTION_END();
1462
1463 HANDLE_INSTRUCTION_START(SPUT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001464 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001465 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1466 }
1467 HANDLE_INSTRUCTION_END();
1468
1469 HANDLE_INSTRUCTION_START(SPUT_WIDE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001470 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001471 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1472 }
1473 HANDLE_INSTRUCTION_END();
1474
1475 HANDLE_INSTRUCTION_START(SPUT_OBJECT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001476 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001477 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1478 }
1479 HANDLE_INSTRUCTION_END();
1480
1481 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001482 bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001483 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001484 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1485 }
1486 HANDLE_INSTRUCTION_END();
1487
1488 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001489 bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001490 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001491 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1492 }
1493 HANDLE_INSTRUCTION_END();
1494
1495 HANDLE_INSTRUCTION_START(INVOKE_SUPER) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001496 bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001497 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001498 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1499 }
1500 HANDLE_INSTRUCTION_END();
1501
1502 HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001503 bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001504 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001505 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1506 }
1507 HANDLE_INSTRUCTION_END();
1508
1509 HANDLE_INSTRUCTION_START(INVOKE_DIRECT) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001510 bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001511 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001512 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1513 }
1514 HANDLE_INSTRUCTION_END();
1515
1516 HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001517 bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001518 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001519 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1520 }
1521 HANDLE_INSTRUCTION_END();
1522
1523 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001524 bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001525 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001526 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1527 }
1528 HANDLE_INSTRUCTION_END();
1529
1530 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001531 bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001532 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001533 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1534 }
1535 HANDLE_INSTRUCTION_END();
1536
1537 HANDLE_INSTRUCTION_START(INVOKE_STATIC) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001538 bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001539 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001540 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1541 }
1542 HANDLE_INSTRUCTION_END();
1543
1544 HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001545 bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001546 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001547 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1548 }
1549 HANDLE_INSTRUCTION_END();
1550
1551 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001552 bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001553 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001554 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1555 }
1556 HANDLE_INSTRUCTION_END();
1557
1558 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001559 bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001560 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001561 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1562 }
1563 HANDLE_INSTRUCTION_END();
1564
1565 HANDLE_INSTRUCTION_START(NEG_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001566 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001567 ADVANCE(1);
1568 HANDLE_INSTRUCTION_END();
1569
1570 HANDLE_INSTRUCTION_START(NOT_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001571 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001572 ADVANCE(1);
1573 HANDLE_INSTRUCTION_END();
1574
1575 HANDLE_INSTRUCTION_START(NEG_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001576 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001577 ADVANCE(1);
1578 HANDLE_INSTRUCTION_END();
1579
1580 HANDLE_INSTRUCTION_START(NOT_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001581 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001582 ADVANCE(1);
1583 HANDLE_INSTRUCTION_END();
1584
1585 HANDLE_INSTRUCTION_START(NEG_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001586 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001587 ADVANCE(1);
1588 HANDLE_INSTRUCTION_END();
1589
1590 HANDLE_INSTRUCTION_START(NEG_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001591 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001592 ADVANCE(1);
1593 HANDLE_INSTRUCTION_END();
1594
1595 HANDLE_INSTRUCTION_START(INT_TO_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001596 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001597 ADVANCE(1);
1598 HANDLE_INSTRUCTION_END();
1599
1600 HANDLE_INSTRUCTION_START(INT_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001601 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001602 ADVANCE(1);
1603 HANDLE_INSTRUCTION_END();
1604
1605 HANDLE_INSTRUCTION_START(INT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001606 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001607 ADVANCE(1);
1608 HANDLE_INSTRUCTION_END();
1609
1610 HANDLE_INSTRUCTION_START(LONG_TO_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001611 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001612 ADVANCE(1);
1613 HANDLE_INSTRUCTION_END();
1614
1615 HANDLE_INSTRUCTION_START(LONG_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001616 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001617 ADVANCE(1);
1618 HANDLE_INSTRUCTION_END();
1619
1620 HANDLE_INSTRUCTION_START(LONG_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001621 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001622 ADVANCE(1);
1623 HANDLE_INSTRUCTION_END();
1624
1625 HANDLE_INSTRUCTION_START(FLOAT_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001626 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001627 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001628 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001629 ADVANCE(1);
1630 }
1631 HANDLE_INSTRUCTION_END();
1632
1633 HANDLE_INSTRUCTION_START(FLOAT_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001634 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001635 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001636 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001637 ADVANCE(1);
1638 }
1639 HANDLE_INSTRUCTION_END();
1640
1641 HANDLE_INSTRUCTION_START(FLOAT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001642 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001643 ADVANCE(1);
1644 HANDLE_INSTRUCTION_END();
1645
1646 HANDLE_INSTRUCTION_START(DOUBLE_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001647 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001648 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001649 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001650 ADVANCE(1);
1651 }
1652 HANDLE_INSTRUCTION_END();
1653
1654 HANDLE_INSTRUCTION_START(DOUBLE_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001655 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001656 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001657 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001658 ADVANCE(1);
1659 }
1660 HANDLE_INSTRUCTION_END();
1661
1662 HANDLE_INSTRUCTION_START(DOUBLE_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001663 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001664 ADVANCE(1);
1665 HANDLE_INSTRUCTION_END();
1666
1667 HANDLE_INSTRUCTION_START(INT_TO_BYTE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001668 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1669 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001670 ADVANCE(1);
1671 HANDLE_INSTRUCTION_END();
1672
1673 HANDLE_INSTRUCTION_START(INT_TO_CHAR)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001674 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1675 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001676 ADVANCE(1);
1677 HANDLE_INSTRUCTION_END();
1678
1679 HANDLE_INSTRUCTION_START(INT_TO_SHORT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001680 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1681 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001682 ADVANCE(1);
1683 HANDLE_INSTRUCTION_END();
1684
1685 HANDLE_INSTRUCTION_START(ADD_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001686 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001687 SafeAdd(shadow_frame.GetVReg(inst->VRegB_23x()),
1688 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001689 ADVANCE(2);
1690 HANDLE_INSTRUCTION_END();
1691
1692 HANDLE_INSTRUCTION_START(SUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001693 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001694 SafeSub(shadow_frame.GetVReg(inst->VRegB_23x()),
1695 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001696 ADVANCE(2);
1697 HANDLE_INSTRUCTION_END();
1698
1699 HANDLE_INSTRUCTION_START(MUL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001700 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001701 SafeMul(shadow_frame.GetVReg(inst->VRegB_23x()),
1702 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001703 ADVANCE(2);
1704 HANDLE_INSTRUCTION_END();
1705
1706 HANDLE_INSTRUCTION_START(DIV_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001707 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
1708 shadow_frame.GetVReg(inst->VRegB_23x()),
1709 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001710 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1711 }
1712 HANDLE_INSTRUCTION_END();
1713
1714 HANDLE_INSTRUCTION_START(REM_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001715 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1716 shadow_frame.GetVReg(inst->VRegB_23x()),
1717 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001718 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1719 }
1720 HANDLE_INSTRUCTION_END();
1721
1722 HANDLE_INSTRUCTION_START(SHL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001723 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001724 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1725 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1726 ADVANCE(2);
1727 HANDLE_INSTRUCTION_END();
1728
1729 HANDLE_INSTRUCTION_START(SHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001730 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001731 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1732 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1733 ADVANCE(2);
1734 HANDLE_INSTRUCTION_END();
1735
1736 HANDLE_INSTRUCTION_START(USHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001737 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001738 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1739 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1740 ADVANCE(2);
1741 HANDLE_INSTRUCTION_END();
1742
1743 HANDLE_INSTRUCTION_START(AND_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001744 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001745 shadow_frame.GetVReg(inst->VRegB_23x()) &
1746 shadow_frame.GetVReg(inst->VRegC_23x()));
1747 ADVANCE(2);
1748 HANDLE_INSTRUCTION_END();
1749
1750 HANDLE_INSTRUCTION_START(OR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001751 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001752 shadow_frame.GetVReg(inst->VRegB_23x()) |
1753 shadow_frame.GetVReg(inst->VRegC_23x()));
1754 ADVANCE(2);
1755 HANDLE_INSTRUCTION_END();
1756
1757 HANDLE_INSTRUCTION_START(XOR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001758 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001759 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1760 shadow_frame.GetVReg(inst->VRegC_23x()));
1761 ADVANCE(2);
1762 HANDLE_INSTRUCTION_END();
1763
1764 HANDLE_INSTRUCTION_START(ADD_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001765 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001766 SafeAdd(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1767 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001768 ADVANCE(2);
1769 HANDLE_INSTRUCTION_END();
1770
1771 HANDLE_INSTRUCTION_START(SUB_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001772 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001773 SafeSub(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1774 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001775 ADVANCE(2);
1776 HANDLE_INSTRUCTION_END();
1777
1778 HANDLE_INSTRUCTION_START(MUL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001779 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001780 SafeMul(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1781 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001782 ADVANCE(2);
1783 HANDLE_INSTRUCTION_END();
1784
1785 HANDLE_INSTRUCTION_START(DIV_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001786 bool success = DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
1787 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1788 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001789 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1790 }
1791 HANDLE_INSTRUCTION_END();
1792
1793 HANDLE_INSTRUCTION_START(REM_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001794 bool success = DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1795 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1796 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001797 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1798 }
1799 HANDLE_INSTRUCTION_END();
1800
1801 HANDLE_INSTRUCTION_START(AND_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001802 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001803 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1804 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1805 ADVANCE(2);
1806 HANDLE_INSTRUCTION_END();
1807
1808 HANDLE_INSTRUCTION_START(OR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001809 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001810 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1811 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1812 ADVANCE(2);
1813 HANDLE_INSTRUCTION_END();
1814
1815 HANDLE_INSTRUCTION_START(XOR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001816 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001817 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1818 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1819 ADVANCE(2);
1820 HANDLE_INSTRUCTION_END();
1821
1822 HANDLE_INSTRUCTION_START(SHL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001823 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001824 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1825 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1826 ADVANCE(2);
1827 HANDLE_INSTRUCTION_END();
1828
1829 HANDLE_INSTRUCTION_START(SHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001830 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001831 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1832 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1833 ADVANCE(2);
1834 HANDLE_INSTRUCTION_END();
1835
1836 HANDLE_INSTRUCTION_START(USHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001837 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001838 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1839 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1840 ADVANCE(2);
1841 HANDLE_INSTRUCTION_END();
1842
1843 HANDLE_INSTRUCTION_START(ADD_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001844 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001845 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1846 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1847 ADVANCE(2);
1848 HANDLE_INSTRUCTION_END();
1849
1850 HANDLE_INSTRUCTION_START(SUB_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001851 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001852 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1853 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1854 ADVANCE(2);
1855 HANDLE_INSTRUCTION_END();
1856
1857 HANDLE_INSTRUCTION_START(MUL_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001858 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001859 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1860 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1861 ADVANCE(2);
1862 HANDLE_INSTRUCTION_END();
1863
1864 HANDLE_INSTRUCTION_START(DIV_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001865 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001866 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1867 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1868 ADVANCE(2);
1869 HANDLE_INSTRUCTION_END();
1870
1871 HANDLE_INSTRUCTION_START(REM_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001872 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001873 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1874 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1875 ADVANCE(2);
1876 HANDLE_INSTRUCTION_END();
1877
1878 HANDLE_INSTRUCTION_START(ADD_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001879 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001880 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1881 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1882 ADVANCE(2);
1883 HANDLE_INSTRUCTION_END();
1884
1885 HANDLE_INSTRUCTION_START(SUB_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001886 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001887 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1888 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1889 ADVANCE(2);
1890 HANDLE_INSTRUCTION_END();
1891
1892 HANDLE_INSTRUCTION_START(MUL_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001893 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001894 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1895 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1896 ADVANCE(2);
1897 HANDLE_INSTRUCTION_END();
1898
1899 HANDLE_INSTRUCTION_START(DIV_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001900 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001901 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1902 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1903 ADVANCE(2);
1904 HANDLE_INSTRUCTION_END();
1905
1906 HANDLE_INSTRUCTION_START(REM_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001907 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001908 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1909 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1910 ADVANCE(2);
1911 HANDLE_INSTRUCTION_END();
1912
1913 HANDLE_INSTRUCTION_START(ADD_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001914 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001915 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001916 SafeAdd(shadow_frame.GetVReg(vregA),
1917 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001918 ADVANCE(1);
1919 }
1920 HANDLE_INSTRUCTION_END();
1921
1922 HANDLE_INSTRUCTION_START(SUB_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001923 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001924 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001925 SafeSub(shadow_frame.GetVReg(vregA),
1926 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001927 ADVANCE(1);
1928 }
1929 HANDLE_INSTRUCTION_END();
1930
1931 HANDLE_INSTRUCTION_START(MUL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001932 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001933 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001934 SafeMul(shadow_frame.GetVReg(vregA),
1935 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001936 ADVANCE(1);
1937 }
1938 HANDLE_INSTRUCTION_END();
1939
1940 HANDLE_INSTRUCTION_START(DIV_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001941 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001942 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001943 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001944 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1945 }
1946 HANDLE_INSTRUCTION_END();
1947
1948 HANDLE_INSTRUCTION_START(REM_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001949 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001950 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001951 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001952 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1953 }
1954 HANDLE_INSTRUCTION_END();
1955
1956 HANDLE_INSTRUCTION_START(SHL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001957 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001958 shadow_frame.SetVReg(vregA,
1959 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001960 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001961 ADVANCE(1);
1962 }
1963 HANDLE_INSTRUCTION_END();
1964
1965 HANDLE_INSTRUCTION_START(SHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001966 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001967 shadow_frame.SetVReg(vregA,
1968 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001969 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001970 ADVANCE(1);
1971 }
1972 HANDLE_INSTRUCTION_END();
1973
1974 HANDLE_INSTRUCTION_START(USHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001975 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001976 shadow_frame.SetVReg(vregA,
1977 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001978 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001979 ADVANCE(1);
1980 }
1981 HANDLE_INSTRUCTION_END();
1982
1983 HANDLE_INSTRUCTION_START(AND_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001984 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001985 shadow_frame.SetVReg(vregA,
1986 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001987 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001988 ADVANCE(1);
1989 }
1990 HANDLE_INSTRUCTION_END();
1991
1992 HANDLE_INSTRUCTION_START(OR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001993 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001994 shadow_frame.SetVReg(vregA,
1995 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001996 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001997 ADVANCE(1);
1998 }
1999 HANDLE_INSTRUCTION_END();
2000
2001 HANDLE_INSTRUCTION_START(XOR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002002 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002003 shadow_frame.SetVReg(vregA,
2004 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002005 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002006 ADVANCE(1);
2007 }
2008 HANDLE_INSTRUCTION_END();
2009
2010 HANDLE_INSTRUCTION_START(ADD_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002011 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002012 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002013 SafeAdd(shadow_frame.GetVRegLong(vregA),
2014 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002015 ADVANCE(1);
2016 }
2017 HANDLE_INSTRUCTION_END();
2018
2019 HANDLE_INSTRUCTION_START(SUB_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002020 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002021 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002022 SafeSub(shadow_frame.GetVRegLong(vregA),
2023 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002024 ADVANCE(1);
2025 }
2026 HANDLE_INSTRUCTION_END();
2027
2028 HANDLE_INSTRUCTION_START(MUL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002029 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002030 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002031 SafeMul(shadow_frame.GetVRegLong(vregA),
2032 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002033 ADVANCE(1);
2034 }
2035 HANDLE_INSTRUCTION_END();
2036
2037 HANDLE_INSTRUCTION_START(DIV_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002038 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002039 bool success = DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002040 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002041 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2042 }
2043 HANDLE_INSTRUCTION_END();
2044
2045 HANDLE_INSTRUCTION_START(REM_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002046 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002047 bool success = DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002048 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002049 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2050 }
2051 HANDLE_INSTRUCTION_END();
2052
2053 HANDLE_INSTRUCTION_START(AND_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002054 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002055 shadow_frame.SetVRegLong(vregA,
2056 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002057 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002058 ADVANCE(1);
2059 }
2060 HANDLE_INSTRUCTION_END();
2061
2062 HANDLE_INSTRUCTION_START(OR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002063 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002064 shadow_frame.SetVRegLong(vregA,
2065 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002066 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002067 ADVANCE(1);
2068 }
2069 HANDLE_INSTRUCTION_END();
2070
2071 HANDLE_INSTRUCTION_START(XOR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002072 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002073 shadow_frame.SetVRegLong(vregA,
2074 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002075 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002076 ADVANCE(1);
2077 }
2078 HANDLE_INSTRUCTION_END();
2079
2080 HANDLE_INSTRUCTION_START(SHL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002081 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002082 shadow_frame.SetVRegLong(vregA,
2083 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002084 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002085 ADVANCE(1);
2086 }
2087 HANDLE_INSTRUCTION_END();
2088
2089 HANDLE_INSTRUCTION_START(SHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002090 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002091 shadow_frame.SetVRegLong(vregA,
2092 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002093 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002094 ADVANCE(1);
2095 }
2096 HANDLE_INSTRUCTION_END();
2097
2098 HANDLE_INSTRUCTION_START(USHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002099 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002100 shadow_frame.SetVRegLong(vregA,
2101 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002102 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002103 ADVANCE(1);
2104 }
2105 HANDLE_INSTRUCTION_END();
2106
2107 HANDLE_INSTRUCTION_START(ADD_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002108 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002109 shadow_frame.SetVRegFloat(vregA,
2110 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002111 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002112 ADVANCE(1);
2113 }
2114 HANDLE_INSTRUCTION_END();
2115
2116 HANDLE_INSTRUCTION_START(SUB_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002117 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002118 shadow_frame.SetVRegFloat(vregA,
2119 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002120 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002121 ADVANCE(1);
2122 }
2123 HANDLE_INSTRUCTION_END();
2124
2125 HANDLE_INSTRUCTION_START(MUL_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002126 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002127 shadow_frame.SetVRegFloat(vregA,
2128 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002129 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002130 ADVANCE(1);
2131 }
2132 HANDLE_INSTRUCTION_END();
2133
2134 HANDLE_INSTRUCTION_START(DIV_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002135 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002136 shadow_frame.SetVRegFloat(vregA,
2137 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002138 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002139 ADVANCE(1);
2140 }
2141 HANDLE_INSTRUCTION_END();
2142
2143 HANDLE_INSTRUCTION_START(REM_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002144 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002145 shadow_frame.SetVRegFloat(vregA,
2146 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002147 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002148 ADVANCE(1);
2149 }
2150 HANDLE_INSTRUCTION_END();
2151
2152 HANDLE_INSTRUCTION_START(ADD_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002153 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002154 shadow_frame.SetVRegDouble(vregA,
2155 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002156 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002157 ADVANCE(1);
2158 }
2159 HANDLE_INSTRUCTION_END();
2160
2161 HANDLE_INSTRUCTION_START(SUB_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002162 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002163 shadow_frame.SetVRegDouble(vregA,
2164 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002165 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002166 ADVANCE(1);
2167 }
2168 HANDLE_INSTRUCTION_END();
2169
2170 HANDLE_INSTRUCTION_START(MUL_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002171 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002172 shadow_frame.SetVRegDouble(vregA,
2173 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002174 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002175 ADVANCE(1);
2176 }
2177 HANDLE_INSTRUCTION_END();
2178
2179 HANDLE_INSTRUCTION_START(DIV_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002180 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002181 shadow_frame.SetVRegDouble(vregA,
2182 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002183 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002184 ADVANCE(1);
2185 }
2186 HANDLE_INSTRUCTION_END();
2187
2188 HANDLE_INSTRUCTION_START(REM_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002189 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002190 shadow_frame.SetVRegDouble(vregA,
2191 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002192 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002193 ADVANCE(1);
2194 }
2195 HANDLE_INSTRUCTION_END();
2196
2197 HANDLE_INSTRUCTION_START(ADD_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002198 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002199 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2200 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002201 ADVANCE(2);
2202 HANDLE_INSTRUCTION_END();
2203
2204 HANDLE_INSTRUCTION_START(RSUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002205 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002206 SafeSub(inst->VRegC_22s(),
2207 shadow_frame.GetVReg(inst->VRegB_22s(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002208 ADVANCE(2);
2209 HANDLE_INSTRUCTION_END();
2210
2211 HANDLE_INSTRUCTION_START(MUL_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002212 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002213 SafeMul(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2214 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002215 ADVANCE(2);
2216 HANDLE_INSTRUCTION_END();
2217
2218 HANDLE_INSTRUCTION_START(DIV_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002219 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
2220 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002221 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2222 }
2223 HANDLE_INSTRUCTION_END();
2224
2225 HANDLE_INSTRUCTION_START(REM_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002226 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
2227 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002228 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2229 }
2230 HANDLE_INSTRUCTION_END();
2231
2232 HANDLE_INSTRUCTION_START(AND_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002233 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2234 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002235 inst->VRegC_22s());
2236 ADVANCE(2);
2237 HANDLE_INSTRUCTION_END();
2238
2239 HANDLE_INSTRUCTION_START(OR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002240 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2241 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002242 inst->VRegC_22s());
2243 ADVANCE(2);
2244 HANDLE_INSTRUCTION_END();
2245
2246 HANDLE_INSTRUCTION_START(XOR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002247 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2248 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002249 inst->VRegC_22s());
2250 ADVANCE(2);
2251 HANDLE_INSTRUCTION_END();
2252
2253 HANDLE_INSTRUCTION_START(ADD_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002254 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002255 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22b()),
2256 inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002257 ADVANCE(2);
2258 HANDLE_INSTRUCTION_END();
2259
2260 HANDLE_INSTRUCTION_START(RSUB_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002261 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002262 SafeSub(inst->VRegC_22b(),
2263 shadow_frame.GetVReg(inst->VRegB_22b())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002264 ADVANCE(2);
2265 HANDLE_INSTRUCTION_END();
2266
2267 HANDLE_INSTRUCTION_START(MUL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002268 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002269 SafeMul(shadow_frame.GetVReg(inst->VRegB_22b()),
2270 inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002271 ADVANCE(2);
2272 HANDLE_INSTRUCTION_END();
2273
2274 HANDLE_INSTRUCTION_START(DIV_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002275 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
2276 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002277 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2278 }
2279 HANDLE_INSTRUCTION_END();
2280
2281 HANDLE_INSTRUCTION_START(REM_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002282 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
2283 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002284 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2285 }
2286 HANDLE_INSTRUCTION_END();
2287
2288 HANDLE_INSTRUCTION_START(AND_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002289 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002290 shadow_frame.GetVReg(inst->VRegB_22b()) &
2291 inst->VRegC_22b());
2292 ADVANCE(2);
2293 HANDLE_INSTRUCTION_END();
2294
2295 HANDLE_INSTRUCTION_START(OR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002296 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002297 shadow_frame.GetVReg(inst->VRegB_22b()) |
2298 inst->VRegC_22b());
2299 ADVANCE(2);
2300 HANDLE_INSTRUCTION_END();
2301
2302 HANDLE_INSTRUCTION_START(XOR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002303 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002304 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2305 inst->VRegC_22b());
2306 ADVANCE(2);
2307 HANDLE_INSTRUCTION_END();
2308
2309 HANDLE_INSTRUCTION_START(SHL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002310 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002311 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2312 (inst->VRegC_22b() & 0x1f));
2313 ADVANCE(2);
2314 HANDLE_INSTRUCTION_END();
2315
2316 HANDLE_INSTRUCTION_START(SHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002317 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002318 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2319 (inst->VRegC_22b() & 0x1f));
2320 ADVANCE(2);
2321 HANDLE_INSTRUCTION_END();
2322
2323 HANDLE_INSTRUCTION_START(USHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002324 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002325 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2326 (inst->VRegC_22b() & 0x1f));
2327 ADVANCE(2);
2328 HANDLE_INSTRUCTION_END();
2329
2330 HANDLE_INSTRUCTION_START(UNUSED_3E)
Ian Rogerse94652f2014-12-02 11:13:19 -08002331 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002332 HANDLE_INSTRUCTION_END();
2333
2334 HANDLE_INSTRUCTION_START(UNUSED_3F)
Ian Rogerse94652f2014-12-02 11:13:19 -08002335 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002336 HANDLE_INSTRUCTION_END();
2337
2338 HANDLE_INSTRUCTION_START(UNUSED_40)
Ian Rogerse94652f2014-12-02 11:13:19 -08002339 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002340 HANDLE_INSTRUCTION_END();
2341
2342 HANDLE_INSTRUCTION_START(UNUSED_41)
Ian Rogerse94652f2014-12-02 11:13:19 -08002343 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002344 HANDLE_INSTRUCTION_END();
2345
2346 HANDLE_INSTRUCTION_START(UNUSED_42)
Ian Rogerse94652f2014-12-02 11:13:19 -08002347 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002348 HANDLE_INSTRUCTION_END();
2349
2350 HANDLE_INSTRUCTION_START(UNUSED_43)
Ian Rogerse94652f2014-12-02 11:13:19 -08002351 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002352 HANDLE_INSTRUCTION_END();
2353
2354 HANDLE_INSTRUCTION_START(UNUSED_79)
Ian Rogerse94652f2014-12-02 11:13:19 -08002355 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002356 HANDLE_INSTRUCTION_END();
2357
2358 HANDLE_INSTRUCTION_START(UNUSED_7A)
Ian Rogerse94652f2014-12-02 11:13:19 -08002359 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002360 HANDLE_INSTRUCTION_END();
2361
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002362 HANDLE_INSTRUCTION_START(UNUSED_F3)
Ian Rogerse94652f2014-12-02 11:13:19 -08002363 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002364 HANDLE_INSTRUCTION_END();
2365
2366 HANDLE_INSTRUCTION_START(UNUSED_F4)
Ian Rogerse94652f2014-12-02 11:13:19 -08002367 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002368 HANDLE_INSTRUCTION_END();
2369
2370 HANDLE_INSTRUCTION_START(UNUSED_F5)
Ian Rogerse94652f2014-12-02 11:13:19 -08002371 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002372 HANDLE_INSTRUCTION_END();
2373
2374 HANDLE_INSTRUCTION_START(UNUSED_F6)
Ian Rogerse94652f2014-12-02 11:13:19 -08002375 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002376 HANDLE_INSTRUCTION_END();
2377
2378 HANDLE_INSTRUCTION_START(UNUSED_F7)
Ian Rogerse94652f2014-12-02 11:13:19 -08002379 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002380 HANDLE_INSTRUCTION_END();
2381
2382 HANDLE_INSTRUCTION_START(UNUSED_F8)
Ian Rogerse94652f2014-12-02 11:13:19 -08002383 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002384 HANDLE_INSTRUCTION_END();
2385
2386 HANDLE_INSTRUCTION_START(UNUSED_F9)
Ian Rogerse94652f2014-12-02 11:13:19 -08002387 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002388 HANDLE_INSTRUCTION_END();
2389
2390 HANDLE_INSTRUCTION_START(UNUSED_FA)
Ian Rogerse94652f2014-12-02 11:13:19 -08002391 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002392 HANDLE_INSTRUCTION_END();
2393
2394 HANDLE_INSTRUCTION_START(UNUSED_FB)
Ian Rogerse94652f2014-12-02 11:13:19 -08002395 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002396 HANDLE_INSTRUCTION_END();
2397
2398 HANDLE_INSTRUCTION_START(UNUSED_FC)
Ian Rogerse94652f2014-12-02 11:13:19 -08002399 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002400 HANDLE_INSTRUCTION_END();
2401
2402 HANDLE_INSTRUCTION_START(UNUSED_FD)
Ian Rogerse94652f2014-12-02 11:13:19 -08002403 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002404 HANDLE_INSTRUCTION_END();
2405
2406 HANDLE_INSTRUCTION_START(UNUSED_FE)
Ian Rogerse94652f2014-12-02 11:13:19 -08002407 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002408 HANDLE_INSTRUCTION_END();
2409
2410 HANDLE_INSTRUCTION_START(UNUSED_FF)
Ian Rogerse94652f2014-12-02 11:13:19 -08002411 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002412 HANDLE_INSTRUCTION_END();
2413
2414 exception_pending_label: {
2415 CHECK(self->IsExceptionPending());
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002416 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -07002417 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002418 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002419 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002420 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002421 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc,
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002422 instrumentation);
2423 if (found_dex_pc == DexFile::kDexNoIndex) {
2424 return JValue(); /* Handled in caller. */
2425 } else {
2426 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc);
2427 ADVANCE(displacement);
2428 }
2429 }
2430
Sebastien Hertz8379b222014-02-24 17:38:15 +01002431// Create alternative instruction handlers dedicated to instrumentation.
2432// Return instructions must not call Instrumentation::DexPcMovedEvent since they already call
2433// Instrumentation::MethodExited. This is to avoid posting debugger events twice for this location.
Sebastien Hertze713d932014-05-15 10:48:53 +02002434// Note: we do not use the kReturn instruction flag here (to test the instruction is a return). The
2435// compiler seems to not evaluate "(Instruction::FlagsOf(Instruction::code) & kReturn) != 0" to
2436// a constant condition that would remove the "if" statement so the test is free.
Sebastien Hertz8379b222014-02-24 17:38:15 +01002437#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
2438 alt_op_##code: { \
2439 if (Instruction::code != Instruction::RETURN_VOID && \
2440 Instruction::code != Instruction::RETURN_VOID_BARRIER && \
2441 Instruction::code != Instruction::RETURN && \
2442 Instruction::code != Instruction::RETURN_WIDE && \
2443 Instruction::code != Instruction::RETURN_OBJECT) { \
2444 if (LIKELY(!notified_method_entry_event)) { \
2445 Runtime* runtime = Runtime::Current(); \
2446 const instrumentation::Instrumentation* instrumentation = runtime->GetInstrumentation(); \
2447 if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
2448 Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_); \
2449 instrumentation->DexPcMovedEvent(self, this_object, shadow_frame.GetMethod(), dex_pc); \
2450 } \
2451 } else { \
2452 notified_method_entry_event = false; \
2453 } \
2454 } \
2455 UPDATE_HANDLER_TABLE(); \
2456 goto *handlersTable[instrumentation::kMainHandlerTable][Instruction::code]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002457 }
2458#include "dex_instruction_list.h"
2459 DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER)
2460#undef DEX_INSTRUCTION_LIST
2461#undef INSTRUMENTATION_INSTRUCTION_HANDLER
2462} // NOLINT(readability/fn_size)
2463
2464// Explicit definitions of ExecuteGotoImpl.
Sebastien Hertzc6714852013-09-30 16:42:32 +02002465template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002466JValue ExecuteGotoImpl<true, false>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002467 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertzc6714852013-09-30 16:42:32 +02002468template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002469JValue ExecuteGotoImpl<false, false>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002470 ShadowFrame& shadow_frame, JValue result_register);
2471template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
Ian Rogerse94652f2014-12-02 11:13:19 -08002472JValue ExecuteGotoImpl<true, true>(Thread* self, const DexFile::CodeItem* code_item,
2473 ShadowFrame& shadow_frame, JValue result_register);
2474template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
2475JValue ExecuteGotoImpl<false, true>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002476 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002477
2478} // namespace interpreter
2479} // namespace art