blob: cead26c2ea0713f1a2733e1820e0bceca5beec70 [file] [log] [blame]
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Colin Crosse84e4f72015-03-18 14:01:19 -070017#if !defined(__clang__)
18// Clang 3.4 fails to build the goto interpreter implementation.
19
Sebastien Hertz8ece0502013-08-07 11:26:41 +020020#include "interpreter_common.h"
Ian Rogersf72a11d2014-10-30 15:41:08 -070021#include "safe_math.h"
Sebastien Hertz8ece0502013-08-07 11:26:41 +020022
23namespace art {
24namespace interpreter {
25
26// In the following macros, we expect the following local variables exist:
27// - "self": the current Thread*.
28// - "inst" : the current Instruction*.
Sebastien Hertz3b588e02013-09-11 14:33:18 +020029// - "inst_data" : the current instruction's first 16 bits.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020030// - "dex_pc": the current pc.
31// - "shadow_frame": the current shadow frame.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020032// - "currentHandlersTable": the current table of pointer to each instruction handler.
33
34// Advance to the next instruction and updates interpreter state.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020035#define ADVANCE(_offset) \
36 do { \
37 int32_t disp = static_cast<int32_t>(_offset); \
38 inst = inst->RelativeAt(disp); \
39 dex_pc = static_cast<uint32_t>(static_cast<int32_t>(dex_pc) + disp); \
40 shadow_frame.SetDexPC(dex_pc); \
Ian Rogerse94652f2014-12-02 11:13:19 -080041 TraceExecution(shadow_frame, inst, dex_pc); \
Sebastien Hertz3b588e02013-09-11 14:33:18 +020042 inst_data = inst->Fetch16(0); \
43 goto *currentHandlersTable[inst->Opcode(inst_data)]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020044 } while (false)
45
46#define HANDLE_PENDING_EXCEPTION() goto exception_pending_label
47
48#define POSSIBLY_HANDLE_PENDING_EXCEPTION(_is_exception_pending, _offset) \
49 do { \
50 if (UNLIKELY(_is_exception_pending)) { \
51 HANDLE_PENDING_EXCEPTION(); \
52 } else { \
53 ADVANCE(_offset); \
54 } \
55 } while (false)
56
Sebastien Hertzee1997a2013-09-19 14:47:09 +020057#define UPDATE_HANDLER_TABLE() \
58 currentHandlersTable = handlersTable[Runtime::Current()->GetInstrumentation()->GetInterpreterHandlerTable()]
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +020059
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080060#define BACKWARD_BRANCH_INSTRUMENTATION(offset) \
61 do { \
62 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation(); \
63 instrumentation->BackwardBranch(self, shadow_frame.GetMethod(), offset); \
64 } while (false)
65
Sebastien Hertz8ece0502013-08-07 11:26:41 +020066#define UNREACHABLE_CODE_CHECK() \
67 do { \
68 if (kIsDebugBuild) { \
69 LOG(FATAL) << "We should not be here !"; \
Ian Rogerse94652f2014-12-02 11:13:19 -080070 UNREACHABLE(); \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020071 } \
72 } while (false)
73
74#define HANDLE_INSTRUCTION_START(opcode) op_##opcode: // NOLINT(whitespace/labels)
75#define HANDLE_INSTRUCTION_END() UNREACHABLE_CODE_CHECK()
76
Sebastien Hertzee1997a2013-09-19 14:47:09 +020077/**
78 * Interpreter based on computed goto tables.
79 *
80 * Each instruction is associated to a handler. This handler is responsible for executing the
81 * instruction and jump to the next instruction's handler.
82 * In order to limit the cost of instrumentation, we have two handler tables:
83 * - the "main" handler table: it contains handlers for normal execution of each instruction without
84 * handling of instrumentation.
85 * - the "alternative" handler table: it contains alternative handlers which first handle
86 * instrumentation before jumping to the corresponding "normal" instruction's handler.
87 *
88 * When instrumentation is active, the interpreter uses the "alternative" handler table. Otherwise
89 * it uses the "main" handler table.
90 *
91 * The current handler table is the handler table being used by the interpreter. It is updated:
92 * - on backward branch (goto, if and switch instructions)
93 * - after invoke
94 * - when an exception is thrown.
95 * This allows to support an attaching debugger to an already running application for instance.
96 *
97 * For a fast handler table update, handler tables are stored in an array of handler tables. Each
98 * handler table is represented by the InterpreterHandlerTable enum which allows to associate it
99 * to an index in this array of handler tables ((see Instrumentation::GetInterpreterHandlerTable).
100 *
101 * Here's the current layout of this array of handler tables:
102 *
103 * ---------------------+---------------+
104 * | NOP | (handler for NOP instruction)
105 * +---------------+
106 * "main" | MOVE | (handler for MOVE instruction)
107 * handler table +---------------+
108 * | ... |
109 * +---------------+
110 * | UNUSED_FF | (handler for UNUSED_FF instruction)
111 * ---------------------+---------------+
112 * | NOP | (alternative handler for NOP instruction)
113 * +---------------+
114 * "alternative" | MOVE | (alternative handler for MOVE instruction)
115 * handler table +---------------+
116 * | ... |
117 * +---------------+
118 * | UNUSED_FF | (alternative handler for UNUSED_FF instruction)
119 * ---------------------+---------------+
120 *
121 */
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100122template<bool do_access_check, bool transaction_active>
Ian Rogerse94652f2014-12-02 11:13:19 -0800123JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowFrame& shadow_frame,
124 JValue result_register) {
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200125 // Define handler tables:
126 // - The main handler table contains execution handlers for each instruction.
127 // - The alternative handler table contains prelude handlers which check for thread suspend and
128 // manage instrumentation before jumping to the execution handler.
129 static const void* const handlersTable[instrumentation::kNumHandlerTables][kNumPackedOpcodes] = {
130 {
131 // Main handler table.
132#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&op_##code,
133#include "dex_instruction_list.h"
134 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
135#undef DEX_INSTRUCTION_LIST
136#undef INSTRUCTION_HANDLER
137 }, {
138 // Alternative handler table.
139#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&alt_op_##code,
140#include "dex_instruction_list.h"
141 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
142#undef DEX_INSTRUCTION_LIST
143#undef INSTRUCTION_HANDLER
144 }
145 };
146
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800147 constexpr bool do_assignability_check = do_access_check;
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200148 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
149 LOG(FATAL) << "Invalid shadow frame for interpreter use";
150 return JValue();
151 }
152 self->VerifyStack();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200153
154 uint32_t dex_pc = shadow_frame.GetDexPC();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200155 const Instruction* inst = Instruction::At(code_item->insns_ + dex_pc);
156 uint16_t inst_data;
157 const void* const* currentHandlersTable;
Sebastien Hertz8379b222014-02-24 17:38:15 +0100158 bool notified_method_entry_event = false;
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200159 UPDATE_HANDLER_TABLE();
Sebastien Hertz270a0e12015-01-16 19:49:09 +0100160 if (LIKELY(dex_pc == 0)) { // We are entering the method as opposed to deoptimizing.
161 if (kIsDebugBuild) {
162 self->AssertNoPendingException();
163 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200164 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200165 if (UNLIKELY(instrumentation->HasMethodEntryListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200166 instrumentation->MethodEnterEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200167 shadow_frame.GetMethod(), 0);
Sebastien Hertz8379b222014-02-24 17:38:15 +0100168 notified_method_entry_event = true;
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200169 }
170 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200171
172 // Jump to first instruction.
173 ADVANCE(0);
174 UNREACHABLE_CODE_CHECK();
175
176 HANDLE_INSTRUCTION_START(NOP)
177 ADVANCE(1);
178 HANDLE_INSTRUCTION_END();
179
180 HANDLE_INSTRUCTION_START(MOVE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200181 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
182 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200183 ADVANCE(1);
184 HANDLE_INSTRUCTION_END();
185
186 HANDLE_INSTRUCTION_START(MOVE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200187 shadow_frame.SetVReg(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200188 shadow_frame.GetVReg(inst->VRegB_22x()));
189 ADVANCE(2);
190 HANDLE_INSTRUCTION_END();
191
192 HANDLE_INSTRUCTION_START(MOVE_16)
193 shadow_frame.SetVReg(inst->VRegA_32x(),
194 shadow_frame.GetVReg(inst->VRegB_32x()));
195 ADVANCE(3);
196 HANDLE_INSTRUCTION_END();
197
198 HANDLE_INSTRUCTION_START(MOVE_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200199 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
200 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200201 ADVANCE(1);
202 HANDLE_INSTRUCTION_END();
203
204 HANDLE_INSTRUCTION_START(MOVE_WIDE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200205 shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200206 shadow_frame.GetVRegLong(inst->VRegB_22x()));
207 ADVANCE(2);
208 HANDLE_INSTRUCTION_END();
209
210 HANDLE_INSTRUCTION_START(MOVE_WIDE_16)
211 shadow_frame.SetVRegLong(inst->VRegA_32x(),
212 shadow_frame.GetVRegLong(inst->VRegB_32x()));
213 ADVANCE(3);
214 HANDLE_INSTRUCTION_END();
215
216 HANDLE_INSTRUCTION_START(MOVE_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200217 shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data),
218 shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200219 ADVANCE(1);
220 HANDLE_INSTRUCTION_END();
221
222 HANDLE_INSTRUCTION_START(MOVE_OBJECT_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200223 shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200224 shadow_frame.GetVRegReference(inst->VRegB_22x()));
225 ADVANCE(2);
226 HANDLE_INSTRUCTION_END();
227
228 HANDLE_INSTRUCTION_START(MOVE_OBJECT_16)
229 shadow_frame.SetVRegReference(inst->VRegA_32x(),
230 shadow_frame.GetVRegReference(inst->VRegB_32x()));
231 ADVANCE(3);
232 HANDLE_INSTRUCTION_END();
233
234 HANDLE_INSTRUCTION_START(MOVE_RESULT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200235 shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200236 ADVANCE(1);
237 HANDLE_INSTRUCTION_END();
238
239 HANDLE_INSTRUCTION_START(MOVE_RESULT_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200240 shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200241 ADVANCE(1);
242 HANDLE_INSTRUCTION_END();
243
244 HANDLE_INSTRUCTION_START(MOVE_RESULT_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200245 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200246 ADVANCE(1);
247 HANDLE_INSTRUCTION_END();
248
249 HANDLE_INSTRUCTION_START(MOVE_EXCEPTION) {
Nicolas Geoffray14691c52015-03-05 10:40:17 +0000250 Throwable* exception = self->GetException();
Sebastien Hertz270a0e12015-01-16 19:49:09 +0100251 DCHECK(exception != nullptr) << "No pending exception on MOVE_EXCEPTION instruction";
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200252 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception);
Sebastien Hertz5c004902014-05-21 10:07:42 +0200253 self->ClearException();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200254 ADVANCE(1);
255 }
256 HANDLE_INSTRUCTION_END();
257
Mathieu Chartierd7cbf8a2015-03-19 12:43:20 -0700258 HANDLE_INSTRUCTION_START(RETURN_VOID_NO_BARRIER) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200259 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700260 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200261 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200262 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200263 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200264 shadow_frame.GetMethod(), dex_pc,
265 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200266 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
267 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
268 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200269 }
270 return result;
271 }
272 HANDLE_INSTRUCTION_END();
273
Mathieu Chartierd7cbf8a2015-03-19 12:43:20 -0700274 HANDLE_INSTRUCTION_START(RETURN_VOID) {
Hans Boehm30359612014-05-21 17:46:23 -0700275 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200276 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700277 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200278 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200279 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200280 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200281 shadow_frame.GetMethod(), dex_pc,
282 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200283 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
284 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
285 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200286 }
287 return result;
288 }
289 HANDLE_INSTRUCTION_END();
290
291 HANDLE_INSTRUCTION_START(RETURN) {
292 JValue result;
293 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200294 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700295 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200296 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200297 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200298 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200299 shadow_frame.GetMethod(), dex_pc,
300 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200301 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
302 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
303 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200304 }
305 return result;
306 }
307 HANDLE_INSTRUCTION_END();
308
309 HANDLE_INSTRUCTION_START(RETURN_WIDE) {
310 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200311 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700312 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200313 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200314 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200315 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200316 shadow_frame.GetMethod(), dex_pc,
317 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200318 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
319 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
320 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200321 }
322 return result;
323 }
324 HANDLE_INSTRUCTION_END();
325
326 HANDLE_INSTRUCTION_START(RETURN_OBJECT) {
327 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700328 self->AllowThreadSuspension();
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700329 const uint8_t vreg_index = inst->VRegA_11x(inst_data);
330 Object* obj_result = shadow_frame.GetVRegReference(vreg_index);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700331 if (do_assignability_check && obj_result != NULL) {
Ian Rogersded66a02014-10-28 18:12:55 -0700332 Class* return_type = shadow_frame.GetMethod()->GetReturnType();
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700333 obj_result = shadow_frame.GetVRegReference(vreg_index);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700334 if (return_type == NULL) {
335 // Return the pending exception.
336 HANDLE_PENDING_EXCEPTION();
337 }
338 if (!obj_result->VerifierInstanceOf(return_type)) {
339 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700340 std::string temp1, temp2;
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000341 self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700342 "Returning '%s' that is not instance of return type '%s'",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700343 obj_result->GetClass()->GetDescriptor(&temp1),
344 return_type->GetDescriptor(&temp2));
Jeff Haoa3faaf42013-09-03 19:07:00 -0700345 HANDLE_PENDING_EXCEPTION();
346 }
347 }
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700348 result.SetL(obj_result);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200349 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200350 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200351 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200352 shadow_frame.GetMethod(), dex_pc,
353 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200354 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
355 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
356 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200357 }
358 return result;
359 }
360 HANDLE_INSTRUCTION_END();
361
362 HANDLE_INSTRUCTION_START(CONST_4) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200363 uint32_t dst = inst->VRegA_11n(inst_data);
364 int32_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200365 shadow_frame.SetVReg(dst, val);
366 if (val == 0) {
367 shadow_frame.SetVRegReference(dst, NULL);
368 }
369 ADVANCE(1);
370 }
371 HANDLE_INSTRUCTION_END();
372
373 HANDLE_INSTRUCTION_START(CONST_16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200374 uint32_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200375 int32_t val = inst->VRegB_21s();
376 shadow_frame.SetVReg(dst, val);
377 if (val == 0) {
378 shadow_frame.SetVRegReference(dst, NULL);
379 }
380 ADVANCE(2);
381 }
382 HANDLE_INSTRUCTION_END();
383
384 HANDLE_INSTRUCTION_START(CONST) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200385 uint32_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200386 int32_t val = inst->VRegB_31i();
387 shadow_frame.SetVReg(dst, val);
388 if (val == 0) {
389 shadow_frame.SetVRegReference(dst, NULL);
390 }
391 ADVANCE(3);
392 }
393 HANDLE_INSTRUCTION_END();
394
395 HANDLE_INSTRUCTION_START(CONST_HIGH16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200396 uint32_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200397 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
398 shadow_frame.SetVReg(dst, val);
399 if (val == 0) {
400 shadow_frame.SetVRegReference(dst, NULL);
401 }
402 ADVANCE(2);
403 }
404 HANDLE_INSTRUCTION_END();
405
406 HANDLE_INSTRUCTION_START(CONST_WIDE_16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200407 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200408 ADVANCE(2);
409 HANDLE_INSTRUCTION_END();
410
411 HANDLE_INSTRUCTION_START(CONST_WIDE_32)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200412 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200413 ADVANCE(3);
414 HANDLE_INSTRUCTION_END();
415
416 HANDLE_INSTRUCTION_START(CONST_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200417 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200418 ADVANCE(5);
419 HANDLE_INSTRUCTION_END();
420
421 HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200422 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200423 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
424 ADVANCE(2);
425 HANDLE_INSTRUCTION_END();
426
427 HANDLE_INSTRUCTION_START(CONST_STRING) {
Ian Rogers6786a582014-10-28 12:49:06 -0700428 String* s = ResolveString(self, shadow_frame, inst->VRegB_21c());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200429 if (UNLIKELY(s == NULL)) {
430 HANDLE_PENDING_EXCEPTION();
431 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200432 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200433 ADVANCE(2);
434 }
435 }
436 HANDLE_INSTRUCTION_END();
437
438 HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
Ian Rogers6786a582014-10-28 12:49:06 -0700439 String* s = ResolveString(self, shadow_frame, inst->VRegB_31c());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200440 if (UNLIKELY(s == NULL)) {
441 HANDLE_PENDING_EXCEPTION();
442 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200443 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200444 ADVANCE(3);
445 }
446 }
447 HANDLE_INSTRUCTION_END();
448
449 HANDLE_INSTRUCTION_START(CONST_CLASS) {
450 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
451 self, false, do_access_check);
452 if (UNLIKELY(c == NULL)) {
453 HANDLE_PENDING_EXCEPTION();
454 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200455 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200456 ADVANCE(2);
457 }
458 }
459 HANDLE_INSTRUCTION_END();
460
461 HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200462 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200463 if (UNLIKELY(obj == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000464 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200465 HANDLE_PENDING_EXCEPTION();
466 } else {
467 DoMonitorEnter(self, obj);
468 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
469 }
470 }
471 HANDLE_INSTRUCTION_END();
472
473 HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200474 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200475 if (UNLIKELY(obj == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000476 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200477 HANDLE_PENDING_EXCEPTION();
478 } else {
479 DoMonitorExit(self, obj);
480 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
481 }
482 }
483 HANDLE_INSTRUCTION_END();
484
485 HANDLE_INSTRUCTION_START(CHECK_CAST) {
486 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
487 self, false, do_access_check);
488 if (UNLIKELY(c == NULL)) {
489 HANDLE_PENDING_EXCEPTION();
490 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200491 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200492 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
493 ThrowClassCastException(c, obj->GetClass());
494 HANDLE_PENDING_EXCEPTION();
495 } else {
496 ADVANCE(2);
497 }
498 }
499 }
500 HANDLE_INSTRUCTION_END();
501
502 HANDLE_INSTRUCTION_START(INSTANCE_OF) {
503 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
504 self, false, do_access_check);
505 if (UNLIKELY(c == NULL)) {
506 HANDLE_PENDING_EXCEPTION();
507 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200508 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
509 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200510 ADVANCE(2);
511 }
512 }
513 HANDLE_INSTRUCTION_END();
514
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700515 HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200516 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200517 if (UNLIKELY(array == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000518 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200519 HANDLE_PENDING_EXCEPTION();
520 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200521 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200522 ADVANCE(1);
523 }
524 }
525 HANDLE_INSTRUCTION_END();
526
527 HANDLE_INSTRUCTION_START(NEW_INSTANCE) {
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700528 Runtime* runtime = Runtime::Current();
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800529 Object* obj = AllocObjectFromCode<do_access_check, true>(
530 inst->VRegB_21c(), shadow_frame.GetMethod(), self,
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700531 runtime->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200532 if (UNLIKELY(obj == NULL)) {
533 HANDLE_PENDING_EXCEPTION();
534 } else {
Sebastien Hertz4e99b3d2014-06-24 14:35:40 +0200535 obj->GetClass()->AssertInitializedOrInitializingInThread(self);
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700536 // Don't allow finalizable objects to be allocated during a transaction since these can't be
537 // finalized without a started runtime.
538 if (transaction_active && obj->GetClass()->IsFinalizable()) {
Sebastien Hertz45b15972015-04-03 16:07:05 +0200539 AbortTransactionF(self, "Allocating finalizable object in transaction: %s",
540 PrettyTypeOf(obj).c_str());
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700541 HANDLE_PENDING_EXCEPTION();
542 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200543 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200544 ADVANCE(2);
545 }
546 }
547 HANDLE_INSTRUCTION_END();
548
549 HANDLE_INSTRUCTION_START(NEW_ARRAY) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200550 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800551 Object* obj = AllocArrayFromCode<do_access_check, true>(
Andreas Gampe1cc7dba2014-12-17 18:43:01 -0800552 inst->VRegC_22c(), length, shadow_frame.GetMethod(), self,
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800553 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200554 if (UNLIKELY(obj == NULL)) {
555 HANDLE_PENDING_EXCEPTION();
556 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200557 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200558 ADVANCE(2);
559 }
560 }
561 HANDLE_INSTRUCTION_END();
562
563 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100564 bool success =
565 DoFilledNewArray<false, do_access_check, transaction_active>(inst, shadow_frame,
566 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200567 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
568 }
569 HANDLE_INSTRUCTION_END();
570
571 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100572 bool success =
573 DoFilledNewArray<true, do_access_check, transaction_active>(inst, shadow_frame,
574 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200575 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
576 }
577 HANDLE_INSTRUCTION_END();
578
579 HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200580 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Ian Rogers832336b2014-10-08 15:35:22 -0700581 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
582 const Instruction::ArrayDataPayload* payload =
583 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
584 bool success = FillArrayData(obj, payload);
585 if (transaction_active && success) {
586 RecordArrayElementsInTransaction(obj->AsArray(), payload->element_count);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200587 }
Ian Rogers832336b2014-10-08 15:35:22 -0700588 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200589 }
590 HANDLE_INSTRUCTION_END();
591
592 HANDLE_INSTRUCTION_START(THROW) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200593 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200594 if (UNLIKELY(exception == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000595 ThrowNullPointerException("throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700596 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
597 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700598 std::string temp;
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000599 self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
Jeff Haoa3faaf42013-09-03 19:07:00 -0700600 "Throwing '%s' that is not instance of Throwable",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700601 exception->GetClass()->GetDescriptor(&temp));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200602 } else {
Nicolas Geoffray14691c52015-03-05 10:40:17 +0000603 self->SetException(exception->AsThrowable());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200604 }
605 HANDLE_PENDING_EXCEPTION();
606 }
607 HANDLE_INSTRUCTION_END();
608
609 HANDLE_INSTRUCTION_START(GOTO) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200610 int8_t offset = inst->VRegA_10t(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200611 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800612 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200613 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700614 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200615 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200616 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200617 }
618 ADVANCE(offset);
619 }
620 HANDLE_INSTRUCTION_END();
621
622 HANDLE_INSTRUCTION_START(GOTO_16) {
623 int16_t offset = inst->VRegA_20t();
624 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800625 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200626 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700627 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200628 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200629 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200630 }
631 ADVANCE(offset);
632 }
633 HANDLE_INSTRUCTION_END();
634
635 HANDLE_INSTRUCTION_START(GOTO_32) {
636 int32_t offset = inst->VRegA_30t();
637 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800638 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200639 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700640 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200641 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200642 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200643 }
644 ADVANCE(offset);
645 }
646 HANDLE_INSTRUCTION_END();
647
648 HANDLE_INSTRUCTION_START(PACKED_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200649 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200650 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800651 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200652 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700653 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200654 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200655 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200656 }
657 ADVANCE(offset);
658 }
659 HANDLE_INSTRUCTION_END();
660
661 HANDLE_INSTRUCTION_START(SPARSE_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200662 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200663 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800664 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200665 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700666 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200667 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200668 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200669 }
670 ADVANCE(offset);
671 }
672 HANDLE_INSTRUCTION_END();
673
Ian Rogers647b1a82014-10-10 11:02:11 -0700674#if defined(__clang__)
675#pragma clang diagnostic push
676#pragma clang diagnostic ignored "-Wfloat-equal"
677#endif
678
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200679 HANDLE_INSTRUCTION_START(CMPL_FLOAT) {
680 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
681 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
682 int32_t result;
683 if (val1 > val2) {
684 result = 1;
685 } else if (val1 == val2) {
686 result = 0;
687 } else {
688 result = -1;
689 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200690 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200691 ADVANCE(2);
692 }
693 HANDLE_INSTRUCTION_END();
694
695 HANDLE_INSTRUCTION_START(CMPG_FLOAT) {
696 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
697 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
698 int32_t result;
699 if (val1 < val2) {
700 result = -1;
701 } else if (val1 == val2) {
702 result = 0;
703 } else {
704 result = 1;
705 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200706 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200707 ADVANCE(2);
708 }
709 HANDLE_INSTRUCTION_END();
710
711 HANDLE_INSTRUCTION_START(CMPL_DOUBLE) {
712 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
713 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
714 int32_t result;
715 if (val1 > val2) {
716 result = 1;
717 } else if (val1 == val2) {
718 result = 0;
719 } else {
720 result = -1;
721 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200722 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200723 ADVANCE(2);
724 }
725 HANDLE_INSTRUCTION_END();
726
727 HANDLE_INSTRUCTION_START(CMPG_DOUBLE) {
728 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
729 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
730 int32_t result;
731 if (val1 < val2) {
732 result = -1;
733 } else if (val1 == val2) {
734 result = 0;
735 } else {
736 result = 1;
737 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200738 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200739 ADVANCE(2);
740 }
741 HANDLE_INSTRUCTION_END();
742
Ian Rogers647b1a82014-10-10 11:02:11 -0700743#if defined(__clang__)
744#pragma clang diagnostic pop
745#endif
746
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200747 HANDLE_INSTRUCTION_START(CMP_LONG) {
748 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
749 int64_t val2 = shadow_frame.GetVRegLong(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
763 HANDLE_INSTRUCTION_START(IF_EQ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200764 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200765 int16_t offset = inst->VRegC_22t();
766 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800767 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200768 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700769 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200770 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200771 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200772 }
773 ADVANCE(offset);
774 } else {
775 ADVANCE(2);
776 }
777 }
778 HANDLE_INSTRUCTION_END();
779
780 HANDLE_INSTRUCTION_START(IF_NE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200781 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) != shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200782 int16_t offset = inst->VRegC_22t();
783 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800784 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200785 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700786 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200787 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200788 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200789 }
790 ADVANCE(offset);
791 } else {
792 ADVANCE(2);
793 }
794 }
795 HANDLE_INSTRUCTION_END();
796
797 HANDLE_INSTRUCTION_START(IF_LT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200798 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) < shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200799 int16_t offset = inst->VRegC_22t();
800 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800801 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200802 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700803 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200804 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200805 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200806 }
807 ADVANCE(offset);
808 } else {
809 ADVANCE(2);
810 }
811 }
812 HANDLE_INSTRUCTION_END();
813
814 HANDLE_INSTRUCTION_START(IF_GE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200815 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200816 int16_t offset = inst->VRegC_22t();
817 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800818 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200819 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700820 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200821 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200822 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200823 }
824 ADVANCE(offset);
825 } else {
826 ADVANCE(2);
827 }
828 }
829 HANDLE_INSTRUCTION_END();
830
831 HANDLE_INSTRUCTION_START(IF_GT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200832 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200833 int16_t offset = inst->VRegC_22t();
834 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800835 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200836 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700837 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200838 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200839 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200840 }
841 ADVANCE(offset);
842 } else {
843 ADVANCE(2);
844 }
845 }
846 HANDLE_INSTRUCTION_END();
847
848 HANDLE_INSTRUCTION_START(IF_LE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200849 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200850 int16_t offset = inst->VRegC_22t();
851 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800852 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200853 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700854 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200855 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200856 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200857 }
858 ADVANCE(offset);
859 } else {
860 ADVANCE(2);
861 }
862 }
863 HANDLE_INSTRUCTION_END();
864
865 HANDLE_INSTRUCTION_START(IF_EQZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200866 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200867 int16_t offset = inst->VRegB_21t();
868 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800869 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200870 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700871 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200872 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200873 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200874 }
875 ADVANCE(offset);
876 } else {
877 ADVANCE(2);
878 }
879 }
880 HANDLE_INSTRUCTION_END();
881
882 HANDLE_INSTRUCTION_START(IF_NEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200883 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200884 int16_t offset = inst->VRegB_21t();
885 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800886 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200887 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700888 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200889 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200890 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200891 }
892 ADVANCE(offset);
893 } else {
894 ADVANCE(2);
895 }
896 }
897 HANDLE_INSTRUCTION_END();
898
899 HANDLE_INSTRUCTION_START(IF_LTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200900 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200901 int16_t offset = inst->VRegB_21t();
902 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800903 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200904 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700905 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200906 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200907 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200908 }
909 ADVANCE(offset);
910 } else {
911 ADVANCE(2);
912 }
913 }
914 HANDLE_INSTRUCTION_END();
915
916 HANDLE_INSTRUCTION_START(IF_GEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200917 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200918 int16_t offset = inst->VRegB_21t();
919 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800920 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200921 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700922 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200923 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200924 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200925 }
926 ADVANCE(offset);
927 } else {
928 ADVANCE(2);
929 }
930 }
931 HANDLE_INSTRUCTION_END();
932
933 HANDLE_INSTRUCTION_START(IF_GTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200934 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200935 int16_t offset = inst->VRegB_21t();
936 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800937 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200938 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700939 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200940 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200941 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200942 }
943 ADVANCE(offset);
944 } else {
945 ADVANCE(2);
946 }
947 }
948 HANDLE_INSTRUCTION_END();
949
950 HANDLE_INSTRUCTION_START(IF_LEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200951 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200952 int16_t offset = inst->VRegB_21t();
953 if (IsBackwardBranch(offset)) {
Mathieu Chartiere5f13e52015-02-24 09:37:21 -0800954 BACKWARD_BRANCH_INSTRUMENTATION(offset);
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200955 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700956 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200957 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200958 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200959 }
960 ADVANCE(offset);
961 } else {
962 ADVANCE(2);
963 }
964 }
965 HANDLE_INSTRUCTION_END();
966
967 HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
968 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
969 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000970 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200971 HANDLE_PENDING_EXCEPTION();
972 } else {
973 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
974 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100975 if (LIKELY(array->CheckIsValidIndex(index))) {
976 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200977 ADVANCE(2);
978 } else {
979 HANDLE_PENDING_EXCEPTION();
980 }
981 }
982 }
983 HANDLE_INSTRUCTION_END();
984
985 HANDLE_INSTRUCTION_START(AGET_BYTE) {
986 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
987 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +0000988 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200989 HANDLE_PENDING_EXCEPTION();
990 } else {
991 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
992 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100993 if (LIKELY(array->CheckIsValidIndex(index))) {
994 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200995 ADVANCE(2);
996 } else {
997 HANDLE_PENDING_EXCEPTION();
998 }
999 }
1000 }
1001 HANDLE_INSTRUCTION_END();
1002
1003 HANDLE_INSTRUCTION_START(AGET_CHAR) {
1004 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1005 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001006 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001007 HANDLE_PENDING_EXCEPTION();
1008 } else {
1009 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1010 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001011 if (LIKELY(array->CheckIsValidIndex(index))) {
1012 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001013 ADVANCE(2);
1014 } else {
1015 HANDLE_PENDING_EXCEPTION();
1016 }
1017 }
1018 }
1019 HANDLE_INSTRUCTION_END();
1020
1021 HANDLE_INSTRUCTION_START(AGET_SHORT) {
1022 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1023 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001024 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001025 HANDLE_PENDING_EXCEPTION();
1026 } else {
1027 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1028 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001029 if (LIKELY(array->CheckIsValidIndex(index))) {
1030 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001031 ADVANCE(2);
1032 } else {
1033 HANDLE_PENDING_EXCEPTION();
1034 }
1035 }
1036 }
1037 HANDLE_INSTRUCTION_END();
1038
1039 HANDLE_INSTRUCTION_START(AGET) {
1040 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1041 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001042 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001043 HANDLE_PENDING_EXCEPTION();
1044 } else {
1045 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1046 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001047 if (LIKELY(array->CheckIsValidIndex(index))) {
1048 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001049 ADVANCE(2);
1050 } else {
1051 HANDLE_PENDING_EXCEPTION();
1052 }
1053 }
1054 }
1055 HANDLE_INSTRUCTION_END();
1056
1057 HANDLE_INSTRUCTION_START(AGET_WIDE) {
1058 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1059 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001060 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001061 HANDLE_PENDING_EXCEPTION();
1062 } else {
1063 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1064 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001065 if (LIKELY(array->CheckIsValidIndex(index))) {
1066 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001067 ADVANCE(2);
1068 } else {
1069 HANDLE_PENDING_EXCEPTION();
1070 }
1071 }
1072 }
1073 HANDLE_INSTRUCTION_END();
1074
1075 HANDLE_INSTRUCTION_START(AGET_OBJECT) {
1076 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1077 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001078 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001079 HANDLE_PENDING_EXCEPTION();
1080 } else {
1081 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1082 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001083 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001084 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001085 ADVANCE(2);
1086 } else {
1087 HANDLE_PENDING_EXCEPTION();
1088 }
1089 }
1090 }
1091 HANDLE_INSTRUCTION_END();
1092
1093 HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
1094 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1095 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001096 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001097 HANDLE_PENDING_EXCEPTION();
1098 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001099 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001100 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1101 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001102 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001103 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001104 ADVANCE(2);
1105 } else {
1106 HANDLE_PENDING_EXCEPTION();
1107 }
1108 }
1109 }
1110 HANDLE_INSTRUCTION_END();
1111
1112 HANDLE_INSTRUCTION_START(APUT_BYTE) {
1113 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1114 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001115 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001116 HANDLE_PENDING_EXCEPTION();
1117 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001118 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001119 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1120 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001121 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001122 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001123 ADVANCE(2);
1124 } else {
1125 HANDLE_PENDING_EXCEPTION();
1126 }
1127 }
1128 }
1129 HANDLE_INSTRUCTION_END();
1130
1131 HANDLE_INSTRUCTION_START(APUT_CHAR) {
1132 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1133 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001134 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001135 HANDLE_PENDING_EXCEPTION();
1136 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001137 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001138 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1139 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001140 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001141 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001142 ADVANCE(2);
1143 } else {
1144 HANDLE_PENDING_EXCEPTION();
1145 }
1146 }
1147 }
1148 HANDLE_INSTRUCTION_END();
1149
1150 HANDLE_INSTRUCTION_START(APUT_SHORT) {
1151 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1152 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001153 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001154 HANDLE_PENDING_EXCEPTION();
1155 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001156 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001157 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1158 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001159 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001160 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001161 ADVANCE(2);
1162 } else {
1163 HANDLE_PENDING_EXCEPTION();
1164 }
1165 }
1166 }
1167 HANDLE_INSTRUCTION_END();
1168
1169 HANDLE_INSTRUCTION_START(APUT) {
1170 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1171 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001172 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001173 HANDLE_PENDING_EXCEPTION();
1174 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001175 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001176 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1177 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001178 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001179 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001180 ADVANCE(2);
1181 } else {
1182 HANDLE_PENDING_EXCEPTION();
1183 }
1184 }
1185 }
1186 HANDLE_INSTRUCTION_END();
1187
1188 HANDLE_INSTRUCTION_START(APUT_WIDE) {
1189 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1190 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001191 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001192 HANDLE_PENDING_EXCEPTION();
1193 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001194 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001195 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1196 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001197 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001198 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001199 ADVANCE(2);
1200 } else {
1201 HANDLE_PENDING_EXCEPTION();
1202 }
1203 }
1204 }
1205 HANDLE_INSTRUCTION_END();
1206
1207 HANDLE_INSTRUCTION_START(APUT_OBJECT) {
1208 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1209 if (UNLIKELY(a == NULL)) {
Nicolas Geoffray0aa50ce2015-03-10 11:03:29 +00001210 ThrowNullPointerExceptionFromInterpreter();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001211 HANDLE_PENDING_EXCEPTION();
1212 } else {
1213 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001214 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001215 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001216 if (LIKELY(array->CheckIsValidIndex(index) && array->CheckAssignable(val))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001217 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001218 ADVANCE(2);
1219 } else {
1220 HANDLE_PENDING_EXCEPTION();
1221 }
1222 }
1223 }
1224 HANDLE_INSTRUCTION_END();
1225
1226 HANDLE_INSTRUCTION_START(IGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001227 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001228 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1229 }
1230 HANDLE_INSTRUCTION_END();
1231
1232 HANDLE_INSTRUCTION_START(IGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001233 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001234 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1235 }
1236 HANDLE_INSTRUCTION_END();
1237
1238 HANDLE_INSTRUCTION_START(IGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001239 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001240 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1241 }
1242 HANDLE_INSTRUCTION_END();
1243
1244 HANDLE_INSTRUCTION_START(IGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001245 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001246 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1247 }
1248 HANDLE_INSTRUCTION_END();
1249
1250 HANDLE_INSTRUCTION_START(IGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001251 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001252 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1253 }
1254 HANDLE_INSTRUCTION_END();
1255
1256 HANDLE_INSTRUCTION_START(IGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001257 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001258 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1259 }
1260 HANDLE_INSTRUCTION_END();
1261
1262 HANDLE_INSTRUCTION_START(IGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001263 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001264 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1265 }
1266 HANDLE_INSTRUCTION_END();
1267
1268 HANDLE_INSTRUCTION_START(IGET_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001269 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001270 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1271 }
1272 HANDLE_INSTRUCTION_END();
1273
Mathieu Chartierffc605c2014-12-10 10:35:44 -08001274 HANDLE_INSTRUCTION_START(IGET_BOOLEAN_QUICK) {
1275 bool success = DoIGetQuick<Primitive::kPrimBoolean>(shadow_frame, inst, inst_data);
1276 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1277 }
1278 HANDLE_INSTRUCTION_END();
1279
1280 HANDLE_INSTRUCTION_START(IGET_BYTE_QUICK) {
1281 bool success = DoIGetQuick<Primitive::kPrimByte>(shadow_frame, inst, inst_data);
1282 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1283 }
1284 HANDLE_INSTRUCTION_END();
1285
1286 HANDLE_INSTRUCTION_START(IGET_CHAR_QUICK) {
1287 bool success = DoIGetQuick<Primitive::kPrimChar>(shadow_frame, inst, inst_data);
1288 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1289 }
1290 HANDLE_INSTRUCTION_END();
1291
1292 HANDLE_INSTRUCTION_START(IGET_SHORT_QUICK) {
1293 bool success = DoIGetQuick<Primitive::kPrimShort>(shadow_frame, inst, inst_data);
1294 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1295 }
1296 HANDLE_INSTRUCTION_END();
1297
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001298 HANDLE_INSTRUCTION_START(IGET_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001299 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001300 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1301 }
1302 HANDLE_INSTRUCTION_END();
1303
1304 HANDLE_INSTRUCTION_START(IGET_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001305 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001306 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1307 }
1308 HANDLE_INSTRUCTION_END();
1309
1310 HANDLE_INSTRUCTION_START(SGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001311 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001312 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1313 }
1314 HANDLE_INSTRUCTION_END();
1315
1316 HANDLE_INSTRUCTION_START(SGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001317 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001318 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1319 }
1320 HANDLE_INSTRUCTION_END();
1321
1322 HANDLE_INSTRUCTION_START(SGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001323 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001324 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1325 }
1326 HANDLE_INSTRUCTION_END();
1327
1328 HANDLE_INSTRUCTION_START(SGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001329 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001330 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1331 }
1332 HANDLE_INSTRUCTION_END();
1333
1334 HANDLE_INSTRUCTION_START(SGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001335 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001336 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1337 }
1338 HANDLE_INSTRUCTION_END();
1339
1340 HANDLE_INSTRUCTION_START(SGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001341 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001342 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1343 }
1344 HANDLE_INSTRUCTION_END();
1345
1346 HANDLE_INSTRUCTION_START(SGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001347 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001348 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1349 }
1350 HANDLE_INSTRUCTION_END();
1351
1352 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001353 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001354 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1355 }
1356 HANDLE_INSTRUCTION_END();
1357
1358 HANDLE_INSTRUCTION_START(IPUT_BYTE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001359 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001360 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1361 }
1362 HANDLE_INSTRUCTION_END();
1363
1364 HANDLE_INSTRUCTION_START(IPUT_CHAR) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001365 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001366 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1367 }
1368 HANDLE_INSTRUCTION_END();
1369
1370 HANDLE_INSTRUCTION_START(IPUT_SHORT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001371 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001372 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1373 }
1374 HANDLE_INSTRUCTION_END();
1375
1376 HANDLE_INSTRUCTION_START(IPUT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001377 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001378 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1379 }
1380 HANDLE_INSTRUCTION_END();
1381
1382 HANDLE_INSTRUCTION_START(IPUT_WIDE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001383 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001384 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1385 }
1386 HANDLE_INSTRUCTION_END();
1387
1388 HANDLE_INSTRUCTION_START(IPUT_OBJECT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001389 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001390 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1391 }
1392 HANDLE_INSTRUCTION_END();
1393
1394 HANDLE_INSTRUCTION_START(IPUT_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001395 bool success = DoIPutQuick<Primitive::kPrimInt, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001396 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1397 }
1398 HANDLE_INSTRUCTION_END();
1399
Fred Shih37f05ef2014-07-16 18:38:08 -07001400 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN_QUICK) {
1401 bool success = DoIPutQuick<Primitive::kPrimBoolean, transaction_active>(shadow_frame, inst, inst_data);
1402 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1403 }
1404 HANDLE_INSTRUCTION_END();
1405
1406 HANDLE_INSTRUCTION_START(IPUT_BYTE_QUICK) {
1407 bool success = DoIPutQuick<Primitive::kPrimByte, transaction_active>(shadow_frame, inst, inst_data);
1408 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1409 }
1410 HANDLE_INSTRUCTION_END();
1411
1412 HANDLE_INSTRUCTION_START(IPUT_CHAR_QUICK) {
1413 bool success = DoIPutQuick<Primitive::kPrimChar, transaction_active>(shadow_frame, inst, inst_data);
1414 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1415 }
1416 HANDLE_INSTRUCTION_END();
1417
1418 HANDLE_INSTRUCTION_START(IPUT_SHORT_QUICK) {
1419 bool success = DoIPutQuick<Primitive::kPrimShort, transaction_active>(shadow_frame, inst, inst_data);
1420 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1421 }
1422 HANDLE_INSTRUCTION_END();
1423
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001424 HANDLE_INSTRUCTION_START(IPUT_WIDE_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001425 bool success = DoIPutQuick<Primitive::kPrimLong, transaction_active>(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_OBJECT_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001431 bool success = DoIPutQuick<Primitive::kPrimNot, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001432 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1433 }
1434 HANDLE_INSTRUCTION_END();
1435
1436 HANDLE_INSTRUCTION_START(SPUT_BOOLEAN) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001437 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001438 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1439 }
1440 HANDLE_INSTRUCTION_END();
1441
1442 HANDLE_INSTRUCTION_START(SPUT_BYTE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001443 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001444 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1445 }
1446 HANDLE_INSTRUCTION_END();
1447
1448 HANDLE_INSTRUCTION_START(SPUT_CHAR) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001449 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001450 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1451 }
1452 HANDLE_INSTRUCTION_END();
1453
1454 HANDLE_INSTRUCTION_START(SPUT_SHORT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001455 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001456 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1457 }
1458 HANDLE_INSTRUCTION_END();
1459
1460 HANDLE_INSTRUCTION_START(SPUT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001461 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001462 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1463 }
1464 HANDLE_INSTRUCTION_END();
1465
1466 HANDLE_INSTRUCTION_START(SPUT_WIDE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001467 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001468 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1469 }
1470 HANDLE_INSTRUCTION_END();
1471
1472 HANDLE_INSTRUCTION_START(SPUT_OBJECT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001473 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001474 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1475 }
1476 HANDLE_INSTRUCTION_END();
1477
1478 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001479 bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001480 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001481 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1482 }
1483 HANDLE_INSTRUCTION_END();
1484
1485 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001486 bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001487 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001488 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1489 }
1490 HANDLE_INSTRUCTION_END();
1491
1492 HANDLE_INSTRUCTION_START(INVOKE_SUPER) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001493 bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001494 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001495 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1496 }
1497 HANDLE_INSTRUCTION_END();
1498
1499 HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001500 bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001501 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001502 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1503 }
1504 HANDLE_INSTRUCTION_END();
1505
1506 HANDLE_INSTRUCTION_START(INVOKE_DIRECT) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001507 bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001508 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001509 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1510 }
1511 HANDLE_INSTRUCTION_END();
1512
1513 HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001514 bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001515 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001516 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1517 }
1518 HANDLE_INSTRUCTION_END();
1519
1520 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001521 bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001522 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001523 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1524 }
1525 HANDLE_INSTRUCTION_END();
1526
1527 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001528 bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001529 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001530 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1531 }
1532 HANDLE_INSTRUCTION_END();
1533
1534 HANDLE_INSTRUCTION_START(INVOKE_STATIC) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001535 bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001536 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001537 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1538 }
1539 HANDLE_INSTRUCTION_END();
1540
1541 HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001542 bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001543 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001544 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1545 }
1546 HANDLE_INSTRUCTION_END();
1547
1548 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001549 bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001550 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001551 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1552 }
1553 HANDLE_INSTRUCTION_END();
1554
1555 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001556 bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001557 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001558 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1559 }
1560 HANDLE_INSTRUCTION_END();
1561
1562 HANDLE_INSTRUCTION_START(NEG_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001563 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001564 ADVANCE(1);
1565 HANDLE_INSTRUCTION_END();
1566
1567 HANDLE_INSTRUCTION_START(NOT_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001568 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001569 ADVANCE(1);
1570 HANDLE_INSTRUCTION_END();
1571
1572 HANDLE_INSTRUCTION_START(NEG_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001573 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001574 ADVANCE(1);
1575 HANDLE_INSTRUCTION_END();
1576
1577 HANDLE_INSTRUCTION_START(NOT_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001578 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001579 ADVANCE(1);
1580 HANDLE_INSTRUCTION_END();
1581
1582 HANDLE_INSTRUCTION_START(NEG_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001583 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001584 ADVANCE(1);
1585 HANDLE_INSTRUCTION_END();
1586
1587 HANDLE_INSTRUCTION_START(NEG_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001588 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001589 ADVANCE(1);
1590 HANDLE_INSTRUCTION_END();
1591
1592 HANDLE_INSTRUCTION_START(INT_TO_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001593 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001594 ADVANCE(1);
1595 HANDLE_INSTRUCTION_END();
1596
1597 HANDLE_INSTRUCTION_START(INT_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001598 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001599 ADVANCE(1);
1600 HANDLE_INSTRUCTION_END();
1601
1602 HANDLE_INSTRUCTION_START(INT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001603 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001604 ADVANCE(1);
1605 HANDLE_INSTRUCTION_END();
1606
1607 HANDLE_INSTRUCTION_START(LONG_TO_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001608 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001609 ADVANCE(1);
1610 HANDLE_INSTRUCTION_END();
1611
1612 HANDLE_INSTRUCTION_START(LONG_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001613 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001614 ADVANCE(1);
1615 HANDLE_INSTRUCTION_END();
1616
1617 HANDLE_INSTRUCTION_START(LONG_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001618 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001619 ADVANCE(1);
1620 HANDLE_INSTRUCTION_END();
1621
1622 HANDLE_INSTRUCTION_START(FLOAT_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001623 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001624 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001625 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001626 ADVANCE(1);
1627 }
1628 HANDLE_INSTRUCTION_END();
1629
1630 HANDLE_INSTRUCTION_START(FLOAT_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001631 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001632 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001633 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001634 ADVANCE(1);
1635 }
1636 HANDLE_INSTRUCTION_END();
1637
1638 HANDLE_INSTRUCTION_START(FLOAT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001639 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001640 ADVANCE(1);
1641 HANDLE_INSTRUCTION_END();
1642
1643 HANDLE_INSTRUCTION_START(DOUBLE_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001644 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001645 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001646 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001647 ADVANCE(1);
1648 }
1649 HANDLE_INSTRUCTION_END();
1650
1651 HANDLE_INSTRUCTION_START(DOUBLE_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001652 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001653 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001654 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001655 ADVANCE(1);
1656 }
1657 HANDLE_INSTRUCTION_END();
1658
1659 HANDLE_INSTRUCTION_START(DOUBLE_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001660 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001661 ADVANCE(1);
1662 HANDLE_INSTRUCTION_END();
1663
1664 HANDLE_INSTRUCTION_START(INT_TO_BYTE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001665 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1666 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001667 ADVANCE(1);
1668 HANDLE_INSTRUCTION_END();
1669
1670 HANDLE_INSTRUCTION_START(INT_TO_CHAR)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001671 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1672 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001673 ADVANCE(1);
1674 HANDLE_INSTRUCTION_END();
1675
1676 HANDLE_INSTRUCTION_START(INT_TO_SHORT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001677 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1678 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001679 ADVANCE(1);
1680 HANDLE_INSTRUCTION_END();
1681
1682 HANDLE_INSTRUCTION_START(ADD_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001683 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001684 SafeAdd(shadow_frame.GetVReg(inst->VRegB_23x()),
1685 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001686 ADVANCE(2);
1687 HANDLE_INSTRUCTION_END();
1688
1689 HANDLE_INSTRUCTION_START(SUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001690 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001691 SafeSub(shadow_frame.GetVReg(inst->VRegB_23x()),
1692 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001693 ADVANCE(2);
1694 HANDLE_INSTRUCTION_END();
1695
1696 HANDLE_INSTRUCTION_START(MUL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001697 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001698 SafeMul(shadow_frame.GetVReg(inst->VRegB_23x()),
1699 shadow_frame.GetVReg(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001700 ADVANCE(2);
1701 HANDLE_INSTRUCTION_END();
1702
1703 HANDLE_INSTRUCTION_START(DIV_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001704 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
1705 shadow_frame.GetVReg(inst->VRegB_23x()),
1706 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001707 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1708 }
1709 HANDLE_INSTRUCTION_END();
1710
1711 HANDLE_INSTRUCTION_START(REM_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001712 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1713 shadow_frame.GetVReg(inst->VRegB_23x()),
1714 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001715 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1716 }
1717 HANDLE_INSTRUCTION_END();
1718
1719 HANDLE_INSTRUCTION_START(SHL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001720 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001721 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1722 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1723 ADVANCE(2);
1724 HANDLE_INSTRUCTION_END();
1725
1726 HANDLE_INSTRUCTION_START(SHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001727 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001728 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1729 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1730 ADVANCE(2);
1731 HANDLE_INSTRUCTION_END();
1732
1733 HANDLE_INSTRUCTION_START(USHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001734 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001735 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1736 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1737 ADVANCE(2);
1738 HANDLE_INSTRUCTION_END();
1739
1740 HANDLE_INSTRUCTION_START(AND_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001741 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001742 shadow_frame.GetVReg(inst->VRegB_23x()) &
1743 shadow_frame.GetVReg(inst->VRegC_23x()));
1744 ADVANCE(2);
1745 HANDLE_INSTRUCTION_END();
1746
1747 HANDLE_INSTRUCTION_START(OR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001748 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001749 shadow_frame.GetVReg(inst->VRegB_23x()) |
1750 shadow_frame.GetVReg(inst->VRegC_23x()));
1751 ADVANCE(2);
1752 HANDLE_INSTRUCTION_END();
1753
1754 HANDLE_INSTRUCTION_START(XOR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001755 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001756 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1757 shadow_frame.GetVReg(inst->VRegC_23x()));
1758 ADVANCE(2);
1759 HANDLE_INSTRUCTION_END();
1760
1761 HANDLE_INSTRUCTION_START(ADD_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001762 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001763 SafeAdd(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1764 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001765 ADVANCE(2);
1766 HANDLE_INSTRUCTION_END();
1767
1768 HANDLE_INSTRUCTION_START(SUB_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001769 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001770 SafeSub(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1771 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001772 ADVANCE(2);
1773 HANDLE_INSTRUCTION_END();
1774
1775 HANDLE_INSTRUCTION_START(MUL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001776 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07001777 SafeMul(shadow_frame.GetVRegLong(inst->VRegB_23x()),
1778 shadow_frame.GetVRegLong(inst->VRegC_23x())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001779 ADVANCE(2);
1780 HANDLE_INSTRUCTION_END();
1781
1782 HANDLE_INSTRUCTION_START(DIV_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001783 bool success = DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
1784 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1785 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001786 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1787 }
1788 HANDLE_INSTRUCTION_END();
1789
1790 HANDLE_INSTRUCTION_START(REM_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001791 bool success = DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1792 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1793 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001794 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1795 }
1796 HANDLE_INSTRUCTION_END();
1797
1798 HANDLE_INSTRUCTION_START(AND_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001799 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001800 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1801 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1802 ADVANCE(2);
1803 HANDLE_INSTRUCTION_END();
1804
1805 HANDLE_INSTRUCTION_START(OR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001806 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001807 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1808 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1809 ADVANCE(2);
1810 HANDLE_INSTRUCTION_END();
1811
1812 HANDLE_INSTRUCTION_START(XOR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001813 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001814 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1815 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1816 ADVANCE(2);
1817 HANDLE_INSTRUCTION_END();
1818
1819 HANDLE_INSTRUCTION_START(SHL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001820 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001821 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1822 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1823 ADVANCE(2);
1824 HANDLE_INSTRUCTION_END();
1825
1826 HANDLE_INSTRUCTION_START(SHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001827 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001828 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1829 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1830 ADVANCE(2);
1831 HANDLE_INSTRUCTION_END();
1832
1833 HANDLE_INSTRUCTION_START(USHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001834 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001835 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1836 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1837 ADVANCE(2);
1838 HANDLE_INSTRUCTION_END();
1839
1840 HANDLE_INSTRUCTION_START(ADD_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001841 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001842 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1843 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1844 ADVANCE(2);
1845 HANDLE_INSTRUCTION_END();
1846
1847 HANDLE_INSTRUCTION_START(SUB_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001848 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001849 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1850 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1851 ADVANCE(2);
1852 HANDLE_INSTRUCTION_END();
1853
1854 HANDLE_INSTRUCTION_START(MUL_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001855 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001856 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1857 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1858 ADVANCE(2);
1859 HANDLE_INSTRUCTION_END();
1860
1861 HANDLE_INSTRUCTION_START(DIV_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001862 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001863 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1864 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1865 ADVANCE(2);
1866 HANDLE_INSTRUCTION_END();
1867
1868 HANDLE_INSTRUCTION_START(REM_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001869 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001870 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1871 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1872 ADVANCE(2);
1873 HANDLE_INSTRUCTION_END();
1874
1875 HANDLE_INSTRUCTION_START(ADD_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001876 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001877 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1878 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1879 ADVANCE(2);
1880 HANDLE_INSTRUCTION_END();
1881
1882 HANDLE_INSTRUCTION_START(SUB_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001883 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001884 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1885 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1886 ADVANCE(2);
1887 HANDLE_INSTRUCTION_END();
1888
1889 HANDLE_INSTRUCTION_START(MUL_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001890 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001891 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1892 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1893 ADVANCE(2);
1894 HANDLE_INSTRUCTION_END();
1895
1896 HANDLE_INSTRUCTION_START(DIV_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001897 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001898 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1899 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1900 ADVANCE(2);
1901 HANDLE_INSTRUCTION_END();
1902
1903 HANDLE_INSTRUCTION_START(REM_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001904 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001905 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1906 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1907 ADVANCE(2);
1908 HANDLE_INSTRUCTION_END();
1909
1910 HANDLE_INSTRUCTION_START(ADD_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001911 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001912 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001913 SafeAdd(shadow_frame.GetVReg(vregA),
1914 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001915 ADVANCE(1);
1916 }
1917 HANDLE_INSTRUCTION_END();
1918
1919 HANDLE_INSTRUCTION_START(SUB_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001920 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001921 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001922 SafeSub(shadow_frame.GetVReg(vregA),
1923 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001924 ADVANCE(1);
1925 }
1926 HANDLE_INSTRUCTION_END();
1927
1928 HANDLE_INSTRUCTION_START(MUL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001929 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001930 shadow_frame.SetVReg(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07001931 SafeMul(shadow_frame.GetVReg(vregA),
1932 shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001933 ADVANCE(1);
1934 }
1935 HANDLE_INSTRUCTION_END();
1936
1937 HANDLE_INSTRUCTION_START(DIV_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001938 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001939 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001940 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001941 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1942 }
1943 HANDLE_INSTRUCTION_END();
1944
1945 HANDLE_INSTRUCTION_START(REM_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001946 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001947 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001948 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001949 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1950 }
1951 HANDLE_INSTRUCTION_END();
1952
1953 HANDLE_INSTRUCTION_START(SHL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001954 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001955 shadow_frame.SetVReg(vregA,
1956 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001957 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001958 ADVANCE(1);
1959 }
1960 HANDLE_INSTRUCTION_END();
1961
1962 HANDLE_INSTRUCTION_START(SHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001963 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001964 shadow_frame.SetVReg(vregA,
1965 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001966 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001967 ADVANCE(1);
1968 }
1969 HANDLE_INSTRUCTION_END();
1970
1971 HANDLE_INSTRUCTION_START(USHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001972 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001973 shadow_frame.SetVReg(vregA,
1974 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001975 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001976 ADVANCE(1);
1977 }
1978 HANDLE_INSTRUCTION_END();
1979
1980 HANDLE_INSTRUCTION_START(AND_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001981 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001982 shadow_frame.SetVReg(vregA,
1983 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001984 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001985 ADVANCE(1);
1986 }
1987 HANDLE_INSTRUCTION_END();
1988
1989 HANDLE_INSTRUCTION_START(OR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001990 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001991 shadow_frame.SetVReg(vregA,
1992 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001993 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001994 ADVANCE(1);
1995 }
1996 HANDLE_INSTRUCTION_END();
1997
1998 HANDLE_INSTRUCTION_START(XOR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001999 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002000 shadow_frame.SetVReg(vregA,
2001 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002002 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002003 ADVANCE(1);
2004 }
2005 HANDLE_INSTRUCTION_END();
2006
2007 HANDLE_INSTRUCTION_START(ADD_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002008 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002009 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002010 SafeAdd(shadow_frame.GetVRegLong(vregA),
2011 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002012 ADVANCE(1);
2013 }
2014 HANDLE_INSTRUCTION_END();
2015
2016 HANDLE_INSTRUCTION_START(SUB_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002017 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002018 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002019 SafeSub(shadow_frame.GetVRegLong(vregA),
2020 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002021 ADVANCE(1);
2022 }
2023 HANDLE_INSTRUCTION_END();
2024
2025 HANDLE_INSTRUCTION_START(MUL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002026 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002027 shadow_frame.SetVRegLong(vregA,
Ian Rogersf72a11d2014-10-30 15:41:08 -07002028 SafeMul(shadow_frame.GetVRegLong(vregA),
2029 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002030 ADVANCE(1);
2031 }
2032 HANDLE_INSTRUCTION_END();
2033
2034 HANDLE_INSTRUCTION_START(DIV_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002035 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002036 bool success = DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002037 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002038 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2039 }
2040 HANDLE_INSTRUCTION_END();
2041
2042 HANDLE_INSTRUCTION_START(REM_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002043 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002044 bool success = DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002045 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002046 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2047 }
2048 HANDLE_INSTRUCTION_END();
2049
2050 HANDLE_INSTRUCTION_START(AND_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002051 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002052 shadow_frame.SetVRegLong(vregA,
2053 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002054 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002055 ADVANCE(1);
2056 }
2057 HANDLE_INSTRUCTION_END();
2058
2059 HANDLE_INSTRUCTION_START(OR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002060 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002061 shadow_frame.SetVRegLong(vregA,
2062 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002063 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002064 ADVANCE(1);
2065 }
2066 HANDLE_INSTRUCTION_END();
2067
2068 HANDLE_INSTRUCTION_START(XOR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002069 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002070 shadow_frame.SetVRegLong(vregA,
2071 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002072 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002073 ADVANCE(1);
2074 }
2075 HANDLE_INSTRUCTION_END();
2076
2077 HANDLE_INSTRUCTION_START(SHL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002078 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002079 shadow_frame.SetVRegLong(vregA,
2080 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002081 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002082 ADVANCE(1);
2083 }
2084 HANDLE_INSTRUCTION_END();
2085
2086 HANDLE_INSTRUCTION_START(SHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002087 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002088 shadow_frame.SetVRegLong(vregA,
2089 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002090 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002091 ADVANCE(1);
2092 }
2093 HANDLE_INSTRUCTION_END();
2094
2095 HANDLE_INSTRUCTION_START(USHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002096 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002097 shadow_frame.SetVRegLong(vregA,
2098 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002099 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002100 ADVANCE(1);
2101 }
2102 HANDLE_INSTRUCTION_END();
2103
2104 HANDLE_INSTRUCTION_START(ADD_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002105 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002106 shadow_frame.SetVRegFloat(vregA,
2107 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002108 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002109 ADVANCE(1);
2110 }
2111 HANDLE_INSTRUCTION_END();
2112
2113 HANDLE_INSTRUCTION_START(SUB_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002114 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002115 shadow_frame.SetVRegFloat(vregA,
2116 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002117 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002118 ADVANCE(1);
2119 }
2120 HANDLE_INSTRUCTION_END();
2121
2122 HANDLE_INSTRUCTION_START(MUL_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002123 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002124 shadow_frame.SetVRegFloat(vregA,
2125 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002126 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002127 ADVANCE(1);
2128 }
2129 HANDLE_INSTRUCTION_END();
2130
2131 HANDLE_INSTRUCTION_START(DIV_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002132 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002133 shadow_frame.SetVRegFloat(vregA,
2134 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002135 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002136 ADVANCE(1);
2137 }
2138 HANDLE_INSTRUCTION_END();
2139
2140 HANDLE_INSTRUCTION_START(REM_FLOAT_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 shadow_frame.SetVRegFloat(vregA,
2143 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002144 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002145 ADVANCE(1);
2146 }
2147 HANDLE_INSTRUCTION_END();
2148
2149 HANDLE_INSTRUCTION_START(ADD_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002150 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002151 shadow_frame.SetVRegDouble(vregA,
2152 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002153 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002154 ADVANCE(1);
2155 }
2156 HANDLE_INSTRUCTION_END();
2157
2158 HANDLE_INSTRUCTION_START(SUB_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002159 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002160 shadow_frame.SetVRegDouble(vregA,
2161 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002162 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002163 ADVANCE(1);
2164 }
2165 HANDLE_INSTRUCTION_END();
2166
2167 HANDLE_INSTRUCTION_START(MUL_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002168 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002169 shadow_frame.SetVRegDouble(vregA,
2170 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002171 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002172 ADVANCE(1);
2173 }
2174 HANDLE_INSTRUCTION_END();
2175
2176 HANDLE_INSTRUCTION_START(DIV_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002177 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002178 shadow_frame.SetVRegDouble(vregA,
2179 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002180 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002181 ADVANCE(1);
2182 }
2183 HANDLE_INSTRUCTION_END();
2184
2185 HANDLE_INSTRUCTION_START(REM_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002186 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002187 shadow_frame.SetVRegDouble(vregA,
2188 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002189 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002190 ADVANCE(1);
2191 }
2192 HANDLE_INSTRUCTION_END();
2193
2194 HANDLE_INSTRUCTION_START(ADD_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002195 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002196 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2197 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002198 ADVANCE(2);
2199 HANDLE_INSTRUCTION_END();
2200
2201 HANDLE_INSTRUCTION_START(RSUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002202 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002203 SafeSub(inst->VRegC_22s(),
2204 shadow_frame.GetVReg(inst->VRegB_22s(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002205 ADVANCE(2);
2206 HANDLE_INSTRUCTION_END();
2207
2208 HANDLE_INSTRUCTION_START(MUL_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002209 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002210 SafeMul(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)),
2211 inst->VRegC_22s()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002212 ADVANCE(2);
2213 HANDLE_INSTRUCTION_END();
2214
2215 HANDLE_INSTRUCTION_START(DIV_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002216 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
2217 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002218 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2219 }
2220 HANDLE_INSTRUCTION_END();
2221
2222 HANDLE_INSTRUCTION_START(REM_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002223 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
2224 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002225 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2226 }
2227 HANDLE_INSTRUCTION_END();
2228
2229 HANDLE_INSTRUCTION_START(AND_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002230 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2231 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002232 inst->VRegC_22s());
2233 ADVANCE(2);
2234 HANDLE_INSTRUCTION_END();
2235
2236 HANDLE_INSTRUCTION_START(OR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002237 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2238 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002239 inst->VRegC_22s());
2240 ADVANCE(2);
2241 HANDLE_INSTRUCTION_END();
2242
2243 HANDLE_INSTRUCTION_START(XOR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002244 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2245 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002246 inst->VRegC_22s());
2247 ADVANCE(2);
2248 HANDLE_INSTRUCTION_END();
2249
2250 HANDLE_INSTRUCTION_START(ADD_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002251 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002252 SafeAdd(shadow_frame.GetVReg(inst->VRegB_22b()),
2253 inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002254 ADVANCE(2);
2255 HANDLE_INSTRUCTION_END();
2256
2257 HANDLE_INSTRUCTION_START(RSUB_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002258 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002259 SafeSub(inst->VRegC_22b(),
2260 shadow_frame.GetVReg(inst->VRegB_22b())));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002261 ADVANCE(2);
2262 HANDLE_INSTRUCTION_END();
2263
2264 HANDLE_INSTRUCTION_START(MUL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002265 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Ian Rogersf72a11d2014-10-30 15:41:08 -07002266 SafeMul(shadow_frame.GetVReg(inst->VRegB_22b()),
2267 inst->VRegC_22b()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002268 ADVANCE(2);
2269 HANDLE_INSTRUCTION_END();
2270
2271 HANDLE_INSTRUCTION_START(DIV_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002272 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
2273 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002274 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2275 }
2276 HANDLE_INSTRUCTION_END();
2277
2278 HANDLE_INSTRUCTION_START(REM_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002279 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
2280 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002281 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2282 }
2283 HANDLE_INSTRUCTION_END();
2284
2285 HANDLE_INSTRUCTION_START(AND_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002286 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002287 shadow_frame.GetVReg(inst->VRegB_22b()) &
2288 inst->VRegC_22b());
2289 ADVANCE(2);
2290 HANDLE_INSTRUCTION_END();
2291
2292 HANDLE_INSTRUCTION_START(OR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002293 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002294 shadow_frame.GetVReg(inst->VRegB_22b()) |
2295 inst->VRegC_22b());
2296 ADVANCE(2);
2297 HANDLE_INSTRUCTION_END();
2298
2299 HANDLE_INSTRUCTION_START(XOR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002300 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002301 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2302 inst->VRegC_22b());
2303 ADVANCE(2);
2304 HANDLE_INSTRUCTION_END();
2305
2306 HANDLE_INSTRUCTION_START(SHL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002307 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002308 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2309 (inst->VRegC_22b() & 0x1f));
2310 ADVANCE(2);
2311 HANDLE_INSTRUCTION_END();
2312
2313 HANDLE_INSTRUCTION_START(SHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002314 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002315 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2316 (inst->VRegC_22b() & 0x1f));
2317 ADVANCE(2);
2318 HANDLE_INSTRUCTION_END();
2319
2320 HANDLE_INSTRUCTION_START(USHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002321 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002322 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2323 (inst->VRegC_22b() & 0x1f));
2324 ADVANCE(2);
2325 HANDLE_INSTRUCTION_END();
2326
2327 HANDLE_INSTRUCTION_START(UNUSED_3E)
Ian Rogerse94652f2014-12-02 11:13:19 -08002328 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002329 HANDLE_INSTRUCTION_END();
2330
2331 HANDLE_INSTRUCTION_START(UNUSED_3F)
Ian Rogerse94652f2014-12-02 11:13:19 -08002332 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002333 HANDLE_INSTRUCTION_END();
2334
2335 HANDLE_INSTRUCTION_START(UNUSED_40)
Ian Rogerse94652f2014-12-02 11:13:19 -08002336 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002337 HANDLE_INSTRUCTION_END();
2338
2339 HANDLE_INSTRUCTION_START(UNUSED_41)
Ian Rogerse94652f2014-12-02 11:13:19 -08002340 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002341 HANDLE_INSTRUCTION_END();
2342
2343 HANDLE_INSTRUCTION_START(UNUSED_42)
Ian Rogerse94652f2014-12-02 11:13:19 -08002344 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002345 HANDLE_INSTRUCTION_END();
2346
2347 HANDLE_INSTRUCTION_START(UNUSED_43)
Ian Rogerse94652f2014-12-02 11:13:19 -08002348 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002349 HANDLE_INSTRUCTION_END();
2350
2351 HANDLE_INSTRUCTION_START(UNUSED_79)
Ian Rogerse94652f2014-12-02 11:13:19 -08002352 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002353 HANDLE_INSTRUCTION_END();
2354
2355 HANDLE_INSTRUCTION_START(UNUSED_7A)
Ian Rogerse94652f2014-12-02 11:13:19 -08002356 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002357 HANDLE_INSTRUCTION_END();
2358
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002359 HANDLE_INSTRUCTION_START(UNUSED_F3)
Ian Rogerse94652f2014-12-02 11:13:19 -08002360 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002361 HANDLE_INSTRUCTION_END();
2362
2363 HANDLE_INSTRUCTION_START(UNUSED_F4)
Ian Rogerse94652f2014-12-02 11:13:19 -08002364 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002365 HANDLE_INSTRUCTION_END();
2366
2367 HANDLE_INSTRUCTION_START(UNUSED_F5)
Ian Rogerse94652f2014-12-02 11:13:19 -08002368 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002369 HANDLE_INSTRUCTION_END();
2370
2371 HANDLE_INSTRUCTION_START(UNUSED_F6)
Ian Rogerse94652f2014-12-02 11:13:19 -08002372 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002373 HANDLE_INSTRUCTION_END();
2374
2375 HANDLE_INSTRUCTION_START(UNUSED_F7)
Ian Rogerse94652f2014-12-02 11:13:19 -08002376 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002377 HANDLE_INSTRUCTION_END();
2378
2379 HANDLE_INSTRUCTION_START(UNUSED_F8)
Ian Rogerse94652f2014-12-02 11:13:19 -08002380 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002381 HANDLE_INSTRUCTION_END();
2382
2383 HANDLE_INSTRUCTION_START(UNUSED_F9)
Ian Rogerse94652f2014-12-02 11:13:19 -08002384 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002385 HANDLE_INSTRUCTION_END();
2386
2387 HANDLE_INSTRUCTION_START(UNUSED_FA)
Ian Rogerse94652f2014-12-02 11:13:19 -08002388 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002389 HANDLE_INSTRUCTION_END();
2390
2391 HANDLE_INSTRUCTION_START(UNUSED_FB)
Ian Rogerse94652f2014-12-02 11:13:19 -08002392 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002393 HANDLE_INSTRUCTION_END();
2394
2395 HANDLE_INSTRUCTION_START(UNUSED_FC)
Ian Rogerse94652f2014-12-02 11:13:19 -08002396 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002397 HANDLE_INSTRUCTION_END();
2398
2399 HANDLE_INSTRUCTION_START(UNUSED_FD)
Ian Rogerse94652f2014-12-02 11:13:19 -08002400 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002401 HANDLE_INSTRUCTION_END();
2402
2403 HANDLE_INSTRUCTION_START(UNUSED_FE)
Ian Rogerse94652f2014-12-02 11:13:19 -08002404 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002405 HANDLE_INSTRUCTION_END();
2406
2407 HANDLE_INSTRUCTION_START(UNUSED_FF)
Ian Rogerse94652f2014-12-02 11:13:19 -08002408 UnexpectedOpcode(inst, shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002409 HANDLE_INSTRUCTION_END();
2410
2411 exception_pending_label: {
2412 CHECK(self->IsExceptionPending());
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002413 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -07002414 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002415 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002416 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002417 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002418 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc,
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002419 instrumentation);
2420 if (found_dex_pc == DexFile::kDexNoIndex) {
2421 return JValue(); /* Handled in caller. */
2422 } else {
2423 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc);
2424 ADVANCE(displacement);
2425 }
2426 }
2427
Sebastien Hertz8379b222014-02-24 17:38:15 +01002428// Create alternative instruction handlers dedicated to instrumentation.
2429// Return instructions must not call Instrumentation::DexPcMovedEvent since they already call
2430// Instrumentation::MethodExited. This is to avoid posting debugger events twice for this location.
Sebastien Hertze713d932014-05-15 10:48:53 +02002431// Note: we do not use the kReturn instruction flag here (to test the instruction is a return). The
2432// compiler seems to not evaluate "(Instruction::FlagsOf(Instruction::code) & kReturn) != 0" to
2433// a constant condition that would remove the "if" statement so the test is free.
Sebastien Hertz8379b222014-02-24 17:38:15 +01002434#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
2435 alt_op_##code: { \
2436 if (Instruction::code != Instruction::RETURN_VOID && \
Mathieu Chartierd7cbf8a2015-03-19 12:43:20 -07002437 Instruction::code != Instruction::RETURN_VOID_NO_BARRIER && \
Sebastien Hertz8379b222014-02-24 17:38:15 +01002438 Instruction::code != Instruction::RETURN && \
2439 Instruction::code != Instruction::RETURN_WIDE && \
2440 Instruction::code != Instruction::RETURN_OBJECT) { \
2441 if (LIKELY(!notified_method_entry_event)) { \
2442 Runtime* runtime = Runtime::Current(); \
2443 const instrumentation::Instrumentation* instrumentation = runtime->GetInstrumentation(); \
2444 if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
2445 Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_); \
2446 instrumentation->DexPcMovedEvent(self, this_object, shadow_frame.GetMethod(), dex_pc); \
2447 } \
2448 } else { \
2449 notified_method_entry_event = false; \
2450 } \
2451 } \
2452 UPDATE_HANDLER_TABLE(); \
2453 goto *handlersTable[instrumentation::kMainHandlerTable][Instruction::code]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002454 }
2455#include "dex_instruction_list.h"
2456 DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER)
2457#undef DEX_INSTRUCTION_LIST
2458#undef INSTRUMENTATION_INSTRUCTION_HANDLER
2459} // NOLINT(readability/fn_size)
2460
2461// Explicit definitions of ExecuteGotoImpl.
Sebastien Hertzc6714852013-09-30 16:42:32 +02002462template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002463JValue ExecuteGotoImpl<true, false>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002464 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertzc6714852013-09-30 16:42:32 +02002465template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
Ian Rogerse94652f2014-12-02 11:13:19 -08002466JValue ExecuteGotoImpl<false, false>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002467 ShadowFrame& shadow_frame, JValue result_register);
2468template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
Ian Rogerse94652f2014-12-02 11:13:19 -08002469JValue ExecuteGotoImpl<true, true>(Thread* self, const DexFile::CodeItem* code_item,
2470 ShadowFrame& shadow_frame, JValue result_register);
2471template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
2472JValue ExecuteGotoImpl<false, true>(Thread* self, const DexFile::CodeItem* code_item,
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002473 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002474
2475} // namespace interpreter
2476} // namespace art
Colin Crosse84e4f72015-03-18 14:01:19 -07002477
2478#endif