blob: b55312fb00c528a1cd30960b118a43dd6c07677e [file] [log] [blame]
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Colin Crosse84e4f72015-03-18 14:01:19 -070017#if !defined(__clang__)
18// Clang 3.4 fails to build the goto interpreter implementation.
19
Igor Murashkin6918bf12015-09-27 19:19:06 -070020
21#include "base/stl_util.h" // MakeUnique
Alex Lighteb7c1442015-08-31 13:17:42 -070022#include "experimental_flags.h"
Sebastien Hertz8ece0502013-08-07 11:26:41 +020023#include "interpreter_common.h"
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +000024#include "jit/jit.h"
Ian Rogersf72a11d2014-10-30 15:41:08 -070025#include "safe_math.h"
Sebastien Hertz8ece0502013-08-07 11:26:41 +020026
Igor Murashkin6918bf12015-09-27 19:19:06 -070027#include <memory> // std::unique_ptr
28
Sebastien Hertz8ece0502013-08-07 11:26:41 +020029namespace art {
30namespace interpreter {
31
32// In the following macros, we expect the following local variables exist:
33// - "self": the current Thread*.
34// - "inst" : the current Instruction*.
Sebastien Hertz3b588e02013-09-11 14:33:18 +020035// - "inst_data" : the current instruction's first 16 bits.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020036// - "dex_pc": the current pc.
37// - "shadow_frame": the current shadow frame.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020038// - "currentHandlersTable": the current table of pointer to each instruction handler.
39
40// Advance to the next instruction and updates interpreter state.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020041#define ADVANCE(_offset) \
42 do { \
43 int32_t disp = static_cast<int32_t>(_offset); \
44 inst = inst->RelativeAt(disp); \
45 dex_pc = static_cast<uint32_t>(static_cast<int32_t>(dex_pc) + disp); \
46 shadow_frame.SetDexPC(dex_pc); \
Ian Rogerse94652f2014-12-02 11:13:19 -080047 TraceExecution(shadow_frame, inst, dex_pc); \
Sebastien Hertz3b588e02013-09-11 14:33:18 +020048 inst_data = inst->Fetch16(0); \
49 goto *currentHandlersTable[inst->Opcode(inst_data)]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020050 } while (false)
51
52#define HANDLE_PENDING_EXCEPTION() goto exception_pending_label
53
54#define POSSIBLY_HANDLE_PENDING_EXCEPTION(_is_exception_pending, _offset) \
55 do { \
56 if (UNLIKELY(_is_exception_pending)) { \
57 HANDLE_PENDING_EXCEPTION(); \
58 } else { \
59 ADVANCE(_offset); \
60 } \
61 } while (false)
62
Sebastien Hertzee1997a2013-09-19 14:47:09 +020063#define UPDATE_HANDLER_TABLE() \
Mathieu Chartier2cebb242015-04-21 16:50:40 -070064 currentHandlersTable = handlersTable[ \
65 Runtime::Current()->GetInstrumentation()->GetInterpreterHandlerTable()]
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +020066
Hiroshi Yamauchi961ea9f2016-04-01 12:02:58 -070067#define BRANCH_INSTRUMENTATION(offset) \
68 do { \
69 ArtMethod* method = shadow_frame.GetMethod(); \
70 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation(); \
71 instrumentation->Branch(self, method, dex_pc, offset); \
72 JValue result; \
73 if (jit::Jit::MaybeDoOnStackReplacement(self, method, dex_pc, offset, &result)) { \
74 return result; \
75 } \
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080076 } while (false)
77
Sebastien Hertz8ece0502013-08-07 11:26:41 +020078#define UNREACHABLE_CODE_CHECK() \
79 do { \
80 if (kIsDebugBuild) { \
81 LOG(FATAL) << "We should not be here !"; \
Ian Rogerse94652f2014-12-02 11:13:19 -080082 UNREACHABLE(); \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020083 } \
84 } while (false)
85
86#define HANDLE_INSTRUCTION_START(opcode) op_##opcode: // NOLINT(whitespace/labels)
87#define HANDLE_INSTRUCTION_END() UNREACHABLE_CODE_CHECK()
88
Igor Murashkin158f35c2015-06-10 15:55:30 -070089// Use with instructions labeled with kExperimental flag:
90#define HANDLE_EXPERIMENTAL_INSTRUCTION_START(opcode) \
91 HANDLE_INSTRUCTION_START(opcode); \
92 DCHECK(inst->IsExperimental()); \
Alex Lighteb7c1442015-08-31 13:17:42 -070093 if (Runtime::Current()->AreExperimentalFlagsEnabled(ExperimentalFlags::kLambdas)) {
Igor Murashkin158f35c2015-06-10 15:55:30 -070094#define HANDLE_EXPERIMENTAL_INSTRUCTION_END() \
95 } else { \
96 UnexpectedOpcode(inst, shadow_frame); \
97 } HANDLE_INSTRUCTION_END();
98
Andreas Gampe03ec9302015-08-27 17:41:47 -070099#define HANDLE_MONITOR_CHECKS() \
100 if (!shadow_frame.GetLockCountData(). \
101 CheckAllMonitorsReleasedOrThrow<do_assignability_check>(self)) { \
102 HANDLE_PENDING_EXCEPTION(); \
103 }
Igor Murashkin158f35c2015-06-10 15:55:30 -0700104
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200105/**
106 * Interpreter based on computed goto tables.
107 *
108 * Each instruction is associated to a handler. This handler is responsible for executing the
109 * instruction and jump to the next instruction's handler.
110 * In order to limit the cost of instrumentation, we have two handler tables:
111 * - the "main" handler table: it contains handlers for normal execution of each instruction without
112 * handling of instrumentation.
113 * - the "alternative" handler table: it contains alternative handlers which first handle
114 * instrumentation before jumping to the corresponding "normal" instruction's handler.
115 *
116 * When instrumentation is active, the interpreter uses the "alternative" handler table. Otherwise
117 * it uses the "main" handler table.
118 *
119 * The current handler table is the handler table being used by the interpreter. It is updated:
120 * - on backward branch (goto, if and switch instructions)
121 * - after invoke
122 * - when an exception is thrown.
123 * This allows to support an attaching debugger to an already running application for instance.
124 *
125 * For a fast handler table update, handler tables are stored in an array of handler tables. Each
126 * handler table is represented by the InterpreterHandlerTable enum which allows to associate it
127 * to an index in this array of handler tables ((see Instrumentation::GetInterpreterHandlerTable).
128 *
129 * Here's the current layout of this array of handler tables:
130 *
131 * ---------------------+---------------+
132 * | NOP | (handler for NOP instruction)
133 * +---------------+
134 * "main" | MOVE | (handler for MOVE instruction)
135 * handler table +---------------+
136 * | ... |
137 * +---------------+
138 * | UNUSED_FF | (handler for UNUSED_FF instruction)
139 * ---------------------+---------------+
140 * | NOP | (alternative handler for NOP instruction)
141 * +---------------+
142 * "alternative" | MOVE | (alternative handler for MOVE instruction)
143 * handler table +---------------+
144 * | ... |
145 * +---------------+
146 * | UNUSED_FF | (alternative handler for UNUSED_FF instruction)
147 * ---------------------+---------------+
148 *
149 */
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100150template<bool do_access_check, bool transaction_active>
Ian Rogerse94652f2014-12-02 11:13:19 -0800151JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowFrame& shadow_frame,
152 JValue result_register) {
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200153 // Define handler tables:
154 // - The main handler table contains execution handlers for each instruction.
155 // - The alternative handler table contains prelude handlers which check for thread suspend and
156 // manage instrumentation before jumping to the execution handler.
157 static const void* const handlersTable[instrumentation::kNumHandlerTables][kNumPackedOpcodes] = {
158 {
159 // Main handler table.
160#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&op_##code,
161#include "dex_instruction_list.h"
162 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
163#undef DEX_INSTRUCTION_LIST
164#undef INSTRUCTION_HANDLER
165 }, {
166 // Alternative handler table.
167#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&alt_op_##code,
168#include "dex_instruction_list.h"
169 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
170#undef DEX_INSTRUCTION_LIST
171#undef INSTRUCTION_HANDLER
172 }
173 };
174
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800175 constexpr bool do_assignability_check = do_access_check;
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200176 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
177 LOG(FATAL) << "Invalid shadow frame for interpreter use";
178 return JValue();
179 }
180 self->VerifyStack();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200181
182 uint32_t dex_pc = shadow_frame.GetDexPC();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200183 const Instruction* inst = Instruction::At(code_item->insns_ + dex_pc);
184 uint16_t inst_data;
185 const void* const* currentHandlersTable;
186 UPDATE_HANDLER_TABLE();
Igor Murashkin6918bf12015-09-27 19:19:06 -0700187 std::unique_ptr<lambda::ClosureBuilder> lambda_closure_builder;
188 size_t lambda_captured_variable_index = 0;
189
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200190 // Jump to first instruction.
191 ADVANCE(0);
192 UNREACHABLE_CODE_CHECK();
193
194 HANDLE_INSTRUCTION_START(NOP)
195 ADVANCE(1);
196 HANDLE_INSTRUCTION_END();
197
198 HANDLE_INSTRUCTION_START(MOVE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200199 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
200 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200201 ADVANCE(1);
202 HANDLE_INSTRUCTION_END();
203
204 HANDLE_INSTRUCTION_START(MOVE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200205 shadow_frame.SetVReg(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200206 shadow_frame.GetVReg(inst->VRegB_22x()));
207 ADVANCE(2);
208 HANDLE_INSTRUCTION_END();
209
210 HANDLE_INSTRUCTION_START(MOVE_16)
211 shadow_frame.SetVReg(inst->VRegA_32x(),
212 shadow_frame.GetVReg(inst->VRegB_32x()));
213 ADVANCE(3);
214 HANDLE_INSTRUCTION_END();
215
216 HANDLE_INSTRUCTION_START(MOVE_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200217 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
218 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200219 ADVANCE(1);
220 HANDLE_INSTRUCTION_END();
221
222 HANDLE_INSTRUCTION_START(MOVE_WIDE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200223 shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200224 shadow_frame.GetVRegLong(inst->VRegB_22x()));
225 ADVANCE(2);
226 HANDLE_INSTRUCTION_END();
227
228 HANDLE_INSTRUCTION_START(MOVE_WIDE_16)
229 shadow_frame.SetVRegLong(inst->VRegA_32x(),
230 shadow_frame.GetVRegLong(inst->VRegB_32x()));
231 ADVANCE(3);
232 HANDLE_INSTRUCTION_END();
233
234 HANDLE_INSTRUCTION_START(MOVE_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200235 shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data),
236 shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200237 ADVANCE(1);
238 HANDLE_INSTRUCTION_END();
239
240 HANDLE_INSTRUCTION_START(MOVE_OBJECT_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200241 shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200242 shadow_frame.GetVRegReference(inst->VRegB_22x()));
243 ADVANCE(2);
244 HANDLE_INSTRUCTION_END();
245
246 HANDLE_INSTRUCTION_START(MOVE_OBJECT_16)
247 shadow_frame.SetVRegReference(inst->VRegA_32x(),
248 shadow_frame.GetVRegReference(inst->VRegB_32x()));
249 ADVANCE(3);
250 HANDLE_INSTRUCTION_END();
251
252 HANDLE_INSTRUCTION_START(MOVE_RESULT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200253 shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200254 ADVANCE(1);
255 HANDLE_INSTRUCTION_END();
256
257 HANDLE_INSTRUCTION_START(MOVE_RESULT_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200258 shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200259 ADVANCE(1);
260 HANDLE_INSTRUCTION_END();
261
262 HANDLE_INSTRUCTION_START(MOVE_RESULT_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200263 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200264 ADVANCE(1);
265 HANDLE_INSTRUCTION_END();
266
267 HANDLE_INSTRUCTION_START(MOVE_EXCEPTION) {
Nicolas Geoffray14691c52015-03-05 10:40:17 +0000268 Throwable* exception = self->GetException();
Sebastien Hertz270a0e12015-01-16 19:49:09 +0100269 DCHECK(exception != nullptr) << "No pending exception on MOVE_EXCEPTION instruction";
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200270 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception);
Sebastien Hertz5c004902014-05-21 10:07:42 +0200271 self->ClearException();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200272 ADVANCE(1);
273 }
274 HANDLE_INSTRUCTION_END();
275
Mathieu Chartierd7cbf8a2015-03-19 12:43:20 -0700276 HANDLE_INSTRUCTION_START(RETURN_VOID_NO_BARRIER) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200277 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700278 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700279 HANDLE_MONITOR_CHECKS();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200280 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200281 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200282 shadow_frame.GetMethod(), dex_pc,
283 result);
284 }
285 return result;
286 }
287 HANDLE_INSTRUCTION_END();
288
Mathieu Chartierd7cbf8a2015-03-19 12:43:20 -0700289 HANDLE_INSTRUCTION_START(RETURN_VOID) {
Hans Boehm30359612014-05-21 17:46:23 -0700290 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200291 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700292 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700293 HANDLE_MONITOR_CHECKS();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200294 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200295 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200296 shadow_frame.GetMethod(), dex_pc,
297 result);
298 }
299 return result;
300 }
301 HANDLE_INSTRUCTION_END();
302
303 HANDLE_INSTRUCTION_START(RETURN) {
304 JValue result;
305 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200306 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700307 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700308 HANDLE_MONITOR_CHECKS();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200309 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200310 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200311 shadow_frame.GetMethod(), dex_pc,
312 result);
313 }
314 return result;
315 }
316 HANDLE_INSTRUCTION_END();
317
318 HANDLE_INSTRUCTION_START(RETURN_WIDE) {
319 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200320 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700321 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700322 HANDLE_MONITOR_CHECKS();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200323 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200324 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200325 shadow_frame.GetMethod(), dex_pc,
326 result);
327 }
328 return result;
329 }
330 HANDLE_INSTRUCTION_END();
331
332 HANDLE_INSTRUCTION_START(RETURN_OBJECT) {
333 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700334 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700335 HANDLE_MONITOR_CHECKS();
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700336 const uint8_t vreg_index = inst->VRegA_11x(inst_data);
337 Object* obj_result = shadow_frame.GetVRegReference(vreg_index);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700338 if (do_assignability_check && obj_result != nullptr) {
Vladimir Marko05792b92015-08-03 11:56:49 +0100339 size_t pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize();
340 Class* return_type = shadow_frame.GetMethod()->GetReturnType(true /* resolve */,
341 pointer_size);
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700342 obj_result = shadow_frame.GetVRegReference(vreg_index);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700343 if (return_type == nullptr) {
Jeff Haoa3faaf42013-09-03 19:07:00 -0700344 // Return the pending exception.
345 HANDLE_PENDING_EXCEPTION();
346 }
347 if (!obj_result->VerifierInstanceOf(return_type)) {
348 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700349 std::string temp1, temp2;
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000350 self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700351 "Returning '%s' that is not instance of return type '%s'",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700352 obj_result->GetClass()->GetDescriptor(&temp1),
353 return_type->GetDescriptor(&temp2));
Jeff Haoa3faaf42013-09-03 19:07:00 -0700354 HANDLE_PENDING_EXCEPTION();
355 }
356 }
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700357 result.SetL(obj_result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200358 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200359 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200360 shadow_frame.GetMethod(), dex_pc,
361 result);
362 }
363 return result;
364 }
365 HANDLE_INSTRUCTION_END();
366
367 HANDLE_INSTRUCTION_START(CONST_4) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200368 uint32_t dst = inst->VRegA_11n(inst_data);
369 int32_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200370 shadow_frame.SetVReg(dst, val);
371 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700372 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200373 }
374 ADVANCE(1);
375 }
376 HANDLE_INSTRUCTION_END();
377
378 HANDLE_INSTRUCTION_START(CONST_16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200379 uint32_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200380 int32_t val = inst->VRegB_21s();
381 shadow_frame.SetVReg(dst, val);
382 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700383 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200384 }
385 ADVANCE(2);
386 }
387 HANDLE_INSTRUCTION_END();
388
389 HANDLE_INSTRUCTION_START(CONST) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200390 uint32_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200391 int32_t val = inst->VRegB_31i();
392 shadow_frame.SetVReg(dst, val);
393 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700394 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200395 }
396 ADVANCE(3);
397 }
398 HANDLE_INSTRUCTION_END();
399
400 HANDLE_INSTRUCTION_START(CONST_HIGH16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200401 uint32_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200402 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
403 shadow_frame.SetVReg(dst, val);
404 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700405 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200406 }
407 ADVANCE(2);
408 }
409 HANDLE_INSTRUCTION_END();
410
411 HANDLE_INSTRUCTION_START(CONST_WIDE_16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200412 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200413 ADVANCE(2);
414 HANDLE_INSTRUCTION_END();
415
416 HANDLE_INSTRUCTION_START(CONST_WIDE_32)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200417 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200418 ADVANCE(3);
419 HANDLE_INSTRUCTION_END();
420
421 HANDLE_INSTRUCTION_START(CONST_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200422 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200423 ADVANCE(5);
424 HANDLE_INSTRUCTION_END();
425
426 HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200427 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200428 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
429 ADVANCE(2);
430 HANDLE_INSTRUCTION_END();
431
432 HANDLE_INSTRUCTION_START(CONST_STRING) {
Ian Rogers6786a582014-10-28 12:49:06 -0700433 String* s = ResolveString(self, shadow_frame, inst->VRegB_21c());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700434 if (UNLIKELY(s == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200435 HANDLE_PENDING_EXCEPTION();
436 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200437 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200438 ADVANCE(2);
439 }
440 }
441 HANDLE_INSTRUCTION_END();
442
443 HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
Ian Rogers6786a582014-10-28 12:49:06 -0700444 String* s = ResolveString(self, shadow_frame, inst->VRegB_31c());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700445 if (UNLIKELY(s == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200446 HANDLE_PENDING_EXCEPTION();
447 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200448 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200449 ADVANCE(3);
450 }
451 }
452 HANDLE_INSTRUCTION_END();
453
454 HANDLE_INSTRUCTION_START(CONST_CLASS) {
455 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
456 self, false, do_access_check);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700457 if (UNLIKELY(c == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200458 HANDLE_PENDING_EXCEPTION();
459 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200460 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200461 ADVANCE(2);
462 }
463 }
464 HANDLE_INSTRUCTION_END();
465
466 HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200467 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700468 if (UNLIKELY(obj == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000469 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200470 HANDLE_PENDING_EXCEPTION();
471 } else {
Andreas Gampe03ec9302015-08-27 17:41:47 -0700472 DoMonitorEnter<do_access_check>(self, &shadow_frame, obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200473 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
474 }
475 }
476 HANDLE_INSTRUCTION_END();
477
478 HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200479 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700480 if (UNLIKELY(obj == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000481 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200482 HANDLE_PENDING_EXCEPTION();
483 } else {
Andreas Gampe03ec9302015-08-27 17:41:47 -0700484 DoMonitorExit<do_access_check>(self, &shadow_frame, obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200485 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
486 }
487 }
488 HANDLE_INSTRUCTION_END();
489
490 HANDLE_INSTRUCTION_START(CHECK_CAST) {
491 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
492 self, false, do_access_check);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700493 if (UNLIKELY(c == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200494 HANDLE_PENDING_EXCEPTION();
495 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200496 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700497 if (UNLIKELY(obj != nullptr && !obj->InstanceOf(c))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200498 ThrowClassCastException(c, obj->GetClass());
499 HANDLE_PENDING_EXCEPTION();
500 } else {
501 ADVANCE(2);
502 }
503 }
504 }
505 HANDLE_INSTRUCTION_END();
506
507 HANDLE_INSTRUCTION_START(INSTANCE_OF) {
508 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
509 self, false, do_access_check);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700510 if (UNLIKELY(c == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200511 HANDLE_PENDING_EXCEPTION();
512 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200513 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700514 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != nullptr && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200515 ADVANCE(2);
516 }
517 }
518 HANDLE_INSTRUCTION_END();
519
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700520 HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200521 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700522 if (UNLIKELY(array == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000523 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200524 HANDLE_PENDING_EXCEPTION();
525 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200526 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200527 ADVANCE(1);
528 }
529 }
530 HANDLE_INSTRUCTION_END();
531
532 HANDLE_INSTRUCTION_START(NEW_INSTANCE) {
Jeff Hao848f70a2014-01-15 13:49:50 -0800533 Object* obj = nullptr;
534 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
535 self, false, do_access_check);
536 if (LIKELY(c != nullptr)) {
537 if (UNLIKELY(c->IsStringClass())) {
538 gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
539 mirror::SetStringCountVisitor visitor(0);
540 obj = String::Alloc<true>(self, 0, allocator_type, visitor);
541 } else {
542 obj = AllocObjectFromCode<do_access_check, true>(
543 inst->VRegB_21c(), shadow_frame.GetMethod(), self,
544 Runtime::Current()->GetHeap()->GetCurrentAllocator());
545 }
546 }
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700547 if (UNLIKELY(obj == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200548 HANDLE_PENDING_EXCEPTION();
549 } else {
Sebastien Hertz4e99b3d2014-06-24 14:35:40 +0200550 obj->GetClass()->AssertInitializedOrInitializingInThread(self);
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700551 // Don't allow finalizable objects to be allocated during a transaction since these can't be
552 // finalized without a started runtime.
553 if (transaction_active && obj->GetClass()->IsFinalizable()) {
Sebastien Hertz45b15972015-04-03 16:07:05 +0200554 AbortTransactionF(self, "Allocating finalizable object in transaction: %s",
555 PrettyTypeOf(obj).c_str());
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700556 HANDLE_PENDING_EXCEPTION();
557 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200558 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200559 ADVANCE(2);
560 }
561 }
562 HANDLE_INSTRUCTION_END();
563
564 HANDLE_INSTRUCTION_START(NEW_ARRAY) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200565 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800566 Object* obj = AllocArrayFromCode<do_access_check, true>(
Andreas Gampe1cc7dba2014-12-17 18:43:01 -0800567 inst->VRegC_22c(), length, shadow_frame.GetMethod(), self,
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800568 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700569 if (UNLIKELY(obj == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200570 HANDLE_PENDING_EXCEPTION();
571 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200572 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200573 ADVANCE(2);
574 }
575 }
576 HANDLE_INSTRUCTION_END();
577
578 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100579 bool success =
580 DoFilledNewArray<false, do_access_check, transaction_active>(inst, shadow_frame,
581 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200582 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
583 }
584 HANDLE_INSTRUCTION_END();
585
586 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100587 bool success =
588 DoFilledNewArray<true, do_access_check, transaction_active>(inst, shadow_frame,
589 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200590 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
591 }
592 HANDLE_INSTRUCTION_END();
593
594 HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200595 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Ian Rogers832336b2014-10-08 15:35:22 -0700596 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
597 const Instruction::ArrayDataPayload* payload =
598 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
599 bool success = FillArrayData(obj, payload);
600 if (transaction_active && success) {
601 RecordArrayElementsInTransaction(obj->AsArray(), payload->element_count);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200602 }
Ian Rogers832336b2014-10-08 15:35:22 -0700603 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200604 }
605 HANDLE_INSTRUCTION_END();
606
607 HANDLE_INSTRUCTION_START(THROW) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200608 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700609 if (UNLIKELY(exception == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000610 ThrowNullPointerException("throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700611 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
612 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700613 std::string temp;
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000614 self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700615 "Throwing '%s' that is not instance of Throwable",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700616 exception->GetClass()->GetDescriptor(&temp));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200617 } else {
Nicolas Geoffray14691c52015-03-05 10:40:17 +0000618 self->SetException(exception->AsThrowable());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200619 }
620 HANDLE_PENDING_EXCEPTION();
621 }
622 HANDLE_INSTRUCTION_END();
623
624 HANDLE_INSTRUCTION_START(GOTO) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200625 int8_t offset = inst->VRegA_10t(inst_data);
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000626 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200627 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200628 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700629 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200630 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200631 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200632 }
633 ADVANCE(offset);
634 }
635 HANDLE_INSTRUCTION_END();
636
637 HANDLE_INSTRUCTION_START(GOTO_16) {
638 int16_t offset = inst->VRegA_20t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000639 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200640 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200641 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700642 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200643 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200644 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200645 }
646 ADVANCE(offset);
647 }
648 HANDLE_INSTRUCTION_END();
649
650 HANDLE_INSTRUCTION_START(GOTO_32) {
651 int32_t offset = inst->VRegA_30t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000652 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200653 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200654 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700655 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200656 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200657 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200658 }
659 ADVANCE(offset);
660 }
661 HANDLE_INSTRUCTION_END();
662
663 HANDLE_INSTRUCTION_START(PACKED_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200664 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000665 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200666 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200667 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700668 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200669 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200670 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200671 }
672 ADVANCE(offset);
673 }
674 HANDLE_INSTRUCTION_END();
675
676 HANDLE_INSTRUCTION_START(SPARSE_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200677 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000678 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200679 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200680 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700681 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200682 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200683 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200684 }
685 ADVANCE(offset);
686 }
687 HANDLE_INSTRUCTION_END();
688
Ian Rogers647b1a82014-10-10 11:02:11 -0700689#if defined(__clang__)
690#pragma clang diagnostic push
691#pragma clang diagnostic ignored "-Wfloat-equal"
692#endif
693
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200694 HANDLE_INSTRUCTION_START(CMPL_FLOAT) {
695 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
696 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
697 int32_t result;
698 if (val1 > val2) {
699 result = 1;
700 } else if (val1 == val2) {
701 result = 0;
702 } else {
703 result = -1;
704 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200705 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200706 ADVANCE(2);
707 }
708 HANDLE_INSTRUCTION_END();
709
710 HANDLE_INSTRUCTION_START(CMPG_FLOAT) {
711 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
712 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
713 int32_t result;
714 if (val1 < val2) {
715 result = -1;
716 } else if (val1 == val2) {
717 result = 0;
718 } else {
719 result = 1;
720 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200721 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200722 ADVANCE(2);
723 }
724 HANDLE_INSTRUCTION_END();
725
726 HANDLE_INSTRUCTION_START(CMPL_DOUBLE) {
727 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
728 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
729 int32_t result;
730 if (val1 > val2) {
731 result = 1;
732 } else if (val1 == val2) {
733 result = 0;
734 } else {
735 result = -1;
736 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200737 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200738 ADVANCE(2);
739 }
740 HANDLE_INSTRUCTION_END();
741
742 HANDLE_INSTRUCTION_START(CMPG_DOUBLE) {
743 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
744 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
745 int32_t result;
746 if (val1 < val2) {
747 result = -1;
748 } else if (val1 == val2) {
749 result = 0;
750 } else {
751 result = 1;
752 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200753 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200754 ADVANCE(2);
755 }
756 HANDLE_INSTRUCTION_END();
757
Ian Rogers647b1a82014-10-10 11:02:11 -0700758#if defined(__clang__)
759#pragma clang diagnostic pop
760#endif
761
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200762 HANDLE_INSTRUCTION_START(CMP_LONG) {
763 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
764 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
765 int32_t result;
766 if (val1 > val2) {
767 result = 1;
768 } else if (val1 == val2) {
769 result = 0;
770 } else {
771 result = -1;
772 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200773 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200774 ADVANCE(2);
775 }
776 HANDLE_INSTRUCTION_END();
777
778 HANDLE_INSTRUCTION_START(IF_EQ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200779 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200780 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000781 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200782 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200783 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700784 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200785 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200786 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200787 }
788 ADVANCE(offset);
789 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800790 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200791 ADVANCE(2);
792 }
793 }
794 HANDLE_INSTRUCTION_END();
795
796 HANDLE_INSTRUCTION_START(IF_NE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700797 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) !=
798 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200799 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000800 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200801 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200802 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700803 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200804 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200805 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200806 }
807 ADVANCE(offset);
808 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800809 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200810 ADVANCE(2);
811 }
812 }
813 HANDLE_INSTRUCTION_END();
814
815 HANDLE_INSTRUCTION_START(IF_LT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700816 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <
817 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200818 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000819 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200820 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200821 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700822 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200823 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200824 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200825 }
826 ADVANCE(offset);
827 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800828 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200829 ADVANCE(2);
830 }
831 }
832 HANDLE_INSTRUCTION_END();
833
834 HANDLE_INSTRUCTION_START(IF_GE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700835 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >=
836 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200837 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000838 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200839 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200840 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700841 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200842 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200843 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200844 }
845 ADVANCE(offset);
846 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800847 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200848 ADVANCE(2);
849 }
850 }
851 HANDLE_INSTRUCTION_END();
852
853 HANDLE_INSTRUCTION_START(IF_GT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700854 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >
855 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200856 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000857 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200858 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200859 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700860 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200861 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200862 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200863 }
864 ADVANCE(offset);
865 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800866 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200867 ADVANCE(2);
868 }
869 }
870 HANDLE_INSTRUCTION_END();
871
872 HANDLE_INSTRUCTION_START(IF_LE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700873 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <=
874 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200875 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000876 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200877 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200878 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700879 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200880 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200881 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200882 }
883 ADVANCE(offset);
884 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800885 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200886 ADVANCE(2);
887 }
888 }
889 HANDLE_INSTRUCTION_END();
890
891 HANDLE_INSTRUCTION_START(IF_EQZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200892 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200893 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000894 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200895 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200896 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700897 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200898 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200899 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200900 }
901 ADVANCE(offset);
902 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800903 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200904 ADVANCE(2);
905 }
906 }
907 HANDLE_INSTRUCTION_END();
908
909 HANDLE_INSTRUCTION_START(IF_NEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200910 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200911 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000912 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200913 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200914 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700915 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200916 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200917 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200918 }
919 ADVANCE(offset);
920 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800921 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200922 ADVANCE(2);
923 }
924 }
925 HANDLE_INSTRUCTION_END();
926
927 HANDLE_INSTRUCTION_START(IF_LTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200928 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200929 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000930 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200931 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200932 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700933 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200934 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200935 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200936 }
937 ADVANCE(offset);
938 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800939 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200940 ADVANCE(2);
941 }
942 }
943 HANDLE_INSTRUCTION_END();
944
945 HANDLE_INSTRUCTION_START(IF_GEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200946 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200947 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000948 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200949 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200950 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700951 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200952 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200953 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200954 }
955 ADVANCE(offset);
956 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800957 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200958 ADVANCE(2);
959 }
960 }
961 HANDLE_INSTRUCTION_END();
962
963 HANDLE_INSTRUCTION_START(IF_GTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200964 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200965 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000966 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200967 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200968 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700969 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200970 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200971 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200972 }
973 ADVANCE(offset);
974 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800975 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200976 ADVANCE(2);
977 }
978 }
979 HANDLE_INSTRUCTION_END();
980
981 HANDLE_INSTRUCTION_START(IF_LEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200982 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200983 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000984 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200985 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200986 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700987 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200988 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200989 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200990 }
991 ADVANCE(offset);
992 } else {
buzbeef1dcacc2016-02-24 14:24:24 -0800993 BRANCH_INSTRUMENTATION(2);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200994 ADVANCE(2);
995 }
996 }
997 HANDLE_INSTRUCTION_END();
998
999 HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
1000 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001001 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001002 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001003 HANDLE_PENDING_EXCEPTION();
1004 } else {
1005 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1006 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001007 if (LIKELY(array->CheckIsValidIndex(index))) {
1008 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001009 ADVANCE(2);
1010 } else {
1011 HANDLE_PENDING_EXCEPTION();
1012 }
1013 }
1014 }
1015 HANDLE_INSTRUCTION_END();
1016
1017 HANDLE_INSTRUCTION_START(AGET_BYTE) {
1018 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001019 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001020 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001021 HANDLE_PENDING_EXCEPTION();
1022 } else {
1023 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1024 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001025 if (LIKELY(array->CheckIsValidIndex(index))) {
1026 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001027 ADVANCE(2);
1028 } else {
1029 HANDLE_PENDING_EXCEPTION();
1030 }
1031 }
1032 }
1033 HANDLE_INSTRUCTION_END();
1034
1035 HANDLE_INSTRUCTION_START(AGET_CHAR) {
1036 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001037 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001038 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001039 HANDLE_PENDING_EXCEPTION();
1040 } else {
1041 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1042 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001043 if (LIKELY(array->CheckIsValidIndex(index))) {
1044 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001045 ADVANCE(2);
1046 } else {
1047 HANDLE_PENDING_EXCEPTION();
1048 }
1049 }
1050 }
1051 HANDLE_INSTRUCTION_END();
1052
1053 HANDLE_INSTRUCTION_START(AGET_SHORT) {
1054 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001055 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001056 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001057 HANDLE_PENDING_EXCEPTION();
1058 } else {
1059 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1060 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001061 if (LIKELY(array->CheckIsValidIndex(index))) {
1062 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001063 ADVANCE(2);
1064 } else {
1065 HANDLE_PENDING_EXCEPTION();
1066 }
1067 }
1068 }
1069 HANDLE_INSTRUCTION_END();
1070
1071 HANDLE_INSTRUCTION_START(AGET) {
1072 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001073 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001074 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001075 HANDLE_PENDING_EXCEPTION();
1076 } else {
1077 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartiere401d142015-04-22 13:56:20 -07001078 DCHECK(a->IsIntArray() || a->IsFloatArray()) << PrettyTypeOf(a);
1079 auto* array = down_cast<IntArray*>(a);
Sebastien Hertzabff6432014-01-27 18:01:39 +01001080 if (LIKELY(array->CheckIsValidIndex(index))) {
1081 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001082 ADVANCE(2);
1083 } else {
1084 HANDLE_PENDING_EXCEPTION();
1085 }
1086 }
1087 }
1088 HANDLE_INSTRUCTION_END();
1089
1090 HANDLE_INSTRUCTION_START(AGET_WIDE) {
1091 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001092 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001093 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001094 HANDLE_PENDING_EXCEPTION();
1095 } else {
1096 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartiere401d142015-04-22 13:56:20 -07001097 DCHECK(a->IsLongArray() || a->IsDoubleArray()) << PrettyTypeOf(a);
1098 auto* array = down_cast<LongArray*>(a);
Sebastien Hertzabff6432014-01-27 18:01:39 +01001099 if (LIKELY(array->CheckIsValidIndex(index))) {
1100 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001101 ADVANCE(2);
1102 } else {
1103 HANDLE_PENDING_EXCEPTION();
1104 }
1105 }
1106 }
1107 HANDLE_INSTRUCTION_END();
1108
1109 HANDLE_INSTRUCTION_START(AGET_OBJECT) {
1110 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001111 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001112 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001113 HANDLE_PENDING_EXCEPTION();
1114 } else {
1115 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1116 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001117 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001118 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001119 ADVANCE(2);
1120 } else {
1121 HANDLE_PENDING_EXCEPTION();
1122 }
1123 }
1124 }
1125 HANDLE_INSTRUCTION_END();
1126
1127 HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
1128 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001129 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001130 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001131 HANDLE_PENDING_EXCEPTION();
1132 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001133 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001134 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1135 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001136 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001137 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001138 ADVANCE(2);
1139 } else {
1140 HANDLE_PENDING_EXCEPTION();
1141 }
1142 }
1143 }
1144 HANDLE_INSTRUCTION_END();
1145
1146 HANDLE_INSTRUCTION_START(APUT_BYTE) {
1147 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001148 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001149 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001150 HANDLE_PENDING_EXCEPTION();
1151 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001152 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001153 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1154 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001155 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001156 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001157 ADVANCE(2);
1158 } else {
1159 HANDLE_PENDING_EXCEPTION();
1160 }
1161 }
1162 }
1163 HANDLE_INSTRUCTION_END();
1164
1165 HANDLE_INSTRUCTION_START(APUT_CHAR) {
1166 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001167 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001168 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001169 HANDLE_PENDING_EXCEPTION();
1170 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001171 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001172 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1173 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001174 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001175 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001176 ADVANCE(2);
1177 } else {
1178 HANDLE_PENDING_EXCEPTION();
1179 }
1180 }
1181 }
1182 HANDLE_INSTRUCTION_END();
1183
1184 HANDLE_INSTRUCTION_START(APUT_SHORT) {
1185 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001186 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001187 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001188 HANDLE_PENDING_EXCEPTION();
1189 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001190 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001191 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1192 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001193 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001194 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001195 ADVANCE(2);
1196 } else {
1197 HANDLE_PENDING_EXCEPTION();
1198 }
1199 }
1200 }
1201 HANDLE_INSTRUCTION_END();
1202
1203 HANDLE_INSTRUCTION_START(APUT) {
1204 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001205 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001206 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001207 HANDLE_PENDING_EXCEPTION();
1208 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001209 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001210 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartiere401d142015-04-22 13:56:20 -07001211 DCHECK(a->IsIntArray() || a->IsFloatArray()) << PrettyTypeOf(a);
1212 auto* array = down_cast<IntArray*>(a);
Sebastien Hertzabff6432014-01-27 18:01:39 +01001213 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001214 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001215 ADVANCE(2);
1216 } else {
1217 HANDLE_PENDING_EXCEPTION();
1218 }
1219 }
1220 }
1221 HANDLE_INSTRUCTION_END();
1222
1223 HANDLE_INSTRUCTION_START(APUT_WIDE) {
1224 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001225 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001226 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001227 HANDLE_PENDING_EXCEPTION();
1228 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001229 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001230 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartiere401d142015-04-22 13:56:20 -07001231 DCHECK(a->IsLongArray() || a->IsDoubleArray()) << PrettyTypeOf(a);
1232 auto* array = down_cast<LongArray*>(a);
Sebastien Hertzabff6432014-01-27 18:01:39 +01001233 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001234 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001235 ADVANCE(2);
1236 } else {
1237 HANDLE_PENDING_EXCEPTION();
1238 }
1239 }
1240 }
1241 HANDLE_INSTRUCTION_END();
1242
1243 HANDLE_INSTRUCTION_START(APUT_OBJECT) {
1244 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001245 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001246 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001247 HANDLE_PENDING_EXCEPTION();
1248 } else {
1249 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001250 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001251 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001252 if (LIKELY(array->CheckIsValidIndex(index) && array->CheckAssignable(val))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001253 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001254 ADVANCE(2);
1255 } else {
1256 HANDLE_PENDING_EXCEPTION();
1257 }
1258 }
1259 }
1260 HANDLE_INSTRUCTION_END();
1261
1262 HANDLE_INSTRUCTION_START(IGET_BOOLEAN) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001263 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(
1264 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001265 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1266 }
1267 HANDLE_INSTRUCTION_END();
1268
1269 HANDLE_INSTRUCTION_START(IGET_BYTE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001270 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(
1271 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001272 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1273 }
1274 HANDLE_INSTRUCTION_END();
1275
1276 HANDLE_INSTRUCTION_START(IGET_CHAR) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001277 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(
1278 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001279 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1280 }
1281 HANDLE_INSTRUCTION_END();
1282
1283 HANDLE_INSTRUCTION_START(IGET_SHORT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001284 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(
1285 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001286 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1287 }
1288 HANDLE_INSTRUCTION_END();
1289
1290 HANDLE_INSTRUCTION_START(IGET) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001291 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(
1292 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001293 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1294 }
1295 HANDLE_INSTRUCTION_END();
1296
1297 HANDLE_INSTRUCTION_START(IGET_WIDE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001298 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(
1299 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001300 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1301 }
1302 HANDLE_INSTRUCTION_END();
1303
1304 HANDLE_INSTRUCTION_START(IGET_OBJECT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001305 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(
1306 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001307 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1308 }
1309 HANDLE_INSTRUCTION_END();
1310
1311 HANDLE_INSTRUCTION_START(IGET_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001312 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001313 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1314 }
1315 HANDLE_INSTRUCTION_END();
1316
Mathieu Chartierffc605c2014-12-10 10:35:44 -08001317 HANDLE_INSTRUCTION_START(IGET_BOOLEAN_QUICK) {
1318 bool success = DoIGetQuick<Primitive::kPrimBoolean>(shadow_frame, inst, inst_data);
1319 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1320 }
1321 HANDLE_INSTRUCTION_END();
1322
1323 HANDLE_INSTRUCTION_START(IGET_BYTE_QUICK) {
1324 bool success = DoIGetQuick<Primitive::kPrimByte>(shadow_frame, inst, inst_data);
1325 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1326 }
1327 HANDLE_INSTRUCTION_END();
1328
1329 HANDLE_INSTRUCTION_START(IGET_CHAR_QUICK) {
1330 bool success = DoIGetQuick<Primitive::kPrimChar>(shadow_frame, inst, inst_data);
1331 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1332 }
1333 HANDLE_INSTRUCTION_END();
1334
1335 HANDLE_INSTRUCTION_START(IGET_SHORT_QUICK) {
1336 bool success = DoIGetQuick<Primitive::kPrimShort>(shadow_frame, inst, inst_data);
1337 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1338 }
1339 HANDLE_INSTRUCTION_END();
1340
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001341 HANDLE_INSTRUCTION_START(IGET_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001342 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001343 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1344 }
1345 HANDLE_INSTRUCTION_END();
1346
1347 HANDLE_INSTRUCTION_START(IGET_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001348 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001349 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1350 }
1351 HANDLE_INSTRUCTION_END();
1352
1353 HANDLE_INSTRUCTION_START(SGET_BOOLEAN) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001354 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(
1355 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001356 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1357 }
1358 HANDLE_INSTRUCTION_END();
1359
1360 HANDLE_INSTRUCTION_START(SGET_BYTE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001361 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(
1362 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(SGET_CHAR) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001368 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(
1369 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001370 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1371 }
1372 HANDLE_INSTRUCTION_END();
1373
1374 HANDLE_INSTRUCTION_START(SGET_SHORT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001375 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(
1376 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001377 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1378 }
1379 HANDLE_INSTRUCTION_END();
1380
1381 HANDLE_INSTRUCTION_START(SGET) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001382 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(
1383 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001384 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1385 }
1386 HANDLE_INSTRUCTION_END();
1387
1388 HANDLE_INSTRUCTION_START(SGET_WIDE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001389 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(
1390 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001391 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1392 }
1393 HANDLE_INSTRUCTION_END();
1394
1395 HANDLE_INSTRUCTION_START(SGET_OBJECT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001396 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(
1397 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001398 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1399 }
1400 HANDLE_INSTRUCTION_END();
1401
1402 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001403 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check,
1404 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001405 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1406 }
1407 HANDLE_INSTRUCTION_END();
1408
1409 HANDLE_INSTRUCTION_START(IPUT_BYTE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001410 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check,
1411 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001412 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1413 }
1414 HANDLE_INSTRUCTION_END();
1415
1416 HANDLE_INSTRUCTION_START(IPUT_CHAR) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001417 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check,
1418 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001419 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1420 }
1421 HANDLE_INSTRUCTION_END();
1422
1423 HANDLE_INSTRUCTION_START(IPUT_SHORT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001424 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check,
1425 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001426 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1427 }
1428 HANDLE_INSTRUCTION_END();
1429
1430 HANDLE_INSTRUCTION_START(IPUT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001431 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check,
1432 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001433 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1434 }
1435 HANDLE_INSTRUCTION_END();
1436
1437 HANDLE_INSTRUCTION_START(IPUT_WIDE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001438 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check,
1439 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001440 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1441 }
1442 HANDLE_INSTRUCTION_END();
1443
1444 HANDLE_INSTRUCTION_START(IPUT_OBJECT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001445 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check,
1446 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(IPUT_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001452 bool success = DoIPutQuick<Primitive::kPrimInt, transaction_active>(
1453 shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001454 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1455 }
1456 HANDLE_INSTRUCTION_END();
1457
Fred Shih37f05ef2014-07-16 18:38:08 -07001458 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001459 bool success = DoIPutQuick<Primitive::kPrimBoolean, transaction_active>(
1460 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001461 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1462 }
1463 HANDLE_INSTRUCTION_END();
1464
1465 HANDLE_INSTRUCTION_START(IPUT_BYTE_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001466 bool success = DoIPutQuick<Primitive::kPrimByte, transaction_active>(
1467 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001468 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1469 }
1470 HANDLE_INSTRUCTION_END();
1471
1472 HANDLE_INSTRUCTION_START(IPUT_CHAR_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001473 bool success = DoIPutQuick<Primitive::kPrimChar, transaction_active>(
1474 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001475 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1476 }
1477 HANDLE_INSTRUCTION_END();
1478
1479 HANDLE_INSTRUCTION_START(IPUT_SHORT_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001480 bool success = DoIPutQuick<Primitive::kPrimShort, transaction_active>(
1481 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001482 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1483 }
1484 HANDLE_INSTRUCTION_END();
1485
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001486 HANDLE_INSTRUCTION_START(IPUT_WIDE_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001487 bool success = DoIPutQuick<Primitive::kPrimLong, transaction_active>(
1488 shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001489 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1490 }
1491 HANDLE_INSTRUCTION_END();
1492
1493 HANDLE_INSTRUCTION_START(IPUT_OBJECT_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001494 bool success = DoIPutQuick<Primitive::kPrimNot, transaction_active>(
1495 shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001496 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1497 }
1498 HANDLE_INSTRUCTION_END();
1499
1500 HANDLE_INSTRUCTION_START(SPUT_BOOLEAN) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001501 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check,
1502 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001503 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1504 }
1505 HANDLE_INSTRUCTION_END();
1506
1507 HANDLE_INSTRUCTION_START(SPUT_BYTE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001508 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check,
1509 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001510 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1511 }
1512 HANDLE_INSTRUCTION_END();
1513
1514 HANDLE_INSTRUCTION_START(SPUT_CHAR) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001515 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check,
1516 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001517 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1518 }
1519 HANDLE_INSTRUCTION_END();
1520
1521 HANDLE_INSTRUCTION_START(SPUT_SHORT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001522 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check,
1523 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001524 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1525 }
1526 HANDLE_INSTRUCTION_END();
1527
1528 HANDLE_INSTRUCTION_START(SPUT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001529 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check,
1530 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001531 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1532 }
1533 HANDLE_INSTRUCTION_END();
1534
1535 HANDLE_INSTRUCTION_START(SPUT_WIDE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001536 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check,
1537 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001538 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1539 }
1540 HANDLE_INSTRUCTION_END();
1541
1542 HANDLE_INSTRUCTION_START(SPUT_OBJECT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001543 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check,
1544 transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001545 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1546 }
1547 HANDLE_INSTRUCTION_END();
1548
1549 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001550 bool success = DoInvoke<kVirtual, false, do_access_check>(
1551 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001552 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001553 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1554 }
1555 HANDLE_INSTRUCTION_END();
1556
1557 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001558 bool success = DoInvoke<kVirtual, true, do_access_check>(
1559 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(INVOKE_SUPER) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001566 bool success = DoInvoke<kSuper, false, do_access_check>(
1567 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001568 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001569 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1570 }
1571 HANDLE_INSTRUCTION_END();
1572
1573 HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001574 bool success = DoInvoke<kSuper, true, do_access_check>(
1575 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001576 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001577 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1578 }
1579 HANDLE_INSTRUCTION_END();
1580
1581 HANDLE_INSTRUCTION_START(INVOKE_DIRECT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001582 bool success = DoInvoke<kDirect, false, do_access_check>(
1583 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001584 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001585 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1586 }
1587 HANDLE_INSTRUCTION_END();
1588
1589 HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001590 bool success = DoInvoke<kDirect, true, do_access_check>(
1591 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001592 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001593 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1594 }
1595 HANDLE_INSTRUCTION_END();
1596
1597 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001598 bool success = DoInvoke<kInterface, false, do_access_check>(
1599 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001600 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001601 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1602 }
1603 HANDLE_INSTRUCTION_END();
1604
1605 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001606 bool success = DoInvoke<kInterface, true, do_access_check>(
1607 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001608 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001609 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1610 }
1611 HANDLE_INSTRUCTION_END();
1612
1613 HANDLE_INSTRUCTION_START(INVOKE_STATIC) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001614 bool success = DoInvoke<kStatic, false, do_access_check>(
1615 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001616 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001617 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1618 }
1619 HANDLE_INSTRUCTION_END();
1620
1621 HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001622 bool success = DoInvoke<kStatic, true, do_access_check>(
1623 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001624 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001625 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1626 }
1627 HANDLE_INSTRUCTION_END();
1628
1629 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001630 bool success = DoInvokeVirtualQuick<false>(
1631 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001632 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001633 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1634 }
1635 HANDLE_INSTRUCTION_END();
1636
1637 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001638 bool success = DoInvokeVirtualQuick<true>(
1639 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001640 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001641 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1642 }
1643 HANDLE_INSTRUCTION_END();
1644
Igor Murashkin158f35c2015-06-10 15:55:30 -07001645 HANDLE_EXPERIMENTAL_INSTRUCTION_START(INVOKE_LAMBDA) {
1646 bool success = DoInvokeLambda<do_access_check>(self, shadow_frame, inst, inst_data,
1647 &result_register);
1648 UPDATE_HANDLER_TABLE();
1649 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1650 }
1651 HANDLE_EXPERIMENTAL_INSTRUCTION_END();
1652
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001653 HANDLE_INSTRUCTION_START(NEG_INT)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001654 shadow_frame.SetVReg(
1655 inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001656 ADVANCE(1);
1657 HANDLE_INSTRUCTION_END();
1658
1659 HANDLE_INSTRUCTION_START(NOT_INT)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001660 shadow_frame.SetVReg(
1661 inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001662 ADVANCE(1);
1663 HANDLE_INSTRUCTION_END();
1664
1665 HANDLE_INSTRUCTION_START(NEG_LONG)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001666 shadow_frame.SetVRegLong(
1667 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001668 ADVANCE(1);
1669 HANDLE_INSTRUCTION_END();
1670
1671 HANDLE_INSTRUCTION_START(NOT_LONG)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001672 shadow_frame.SetVRegLong(
1673 inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001674 ADVANCE(1);
1675 HANDLE_INSTRUCTION_END();
1676
1677 HANDLE_INSTRUCTION_START(NEG_FLOAT)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001678 shadow_frame.SetVRegFloat(
1679 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001680 ADVANCE(1);
1681 HANDLE_INSTRUCTION_END();
1682
1683 HANDLE_INSTRUCTION_START(NEG_DOUBLE)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001684 shadow_frame.SetVRegDouble(
1685 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001686 ADVANCE(1);
1687 HANDLE_INSTRUCTION_END();
1688
1689 HANDLE_INSTRUCTION_START(INT_TO_LONG)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001690 shadow_frame.SetVRegLong(
1691 inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001692 ADVANCE(1);
1693 HANDLE_INSTRUCTION_END();
1694
1695 HANDLE_INSTRUCTION_START(INT_TO_FLOAT)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001696 shadow_frame.SetVRegFloat(
1697 inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001698 ADVANCE(1);
1699 HANDLE_INSTRUCTION_END();
1700
1701 HANDLE_INSTRUCTION_START(INT_TO_DOUBLE)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001702 shadow_frame.SetVRegDouble(
1703 inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001704 ADVANCE(1);
1705 HANDLE_INSTRUCTION_END();
1706
1707 HANDLE_INSTRUCTION_START(LONG_TO_INT)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001708 shadow_frame.SetVReg(
1709 inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001710 ADVANCE(1);
1711 HANDLE_INSTRUCTION_END();
1712
1713 HANDLE_INSTRUCTION_START(LONG_TO_FLOAT)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001714 shadow_frame.SetVRegFloat(
1715 inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001716 ADVANCE(1);
1717 HANDLE_INSTRUCTION_END();
1718
1719 HANDLE_INSTRUCTION_START(LONG_TO_DOUBLE)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001720 shadow_frame.SetVRegDouble(
1721 inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001722 ADVANCE(1);
1723 HANDLE_INSTRUCTION_END();
1724
1725 HANDLE_INSTRUCTION_START(FLOAT_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001726 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001727 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001728 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001729 ADVANCE(1);
1730 }
1731 HANDLE_INSTRUCTION_END();
1732
1733 HANDLE_INSTRUCTION_START(FLOAT_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001734 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001735 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001736 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001737 ADVANCE(1);
1738 }
1739 HANDLE_INSTRUCTION_END();
1740
1741 HANDLE_INSTRUCTION_START(FLOAT_TO_DOUBLE)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001742 shadow_frame.SetVRegDouble(
1743 inst->VRegA_12x(inst_data), shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001744 ADVANCE(1);
1745 HANDLE_INSTRUCTION_END();
1746
1747 HANDLE_INSTRUCTION_START(DOUBLE_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001748 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001749 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001750 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001751 ADVANCE(1);
1752 }
1753 HANDLE_INSTRUCTION_END();
1754
1755 HANDLE_INSTRUCTION_START(DOUBLE_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001756 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001757 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001758 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001759 ADVANCE(1);
1760 }
1761 HANDLE_INSTRUCTION_END();
1762
1763 HANDLE_INSTRUCTION_START(DOUBLE_TO_FLOAT)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001764 shadow_frame.SetVRegFloat(
1765 inst->VRegA_12x(inst_data), shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001766 ADVANCE(1);
1767 HANDLE_INSTRUCTION_END();
1768
1769 HANDLE_INSTRUCTION_START(INT_TO_BYTE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001770 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1771 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001772 ADVANCE(1);
1773 HANDLE_INSTRUCTION_END();
1774
1775 HANDLE_INSTRUCTION_START(INT_TO_CHAR)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001776 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1777 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001778 ADVANCE(1);
1779 HANDLE_INSTRUCTION_END();
1780
1781 HANDLE_INSTRUCTION_START(INT_TO_SHORT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001782 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1783 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001784 ADVANCE(1);
1785 HANDLE_INSTRUCTION_END();
1786
1787 HANDLE_INSTRUCTION_START(ADD_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001788 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001789 SafeAdd(shadow_frame.GetVReg(inst->VRegB_23x()),
1790 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001791 ADVANCE(2);
1792 HANDLE_INSTRUCTION_END();
1793
1794 HANDLE_INSTRUCTION_START(SUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001795 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001796 SafeSub(shadow_frame.GetVReg(inst->VRegB_23x()),
1797 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001798 ADVANCE(2);
1799 HANDLE_INSTRUCTION_END();
1800
1801 HANDLE_INSTRUCTION_START(MUL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001802 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001803 SafeMul(shadow_frame.GetVReg(inst->VRegB_23x()),
1804 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001805 ADVANCE(2);
1806 HANDLE_INSTRUCTION_END();
1807
1808 HANDLE_INSTRUCTION_START(DIV_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001809 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
1810 shadow_frame.GetVReg(inst->VRegB_23x()),
1811 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001812 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1813 }
1814 HANDLE_INSTRUCTION_END();
1815
1816 HANDLE_INSTRUCTION_START(REM_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001817 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1818 shadow_frame.GetVReg(inst->VRegB_23x()),
1819 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001820 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1821 }
1822 HANDLE_INSTRUCTION_END();
1823
1824 HANDLE_INSTRUCTION_START(SHL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001825 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001826 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1827 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1828 ADVANCE(2);
1829 HANDLE_INSTRUCTION_END();
1830
1831 HANDLE_INSTRUCTION_START(SHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001832 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001833 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1834 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1835 ADVANCE(2);
1836 HANDLE_INSTRUCTION_END();
1837
1838 HANDLE_INSTRUCTION_START(USHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001839 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001840 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1841 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1842 ADVANCE(2);
1843 HANDLE_INSTRUCTION_END();
1844
1845 HANDLE_INSTRUCTION_START(AND_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001846 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001847 shadow_frame.GetVReg(inst->VRegB_23x()) &
1848 shadow_frame.GetVReg(inst->VRegC_23x()));
1849 ADVANCE(2);
1850 HANDLE_INSTRUCTION_END();
1851
1852 HANDLE_INSTRUCTION_START(OR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001853 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001854 shadow_frame.GetVReg(inst->VRegB_23x()) |
1855 shadow_frame.GetVReg(inst->VRegC_23x()));
1856 ADVANCE(2);
1857 HANDLE_INSTRUCTION_END();
1858
1859 HANDLE_INSTRUCTION_START(XOR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001860 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001861 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1862 shadow_frame.GetVReg(inst->VRegC_23x()));
1863 ADVANCE(2);
1864 HANDLE_INSTRUCTION_END();
1865
1866 HANDLE_INSTRUCTION_START(ADD_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001867 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001868 SafeAdd(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1869 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001870 ADVANCE(2);
1871 HANDLE_INSTRUCTION_END();
1872
1873 HANDLE_INSTRUCTION_START(SUB_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001874 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001875 SafeSub(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1876 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001877 ADVANCE(2);
1878 HANDLE_INSTRUCTION_END();
1879
1880 HANDLE_INSTRUCTION_START(MUL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001881 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001882 SafeMul(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1883 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001884 ADVANCE(2);
1885 HANDLE_INSTRUCTION_END();
1886
1887 HANDLE_INSTRUCTION_START(DIV_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001888 bool success = DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
1889 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1890 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001891 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1892 }
1893 HANDLE_INSTRUCTION_END();
1894
1895 HANDLE_INSTRUCTION_START(REM_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001896 bool success = DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1897 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1898 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001899 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1900 }
1901 HANDLE_INSTRUCTION_END();
1902
1903 HANDLE_INSTRUCTION_START(AND_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001904 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001905 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1906 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1907 ADVANCE(2);
1908 HANDLE_INSTRUCTION_END();
1909
1910 HANDLE_INSTRUCTION_START(OR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001911 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001912 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1913 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1914 ADVANCE(2);
1915 HANDLE_INSTRUCTION_END();
1916
1917 HANDLE_INSTRUCTION_START(XOR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001918 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001919 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1920 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1921 ADVANCE(2);
1922 HANDLE_INSTRUCTION_END();
1923
1924 HANDLE_INSTRUCTION_START(SHL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001925 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001926 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1927 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1928 ADVANCE(2);
1929 HANDLE_INSTRUCTION_END();
1930
1931 HANDLE_INSTRUCTION_START(SHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001932 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001933 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1934 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1935 ADVANCE(2);
1936 HANDLE_INSTRUCTION_END();
1937
1938 HANDLE_INSTRUCTION_START(USHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001939 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001940 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1941 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1942 ADVANCE(2);
1943 HANDLE_INSTRUCTION_END();
1944
1945 HANDLE_INSTRUCTION_START(ADD_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001946 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001947 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1948 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1949 ADVANCE(2);
1950 HANDLE_INSTRUCTION_END();
1951
1952 HANDLE_INSTRUCTION_START(SUB_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001953 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001954 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1955 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1956 ADVANCE(2);
1957 HANDLE_INSTRUCTION_END();
1958
1959 HANDLE_INSTRUCTION_START(MUL_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001960 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001961 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1962 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1963 ADVANCE(2);
1964 HANDLE_INSTRUCTION_END();
1965
1966 HANDLE_INSTRUCTION_START(DIV_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001967 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001968 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1969 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1970 ADVANCE(2);
1971 HANDLE_INSTRUCTION_END();
1972
1973 HANDLE_INSTRUCTION_START(REM_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001974 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001975 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1976 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1977 ADVANCE(2);
1978 HANDLE_INSTRUCTION_END();
1979
1980 HANDLE_INSTRUCTION_START(ADD_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001981 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001982 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1983 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1984 ADVANCE(2);
1985 HANDLE_INSTRUCTION_END();
1986
1987 HANDLE_INSTRUCTION_START(SUB_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001988 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001989 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1990 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1991 ADVANCE(2);
1992 HANDLE_INSTRUCTION_END();
1993
1994 HANDLE_INSTRUCTION_START(MUL_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001995 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001996 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1997 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1998 ADVANCE(2);
1999 HANDLE_INSTRUCTION_END();
2000
2001 HANDLE_INSTRUCTION_START(DIV_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002002 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002003 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
2004 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
2005 ADVANCE(2);
2006 HANDLE_INSTRUCTION_END();
2007
2008 HANDLE_INSTRUCTION_START(REM_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002009 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002010 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
2011 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
2012 ADVANCE(2);
2013 HANDLE_INSTRUCTION_END();
2014
2015 HANDLE_INSTRUCTION_START(ADD_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002016 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002017 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002018 SafeAdd(shadow_frame.GetVReg(vregA),
2019 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002020 ADVANCE(1);
2021 }
2022 HANDLE_INSTRUCTION_END();
2023
2024 HANDLE_INSTRUCTION_START(SUB_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002025 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002026 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002027 SafeSub(shadow_frame.GetVReg(vregA),
2028 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002029 ADVANCE(1);
2030 }
2031 HANDLE_INSTRUCTION_END();
2032
2033 HANDLE_INSTRUCTION_START(MUL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002034 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002035 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002036 SafeMul(shadow_frame.GetVReg(vregA),
2037 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002038 ADVANCE(1);
2039 }
2040 HANDLE_INSTRUCTION_END();
2041
2042 HANDLE_INSTRUCTION_START(DIV_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002043 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002044 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002045 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002046 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2047 }
2048 HANDLE_INSTRUCTION_END();
2049
2050 HANDLE_INSTRUCTION_START(REM_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002051 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002052 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002053 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002054 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2055 }
2056 HANDLE_INSTRUCTION_END();
2057
2058 HANDLE_INSTRUCTION_START(SHL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002059 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002060 shadow_frame.SetVReg(vregA,
2061 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002062 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002063 ADVANCE(1);
2064 }
2065 HANDLE_INSTRUCTION_END();
2066
2067 HANDLE_INSTRUCTION_START(SHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002068 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002069 shadow_frame.SetVReg(vregA,
2070 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002071 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002072 ADVANCE(1);
2073 }
2074 HANDLE_INSTRUCTION_END();
2075
2076 HANDLE_INSTRUCTION_START(USHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002077 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002078 shadow_frame.SetVReg(vregA,
2079 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002080 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002081 ADVANCE(1);
2082 }
2083 HANDLE_INSTRUCTION_END();
2084
2085 HANDLE_INSTRUCTION_START(AND_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002086 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002087 shadow_frame.SetVReg(vregA,
2088 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002089 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002090 ADVANCE(1);
2091 }
2092 HANDLE_INSTRUCTION_END();
2093
2094 HANDLE_INSTRUCTION_START(OR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002095 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002096 shadow_frame.SetVReg(vregA,
2097 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002098 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002099 ADVANCE(1);
2100 }
2101 HANDLE_INSTRUCTION_END();
2102
2103 HANDLE_INSTRUCTION_START(XOR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002104 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002105 shadow_frame.SetVReg(vregA,
2106 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002107 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002108 ADVANCE(1);
2109 }
2110 HANDLE_INSTRUCTION_END();
2111
2112 HANDLE_INSTRUCTION_START(ADD_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002113 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002114 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002115 SafeAdd(shadow_frame.GetVRegLong(vregA),
2116 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002117 ADVANCE(1);
2118 }
2119 HANDLE_INSTRUCTION_END();
2120
2121 HANDLE_INSTRUCTION_START(SUB_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002122 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002123 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002124 SafeSub(shadow_frame.GetVRegLong(vregA),
2125 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002126 ADVANCE(1);
2127 }
2128 HANDLE_INSTRUCTION_END();
2129
2130 HANDLE_INSTRUCTION_START(MUL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002131 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002132 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002133 SafeMul(shadow_frame.GetVRegLong(vregA),
2134 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002135 ADVANCE(1);
2136 }
2137 HANDLE_INSTRUCTION_END();
2138
2139 HANDLE_INSTRUCTION_START(DIV_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002140 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002141 bool success = DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002142 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002143 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2144 }
2145 HANDLE_INSTRUCTION_END();
2146
2147 HANDLE_INSTRUCTION_START(REM_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002148 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002149 bool success = DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002150 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002151 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2152 }
2153 HANDLE_INSTRUCTION_END();
2154
2155 HANDLE_INSTRUCTION_START(AND_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002156 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002157 shadow_frame.SetVRegLong(vregA,
2158 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002159 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002160 ADVANCE(1);
2161 }
2162 HANDLE_INSTRUCTION_END();
2163
2164 HANDLE_INSTRUCTION_START(OR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002165 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002166 shadow_frame.SetVRegLong(vregA,
2167 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002168 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002169 ADVANCE(1);
2170 }
2171 HANDLE_INSTRUCTION_END();
2172
2173 HANDLE_INSTRUCTION_START(XOR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002174 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002175 shadow_frame.SetVRegLong(vregA,
2176 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002177 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002178 ADVANCE(1);
2179 }
2180 HANDLE_INSTRUCTION_END();
2181
2182 HANDLE_INSTRUCTION_START(SHL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002183 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002184 shadow_frame.SetVRegLong(vregA,
2185 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002186 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002187 ADVANCE(1);
2188 }
2189 HANDLE_INSTRUCTION_END();
2190
2191 HANDLE_INSTRUCTION_START(SHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002192 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002193 shadow_frame.SetVRegLong(vregA,
2194 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002195 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002196 ADVANCE(1);
2197 }
2198 HANDLE_INSTRUCTION_END();
2199
2200 HANDLE_INSTRUCTION_START(USHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002201 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002202 shadow_frame.SetVRegLong(vregA,
2203 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002204 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002205 ADVANCE(1);
2206 }
2207 HANDLE_INSTRUCTION_END();
2208
2209 HANDLE_INSTRUCTION_START(ADD_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002210 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002211 shadow_frame.SetVRegFloat(vregA,
2212 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002213 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002214 ADVANCE(1);
2215 }
2216 HANDLE_INSTRUCTION_END();
2217
2218 HANDLE_INSTRUCTION_START(SUB_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002219 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002220 shadow_frame.SetVRegFloat(vregA,
2221 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002222 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002223 ADVANCE(1);
2224 }
2225 HANDLE_INSTRUCTION_END();
2226
2227 HANDLE_INSTRUCTION_START(MUL_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002228 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002229 shadow_frame.SetVRegFloat(vregA,
2230 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002231 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002232 ADVANCE(1);
2233 }
2234 HANDLE_INSTRUCTION_END();
2235
2236 HANDLE_INSTRUCTION_START(DIV_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002237 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002238 shadow_frame.SetVRegFloat(vregA,
2239 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002240 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002241 ADVANCE(1);
2242 }
2243 HANDLE_INSTRUCTION_END();
2244
2245 HANDLE_INSTRUCTION_START(REM_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002246 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002247 shadow_frame.SetVRegFloat(vregA,
2248 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002249 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002250 ADVANCE(1);
2251 }
2252 HANDLE_INSTRUCTION_END();
2253
2254 HANDLE_INSTRUCTION_START(ADD_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002255 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002256 shadow_frame.SetVRegDouble(vregA,
2257 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002258 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002259 ADVANCE(1);
2260 }
2261 HANDLE_INSTRUCTION_END();
2262
2263 HANDLE_INSTRUCTION_START(SUB_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002264 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002265 shadow_frame.SetVRegDouble(vregA,
2266 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002267 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002268 ADVANCE(1);
2269 }
2270 HANDLE_INSTRUCTION_END();
2271
2272 HANDLE_INSTRUCTION_START(MUL_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002273 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002274 shadow_frame.SetVRegDouble(vregA,
2275 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002276 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002277 ADVANCE(1);
2278 }
2279 HANDLE_INSTRUCTION_END();
2280
2281 HANDLE_INSTRUCTION_START(DIV_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002282 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002283 shadow_frame.SetVRegDouble(vregA,
2284 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002285 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002286 ADVANCE(1);
2287 }
2288 HANDLE_INSTRUCTION_END();
2289
2290 HANDLE_INSTRUCTION_START(REM_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002291 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002292 shadow_frame.SetVRegDouble(vregA,
2293 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002294 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002295 ADVANCE(1);
2296 }
2297 HANDLE_INSTRUCTION_END();
2298
2299 HANDLE_INSTRUCTION_START(ADD_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002300 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002301 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2302 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002303 ADVANCE(2);
2304 HANDLE_INSTRUCTION_END();
2305
2306 HANDLE_INSTRUCTION_START(RSUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002307 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002308 SafeSub(inst->VRegC_22s(),
2309 shadow_frame.GetVReg(inst->VRegB_22s(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002310 ADVANCE(2);
2311 HANDLE_INSTRUCTION_END();
2312
2313 HANDLE_INSTRUCTION_START(MUL_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002314 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002315 SafeMul(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2316 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002317 ADVANCE(2);
2318 HANDLE_INSTRUCTION_END();
2319
2320 HANDLE_INSTRUCTION_START(DIV_INT_LIT16) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07002321 bool success = DoIntDivide(
2322 shadow_frame, inst->VRegA_22s(inst_data), shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2323 inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002324 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2325 }
2326 HANDLE_INSTRUCTION_END();
2327
2328 HANDLE_INSTRUCTION_START(REM_INT_LIT16) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07002329 bool success = DoIntRemainder(
2330 shadow_frame, inst->VRegA_22s(inst_data), shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2331 inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002332 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2333 }
2334 HANDLE_INSTRUCTION_END();
2335
2336 HANDLE_INSTRUCTION_START(AND_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002337 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2338 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002339 inst->VRegC_22s());
2340 ADVANCE(2);
2341 HANDLE_INSTRUCTION_END();
2342
2343 HANDLE_INSTRUCTION_START(OR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002344 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2345 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002346 inst->VRegC_22s());
2347 ADVANCE(2);
2348 HANDLE_INSTRUCTION_END();
2349
2350 HANDLE_INSTRUCTION_START(XOR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002351 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2352 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002353 inst->VRegC_22s());
2354 ADVANCE(2);
2355 HANDLE_INSTRUCTION_END();
2356
2357 HANDLE_INSTRUCTION_START(ADD_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002358 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002359 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22b()),
2360 inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002361 ADVANCE(2);
2362 HANDLE_INSTRUCTION_END();
2363
2364 HANDLE_INSTRUCTION_START(RSUB_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002365 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002366 SafeSub(inst->VRegC_22b(),
2367 shadow_frame.GetVReg(inst->VRegB_22b())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002368 ADVANCE(2);
2369 HANDLE_INSTRUCTION_END();
2370
2371 HANDLE_INSTRUCTION_START(MUL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002372 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002373 SafeMul(shadow_frame.GetVReg(inst->VRegB_22b()),
2374 inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002375 ADVANCE(2);
2376 HANDLE_INSTRUCTION_END();
2377
2378 HANDLE_INSTRUCTION_START(DIV_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002379 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
2380 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002381 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2382 }
2383 HANDLE_INSTRUCTION_END();
2384
2385 HANDLE_INSTRUCTION_START(REM_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002386 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
2387 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002388 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2389 }
2390 HANDLE_INSTRUCTION_END();
2391
2392 HANDLE_INSTRUCTION_START(AND_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002393 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002394 shadow_frame.GetVReg(inst->VRegB_22b()) &
2395 inst->VRegC_22b());
2396 ADVANCE(2);
2397 HANDLE_INSTRUCTION_END();
2398
2399 HANDLE_INSTRUCTION_START(OR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002400 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002401 shadow_frame.GetVReg(inst->VRegB_22b()) |
2402 inst->VRegC_22b());
2403 ADVANCE(2);
2404 HANDLE_INSTRUCTION_END();
2405
2406 HANDLE_INSTRUCTION_START(XOR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002407 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002408 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2409 inst->VRegC_22b());
2410 ADVANCE(2);
2411 HANDLE_INSTRUCTION_END();
2412
2413 HANDLE_INSTRUCTION_START(SHL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002414 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002415 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2416 (inst->VRegC_22b() & 0x1f));
2417 ADVANCE(2);
2418 HANDLE_INSTRUCTION_END();
2419
2420 HANDLE_INSTRUCTION_START(SHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002421 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002422 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2423 (inst->VRegC_22b() & 0x1f));
2424 ADVANCE(2);
2425 HANDLE_INSTRUCTION_END();
2426
2427 HANDLE_INSTRUCTION_START(USHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002428 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002429 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2430 (inst->VRegC_22b() & 0x1f));
2431 ADVANCE(2);
2432 HANDLE_INSTRUCTION_END();
2433
Igor Murashkin158f35c2015-06-10 15:55:30 -07002434 HANDLE_EXPERIMENTAL_INSTRUCTION_START(CREATE_LAMBDA) {
Igor Murashkin6918bf12015-09-27 19:19:06 -07002435 if (lambda_closure_builder == nullptr) {
2436 // DoCreateLambda always needs a ClosureBuilder, even if it has 0 captured variables.
2437 lambda_closure_builder = MakeUnique<lambda::ClosureBuilder>();
2438 }
2439
2440 // TODO: these allocations should not leak, and the lambda method should not be local.
2441 lambda::Closure* lambda_closure =
2442 reinterpret_cast<lambda::Closure*>(alloca(lambda_closure_builder->GetSize()));
2443 bool success = DoCreateLambda<do_access_check>(self,
2444 inst,
2445 /*inout*/shadow_frame,
2446 /*inout*/lambda_closure_builder.get(),
2447 /*inout*/lambda_closure);
2448 lambda_closure_builder.reset(nullptr); // reset state of variables captured
Igor Murashkin158f35c2015-06-10 15:55:30 -07002449 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2450 }
2451 HANDLE_EXPERIMENTAL_INSTRUCTION_END();
2452
Igor Murashkin2ee54e22015-06-18 10:05:11 -07002453 HANDLE_EXPERIMENTAL_INSTRUCTION_START(BOX_LAMBDA) {
2454 bool success = DoBoxLambda<do_access_check>(self, shadow_frame, inst, inst_data);
2455 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2456 }
2457 HANDLE_EXPERIMENTAL_INSTRUCTION_END();
2458
2459 HANDLE_EXPERIMENTAL_INSTRUCTION_START(UNBOX_LAMBDA) {
2460 bool success = DoUnboxLambda<do_access_check>(self, shadow_frame, inst, inst_data);
2461 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2462 }
2463 HANDLE_EXPERIMENTAL_INSTRUCTION_END();
2464
Igor Murashkin6918bf12015-09-27 19:19:06 -07002465 HANDLE_EXPERIMENTAL_INSTRUCTION_START(CAPTURE_VARIABLE) {
2466 if (lambda_closure_builder == nullptr) {
2467 lambda_closure_builder = MakeUnique<lambda::ClosureBuilder>();
2468 }
2469
2470 bool success = DoCaptureVariable<do_access_check>(self,
2471 inst,
2472 /*inout*/shadow_frame,
2473 /*inout*/lambda_closure_builder.get());
2474
2475 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2476 }
2477 HANDLE_EXPERIMENTAL_INSTRUCTION_END();
2478
2479 HANDLE_EXPERIMENTAL_INSTRUCTION_START(LIBERATE_VARIABLE) {
2480 bool success = DoLiberateVariable<do_access_check>(self,
2481 inst,
2482 lambda_captured_variable_index,
2483 /*inout*/shadow_frame);
2484 // Temporarily only allow sequences of 'liberate-variable, liberate-variable, ...'
2485 lambda_captured_variable_index++;
2486 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2487 }
2488 HANDLE_EXPERIMENTAL_INSTRUCTION_END();
2489
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002490 HANDLE_INSTRUCTION_START(UNUSED_3E)
Ian Rogerse94652f2014-12-02 11:13:19 -08002491 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002492 HANDLE_INSTRUCTION_END();
2493
2494 HANDLE_INSTRUCTION_START(UNUSED_3F)
Ian Rogerse94652f2014-12-02 11:13:19 -08002495 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002496 HANDLE_INSTRUCTION_END();
2497
2498 HANDLE_INSTRUCTION_START(UNUSED_40)
Ian Rogerse94652f2014-12-02 11:13:19 -08002499 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002500 HANDLE_INSTRUCTION_END();
2501
2502 HANDLE_INSTRUCTION_START(UNUSED_41)
Ian Rogerse94652f2014-12-02 11:13:19 -08002503 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002504 HANDLE_INSTRUCTION_END();
2505
2506 HANDLE_INSTRUCTION_START(UNUSED_42)
Ian Rogerse94652f2014-12-02 11:13:19 -08002507 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002508 HANDLE_INSTRUCTION_END();
2509
2510 HANDLE_INSTRUCTION_START(UNUSED_43)
Ian Rogerse94652f2014-12-02 11:13:19 -08002511 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002512 HANDLE_INSTRUCTION_END();
2513
2514 HANDLE_INSTRUCTION_START(UNUSED_79)
Ian Rogerse94652f2014-12-02 11:13:19 -08002515 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002516 HANDLE_INSTRUCTION_END();
2517
2518 HANDLE_INSTRUCTION_START(UNUSED_7A)
Ian Rogerse94652f2014-12-02 11:13:19 -08002519 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002520 HANDLE_INSTRUCTION_END();
2521
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002522 HANDLE_INSTRUCTION_START(UNUSED_F4)
Ian Rogerse94652f2014-12-02 11:13:19 -08002523 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002524 HANDLE_INSTRUCTION_END();
2525
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002526 HANDLE_INSTRUCTION_START(UNUSED_FA)
Ian Rogerse94652f2014-12-02 11:13:19 -08002527 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002528 HANDLE_INSTRUCTION_END();
2529
2530 HANDLE_INSTRUCTION_START(UNUSED_FB)
Ian Rogerse94652f2014-12-02 11:13:19 -08002531 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002532 HANDLE_INSTRUCTION_END();
2533
2534 HANDLE_INSTRUCTION_START(UNUSED_FC)
Ian Rogerse94652f2014-12-02 11:13:19 -08002535 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002536 HANDLE_INSTRUCTION_END();
2537
2538 HANDLE_INSTRUCTION_START(UNUSED_FD)
Ian Rogerse94652f2014-12-02 11:13:19 -08002539 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002540 HANDLE_INSTRUCTION_END();
2541
2542 HANDLE_INSTRUCTION_START(UNUSED_FE)
Ian Rogerse94652f2014-12-02 11:13:19 -08002543 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002544 HANDLE_INSTRUCTION_END();
2545
2546 HANDLE_INSTRUCTION_START(UNUSED_FF)
Ian Rogerse94652f2014-12-02 11:13:19 -08002547 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002548 HANDLE_INSTRUCTION_END();
2549
2550 exception_pending_label: {
2551 CHECK(self->IsExceptionPending());
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002552 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -07002553 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002554 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002555 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002556 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc,
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002557 instrumentation);
2558 if (found_dex_pc == DexFile::kDexNoIndex) {
Andreas Gampe03ec9302015-08-27 17:41:47 -07002559 // Structured locking is to be enforced for abnormal termination, too.
2560 shadow_frame.GetLockCountData().CheckAllMonitorsReleasedOrThrow<do_assignability_check>(self);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002561 return JValue(); /* Handled in caller. */
2562 } else {
2563 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc);
2564 ADVANCE(displacement);
2565 }
2566 }
2567
Sebastien Hertz8379b222014-02-24 17:38:15 +01002568// Create alternative instruction handlers dedicated to instrumentation.
2569// Return instructions must not call Instrumentation::DexPcMovedEvent since they already call
2570// Instrumentation::MethodExited. This is to avoid posting debugger events twice for this location.
Sebastien Hertze713d932014-05-15 10:48:53 +02002571// Note: we do not use the kReturn instruction flag here (to test the instruction is a return). The
2572// compiler seems to not evaluate "(Instruction::FlagsOf(Instruction::code) & kReturn) != 0" to
2573// a constant condition that would remove the "if" statement so the test is free.
Sebastien Hertz9d6bf692015-04-10 12:12:33 +02002574#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
2575 alt_op_##code: { \
2576 Runtime* const runtime = Runtime::Current(); \
2577 const instrumentation::Instrumentation* instrumentation = runtime->GetInstrumentation(); \
2578 if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
2579 Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_); \
2580 instrumentation->DexPcMovedEvent(self, this_object, shadow_frame.GetMethod(), dex_pc); \
2581 } \
2582 UPDATE_HANDLER_TABLE(); \
2583 goto *handlersTable[instrumentation::kMainHandlerTable][Instruction::code]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002584 }
2585#include "dex_instruction_list.h"
2586 DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER)
2587#undef DEX_INSTRUCTION_LIST
2588#undef INSTRUMENTATION_INSTRUCTION_HANDLER
2589} // NOLINT(readability/fn_size)
2590
2591// Explicit definitions of ExecuteGotoImpl.
Mathieu Chartier90443472015-07-16 20:32:27 -07002592template SHARED_REQUIRES(Locks::mutator_lock_) HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002593JValue ExecuteGotoImpl<true, false>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002594 ShadowFrame& shadow_frame, JValue result_register);
Mathieu Chartier90443472015-07-16 20:32:27 -07002595template SHARED_REQUIRES(Locks::mutator_lock_) HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002596JValue ExecuteGotoImpl<false, false>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002597 ShadowFrame& shadow_frame, JValue result_register);
Mathieu Chartier90443472015-07-16 20:32:27 -07002598template SHARED_REQUIRES(Locks::mutator_lock_)
Ian Rogerse94652f2014-12-02 11:13:19 -08002599JValue ExecuteGotoImpl<true, true>(Thread* self, const DexFile::CodeItem* code_item,
2600 ShadowFrame& shadow_frame, JValue result_register);
Mathieu Chartier90443472015-07-16 20:32:27 -07002601template SHARED_REQUIRES(Locks::mutator_lock_)
Ian Rogerse94652f2014-12-02 11:13:19 -08002602JValue ExecuteGotoImpl<false, true>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002603 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002604
2605} // namespace interpreter
2606} // namespace art
Colin Crosse84e4f72015-03-18 14:01:19 -07002607
2608#endif