blob: ca8598e5e6196396de6c2f81c94c658e34b59b52 [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
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +000067#define BRANCH_INSTRUMENTATION(offset) \
68 do { \
69 ArtMethod* method = shadow_frame.GetMethod(); \
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080070 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation(); \
Nicolas Geoffrayb331feb2016-02-05 16:51:53 +000071 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 Hertzee1997a2013-09-19 14:47:09 +0200280 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200281 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200282 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200283 shadow_frame.GetMethod(), dex_pc,
284 result);
285 }
286 return result;
287 }
288 HANDLE_INSTRUCTION_END();
289
Mathieu Chartierd7cbf8a2015-03-19 12:43:20 -0700290 HANDLE_INSTRUCTION_START(RETURN_VOID) {
Hans Boehm30359612014-05-21 17:46:23 -0700291 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200292 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700293 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700294 HANDLE_MONITOR_CHECKS();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200295 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200296 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200297 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200298 shadow_frame.GetMethod(), dex_pc,
299 result);
300 }
301 return result;
302 }
303 HANDLE_INSTRUCTION_END();
304
305 HANDLE_INSTRUCTION_START(RETURN) {
306 JValue result;
307 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200308 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700309 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700310 HANDLE_MONITOR_CHECKS();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200311 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200312 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200313 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200314 shadow_frame.GetMethod(), dex_pc,
315 result);
316 }
317 return result;
318 }
319 HANDLE_INSTRUCTION_END();
320
321 HANDLE_INSTRUCTION_START(RETURN_WIDE) {
322 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200323 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700324 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700325 HANDLE_MONITOR_CHECKS();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200326 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200327 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200328 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200329 shadow_frame.GetMethod(), dex_pc,
330 result);
331 }
332 return result;
333 }
334 HANDLE_INSTRUCTION_END();
335
336 HANDLE_INSTRUCTION_START(RETURN_OBJECT) {
337 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700338 self->AllowThreadSuspension();
Andreas Gampe03ec9302015-08-27 17:41:47 -0700339 HANDLE_MONITOR_CHECKS();
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700340 const uint8_t vreg_index = inst->VRegA_11x(inst_data);
341 Object* obj_result = shadow_frame.GetVRegReference(vreg_index);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700342 if (do_assignability_check && obj_result != nullptr) {
Vladimir Marko05792b92015-08-03 11:56:49 +0100343 size_t pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize();
344 Class* return_type = shadow_frame.GetMethod()->GetReturnType(true /* resolve */,
345 pointer_size);
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700346 obj_result = shadow_frame.GetVRegReference(vreg_index);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700347 if (return_type == nullptr) {
Jeff Haoa3faaf42013-09-03 19:07:00 -0700348 // Return the pending exception.
349 HANDLE_PENDING_EXCEPTION();
350 }
351 if (!obj_result->VerifierInstanceOf(return_type)) {
352 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700353 std::string temp1, temp2;
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000354 self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700355 "Returning '%s' that is not instance of return type '%s'",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700356 obj_result->GetClass()->GetDescriptor(&temp1),
357 return_type->GetDescriptor(&temp2));
Jeff Haoa3faaf42013-09-03 19:07:00 -0700358 HANDLE_PENDING_EXCEPTION();
359 }
360 }
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700361 result.SetL(obj_result);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200362 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200363 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200364 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200365 shadow_frame.GetMethod(), dex_pc,
366 result);
367 }
368 return result;
369 }
370 HANDLE_INSTRUCTION_END();
371
372 HANDLE_INSTRUCTION_START(CONST_4) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200373 uint32_t dst = inst->VRegA_11n(inst_data);
374 int32_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200375 shadow_frame.SetVReg(dst, val);
376 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700377 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200378 }
379 ADVANCE(1);
380 }
381 HANDLE_INSTRUCTION_END();
382
383 HANDLE_INSTRUCTION_START(CONST_16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200384 uint32_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200385 int32_t val = inst->VRegB_21s();
386 shadow_frame.SetVReg(dst, val);
387 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700388 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200389 }
390 ADVANCE(2);
391 }
392 HANDLE_INSTRUCTION_END();
393
394 HANDLE_INSTRUCTION_START(CONST) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200395 uint32_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200396 int32_t val = inst->VRegB_31i();
397 shadow_frame.SetVReg(dst, val);
398 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700399 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200400 }
401 ADVANCE(3);
402 }
403 HANDLE_INSTRUCTION_END();
404
405 HANDLE_INSTRUCTION_START(CONST_HIGH16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200406 uint32_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200407 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
408 shadow_frame.SetVReg(dst, val);
409 if (val == 0) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700410 shadow_frame.SetVRegReference(dst, nullptr);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200411 }
412 ADVANCE(2);
413 }
414 HANDLE_INSTRUCTION_END();
415
416 HANDLE_INSTRUCTION_START(CONST_WIDE_16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200417 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200418 ADVANCE(2);
419 HANDLE_INSTRUCTION_END();
420
421 HANDLE_INSTRUCTION_START(CONST_WIDE_32)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200422 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200423 ADVANCE(3);
424 HANDLE_INSTRUCTION_END();
425
426 HANDLE_INSTRUCTION_START(CONST_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200427 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200428 ADVANCE(5);
429 HANDLE_INSTRUCTION_END();
430
431 HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200432 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200433 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
434 ADVANCE(2);
435 HANDLE_INSTRUCTION_END();
436
437 HANDLE_INSTRUCTION_START(CONST_STRING) {
Ian Rogers6786a582014-10-28 12:49:06 -0700438 String* s = ResolveString(self, shadow_frame, inst->VRegB_21c());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700439 if (UNLIKELY(s == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200440 HANDLE_PENDING_EXCEPTION();
441 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200442 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200443 ADVANCE(2);
444 }
445 }
446 HANDLE_INSTRUCTION_END();
447
448 HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
Ian Rogers6786a582014-10-28 12:49:06 -0700449 String* s = ResolveString(self, shadow_frame, inst->VRegB_31c());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700450 if (UNLIKELY(s == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200451 HANDLE_PENDING_EXCEPTION();
452 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200453 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200454 ADVANCE(3);
455 }
456 }
457 HANDLE_INSTRUCTION_END();
458
459 HANDLE_INSTRUCTION_START(CONST_CLASS) {
460 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
461 self, false, do_access_check);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700462 if (UNLIKELY(c == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200463 HANDLE_PENDING_EXCEPTION();
464 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200465 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200466 ADVANCE(2);
467 }
468 }
469 HANDLE_INSTRUCTION_END();
470
471 HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200472 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700473 if (UNLIKELY(obj == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000474 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200475 HANDLE_PENDING_EXCEPTION();
476 } else {
Andreas Gampe03ec9302015-08-27 17:41:47 -0700477 DoMonitorEnter<do_access_check>(self, &shadow_frame, obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200478 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
479 }
480 }
481 HANDLE_INSTRUCTION_END();
482
483 HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200484 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700485 if (UNLIKELY(obj == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000486 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200487 HANDLE_PENDING_EXCEPTION();
488 } else {
Andreas Gampe03ec9302015-08-27 17:41:47 -0700489 DoMonitorExit<do_access_check>(self, &shadow_frame, obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200490 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
491 }
492 }
493 HANDLE_INSTRUCTION_END();
494
495 HANDLE_INSTRUCTION_START(CHECK_CAST) {
496 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
497 self, false, do_access_check);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700498 if (UNLIKELY(c == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200499 HANDLE_PENDING_EXCEPTION();
500 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200501 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700502 if (UNLIKELY(obj != nullptr && !obj->InstanceOf(c))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200503 ThrowClassCastException(c, obj->GetClass());
504 HANDLE_PENDING_EXCEPTION();
505 } else {
506 ADVANCE(2);
507 }
508 }
509 }
510 HANDLE_INSTRUCTION_END();
511
512 HANDLE_INSTRUCTION_START(INSTANCE_OF) {
513 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
514 self, false, do_access_check);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700515 if (UNLIKELY(c == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200516 HANDLE_PENDING_EXCEPTION();
517 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200518 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700519 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != nullptr && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200520 ADVANCE(2);
521 }
522 }
523 HANDLE_INSTRUCTION_END();
524
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700525 HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200526 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700527 if (UNLIKELY(array == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000528 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200529 HANDLE_PENDING_EXCEPTION();
530 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200531 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200532 ADVANCE(1);
533 }
534 }
535 HANDLE_INSTRUCTION_END();
536
537 HANDLE_INSTRUCTION_START(NEW_INSTANCE) {
Jeff Hao848f70a2014-01-15 13:49:50 -0800538 Object* obj = nullptr;
539 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
540 self, false, do_access_check);
541 if (LIKELY(c != nullptr)) {
542 if (UNLIKELY(c->IsStringClass())) {
543 gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
544 mirror::SetStringCountVisitor visitor(0);
545 obj = String::Alloc<true>(self, 0, allocator_type, visitor);
546 } else {
547 obj = AllocObjectFromCode<do_access_check, true>(
548 inst->VRegB_21c(), shadow_frame.GetMethod(), self,
549 Runtime::Current()->GetHeap()->GetCurrentAllocator());
550 }
551 }
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700552 if (UNLIKELY(obj == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200553 HANDLE_PENDING_EXCEPTION();
554 } else {
Sebastien Hertz4e99b3d2014-06-24 14:35:40 +0200555 obj->GetClass()->AssertInitializedOrInitializingInThread(self);
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700556 // Don't allow finalizable objects to be allocated during a transaction since these can't be
557 // finalized without a started runtime.
558 if (transaction_active && obj->GetClass()->IsFinalizable()) {
Sebastien Hertz45b15972015-04-03 16:07:05 +0200559 AbortTransactionF(self, "Allocating finalizable object in transaction: %s",
560 PrettyTypeOf(obj).c_str());
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700561 HANDLE_PENDING_EXCEPTION();
562 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200563 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200564 ADVANCE(2);
565 }
566 }
567 HANDLE_INSTRUCTION_END();
568
569 HANDLE_INSTRUCTION_START(NEW_ARRAY) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200570 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800571 Object* obj = AllocArrayFromCode<do_access_check, true>(
Andreas Gampe1cc7dba2014-12-17 18:43:01 -0800572 inst->VRegC_22c(), length, shadow_frame.GetMethod(), self,
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800573 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700574 if (UNLIKELY(obj == nullptr)) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200575 HANDLE_PENDING_EXCEPTION();
576 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200577 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200578 ADVANCE(2);
579 }
580 }
581 HANDLE_INSTRUCTION_END();
582
583 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100584 bool success =
585 DoFilledNewArray<false, do_access_check, transaction_active>(inst, shadow_frame,
586 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200587 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
588 }
589 HANDLE_INSTRUCTION_END();
590
591 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100592 bool success =
593 DoFilledNewArray<true, do_access_check, transaction_active>(inst, shadow_frame,
594 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200595 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
596 }
597 HANDLE_INSTRUCTION_END();
598
599 HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200600 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Ian Rogers832336b2014-10-08 15:35:22 -0700601 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
602 const Instruction::ArrayDataPayload* payload =
603 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
604 bool success = FillArrayData(obj, payload);
605 if (transaction_active && success) {
606 RecordArrayElementsInTransaction(obj->AsArray(), payload->element_count);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200607 }
Ian Rogers832336b2014-10-08 15:35:22 -0700608 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200609 }
610 HANDLE_INSTRUCTION_END();
611
612 HANDLE_INSTRUCTION_START(THROW) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200613 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700614 if (UNLIKELY(exception == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000615 ThrowNullPointerException("throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700616 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
617 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700618 std::string temp;
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000619 self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700620 "Throwing '%s' that is not instance of Throwable",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700621 exception->GetClass()->GetDescriptor(&temp));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200622 } else {
Nicolas Geoffray14691c52015-03-05 10:40:17 +0000623 self->SetException(exception->AsThrowable());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200624 }
625 HANDLE_PENDING_EXCEPTION();
626 }
627 HANDLE_INSTRUCTION_END();
628
629 HANDLE_INSTRUCTION_START(GOTO) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200630 int8_t offset = inst->VRegA_10t(inst_data);
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000631 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200632 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200633 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700634 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200635 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200636 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200637 }
638 ADVANCE(offset);
639 }
640 HANDLE_INSTRUCTION_END();
641
642 HANDLE_INSTRUCTION_START(GOTO_16) {
643 int16_t offset = inst->VRegA_20t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000644 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200645 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200646 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700647 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200648 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200649 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200650 }
651 ADVANCE(offset);
652 }
653 HANDLE_INSTRUCTION_END();
654
655 HANDLE_INSTRUCTION_START(GOTO_32) {
656 int32_t offset = inst->VRegA_30t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000657 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200658 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200659 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700660 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200661 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200662 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200663 }
664 ADVANCE(offset);
665 }
666 HANDLE_INSTRUCTION_END();
667
668 HANDLE_INSTRUCTION_START(PACKED_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200669 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000670 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200671 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200672 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700673 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200674 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200675 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200676 }
677 ADVANCE(offset);
678 }
679 HANDLE_INSTRUCTION_END();
680
681 HANDLE_INSTRUCTION_START(SPARSE_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200682 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000683 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200684 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200685 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700686 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200687 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200688 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200689 }
690 ADVANCE(offset);
691 }
692 HANDLE_INSTRUCTION_END();
693
Ian Rogers647b1a82014-10-10 11:02:11 -0700694#if defined(__clang__)
695#pragma clang diagnostic push
696#pragma clang diagnostic ignored "-Wfloat-equal"
697#endif
698
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200699 HANDLE_INSTRUCTION_START(CMPL_FLOAT) {
700 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
701 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
702 int32_t result;
703 if (val1 > val2) {
704 result = 1;
705 } else if (val1 == val2) {
706 result = 0;
707 } else {
708 result = -1;
709 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200710 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200711 ADVANCE(2);
712 }
713 HANDLE_INSTRUCTION_END();
714
715 HANDLE_INSTRUCTION_START(CMPG_FLOAT) {
716 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
717 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
718 int32_t result;
719 if (val1 < val2) {
720 result = -1;
721 } else if (val1 == val2) {
722 result = 0;
723 } else {
724 result = 1;
725 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200726 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200727 ADVANCE(2);
728 }
729 HANDLE_INSTRUCTION_END();
730
731 HANDLE_INSTRUCTION_START(CMPL_DOUBLE) {
732 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
733 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
734 int32_t result;
735 if (val1 > val2) {
736 result = 1;
737 } else if (val1 == val2) {
738 result = 0;
739 } else {
740 result = -1;
741 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200742 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200743 ADVANCE(2);
744 }
745 HANDLE_INSTRUCTION_END();
746
747 HANDLE_INSTRUCTION_START(CMPG_DOUBLE) {
748 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
749 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
750 int32_t result;
751 if (val1 < val2) {
752 result = -1;
753 } else if (val1 == val2) {
754 result = 0;
755 } else {
756 result = 1;
757 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200758 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200759 ADVANCE(2);
760 }
761 HANDLE_INSTRUCTION_END();
762
Ian Rogers647b1a82014-10-10 11:02:11 -0700763#if defined(__clang__)
764#pragma clang diagnostic pop
765#endif
766
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200767 HANDLE_INSTRUCTION_START(CMP_LONG) {
768 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
769 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
770 int32_t result;
771 if (val1 > val2) {
772 result = 1;
773 } else if (val1 == val2) {
774 result = 0;
775 } else {
776 result = -1;
777 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200778 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200779 ADVANCE(2);
780 }
781 HANDLE_INSTRUCTION_END();
782
783 HANDLE_INSTRUCTION_START(IF_EQ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200784 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200785 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000786 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200787 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200788 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700789 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200790 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200791 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200792 }
793 ADVANCE(offset);
794 } else {
795 ADVANCE(2);
796 }
797 }
798 HANDLE_INSTRUCTION_END();
799
800 HANDLE_INSTRUCTION_START(IF_NE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700801 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) !=
802 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200803 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000804 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200805 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200806 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700807 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200808 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200809 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200810 }
811 ADVANCE(offset);
812 } else {
813 ADVANCE(2);
814 }
815 }
816 HANDLE_INSTRUCTION_END();
817
818 HANDLE_INSTRUCTION_START(IF_LT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700819 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <
820 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200821 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000822 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200823 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200824 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700825 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200826 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200827 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200828 }
829 ADVANCE(offset);
830 } else {
831 ADVANCE(2);
832 }
833 }
834 HANDLE_INSTRUCTION_END();
835
836 HANDLE_INSTRUCTION_START(IF_GE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700837 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >=
838 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200839 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000840 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200841 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200842 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700843 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200844 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200845 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200846 }
847 ADVANCE(offset);
848 } else {
849 ADVANCE(2);
850 }
851 }
852 HANDLE_INSTRUCTION_END();
853
854 HANDLE_INSTRUCTION_START(IF_GT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700855 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >
856 shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200857 int16_t offset = inst->VRegC_22t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000858 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200859 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200860 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700861 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200862 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200863 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200864 }
865 ADVANCE(offset);
866 } else {
867 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 {
885 ADVANCE(2);
886 }
887 }
888 HANDLE_INSTRUCTION_END();
889
890 HANDLE_INSTRUCTION_START(IF_EQZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200891 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200892 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000893 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200894 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200895 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700896 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200897 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200898 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200899 }
900 ADVANCE(offset);
901 } else {
902 ADVANCE(2);
903 }
904 }
905 HANDLE_INSTRUCTION_END();
906
907 HANDLE_INSTRUCTION_START(IF_NEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200908 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200909 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000910 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200911 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200912 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700913 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200914 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200915 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200916 }
917 ADVANCE(offset);
918 } else {
919 ADVANCE(2);
920 }
921 }
922 HANDLE_INSTRUCTION_END();
923
924 HANDLE_INSTRUCTION_START(IF_LTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200925 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200926 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000927 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200928 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200929 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700930 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200931 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200932 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200933 }
934 ADVANCE(offset);
935 } else {
936 ADVANCE(2);
937 }
938 }
939 HANDLE_INSTRUCTION_END();
940
941 HANDLE_INSTRUCTION_START(IF_GEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200942 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200943 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000944 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200945 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200946 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700947 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200948 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200949 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200950 }
951 ADVANCE(offset);
952 } else {
953 ADVANCE(2);
954 }
955 }
956 HANDLE_INSTRUCTION_END();
957
958 HANDLE_INSTRUCTION_START(IF_GTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200959 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200960 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000961 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200962 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200963 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700964 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200965 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200966 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200967 }
968 ADVANCE(offset);
969 } else {
970 ADVANCE(2);
971 }
972 }
973 HANDLE_INSTRUCTION_END();
974
975 HANDLE_INSTRUCTION_START(IF_LEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200976 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200977 int16_t offset = inst->VRegB_21t();
Nicolas Geoffray81f0f952016-01-20 16:25:19 +0000978 BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200979 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200980 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700981 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200982 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200983 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200984 }
985 ADVANCE(offset);
986 } else {
987 ADVANCE(2);
988 }
989 }
990 HANDLE_INSTRUCTION_END();
991
992 HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
993 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700994 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000995 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200996 HANDLE_PENDING_EXCEPTION();
997 } else {
998 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
999 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001000 if (LIKELY(array->CheckIsValidIndex(index))) {
1001 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001002 ADVANCE(2);
1003 } else {
1004 HANDLE_PENDING_EXCEPTION();
1005 }
1006 }
1007 }
1008 HANDLE_INSTRUCTION_END();
1009
1010 HANDLE_INSTRUCTION_START(AGET_BYTE) {
1011 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001012 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001013 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001014 HANDLE_PENDING_EXCEPTION();
1015 } else {
1016 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1017 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001018 if (LIKELY(array->CheckIsValidIndex(index))) {
1019 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001020 ADVANCE(2);
1021 } else {
1022 HANDLE_PENDING_EXCEPTION();
1023 }
1024 }
1025 }
1026 HANDLE_INSTRUCTION_END();
1027
1028 HANDLE_INSTRUCTION_START(AGET_CHAR) {
1029 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001030 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001031 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001032 HANDLE_PENDING_EXCEPTION();
1033 } else {
1034 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1035 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001036 if (LIKELY(array->CheckIsValidIndex(index))) {
1037 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001038 ADVANCE(2);
1039 } else {
1040 HANDLE_PENDING_EXCEPTION();
1041 }
1042 }
1043 }
1044 HANDLE_INSTRUCTION_END();
1045
1046 HANDLE_INSTRUCTION_START(AGET_SHORT) {
1047 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001048 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001049 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001050 HANDLE_PENDING_EXCEPTION();
1051 } else {
1052 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1053 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001054 if (LIKELY(array->CheckIsValidIndex(index))) {
1055 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001056 ADVANCE(2);
1057 } else {
1058 HANDLE_PENDING_EXCEPTION();
1059 }
1060 }
1061 }
1062 HANDLE_INSTRUCTION_END();
1063
1064 HANDLE_INSTRUCTION_START(AGET) {
1065 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001066 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001067 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001068 HANDLE_PENDING_EXCEPTION();
1069 } else {
1070 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartiere401d142015-04-22 13:56:20 -07001071 DCHECK(a->IsIntArray() || a->IsFloatArray()) << PrettyTypeOf(a);
1072 auto* array = down_cast<IntArray*>(a);
Sebastien Hertzabff6432014-01-27 18:01:39 +01001073 if (LIKELY(array->CheckIsValidIndex(index))) {
1074 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001075 ADVANCE(2);
1076 } else {
1077 HANDLE_PENDING_EXCEPTION();
1078 }
1079 }
1080 }
1081 HANDLE_INSTRUCTION_END();
1082
1083 HANDLE_INSTRUCTION_START(AGET_WIDE) {
1084 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001085 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001086 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001087 HANDLE_PENDING_EXCEPTION();
1088 } else {
1089 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartiere401d142015-04-22 13:56:20 -07001090 DCHECK(a->IsLongArray() || a->IsDoubleArray()) << PrettyTypeOf(a);
1091 auto* array = down_cast<LongArray*>(a);
Sebastien Hertzabff6432014-01-27 18:01:39 +01001092 if (LIKELY(array->CheckIsValidIndex(index))) {
1093 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001094 ADVANCE(2);
1095 } else {
1096 HANDLE_PENDING_EXCEPTION();
1097 }
1098 }
1099 }
1100 HANDLE_INSTRUCTION_END();
1101
1102 HANDLE_INSTRUCTION_START(AGET_OBJECT) {
1103 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001104 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001105 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001106 HANDLE_PENDING_EXCEPTION();
1107 } else {
1108 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1109 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001110 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001111 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001112 ADVANCE(2);
1113 } else {
1114 HANDLE_PENDING_EXCEPTION();
1115 }
1116 }
1117 }
1118 HANDLE_INSTRUCTION_END();
1119
1120 HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
1121 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001122 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001123 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001124 HANDLE_PENDING_EXCEPTION();
1125 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001126 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001127 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1128 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001129 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001130 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001131 ADVANCE(2);
1132 } else {
1133 HANDLE_PENDING_EXCEPTION();
1134 }
1135 }
1136 }
1137 HANDLE_INSTRUCTION_END();
1138
1139 HANDLE_INSTRUCTION_START(APUT_BYTE) {
1140 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001141 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001142 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001143 HANDLE_PENDING_EXCEPTION();
1144 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001145 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001146 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1147 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001148 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001149 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001150 ADVANCE(2);
1151 } else {
1152 HANDLE_PENDING_EXCEPTION();
1153 }
1154 }
1155 }
1156 HANDLE_INSTRUCTION_END();
1157
1158 HANDLE_INSTRUCTION_START(APUT_CHAR) {
1159 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001160 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001161 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001162 HANDLE_PENDING_EXCEPTION();
1163 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001164 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001165 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1166 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001167 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001168 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001169 ADVANCE(2);
1170 } else {
1171 HANDLE_PENDING_EXCEPTION();
1172 }
1173 }
1174 }
1175 HANDLE_INSTRUCTION_END();
1176
1177 HANDLE_INSTRUCTION_START(APUT_SHORT) {
1178 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001179 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001180 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001181 HANDLE_PENDING_EXCEPTION();
1182 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001183 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001184 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1185 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001186 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001187 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001188 ADVANCE(2);
1189 } else {
1190 HANDLE_PENDING_EXCEPTION();
1191 }
1192 }
1193 }
1194 HANDLE_INSTRUCTION_END();
1195
1196 HANDLE_INSTRUCTION_START(APUT) {
1197 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001198 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001199 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001200 HANDLE_PENDING_EXCEPTION();
1201 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001202 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001203 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartiere401d142015-04-22 13:56:20 -07001204 DCHECK(a->IsIntArray() || a->IsFloatArray()) << PrettyTypeOf(a);
1205 auto* array = down_cast<IntArray*>(a);
Sebastien Hertzabff6432014-01-27 18:01:39 +01001206 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001207 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001208 ADVANCE(2);
1209 } else {
1210 HANDLE_PENDING_EXCEPTION();
1211 }
1212 }
1213 }
1214 HANDLE_INSTRUCTION_END();
1215
1216 HANDLE_INSTRUCTION_START(APUT_WIDE) {
1217 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001218 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001219 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001220 HANDLE_PENDING_EXCEPTION();
1221 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001222 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001223 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Mathieu Chartiere401d142015-04-22 13:56:20 -07001224 DCHECK(a->IsLongArray() || a->IsDoubleArray()) << PrettyTypeOf(a);
1225 auto* array = down_cast<LongArray*>(a);
Sebastien Hertzabff6432014-01-27 18:01:39 +01001226 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001227 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001228 ADVANCE(2);
1229 } else {
1230 HANDLE_PENDING_EXCEPTION();
1231 }
1232 }
1233 }
1234 HANDLE_INSTRUCTION_END();
1235
1236 HANDLE_INSTRUCTION_START(APUT_OBJECT) {
1237 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001238 if (UNLIKELY(a == nullptr)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001239 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001240 HANDLE_PENDING_EXCEPTION();
1241 } else {
1242 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001243 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001244 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001245 if (LIKELY(array->CheckIsValidIndex(index) && array->CheckAssignable(val))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001246 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001247 ADVANCE(2);
1248 } else {
1249 HANDLE_PENDING_EXCEPTION();
1250 }
1251 }
1252 }
1253 HANDLE_INSTRUCTION_END();
1254
1255 HANDLE_INSTRUCTION_START(IGET_BOOLEAN) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001256 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(
1257 self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001258 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1259 }
1260 HANDLE_INSTRUCTION_END();
1261
1262 HANDLE_INSTRUCTION_START(IGET_BYTE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001263 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, 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_CHAR) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001270 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, 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_SHORT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001277 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, 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) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001284 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, 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_WIDE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001291 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, 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_OBJECT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001298 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, 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_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001305 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001306 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1307 }
1308 HANDLE_INSTRUCTION_END();
1309
Mathieu Chartierffc605c2014-12-10 10:35:44 -08001310 HANDLE_INSTRUCTION_START(IGET_BOOLEAN_QUICK) {
1311 bool success = DoIGetQuick<Primitive::kPrimBoolean>(shadow_frame, inst, inst_data);
1312 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1313 }
1314 HANDLE_INSTRUCTION_END();
1315
1316 HANDLE_INSTRUCTION_START(IGET_BYTE_QUICK) {
1317 bool success = DoIGetQuick<Primitive::kPrimByte>(shadow_frame, inst, inst_data);
1318 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1319 }
1320 HANDLE_INSTRUCTION_END();
1321
1322 HANDLE_INSTRUCTION_START(IGET_CHAR_QUICK) {
1323 bool success = DoIGetQuick<Primitive::kPrimChar>(shadow_frame, inst, inst_data);
1324 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1325 }
1326 HANDLE_INSTRUCTION_END();
1327
1328 HANDLE_INSTRUCTION_START(IGET_SHORT_QUICK) {
1329 bool success = DoIGetQuick<Primitive::kPrimShort>(shadow_frame, inst, inst_data);
1330 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1331 }
1332 HANDLE_INSTRUCTION_END();
1333
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001334 HANDLE_INSTRUCTION_START(IGET_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001335 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001336 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1337 }
1338 HANDLE_INSTRUCTION_END();
1339
1340 HANDLE_INSTRUCTION_START(IGET_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001341 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001342 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1343 }
1344 HANDLE_INSTRUCTION_END();
1345
1346 HANDLE_INSTRUCTION_START(SGET_BOOLEAN) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001347 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(
1348 self, 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_BYTE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001354 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, 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_CHAR) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001361 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, 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_SHORT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001368 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, 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) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001375 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, 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_WIDE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001382 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, 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_OBJECT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001389 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, 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(IPUT_BOOLEAN) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001396 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check,
1397 transaction_active>(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_BYTE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001403 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, 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_CHAR) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001410 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, 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_SHORT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001417 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, 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) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001424 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, 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_WIDE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001431 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, 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_OBJECT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001438 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, 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_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001445 bool success = DoIPutQuick<Primitive::kPrimInt, transaction_active>(
1446 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
Fred Shih37f05ef2014-07-16 18:38:08 -07001451 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001452 bool success = DoIPutQuick<Primitive::kPrimBoolean, transaction_active>(
1453 shadow_frame, inst, inst_data);
Fred Shih37f05ef2014-07-16 18:38:08 -07001454 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1455 }
1456 HANDLE_INSTRUCTION_END();
1457
1458 HANDLE_INSTRUCTION_START(IPUT_BYTE_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001459 bool success = DoIPutQuick<Primitive::kPrimByte, 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_CHAR_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001466 bool success = DoIPutQuick<Primitive::kPrimChar, 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_SHORT_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001473 bool success = DoIPutQuick<Primitive::kPrimShort, 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
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001479 HANDLE_INSTRUCTION_START(IPUT_WIDE_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001480 bool success = DoIPutQuick<Primitive::kPrimLong, transaction_active>(
1481 shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001482 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1483 }
1484 HANDLE_INSTRUCTION_END();
1485
1486 HANDLE_INSTRUCTION_START(IPUT_OBJECT_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001487 bool success = DoIPutQuick<Primitive::kPrimNot, 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(SPUT_BOOLEAN) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001494 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check,
1495 transaction_active>(self, 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_BYTE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001501 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, 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_CHAR) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001508 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, 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_SHORT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001515 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, 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) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001522 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, 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_WIDE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001529 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, 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_OBJECT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001536 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, 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(INVOKE_VIRTUAL) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001543 bool success = DoInvoke<kVirtual, false, do_access_check>(
1544 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001545 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001546 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1547 }
1548 HANDLE_INSTRUCTION_END();
1549
1550 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001551 bool success = DoInvoke<kVirtual, true, do_access_check>(
1552 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001553 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001554 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1555 }
1556 HANDLE_INSTRUCTION_END();
1557
1558 HANDLE_INSTRUCTION_START(INVOKE_SUPER) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001559 bool success = DoInvoke<kSuper, false, do_access_check>(
1560 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001561 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001562 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1563 }
1564 HANDLE_INSTRUCTION_END();
1565
1566 HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001567 bool success = DoInvoke<kSuper, true, do_access_check>(
1568 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001569 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001570 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1571 }
1572 HANDLE_INSTRUCTION_END();
1573
1574 HANDLE_INSTRUCTION_START(INVOKE_DIRECT) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001575 bool success = DoInvoke<kDirect, false, do_access_check>(
1576 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001577 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001578 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1579 }
1580 HANDLE_INSTRUCTION_END();
1581
1582 HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001583 bool success = DoInvoke<kDirect, true, do_access_check>(
1584 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001585 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001586 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1587 }
1588 HANDLE_INSTRUCTION_END();
1589
1590 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001591 bool success = DoInvoke<kInterface, false, do_access_check>(
1592 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001593 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001594 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1595 }
1596 HANDLE_INSTRUCTION_END();
1597
1598 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001599 bool success = DoInvoke<kInterface, true, do_access_check>(
1600 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001601 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001602 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1603 }
1604 HANDLE_INSTRUCTION_END();
1605
1606 HANDLE_INSTRUCTION_START(INVOKE_STATIC) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001607 bool success = DoInvoke<kStatic, false, do_access_check>(
1608 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001609 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001610 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1611 }
1612 HANDLE_INSTRUCTION_END();
1613
1614 HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001615 bool success = DoInvoke<kStatic, true, do_access_check>(
1616 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001617 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001618 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1619 }
1620 HANDLE_INSTRUCTION_END();
1621
1622 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001623 bool success = DoInvokeVirtualQuick<false>(
1624 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001625 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001626 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1627 }
1628 HANDLE_INSTRUCTION_END();
1629
1630 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001631 bool success = DoInvokeVirtualQuick<true>(
1632 self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001633 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001634 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1635 }
1636 HANDLE_INSTRUCTION_END();
1637
Igor Murashkin158f35c2015-06-10 15:55:30 -07001638 HANDLE_EXPERIMENTAL_INSTRUCTION_START(INVOKE_LAMBDA) {
1639 bool success = DoInvokeLambda<do_access_check>(self, shadow_frame, inst, inst_data,
1640 &result_register);
1641 UPDATE_HANDLER_TABLE();
1642 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1643 }
1644 HANDLE_EXPERIMENTAL_INSTRUCTION_END();
1645
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001646 HANDLE_INSTRUCTION_START(NEG_INT)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001647 shadow_frame.SetVReg(
1648 inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001649 ADVANCE(1);
1650 HANDLE_INSTRUCTION_END();
1651
1652 HANDLE_INSTRUCTION_START(NOT_INT)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001653 shadow_frame.SetVReg(
1654 inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001655 ADVANCE(1);
1656 HANDLE_INSTRUCTION_END();
1657
1658 HANDLE_INSTRUCTION_START(NEG_LONG)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001659 shadow_frame.SetVRegLong(
1660 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001661 ADVANCE(1);
1662 HANDLE_INSTRUCTION_END();
1663
1664 HANDLE_INSTRUCTION_START(NOT_LONG)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001665 shadow_frame.SetVRegLong(
1666 inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001667 ADVANCE(1);
1668 HANDLE_INSTRUCTION_END();
1669
1670 HANDLE_INSTRUCTION_START(NEG_FLOAT)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001671 shadow_frame.SetVRegFloat(
1672 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001673 ADVANCE(1);
1674 HANDLE_INSTRUCTION_END();
1675
1676 HANDLE_INSTRUCTION_START(NEG_DOUBLE)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001677 shadow_frame.SetVRegDouble(
1678 inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001679 ADVANCE(1);
1680 HANDLE_INSTRUCTION_END();
1681
1682 HANDLE_INSTRUCTION_START(INT_TO_LONG)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001683 shadow_frame.SetVRegLong(
1684 inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001685 ADVANCE(1);
1686 HANDLE_INSTRUCTION_END();
1687
1688 HANDLE_INSTRUCTION_START(INT_TO_FLOAT)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001689 shadow_frame.SetVRegFloat(
1690 inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001691 ADVANCE(1);
1692 HANDLE_INSTRUCTION_END();
1693
1694 HANDLE_INSTRUCTION_START(INT_TO_DOUBLE)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001695 shadow_frame.SetVRegDouble(
1696 inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001697 ADVANCE(1);
1698 HANDLE_INSTRUCTION_END();
1699
1700 HANDLE_INSTRUCTION_START(LONG_TO_INT)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001701 shadow_frame.SetVReg(
1702 inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001703 ADVANCE(1);
1704 HANDLE_INSTRUCTION_END();
1705
1706 HANDLE_INSTRUCTION_START(LONG_TO_FLOAT)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001707 shadow_frame.SetVRegFloat(
1708 inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001709 ADVANCE(1);
1710 HANDLE_INSTRUCTION_END();
1711
1712 HANDLE_INSTRUCTION_START(LONG_TO_DOUBLE)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001713 shadow_frame.SetVRegDouble(
1714 inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001715 ADVANCE(1);
1716 HANDLE_INSTRUCTION_END();
1717
1718 HANDLE_INSTRUCTION_START(FLOAT_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001719 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001720 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001721 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001722 ADVANCE(1);
1723 }
1724 HANDLE_INSTRUCTION_END();
1725
1726 HANDLE_INSTRUCTION_START(FLOAT_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001727 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001728 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001729 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001730 ADVANCE(1);
1731 }
1732 HANDLE_INSTRUCTION_END();
1733
1734 HANDLE_INSTRUCTION_START(FLOAT_TO_DOUBLE)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001735 shadow_frame.SetVRegDouble(
1736 inst->VRegA_12x(inst_data), shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001737 ADVANCE(1);
1738 HANDLE_INSTRUCTION_END();
1739
1740 HANDLE_INSTRUCTION_START(DOUBLE_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001741 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001742 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001743 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001744 ADVANCE(1);
1745 }
1746 HANDLE_INSTRUCTION_END();
1747
1748 HANDLE_INSTRUCTION_START(DOUBLE_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001749 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001750 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001751 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001752 ADVANCE(1);
1753 }
1754 HANDLE_INSTRUCTION_END();
1755
1756 HANDLE_INSTRUCTION_START(DOUBLE_TO_FLOAT)
Mathieu Chartier2cebb242015-04-21 16:50:40 -07001757 shadow_frame.SetVRegFloat(
1758 inst->VRegA_12x(inst_data), shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001759 ADVANCE(1);
1760 HANDLE_INSTRUCTION_END();
1761
1762 HANDLE_INSTRUCTION_START(INT_TO_BYTE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001763 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1764 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001765 ADVANCE(1);
1766 HANDLE_INSTRUCTION_END();
1767
1768 HANDLE_INSTRUCTION_START(INT_TO_CHAR)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001769 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1770 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001771 ADVANCE(1);
1772 HANDLE_INSTRUCTION_END();
1773
1774 HANDLE_INSTRUCTION_START(INT_TO_SHORT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001775 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1776 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001777 ADVANCE(1);
1778 HANDLE_INSTRUCTION_END();
1779
1780 HANDLE_INSTRUCTION_START(ADD_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001781 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001782 SafeAdd(shadow_frame.GetVReg(inst->VRegB_23x()),
1783 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001784 ADVANCE(2);
1785 HANDLE_INSTRUCTION_END();
1786
1787 HANDLE_INSTRUCTION_START(SUB_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 SafeSub(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(MUL_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 SafeMul(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(DIV_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001802 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
1803 shadow_frame.GetVReg(inst->VRegB_23x()),
1804 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001805 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1806 }
1807 HANDLE_INSTRUCTION_END();
1808
1809 HANDLE_INSTRUCTION_START(REM_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001810 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1811 shadow_frame.GetVReg(inst->VRegB_23x()),
1812 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001813 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1814 }
1815 HANDLE_INSTRUCTION_END();
1816
1817 HANDLE_INSTRUCTION_START(SHL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001818 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001819 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1820 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1821 ADVANCE(2);
1822 HANDLE_INSTRUCTION_END();
1823
1824 HANDLE_INSTRUCTION_START(SHR_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(USHR_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 static_cast<uint32_t>(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(AND_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 shadow_frame.GetVReg(inst->VRegB_23x()) &
1841 shadow_frame.GetVReg(inst->VRegC_23x()));
1842 ADVANCE(2);
1843 HANDLE_INSTRUCTION_END();
1844
1845 HANDLE_INSTRUCTION_START(OR_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(XOR_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(ADD_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001860 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001861 SafeAdd(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1862 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001863 ADVANCE(2);
1864 HANDLE_INSTRUCTION_END();
1865
1866 HANDLE_INSTRUCTION_START(SUB_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 SafeSub(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(MUL_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 SafeMul(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(DIV_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001881 bool success = DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
1882 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1883 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001884 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1885 }
1886 HANDLE_INSTRUCTION_END();
1887
1888 HANDLE_INSTRUCTION_START(REM_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001889 bool success = DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1890 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1891 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001892 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1893 }
1894 HANDLE_INSTRUCTION_END();
1895
1896 HANDLE_INSTRUCTION_START(AND_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001897 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001898 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1899 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1900 ADVANCE(2);
1901 HANDLE_INSTRUCTION_END();
1902
1903 HANDLE_INSTRUCTION_START(OR_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(XOR_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(SHL_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.GetVReg(inst->VRegC_23x()) & 0x3f));
1921 ADVANCE(2);
1922 HANDLE_INSTRUCTION_END();
1923
1924 HANDLE_INSTRUCTION_START(SHR_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(USHR_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 static_cast<uint64_t>(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(ADD_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001939 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001940 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1941 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1942 ADVANCE(2);
1943 HANDLE_INSTRUCTION_END();
1944
1945 HANDLE_INSTRUCTION_START(SUB_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(MUL_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(DIV_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(REM_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 fmodf(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(ADD_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001974 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001975 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1976 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1977 ADVANCE(2);
1978 HANDLE_INSTRUCTION_END();
1979
1980 HANDLE_INSTRUCTION_START(SUB_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(MUL_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(DIV_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(REM_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 fmod(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(ADD_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002009 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002010 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002011 SafeAdd(shadow_frame.GetVReg(vregA),
2012 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002013 ADVANCE(1);
2014 }
2015 HANDLE_INSTRUCTION_END();
2016
2017 HANDLE_INSTRUCTION_START(SUB_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002018 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002019 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002020 SafeSub(shadow_frame.GetVReg(vregA),
2021 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002022 ADVANCE(1);
2023 }
2024 HANDLE_INSTRUCTION_END();
2025
2026 HANDLE_INSTRUCTION_START(MUL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002027 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002028 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002029 SafeMul(shadow_frame.GetVReg(vregA),
2030 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002031 ADVANCE(1);
2032 }
2033 HANDLE_INSTRUCTION_END();
2034
2035 HANDLE_INSTRUCTION_START(DIV_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002036 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002037 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002038 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002039 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2040 }
2041 HANDLE_INSTRUCTION_END();
2042
2043 HANDLE_INSTRUCTION_START(REM_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002044 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002045 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002046 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002047 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2048 }
2049 HANDLE_INSTRUCTION_END();
2050
2051 HANDLE_INSTRUCTION_START(SHL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002052 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002053 shadow_frame.SetVReg(vregA,
2054 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002055 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002056 ADVANCE(1);
2057 }
2058 HANDLE_INSTRUCTION_END();
2059
2060 HANDLE_INSTRUCTION_START(SHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002061 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002062 shadow_frame.SetVReg(vregA,
2063 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002064 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002065 ADVANCE(1);
2066 }
2067 HANDLE_INSTRUCTION_END();
2068
2069 HANDLE_INSTRUCTION_START(USHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002070 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002071 shadow_frame.SetVReg(vregA,
2072 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002073 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002074 ADVANCE(1);
2075 }
2076 HANDLE_INSTRUCTION_END();
2077
2078 HANDLE_INSTRUCTION_START(AND_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002079 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002080 shadow_frame.SetVReg(vregA,
2081 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002082 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002083 ADVANCE(1);
2084 }
2085 HANDLE_INSTRUCTION_END();
2086
2087 HANDLE_INSTRUCTION_START(OR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002088 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002089 shadow_frame.SetVReg(vregA,
2090 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002091 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002092 ADVANCE(1);
2093 }
2094 HANDLE_INSTRUCTION_END();
2095
2096 HANDLE_INSTRUCTION_START(XOR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002097 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002098 shadow_frame.SetVReg(vregA,
2099 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002100 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002101 ADVANCE(1);
2102 }
2103 HANDLE_INSTRUCTION_END();
2104
2105 HANDLE_INSTRUCTION_START(ADD_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002106 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002107 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002108 SafeAdd(shadow_frame.GetVRegLong(vregA),
2109 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002110 ADVANCE(1);
2111 }
2112 HANDLE_INSTRUCTION_END();
2113
2114 HANDLE_INSTRUCTION_START(SUB_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002115 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002116 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002117 SafeSub(shadow_frame.GetVRegLong(vregA),
2118 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002119 ADVANCE(1);
2120 }
2121 HANDLE_INSTRUCTION_END();
2122
2123 HANDLE_INSTRUCTION_START(MUL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002124 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002125 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002126 SafeMul(shadow_frame.GetVRegLong(vregA),
2127 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002128 ADVANCE(1);
2129 }
2130 HANDLE_INSTRUCTION_END();
2131
2132 HANDLE_INSTRUCTION_START(DIV_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002133 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002134 bool success = DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002135 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002136 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2137 }
2138 HANDLE_INSTRUCTION_END();
2139
2140 HANDLE_INSTRUCTION_START(REM_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002141 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002142 bool success = DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002143 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002144 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2145 }
2146 HANDLE_INSTRUCTION_END();
2147
2148 HANDLE_INSTRUCTION_START(AND_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002149 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002150 shadow_frame.SetVRegLong(vregA,
2151 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002152 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002153 ADVANCE(1);
2154 }
2155 HANDLE_INSTRUCTION_END();
2156
2157 HANDLE_INSTRUCTION_START(OR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002158 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002159 shadow_frame.SetVRegLong(vregA,
2160 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002161 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002162 ADVANCE(1);
2163 }
2164 HANDLE_INSTRUCTION_END();
2165
2166 HANDLE_INSTRUCTION_START(XOR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002167 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002168 shadow_frame.SetVRegLong(vregA,
2169 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002170 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002171 ADVANCE(1);
2172 }
2173 HANDLE_INSTRUCTION_END();
2174
2175 HANDLE_INSTRUCTION_START(SHL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002176 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002177 shadow_frame.SetVRegLong(vregA,
2178 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002179 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002180 ADVANCE(1);
2181 }
2182 HANDLE_INSTRUCTION_END();
2183
2184 HANDLE_INSTRUCTION_START(SHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002185 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002186 shadow_frame.SetVRegLong(vregA,
2187 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002188 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002189 ADVANCE(1);
2190 }
2191 HANDLE_INSTRUCTION_END();
2192
2193 HANDLE_INSTRUCTION_START(USHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002194 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002195 shadow_frame.SetVRegLong(vregA,
2196 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002197 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002198 ADVANCE(1);
2199 }
2200 HANDLE_INSTRUCTION_END();
2201
2202 HANDLE_INSTRUCTION_START(ADD_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002203 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002204 shadow_frame.SetVRegFloat(vregA,
2205 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002206 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002207 ADVANCE(1);
2208 }
2209 HANDLE_INSTRUCTION_END();
2210
2211 HANDLE_INSTRUCTION_START(SUB_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002212 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002213 shadow_frame.SetVRegFloat(vregA,
2214 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002215 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002216 ADVANCE(1);
2217 }
2218 HANDLE_INSTRUCTION_END();
2219
2220 HANDLE_INSTRUCTION_START(MUL_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002221 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002222 shadow_frame.SetVRegFloat(vregA,
2223 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002224 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002225 ADVANCE(1);
2226 }
2227 HANDLE_INSTRUCTION_END();
2228
2229 HANDLE_INSTRUCTION_START(DIV_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002230 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002231 shadow_frame.SetVRegFloat(vregA,
2232 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002233 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002234 ADVANCE(1);
2235 }
2236 HANDLE_INSTRUCTION_END();
2237
2238 HANDLE_INSTRUCTION_START(REM_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002239 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002240 shadow_frame.SetVRegFloat(vregA,
2241 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002242 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002243 ADVANCE(1);
2244 }
2245 HANDLE_INSTRUCTION_END();
2246
2247 HANDLE_INSTRUCTION_START(ADD_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002248 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002249 shadow_frame.SetVRegDouble(vregA,
2250 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002251 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002252 ADVANCE(1);
2253 }
2254 HANDLE_INSTRUCTION_END();
2255
2256 HANDLE_INSTRUCTION_START(SUB_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002257 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002258 shadow_frame.SetVRegDouble(vregA,
2259 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002260 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002261 ADVANCE(1);
2262 }
2263 HANDLE_INSTRUCTION_END();
2264
2265 HANDLE_INSTRUCTION_START(MUL_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002266 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002267 shadow_frame.SetVRegDouble(vregA,
2268 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002269 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002270 ADVANCE(1);
2271 }
2272 HANDLE_INSTRUCTION_END();
2273
2274 HANDLE_INSTRUCTION_START(DIV_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002275 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002276 shadow_frame.SetVRegDouble(vregA,
2277 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002278 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002279 ADVANCE(1);
2280 }
2281 HANDLE_INSTRUCTION_END();
2282
2283 HANDLE_INSTRUCTION_START(REM_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002284 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002285 shadow_frame.SetVRegDouble(vregA,
2286 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002287 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002288 ADVANCE(1);
2289 }
2290 HANDLE_INSTRUCTION_END();
2291
2292 HANDLE_INSTRUCTION_START(ADD_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002293 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002294 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2295 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002296 ADVANCE(2);
2297 HANDLE_INSTRUCTION_END();
2298
2299 HANDLE_INSTRUCTION_START(RSUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002300 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002301 SafeSub(inst->VRegC_22s(),
2302 shadow_frame.GetVReg(inst->VRegB_22s(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002303 ADVANCE(2);
2304 HANDLE_INSTRUCTION_END();
2305
2306 HANDLE_INSTRUCTION_START(MUL_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002307 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002308 SafeMul(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2309 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002310 ADVANCE(2);
2311 HANDLE_INSTRUCTION_END();
2312
2313 HANDLE_INSTRUCTION_START(DIV_INT_LIT16) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07002314 bool success = DoIntDivide(
2315 shadow_frame, inst->VRegA_22s(inst_data), shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2316 inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002317 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2318 }
2319 HANDLE_INSTRUCTION_END();
2320
2321 HANDLE_INSTRUCTION_START(REM_INT_LIT16) {
Mathieu Chartier2cebb242015-04-21 16:50:40 -07002322 bool success = DoIntRemainder(
2323 shadow_frame, inst->VRegA_22s(inst_data), shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2324 inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002325 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2326 }
2327 HANDLE_INSTRUCTION_END();
2328
2329 HANDLE_INSTRUCTION_START(AND_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002330 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2331 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002332 inst->VRegC_22s());
2333 ADVANCE(2);
2334 HANDLE_INSTRUCTION_END();
2335
2336 HANDLE_INSTRUCTION_START(OR_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(XOR_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(ADD_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002351 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002352 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22b()),
2353 inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002354 ADVANCE(2);
2355 HANDLE_INSTRUCTION_END();
2356
2357 HANDLE_INSTRUCTION_START(RSUB_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 SafeSub(inst->VRegC_22b(),
2360 shadow_frame.GetVReg(inst->VRegB_22b())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002361 ADVANCE(2);
2362 HANDLE_INSTRUCTION_END();
2363
2364 HANDLE_INSTRUCTION_START(MUL_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 SafeMul(shadow_frame.GetVReg(inst->VRegB_22b()),
2367 inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002368 ADVANCE(2);
2369 HANDLE_INSTRUCTION_END();
2370
2371 HANDLE_INSTRUCTION_START(DIV_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002372 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
2373 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002374 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2375 }
2376 HANDLE_INSTRUCTION_END();
2377
2378 HANDLE_INSTRUCTION_START(REM_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002379 bool success = DoIntRemainder(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(AND_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002386 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002387 shadow_frame.GetVReg(inst->VRegB_22b()) &
2388 inst->VRegC_22b());
2389 ADVANCE(2);
2390 HANDLE_INSTRUCTION_END();
2391
2392 HANDLE_INSTRUCTION_START(OR_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(XOR_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(SHL_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() & 0x1f));
2410 ADVANCE(2);
2411 HANDLE_INSTRUCTION_END();
2412
2413 HANDLE_INSTRUCTION_START(SHR_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(USHR_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 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2423 (inst->VRegC_22b() & 0x1f));
2424 ADVANCE(2);
2425 HANDLE_INSTRUCTION_END();
2426
Igor Murashkin158f35c2015-06-10 15:55:30 -07002427 HANDLE_EXPERIMENTAL_INSTRUCTION_START(CREATE_LAMBDA) {
Igor Murashkin6918bf12015-09-27 19:19:06 -07002428 if (lambda_closure_builder == nullptr) {
2429 // DoCreateLambda always needs a ClosureBuilder, even if it has 0 captured variables.
2430 lambda_closure_builder = MakeUnique<lambda::ClosureBuilder>();
2431 }
2432
2433 // TODO: these allocations should not leak, and the lambda method should not be local.
2434 lambda::Closure* lambda_closure =
2435 reinterpret_cast<lambda::Closure*>(alloca(lambda_closure_builder->GetSize()));
2436 bool success = DoCreateLambda<do_access_check>(self,
2437 inst,
2438 /*inout*/shadow_frame,
2439 /*inout*/lambda_closure_builder.get(),
2440 /*inout*/lambda_closure);
2441 lambda_closure_builder.reset(nullptr); // reset state of variables captured
Igor Murashkin158f35c2015-06-10 15:55:30 -07002442 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2443 }
2444 HANDLE_EXPERIMENTAL_INSTRUCTION_END();
2445
Igor Murashkin2ee54e22015-06-18 10:05:11 -07002446 HANDLE_EXPERIMENTAL_INSTRUCTION_START(BOX_LAMBDA) {
2447 bool success = DoBoxLambda<do_access_check>(self, shadow_frame, inst, inst_data);
2448 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2449 }
2450 HANDLE_EXPERIMENTAL_INSTRUCTION_END();
2451
2452 HANDLE_EXPERIMENTAL_INSTRUCTION_START(UNBOX_LAMBDA) {
2453 bool success = DoUnboxLambda<do_access_check>(self, shadow_frame, inst, inst_data);
2454 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2455 }
2456 HANDLE_EXPERIMENTAL_INSTRUCTION_END();
2457
Igor Murashkin6918bf12015-09-27 19:19:06 -07002458 HANDLE_EXPERIMENTAL_INSTRUCTION_START(CAPTURE_VARIABLE) {
2459 if (lambda_closure_builder == nullptr) {
2460 lambda_closure_builder = MakeUnique<lambda::ClosureBuilder>();
2461 }
2462
2463 bool success = DoCaptureVariable<do_access_check>(self,
2464 inst,
2465 /*inout*/shadow_frame,
2466 /*inout*/lambda_closure_builder.get());
2467
2468 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2469 }
2470 HANDLE_EXPERIMENTAL_INSTRUCTION_END();
2471
2472 HANDLE_EXPERIMENTAL_INSTRUCTION_START(LIBERATE_VARIABLE) {
2473 bool success = DoLiberateVariable<do_access_check>(self,
2474 inst,
2475 lambda_captured_variable_index,
2476 /*inout*/shadow_frame);
2477 // Temporarily only allow sequences of 'liberate-variable, liberate-variable, ...'
2478 lambda_captured_variable_index++;
2479 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2480 }
2481 HANDLE_EXPERIMENTAL_INSTRUCTION_END();
2482
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002483 HANDLE_INSTRUCTION_START(UNUSED_3E)
Ian Rogerse94652f2014-12-02 11:13:19 -08002484 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002485 HANDLE_INSTRUCTION_END();
2486
2487 HANDLE_INSTRUCTION_START(UNUSED_3F)
Ian Rogerse94652f2014-12-02 11:13:19 -08002488 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002489 HANDLE_INSTRUCTION_END();
2490
2491 HANDLE_INSTRUCTION_START(UNUSED_40)
Ian Rogerse94652f2014-12-02 11:13:19 -08002492 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002493 HANDLE_INSTRUCTION_END();
2494
2495 HANDLE_INSTRUCTION_START(UNUSED_41)
Ian Rogerse94652f2014-12-02 11:13:19 -08002496 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002497 HANDLE_INSTRUCTION_END();
2498
2499 HANDLE_INSTRUCTION_START(UNUSED_42)
Ian Rogerse94652f2014-12-02 11:13:19 -08002500 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002501 HANDLE_INSTRUCTION_END();
2502
2503 HANDLE_INSTRUCTION_START(UNUSED_43)
Ian Rogerse94652f2014-12-02 11:13:19 -08002504 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002505 HANDLE_INSTRUCTION_END();
2506
2507 HANDLE_INSTRUCTION_START(UNUSED_79)
Ian Rogerse94652f2014-12-02 11:13:19 -08002508 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002509 HANDLE_INSTRUCTION_END();
2510
2511 HANDLE_INSTRUCTION_START(UNUSED_7A)
Ian Rogerse94652f2014-12-02 11:13:19 -08002512 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002513 HANDLE_INSTRUCTION_END();
2514
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002515 HANDLE_INSTRUCTION_START(UNUSED_F4)
Ian Rogerse94652f2014-12-02 11:13:19 -08002516 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002517 HANDLE_INSTRUCTION_END();
2518
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002519 HANDLE_INSTRUCTION_START(UNUSED_FA)
Ian Rogerse94652f2014-12-02 11:13:19 -08002520 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002521 HANDLE_INSTRUCTION_END();
2522
2523 HANDLE_INSTRUCTION_START(UNUSED_FB)
Ian Rogerse94652f2014-12-02 11:13:19 -08002524 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002525 HANDLE_INSTRUCTION_END();
2526
2527 HANDLE_INSTRUCTION_START(UNUSED_FC)
Ian Rogerse94652f2014-12-02 11:13:19 -08002528 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002529 HANDLE_INSTRUCTION_END();
2530
2531 HANDLE_INSTRUCTION_START(UNUSED_FD)
Ian Rogerse94652f2014-12-02 11:13:19 -08002532 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002533 HANDLE_INSTRUCTION_END();
2534
2535 HANDLE_INSTRUCTION_START(UNUSED_FE)
Ian Rogerse94652f2014-12-02 11:13:19 -08002536 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002537 HANDLE_INSTRUCTION_END();
2538
2539 HANDLE_INSTRUCTION_START(UNUSED_FF)
Ian Rogerse94652f2014-12-02 11:13:19 -08002540 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002541 HANDLE_INSTRUCTION_END();
2542
2543 exception_pending_label: {
2544 CHECK(self->IsExceptionPending());
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002545 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -07002546 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002547 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002548 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002549 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002550 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc,
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002551 instrumentation);
2552 if (found_dex_pc == DexFile::kDexNoIndex) {
Andreas Gampe03ec9302015-08-27 17:41:47 -07002553 // Structured locking is to be enforced for abnormal termination, too.
2554 shadow_frame.GetLockCountData().CheckAllMonitorsReleasedOrThrow<do_assignability_check>(self);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002555 return JValue(); /* Handled in caller. */
2556 } else {
2557 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc);
2558 ADVANCE(displacement);
2559 }
2560 }
2561
Sebastien Hertz8379b222014-02-24 17:38:15 +01002562// Create alternative instruction handlers dedicated to instrumentation.
2563// Return instructions must not call Instrumentation::DexPcMovedEvent since they already call
2564// Instrumentation::MethodExited. This is to avoid posting debugger events twice for this location.
Sebastien Hertze713d932014-05-15 10:48:53 +02002565// Note: we do not use the kReturn instruction flag here (to test the instruction is a return). The
2566// compiler seems to not evaluate "(Instruction::FlagsOf(Instruction::code) & kReturn) != 0" to
2567// a constant condition that would remove the "if" statement so the test is free.
Sebastien Hertz9d6bf692015-04-10 12:12:33 +02002568#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
2569 alt_op_##code: { \
2570 Runtime* const runtime = Runtime::Current(); \
2571 const instrumentation::Instrumentation* instrumentation = runtime->GetInstrumentation(); \
2572 if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
2573 Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_); \
2574 instrumentation->DexPcMovedEvent(self, this_object, shadow_frame.GetMethod(), dex_pc); \
2575 } \
2576 UPDATE_HANDLER_TABLE(); \
2577 goto *handlersTable[instrumentation::kMainHandlerTable][Instruction::code]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002578 }
2579#include "dex_instruction_list.h"
2580 DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER)
2581#undef DEX_INSTRUCTION_LIST
2582#undef INSTRUMENTATION_INSTRUCTION_HANDLER
2583} // NOLINT(readability/fn_size)
2584
2585// Explicit definitions of ExecuteGotoImpl.
Mathieu Chartier90443472015-07-16 20:32:27 -07002586template SHARED_REQUIRES(Locks::mutator_lock_) HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002587JValue ExecuteGotoImpl<true, false>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002588 ShadowFrame& shadow_frame, JValue result_register);
Mathieu Chartier90443472015-07-16 20:32:27 -07002589template SHARED_REQUIRES(Locks::mutator_lock_) HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002590JValue ExecuteGotoImpl<false, false>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002591 ShadowFrame& shadow_frame, JValue result_register);
Mathieu Chartier90443472015-07-16 20:32:27 -07002592template SHARED_REQUIRES(Locks::mutator_lock_)
Ian Rogerse94652f2014-12-02 11:13:19 -08002593JValue ExecuteGotoImpl<true, true>(Thread* self, const DexFile::CodeItem* code_item,
2594 ShadowFrame& shadow_frame, JValue result_register);
Mathieu Chartier90443472015-07-16 20:32:27 -07002595template SHARED_REQUIRES(Locks::mutator_lock_)
Ian Rogerse94652f2014-12-02 11:13:19 -08002596JValue ExecuteGotoImpl<false, true>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002597 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002598
2599} // namespace interpreter
2600} // namespace art
Colin Crosse84e4f72015-03-18 14:01:19 -07002601
2602#endif