blob: 5c8a6c6f16245a28bc4304f746597fa89c311beb [file] [log] [blame]
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "interpreter_common.h"
18
19namespace art {
20namespace interpreter {
21
22// In the following macros, we expect the following local variables exist:
23// - "self": the current Thread*.
24// - "inst" : the current Instruction*.
Sebastien Hertz3b588e02013-09-11 14:33:18 +020025// - "inst_data" : the current instruction's first 16 bits.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020026// - "dex_pc": the current pc.
27// - "shadow_frame": the current shadow frame.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020028// - "mh": the current MethodHelper.
29// - "currentHandlersTable": the current table of pointer to each instruction handler.
30
31// Advance to the next instruction and updates interpreter state.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020032#define ADVANCE(_offset) \
33 do { \
34 int32_t disp = static_cast<int32_t>(_offset); \
35 inst = inst->RelativeAt(disp); \
36 dex_pc = static_cast<uint32_t>(static_cast<int32_t>(dex_pc) + disp); \
37 shadow_frame.SetDexPC(dex_pc); \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020038 TraceExecution(shadow_frame, inst, dex_pc, mh); \
Sebastien Hertz3b588e02013-09-11 14:33:18 +020039 inst_data = inst->Fetch16(0); \
40 goto *currentHandlersTable[inst->Opcode(inst_data)]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020041 } while (false)
42
43#define HANDLE_PENDING_EXCEPTION() goto exception_pending_label
44
45#define POSSIBLY_HANDLE_PENDING_EXCEPTION(_is_exception_pending, _offset) \
46 do { \
47 if (UNLIKELY(_is_exception_pending)) { \
48 HANDLE_PENDING_EXCEPTION(); \
49 } else { \
50 ADVANCE(_offset); \
51 } \
52 } while (false)
53
Sebastien Hertzee1997a2013-09-19 14:47:09 +020054#define UPDATE_HANDLER_TABLE() \
55 currentHandlersTable = handlersTable[Runtime::Current()->GetInstrumentation()->GetInterpreterHandlerTable()]
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +020056
Sebastien Hertz8ece0502013-08-07 11:26:41 +020057#define UNREACHABLE_CODE_CHECK() \
58 do { \
59 if (kIsDebugBuild) { \
60 LOG(FATAL) << "We should not be here !"; \
61 } \
62 } while (false)
63
64#define HANDLE_INSTRUCTION_START(opcode) op_##opcode: // NOLINT(whitespace/labels)
65#define HANDLE_INSTRUCTION_END() UNREACHABLE_CODE_CHECK()
66
Sebastien Hertzee1997a2013-09-19 14:47:09 +020067/**
68 * Interpreter based on computed goto tables.
69 *
70 * Each instruction is associated to a handler. This handler is responsible for executing the
71 * instruction and jump to the next instruction's handler.
72 * In order to limit the cost of instrumentation, we have two handler tables:
73 * - the "main" handler table: it contains handlers for normal execution of each instruction without
74 * handling of instrumentation.
75 * - the "alternative" handler table: it contains alternative handlers which first handle
76 * instrumentation before jumping to the corresponding "normal" instruction's handler.
77 *
78 * When instrumentation is active, the interpreter uses the "alternative" handler table. Otherwise
79 * it uses the "main" handler table.
80 *
81 * The current handler table is the handler table being used by the interpreter. It is updated:
82 * - on backward branch (goto, if and switch instructions)
83 * - after invoke
84 * - when an exception is thrown.
85 * This allows to support an attaching debugger to an already running application for instance.
86 *
87 * For a fast handler table update, handler tables are stored in an array of handler tables. Each
88 * handler table is represented by the InterpreterHandlerTable enum which allows to associate it
89 * to an index in this array of handler tables ((see Instrumentation::GetInterpreterHandlerTable).
90 *
91 * Here's the current layout of this array of handler tables:
92 *
93 * ---------------------+---------------+
94 * | NOP | (handler for NOP instruction)
95 * +---------------+
96 * "main" | MOVE | (handler for MOVE instruction)
97 * handler table +---------------+
98 * | ... |
99 * +---------------+
100 * | UNUSED_FF | (handler for UNUSED_FF instruction)
101 * ---------------------+---------------+
102 * | NOP | (alternative handler for NOP instruction)
103 * +---------------+
104 * "alternative" | MOVE | (alternative handler for MOVE instruction)
105 * handler table +---------------+
106 * | ... |
107 * +---------------+
108 * | UNUSED_FF | (alternative handler for UNUSED_FF instruction)
109 * ---------------------+---------------+
110 *
111 */
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100112template<bool do_access_check, bool transaction_active>
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200113JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item,
114 ShadowFrame& shadow_frame, JValue result_register) {
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200115 // Define handler tables:
116 // - The main handler table contains execution handlers for each instruction.
117 // - The alternative handler table contains prelude handlers which check for thread suspend and
118 // manage instrumentation before jumping to the execution handler.
119 static const void* const handlersTable[instrumentation::kNumHandlerTables][kNumPackedOpcodes] = {
120 {
121 // Main handler table.
122#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&op_##code,
123#include "dex_instruction_list.h"
124 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
125#undef DEX_INSTRUCTION_LIST
126#undef INSTRUCTION_HANDLER
127 }, {
128 // Alternative handler table.
129#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&alt_op_##code,
130#include "dex_instruction_list.h"
131 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
132#undef DEX_INSTRUCTION_LIST
133#undef INSTRUCTION_HANDLER
134 }
135 };
136
137 const bool do_assignability_check = do_access_check;
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200138 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
139 LOG(FATAL) << "Invalid shadow frame for interpreter use";
140 return JValue();
141 }
142 self->VerifyStack();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200143
144 uint32_t dex_pc = shadow_frame.GetDexPC();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200145 const Instruction* inst = Instruction::At(code_item->insns_ + dex_pc);
146 uint16_t inst_data;
147 const void* const* currentHandlersTable;
Sebastien Hertz8379b222014-02-24 17:38:15 +0100148 bool notified_method_entry_event = false;
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200149 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200150 if (LIKELY(dex_pc == 0)) { // We are entering the method as opposed to deoptimizing..
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200151 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200152 if (UNLIKELY(instrumentation->HasMethodEntryListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200153 instrumentation->MethodEnterEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200154 shadow_frame.GetMethod(), 0);
Sebastien Hertz8379b222014-02-24 17:38:15 +0100155 notified_method_entry_event = true;
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200156 }
157 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200158
159 // Jump to first instruction.
160 ADVANCE(0);
161 UNREACHABLE_CODE_CHECK();
162
163 HANDLE_INSTRUCTION_START(NOP)
164 ADVANCE(1);
165 HANDLE_INSTRUCTION_END();
166
167 HANDLE_INSTRUCTION_START(MOVE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200168 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
169 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200170 ADVANCE(1);
171 HANDLE_INSTRUCTION_END();
172
173 HANDLE_INSTRUCTION_START(MOVE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200174 shadow_frame.SetVReg(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200175 shadow_frame.GetVReg(inst->VRegB_22x()));
176 ADVANCE(2);
177 HANDLE_INSTRUCTION_END();
178
179 HANDLE_INSTRUCTION_START(MOVE_16)
180 shadow_frame.SetVReg(inst->VRegA_32x(),
181 shadow_frame.GetVReg(inst->VRegB_32x()));
182 ADVANCE(3);
183 HANDLE_INSTRUCTION_END();
184
185 HANDLE_INSTRUCTION_START(MOVE_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200186 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
187 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200188 ADVANCE(1);
189 HANDLE_INSTRUCTION_END();
190
191 HANDLE_INSTRUCTION_START(MOVE_WIDE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200192 shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200193 shadow_frame.GetVRegLong(inst->VRegB_22x()));
194 ADVANCE(2);
195 HANDLE_INSTRUCTION_END();
196
197 HANDLE_INSTRUCTION_START(MOVE_WIDE_16)
198 shadow_frame.SetVRegLong(inst->VRegA_32x(),
199 shadow_frame.GetVRegLong(inst->VRegB_32x()));
200 ADVANCE(3);
201 HANDLE_INSTRUCTION_END();
202
203 HANDLE_INSTRUCTION_START(MOVE_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200204 shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data),
205 shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200206 ADVANCE(1);
207 HANDLE_INSTRUCTION_END();
208
209 HANDLE_INSTRUCTION_START(MOVE_OBJECT_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200210 shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200211 shadow_frame.GetVRegReference(inst->VRegB_22x()));
212 ADVANCE(2);
213 HANDLE_INSTRUCTION_END();
214
215 HANDLE_INSTRUCTION_START(MOVE_OBJECT_16)
216 shadow_frame.SetVRegReference(inst->VRegA_32x(),
217 shadow_frame.GetVRegReference(inst->VRegB_32x()));
218 ADVANCE(3);
219 HANDLE_INSTRUCTION_END();
220
221 HANDLE_INSTRUCTION_START(MOVE_RESULT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200222 shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200223 ADVANCE(1);
224 HANDLE_INSTRUCTION_END();
225
226 HANDLE_INSTRUCTION_START(MOVE_RESULT_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200227 shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200228 ADVANCE(1);
229 HANDLE_INSTRUCTION_END();
230
231 HANDLE_INSTRUCTION_START(MOVE_RESULT_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200232 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200233 ADVANCE(1);
234 HANDLE_INSTRUCTION_END();
235
236 HANDLE_INSTRUCTION_START(MOVE_EXCEPTION) {
Sebastien Hertz5c004902014-05-21 10:07:42 +0200237 Throwable* exception = self->GetException(nullptr);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200238 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception);
Sebastien Hertz5c004902014-05-21 10:07:42 +0200239 self->ClearException();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200240 ADVANCE(1);
241 }
242 HANDLE_INSTRUCTION_END();
243
244 HANDLE_INSTRUCTION_START(RETURN_VOID) {
245 JValue result;
Sebastien Hertz043036f2013-09-09 18:26:48 +0200246 if (do_access_check) {
247 // If access checks are required then the dex-to-dex compiler and analysis of
248 // whether the class has final fields hasn't been performed. Conservatively
249 // perform the memory barrier now.
Hans Boehm30359612014-05-21 17:46:23 -0700250 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz043036f2013-09-09 18:26:48 +0200251 }
Ian Rogers7b078e82014-09-10 14:44:24 -0700252 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200253 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200254 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200255 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200256 shadow_frame.GetMethod(), dex_pc,
257 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200258 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
259 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
260 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200261 }
262 return result;
263 }
264 HANDLE_INSTRUCTION_END();
265
266 HANDLE_INSTRUCTION_START(RETURN_VOID_BARRIER) {
Hans Boehm30359612014-05-21 17:46:23 -0700267 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200268 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700269 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200270 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200271 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200272 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200273 shadow_frame.GetMethod(), dex_pc,
274 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200275 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
276 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
277 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200278 }
279 return result;
280 }
281 HANDLE_INSTRUCTION_END();
282
283 HANDLE_INSTRUCTION_START(RETURN) {
284 JValue result;
285 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200286 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700287 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200288 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200289 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200290 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200291 shadow_frame.GetMethod(), dex_pc,
292 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200293 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
294 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
295 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200296 }
297 return result;
298 }
299 HANDLE_INSTRUCTION_END();
300
301 HANDLE_INSTRUCTION_START(RETURN_WIDE) {
302 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200303 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700304 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200305 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200306 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200307 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200308 shadow_frame.GetMethod(), dex_pc,
309 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200310 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
311 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
312 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200313 }
314 return result;
315 }
316 HANDLE_INSTRUCTION_END();
317
318 HANDLE_INSTRUCTION_START(RETURN_OBJECT) {
319 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700320 self->AllowThreadSuspension();
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700321 const uint8_t vreg_index = inst->VRegA_11x(inst_data);
322 Object* obj_result = shadow_frame.GetVRegReference(vreg_index);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700323 if (do_assignability_check && obj_result != NULL) {
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700324 StackHandleScope<1> hs(self);
325 MethodHelper mh(hs.NewHandle(shadow_frame.GetMethod()));
326 Class* return_type = mh.GetReturnType();
327 obj_result = shadow_frame.GetVRegReference(vreg_index);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700328 if (return_type == NULL) {
329 // Return the pending exception.
330 HANDLE_PENDING_EXCEPTION();
331 }
332 if (!obj_result->VerifierInstanceOf(return_type)) {
333 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700334 std::string temp1, temp2;
Jeff Haoa3faaf42013-09-03 19:07:00 -0700335 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
336 "Ljava/lang/VirtualMachineError;",
337 "Returning '%s' that is not instance of return type '%s'",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700338 obj_result->GetClass()->GetDescriptor(&temp1),
339 return_type->GetDescriptor(&temp2));
Jeff Haoa3faaf42013-09-03 19:07:00 -0700340 HANDLE_PENDING_EXCEPTION();
341 }
342 }
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700343 result.SetL(obj_result);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200344 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200345 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200346 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200347 shadow_frame.GetMethod(), dex_pc,
348 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200349 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
350 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
351 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200352 }
353 return result;
354 }
355 HANDLE_INSTRUCTION_END();
356
357 HANDLE_INSTRUCTION_START(CONST_4) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200358 uint32_t dst = inst->VRegA_11n(inst_data);
359 int32_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200360 shadow_frame.SetVReg(dst, val);
361 if (val == 0) {
362 shadow_frame.SetVRegReference(dst, NULL);
363 }
364 ADVANCE(1);
365 }
366 HANDLE_INSTRUCTION_END();
367
368 HANDLE_INSTRUCTION_START(CONST_16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200369 uint32_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200370 int32_t val = inst->VRegB_21s();
371 shadow_frame.SetVReg(dst, val);
372 if (val == 0) {
373 shadow_frame.SetVRegReference(dst, NULL);
374 }
375 ADVANCE(2);
376 }
377 HANDLE_INSTRUCTION_END();
378
379 HANDLE_INSTRUCTION_START(CONST) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200380 uint32_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200381 int32_t val = inst->VRegB_31i();
382 shadow_frame.SetVReg(dst, val);
383 if (val == 0) {
384 shadow_frame.SetVRegReference(dst, NULL);
385 }
386 ADVANCE(3);
387 }
388 HANDLE_INSTRUCTION_END();
389
390 HANDLE_INSTRUCTION_START(CONST_HIGH16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200391 uint32_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200392 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
393 shadow_frame.SetVReg(dst, val);
394 if (val == 0) {
395 shadow_frame.SetVRegReference(dst, NULL);
396 }
397 ADVANCE(2);
398 }
399 HANDLE_INSTRUCTION_END();
400
401 HANDLE_INSTRUCTION_START(CONST_WIDE_16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200402 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200403 ADVANCE(2);
404 HANDLE_INSTRUCTION_END();
405
406 HANDLE_INSTRUCTION_START(CONST_WIDE_32)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200407 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200408 ADVANCE(3);
409 HANDLE_INSTRUCTION_END();
410
411 HANDLE_INSTRUCTION_START(CONST_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200412 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200413 ADVANCE(5);
414 HANDLE_INSTRUCTION_END();
415
416 HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200417 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200418 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
419 ADVANCE(2);
420 HANDLE_INSTRUCTION_END();
421
422 HANDLE_INSTRUCTION_START(CONST_STRING) {
423 String* s = ResolveString(self, mh, inst->VRegB_21c());
424 if (UNLIKELY(s == NULL)) {
425 HANDLE_PENDING_EXCEPTION();
426 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200427 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200428 ADVANCE(2);
429 }
430 }
431 HANDLE_INSTRUCTION_END();
432
433 HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
434 String* s = ResolveString(self, mh, inst->VRegB_31c());
435 if (UNLIKELY(s == NULL)) {
436 HANDLE_PENDING_EXCEPTION();
437 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200438 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200439 ADVANCE(3);
440 }
441 }
442 HANDLE_INSTRUCTION_END();
443
444 HANDLE_INSTRUCTION_START(CONST_CLASS) {
445 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
446 self, false, do_access_check);
447 if (UNLIKELY(c == NULL)) {
448 HANDLE_PENDING_EXCEPTION();
449 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200450 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200451 ADVANCE(2);
452 }
453 }
454 HANDLE_INSTRUCTION_END();
455
456 HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200457 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200458 if (UNLIKELY(obj == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200459 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200460 HANDLE_PENDING_EXCEPTION();
461 } else {
462 DoMonitorEnter(self, obj);
463 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
464 }
465 }
466 HANDLE_INSTRUCTION_END();
467
468 HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200469 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200470 if (UNLIKELY(obj == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200471 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200472 HANDLE_PENDING_EXCEPTION();
473 } else {
474 DoMonitorExit(self, obj);
475 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
476 }
477 }
478 HANDLE_INSTRUCTION_END();
479
480 HANDLE_INSTRUCTION_START(CHECK_CAST) {
481 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
482 self, false, do_access_check);
483 if (UNLIKELY(c == NULL)) {
484 HANDLE_PENDING_EXCEPTION();
485 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200486 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200487 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
488 ThrowClassCastException(c, obj->GetClass());
489 HANDLE_PENDING_EXCEPTION();
490 } else {
491 ADVANCE(2);
492 }
493 }
494 }
495 HANDLE_INSTRUCTION_END();
496
497 HANDLE_INSTRUCTION_START(INSTANCE_OF) {
498 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
499 self, false, do_access_check);
500 if (UNLIKELY(c == NULL)) {
501 HANDLE_PENDING_EXCEPTION();
502 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200503 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
504 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200505 ADVANCE(2);
506 }
507 }
508 HANDLE_INSTRUCTION_END();
509
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700510 HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200511 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200512 if (UNLIKELY(array == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200513 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200514 HANDLE_PENDING_EXCEPTION();
515 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200516 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200517 ADVANCE(1);
518 }
519 }
520 HANDLE_INSTRUCTION_END();
521
522 HANDLE_INSTRUCTION_START(NEW_INSTANCE) {
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700523 Runtime* runtime = Runtime::Current();
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800524 Object* obj = AllocObjectFromCode<do_access_check, true>(
525 inst->VRegB_21c(), shadow_frame.GetMethod(), self,
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700526 runtime->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200527 if (UNLIKELY(obj == NULL)) {
528 HANDLE_PENDING_EXCEPTION();
529 } else {
Sebastien Hertz4e99b3d2014-06-24 14:35:40 +0200530 obj->GetClass()->AssertInitializedOrInitializingInThread(self);
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700531 // Don't allow finalizable objects to be allocated during a transaction since these can't be
532 // finalized without a started runtime.
533 if (transaction_active && obj->GetClass()->IsFinalizable()) {
Ian Rogers2fa98e22014-05-06 15:26:39 -0700534 AbortTransaction(self, "Allocating finalizable object in transaction: %s",
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700535 PrettyTypeOf(obj).c_str());
536 HANDLE_PENDING_EXCEPTION();
537 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200538 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200539 ADVANCE(2);
540 }
541 }
542 HANDLE_INSTRUCTION_END();
543
544 HANDLE_INSTRUCTION_START(NEW_ARRAY) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200545 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800546 Object* obj = AllocArrayFromCode<do_access_check, true>(
547 inst->VRegC_22c(), shadow_frame.GetMethod(), length, self,
548 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200549 if (UNLIKELY(obj == NULL)) {
550 HANDLE_PENDING_EXCEPTION();
551 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200552 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200553 ADVANCE(2);
554 }
555 }
556 HANDLE_INSTRUCTION_END();
557
558 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100559 bool success =
560 DoFilledNewArray<false, do_access_check, transaction_active>(inst, shadow_frame,
561 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200562 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
563 }
564 HANDLE_INSTRUCTION_END();
565
566 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100567 bool success =
568 DoFilledNewArray<true, do_access_check, transaction_active>(inst, shadow_frame,
569 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200570 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
571 }
572 HANDLE_INSTRUCTION_END();
573
574 HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200575 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200576 if (UNLIKELY(obj == NULL)) {
577 ThrowNullPointerException(NULL, "null array in FILL_ARRAY_DATA");
578 HANDLE_PENDING_EXCEPTION();
579 } else {
580 Array* array = obj->AsArray();
581 DCHECK(array->IsArrayInstance() && !array->IsObjectArray());
582 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
583 const Instruction::ArrayDataPayload* payload =
584 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
585 if (UNLIKELY(static_cast<int32_t>(payload->element_count) > array->GetLength())) {
586 self->ThrowNewExceptionF(shadow_frame.GetCurrentLocationForThrow(),
587 "Ljava/lang/ArrayIndexOutOfBoundsException;",
588 "failed FILL_ARRAY_DATA; length=%d, index=%d",
589 array->GetLength(), payload->element_count);
590 HANDLE_PENDING_EXCEPTION();
591 } else {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100592 if (transaction_active) {
593 RecordArrayElementsInTransaction(array, payload->element_count);
594 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200595 uint32_t size_in_bytes = payload->element_count * payload->element_width;
Ian Rogersef7d42f2014-01-06 12:55:46 -0800596 memcpy(array->GetRawData(payload->element_width, 0), payload->data, size_in_bytes);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200597 ADVANCE(3);
598 }
599 }
600 }
601 HANDLE_INSTRUCTION_END();
602
603 HANDLE_INSTRUCTION_START(THROW) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200604 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200605 if (UNLIKELY(exception == NULL)) {
606 ThrowNullPointerException(NULL, "throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700607 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
608 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700609 std::string temp;
Jeff Haoa3faaf42013-09-03 19:07:00 -0700610 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
611 "Ljava/lang/VirtualMachineError;",
612 "Throwing '%s' that is not instance of Throwable",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700613 exception->GetClass()->GetDescriptor(&temp));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200614 } else {
615 self->SetException(shadow_frame.GetCurrentLocationForThrow(), exception->AsThrowable());
616 }
617 HANDLE_PENDING_EXCEPTION();
618 }
619 HANDLE_INSTRUCTION_END();
620
621 HANDLE_INSTRUCTION_START(GOTO) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200622 int8_t offset = inst->VRegA_10t(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200623 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200624 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700625 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200626 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200627 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200628 }
629 ADVANCE(offset);
630 }
631 HANDLE_INSTRUCTION_END();
632
633 HANDLE_INSTRUCTION_START(GOTO_16) {
634 int16_t offset = inst->VRegA_20t();
635 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200636 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700637 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200638 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200639 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200640 }
641 ADVANCE(offset);
642 }
643 HANDLE_INSTRUCTION_END();
644
645 HANDLE_INSTRUCTION_START(GOTO_32) {
646 int32_t offset = inst->VRegA_30t();
647 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200648 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700649 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200650 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200651 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200652 }
653 ADVANCE(offset);
654 }
655 HANDLE_INSTRUCTION_END();
656
657 HANDLE_INSTRUCTION_START(PACKED_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200658 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200659 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200660 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700661 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200662 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200663 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200664 }
665 ADVANCE(offset);
666 }
667 HANDLE_INSTRUCTION_END();
668
669 HANDLE_INSTRUCTION_START(SPARSE_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200670 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200671 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200672 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700673 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200674 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200675 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200676 }
677 ADVANCE(offset);
678 }
679 HANDLE_INSTRUCTION_END();
680
681 HANDLE_INSTRUCTION_START(CMPL_FLOAT) {
682 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
683 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
684 int32_t result;
685 if (val1 > val2) {
686 result = 1;
687 } else if (val1 == val2) {
688 result = 0;
689 } else {
690 result = -1;
691 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200692 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200693 ADVANCE(2);
694 }
695 HANDLE_INSTRUCTION_END();
696
697 HANDLE_INSTRUCTION_START(CMPG_FLOAT) {
698 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
699 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
700 int32_t result;
701 if (val1 < val2) {
702 result = -1;
703 } else if (val1 == val2) {
704 result = 0;
705 } else {
706 result = 1;
707 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200708 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200709 ADVANCE(2);
710 }
711 HANDLE_INSTRUCTION_END();
712
713 HANDLE_INSTRUCTION_START(CMPL_DOUBLE) {
714 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
715 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
716 int32_t result;
717 if (val1 > val2) {
718 result = 1;
719 } else if (val1 == val2) {
720 result = 0;
721 } else {
722 result = -1;
723 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200724 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200725 ADVANCE(2);
726 }
727 HANDLE_INSTRUCTION_END();
728
729 HANDLE_INSTRUCTION_START(CMPG_DOUBLE) {
730 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
731 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
732 int32_t result;
733 if (val1 < val2) {
734 result = -1;
735 } else if (val1 == val2) {
736 result = 0;
737 } else {
738 result = 1;
739 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200740 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200741 ADVANCE(2);
742 }
743 HANDLE_INSTRUCTION_END();
744
745 HANDLE_INSTRUCTION_START(CMP_LONG) {
746 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
747 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
748 int32_t result;
749 if (val1 > val2) {
750 result = 1;
751 } else if (val1 == val2) {
752 result = 0;
753 } else {
754 result = -1;
755 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200756 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200757 ADVANCE(2);
758 }
759 HANDLE_INSTRUCTION_END();
760
761 HANDLE_INSTRUCTION_START(IF_EQ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200762 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200763 int16_t offset = inst->VRegC_22t();
764 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200765 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700766 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200767 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200768 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200769 }
770 ADVANCE(offset);
771 } else {
772 ADVANCE(2);
773 }
774 }
775 HANDLE_INSTRUCTION_END();
776
777 HANDLE_INSTRUCTION_START(IF_NE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200778 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) != shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200779 int16_t offset = inst->VRegC_22t();
780 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200781 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700782 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200783 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200784 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200785 }
786 ADVANCE(offset);
787 } else {
788 ADVANCE(2);
789 }
790 }
791 HANDLE_INSTRUCTION_END();
792
793 HANDLE_INSTRUCTION_START(IF_LT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200794 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) < shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200795 int16_t offset = inst->VRegC_22t();
796 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200797 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700798 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200799 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200800 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200801 }
802 ADVANCE(offset);
803 } else {
804 ADVANCE(2);
805 }
806 }
807 HANDLE_INSTRUCTION_END();
808
809 HANDLE_INSTRUCTION_START(IF_GE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200810 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200811 int16_t offset = inst->VRegC_22t();
812 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200813 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700814 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200815 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200816 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200817 }
818 ADVANCE(offset);
819 } else {
820 ADVANCE(2);
821 }
822 }
823 HANDLE_INSTRUCTION_END();
824
825 HANDLE_INSTRUCTION_START(IF_GT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200826 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200827 int16_t offset = inst->VRegC_22t();
828 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200829 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700830 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200831 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200832 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200833 }
834 ADVANCE(offset);
835 } else {
836 ADVANCE(2);
837 }
838 }
839 HANDLE_INSTRUCTION_END();
840
841 HANDLE_INSTRUCTION_START(IF_LE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200842 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200843 int16_t offset = inst->VRegC_22t();
844 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200845 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700846 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200847 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200848 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200849 }
850 ADVANCE(offset);
851 } else {
852 ADVANCE(2);
853 }
854 }
855 HANDLE_INSTRUCTION_END();
856
857 HANDLE_INSTRUCTION_START(IF_EQZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200858 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200859 int16_t offset = inst->VRegB_21t();
860 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200861 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700862 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200863 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200864 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200865 }
866 ADVANCE(offset);
867 } else {
868 ADVANCE(2);
869 }
870 }
871 HANDLE_INSTRUCTION_END();
872
873 HANDLE_INSTRUCTION_START(IF_NEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200874 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200875 int16_t offset = inst->VRegB_21t();
876 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200877 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700878 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200879 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200880 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200881 }
882 ADVANCE(offset);
883 } else {
884 ADVANCE(2);
885 }
886 }
887 HANDLE_INSTRUCTION_END();
888
889 HANDLE_INSTRUCTION_START(IF_LTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200890 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200891 int16_t offset = inst->VRegB_21t();
892 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200893 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700894 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200895 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200896 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200897 }
898 ADVANCE(offset);
899 } else {
900 ADVANCE(2);
901 }
902 }
903 HANDLE_INSTRUCTION_END();
904
905 HANDLE_INSTRUCTION_START(IF_GEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200906 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200907 int16_t offset = inst->VRegB_21t();
908 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200909 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700910 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200911 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200912 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200913 }
914 ADVANCE(offset);
915 } else {
916 ADVANCE(2);
917 }
918 }
919 HANDLE_INSTRUCTION_END();
920
921 HANDLE_INSTRUCTION_START(IF_GTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200922 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200923 int16_t offset = inst->VRegB_21t();
924 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200925 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700926 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200927 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200928 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200929 }
930 ADVANCE(offset);
931 } else {
932 ADVANCE(2);
933 }
934 }
935 HANDLE_INSTRUCTION_END();
936
937 HANDLE_INSTRUCTION_START(IF_LEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200938 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200939 int16_t offset = inst->VRegB_21t();
940 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200941 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700942 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200943 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200944 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200945 }
946 ADVANCE(offset);
947 } else {
948 ADVANCE(2);
949 }
950 }
951 HANDLE_INSTRUCTION_END();
952
953 HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
954 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
955 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200956 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200957 HANDLE_PENDING_EXCEPTION();
958 } else {
959 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
960 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100961 if (LIKELY(array->CheckIsValidIndex(index))) {
962 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200963 ADVANCE(2);
964 } else {
965 HANDLE_PENDING_EXCEPTION();
966 }
967 }
968 }
969 HANDLE_INSTRUCTION_END();
970
971 HANDLE_INSTRUCTION_START(AGET_BYTE) {
972 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
973 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200974 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200975 HANDLE_PENDING_EXCEPTION();
976 } else {
977 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
978 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100979 if (LIKELY(array->CheckIsValidIndex(index))) {
980 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200981 ADVANCE(2);
982 } else {
983 HANDLE_PENDING_EXCEPTION();
984 }
985 }
986 }
987 HANDLE_INSTRUCTION_END();
988
989 HANDLE_INSTRUCTION_START(AGET_CHAR) {
990 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
991 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200992 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200993 HANDLE_PENDING_EXCEPTION();
994 } else {
995 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
996 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100997 if (LIKELY(array->CheckIsValidIndex(index))) {
998 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200999 ADVANCE(2);
1000 } else {
1001 HANDLE_PENDING_EXCEPTION();
1002 }
1003 }
1004 }
1005 HANDLE_INSTRUCTION_END();
1006
1007 HANDLE_INSTRUCTION_START(AGET_SHORT) {
1008 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1009 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001010 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001011 HANDLE_PENDING_EXCEPTION();
1012 } else {
1013 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1014 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001015 if (LIKELY(array->CheckIsValidIndex(index))) {
1016 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001017 ADVANCE(2);
1018 } else {
1019 HANDLE_PENDING_EXCEPTION();
1020 }
1021 }
1022 }
1023 HANDLE_INSTRUCTION_END();
1024
1025 HANDLE_INSTRUCTION_START(AGET) {
1026 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1027 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001028 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001029 HANDLE_PENDING_EXCEPTION();
1030 } else {
1031 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1032 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001033 if (LIKELY(array->CheckIsValidIndex(index))) {
1034 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001035 ADVANCE(2);
1036 } else {
1037 HANDLE_PENDING_EXCEPTION();
1038 }
1039 }
1040 }
1041 HANDLE_INSTRUCTION_END();
1042
1043 HANDLE_INSTRUCTION_START(AGET_WIDE) {
1044 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1045 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001046 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001047 HANDLE_PENDING_EXCEPTION();
1048 } else {
1049 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1050 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001051 if (LIKELY(array->CheckIsValidIndex(index))) {
1052 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001053 ADVANCE(2);
1054 } else {
1055 HANDLE_PENDING_EXCEPTION();
1056 }
1057 }
1058 }
1059 HANDLE_INSTRUCTION_END();
1060
1061 HANDLE_INSTRUCTION_START(AGET_OBJECT) {
1062 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1063 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001064 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001065 HANDLE_PENDING_EXCEPTION();
1066 } else {
1067 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1068 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001069 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001070 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001071 ADVANCE(2);
1072 } else {
1073 HANDLE_PENDING_EXCEPTION();
1074 }
1075 }
1076 }
1077 HANDLE_INSTRUCTION_END();
1078
1079 HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
1080 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1081 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001082 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001083 HANDLE_PENDING_EXCEPTION();
1084 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001085 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001086 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1087 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001088 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001089 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001090 ADVANCE(2);
1091 } else {
1092 HANDLE_PENDING_EXCEPTION();
1093 }
1094 }
1095 }
1096 HANDLE_INSTRUCTION_END();
1097
1098 HANDLE_INSTRUCTION_START(APUT_BYTE) {
1099 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1100 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001101 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001102 HANDLE_PENDING_EXCEPTION();
1103 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001104 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001105 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1106 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001107 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001108 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001109 ADVANCE(2);
1110 } else {
1111 HANDLE_PENDING_EXCEPTION();
1112 }
1113 }
1114 }
1115 HANDLE_INSTRUCTION_END();
1116
1117 HANDLE_INSTRUCTION_START(APUT_CHAR) {
1118 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1119 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001120 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001121 HANDLE_PENDING_EXCEPTION();
1122 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001123 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001124 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1125 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001126 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001127 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001128 ADVANCE(2);
1129 } else {
1130 HANDLE_PENDING_EXCEPTION();
1131 }
1132 }
1133 }
1134 HANDLE_INSTRUCTION_END();
1135
1136 HANDLE_INSTRUCTION_START(APUT_SHORT) {
1137 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1138 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001139 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001140 HANDLE_PENDING_EXCEPTION();
1141 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001142 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001143 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1144 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001145 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001146 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001147 ADVANCE(2);
1148 } else {
1149 HANDLE_PENDING_EXCEPTION();
1150 }
1151 }
1152 }
1153 HANDLE_INSTRUCTION_END();
1154
1155 HANDLE_INSTRUCTION_START(APUT) {
1156 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1157 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001158 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001159 HANDLE_PENDING_EXCEPTION();
1160 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001161 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001162 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1163 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001164 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001165 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001166 ADVANCE(2);
1167 } else {
1168 HANDLE_PENDING_EXCEPTION();
1169 }
1170 }
1171 }
1172 HANDLE_INSTRUCTION_END();
1173
1174 HANDLE_INSTRUCTION_START(APUT_WIDE) {
1175 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1176 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001177 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001178 HANDLE_PENDING_EXCEPTION();
1179 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001180 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001181 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1182 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001183 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001184 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001185 ADVANCE(2);
1186 } else {
1187 HANDLE_PENDING_EXCEPTION();
1188 }
1189 }
1190 }
1191 HANDLE_INSTRUCTION_END();
1192
1193 HANDLE_INSTRUCTION_START(APUT_OBJECT) {
1194 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1195 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001196 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001197 HANDLE_PENDING_EXCEPTION();
1198 } else {
1199 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001200 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001201 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001202 if (LIKELY(array->CheckIsValidIndex(index) && array->CheckAssignable(val))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001203 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001204 ADVANCE(2);
1205 } else {
1206 HANDLE_PENDING_EXCEPTION();
1207 }
1208 }
1209 }
1210 HANDLE_INSTRUCTION_END();
1211
1212 HANDLE_INSTRUCTION_START(IGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001213 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001214 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1215 }
1216 HANDLE_INSTRUCTION_END();
1217
1218 HANDLE_INSTRUCTION_START(IGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001219 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001220 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1221 }
1222 HANDLE_INSTRUCTION_END();
1223
1224 HANDLE_INSTRUCTION_START(IGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001225 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001226 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1227 }
1228 HANDLE_INSTRUCTION_END();
1229
1230 HANDLE_INSTRUCTION_START(IGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001231 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001232 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1233 }
1234 HANDLE_INSTRUCTION_END();
1235
1236 HANDLE_INSTRUCTION_START(IGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001237 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001238 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1239 }
1240 HANDLE_INSTRUCTION_END();
1241
1242 HANDLE_INSTRUCTION_START(IGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001243 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001244 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1245 }
1246 HANDLE_INSTRUCTION_END();
1247
1248 HANDLE_INSTRUCTION_START(IGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001249 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001250 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1251 }
1252 HANDLE_INSTRUCTION_END();
1253
1254 HANDLE_INSTRUCTION_START(IGET_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001255 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001256 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1257 }
1258 HANDLE_INSTRUCTION_END();
1259
1260 HANDLE_INSTRUCTION_START(IGET_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001261 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001262 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1263 }
1264 HANDLE_INSTRUCTION_END();
1265
1266 HANDLE_INSTRUCTION_START(IGET_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001267 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001268 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1269 }
1270 HANDLE_INSTRUCTION_END();
1271
1272 HANDLE_INSTRUCTION_START(SGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001273 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001274 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1275 }
1276 HANDLE_INSTRUCTION_END();
1277
1278 HANDLE_INSTRUCTION_START(SGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001279 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001280 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1281 }
1282 HANDLE_INSTRUCTION_END();
1283
1284 HANDLE_INSTRUCTION_START(SGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001285 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001286 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1287 }
1288 HANDLE_INSTRUCTION_END();
1289
1290 HANDLE_INSTRUCTION_START(SGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001291 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001292 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1293 }
1294 HANDLE_INSTRUCTION_END();
1295
1296 HANDLE_INSTRUCTION_START(SGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001297 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001298 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1299 }
1300 HANDLE_INSTRUCTION_END();
1301
1302 HANDLE_INSTRUCTION_START(SGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001303 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001304 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1305 }
1306 HANDLE_INSTRUCTION_END();
1307
1308 HANDLE_INSTRUCTION_START(SGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001309 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001310 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1311 }
1312 HANDLE_INSTRUCTION_END();
1313
1314 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001315 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001316 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1317 }
1318 HANDLE_INSTRUCTION_END();
1319
1320 HANDLE_INSTRUCTION_START(IPUT_BYTE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001321 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001322 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1323 }
1324 HANDLE_INSTRUCTION_END();
1325
1326 HANDLE_INSTRUCTION_START(IPUT_CHAR) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001327 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001328 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1329 }
1330 HANDLE_INSTRUCTION_END();
1331
1332 HANDLE_INSTRUCTION_START(IPUT_SHORT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001333 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001334 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1335 }
1336 HANDLE_INSTRUCTION_END();
1337
1338 HANDLE_INSTRUCTION_START(IPUT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001339 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001340 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1341 }
1342 HANDLE_INSTRUCTION_END();
1343
1344 HANDLE_INSTRUCTION_START(IPUT_WIDE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001345 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001346 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1347 }
1348 HANDLE_INSTRUCTION_END();
1349
1350 HANDLE_INSTRUCTION_START(IPUT_OBJECT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001351 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001352 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1353 }
1354 HANDLE_INSTRUCTION_END();
1355
1356 HANDLE_INSTRUCTION_START(IPUT_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001357 bool success = DoIPutQuick<Primitive::kPrimInt, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001358 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1359 }
1360 HANDLE_INSTRUCTION_END();
1361
Fred Shih37f05ef2014-07-16 18:38:08 -07001362 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN_QUICK) {
1363 bool success = DoIPutQuick<Primitive::kPrimBoolean, transaction_active>(shadow_frame, inst, inst_data);
1364 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1365 }
1366 HANDLE_INSTRUCTION_END();
1367
1368 HANDLE_INSTRUCTION_START(IPUT_BYTE_QUICK) {
1369 bool success = DoIPutQuick<Primitive::kPrimByte, transaction_active>(shadow_frame, inst, inst_data);
1370 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1371 }
1372 HANDLE_INSTRUCTION_END();
1373
1374 HANDLE_INSTRUCTION_START(IPUT_CHAR_QUICK) {
1375 bool success = DoIPutQuick<Primitive::kPrimChar, transaction_active>(shadow_frame, inst, inst_data);
1376 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1377 }
1378 HANDLE_INSTRUCTION_END();
1379
1380 HANDLE_INSTRUCTION_START(IPUT_SHORT_QUICK) {
1381 bool success = DoIPutQuick<Primitive::kPrimShort, transaction_active>(shadow_frame, inst, inst_data);
1382 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1383 }
1384 HANDLE_INSTRUCTION_END();
1385
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001386 HANDLE_INSTRUCTION_START(IPUT_WIDE_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001387 bool success = DoIPutQuick<Primitive::kPrimLong, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001388 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1389 }
1390 HANDLE_INSTRUCTION_END();
1391
1392 HANDLE_INSTRUCTION_START(IPUT_OBJECT_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001393 bool success = DoIPutQuick<Primitive::kPrimNot, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001394 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1395 }
1396 HANDLE_INSTRUCTION_END();
1397
1398 HANDLE_INSTRUCTION_START(SPUT_BOOLEAN) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001399 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001400 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1401 }
1402 HANDLE_INSTRUCTION_END();
1403
1404 HANDLE_INSTRUCTION_START(SPUT_BYTE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001405 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001406 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1407 }
1408 HANDLE_INSTRUCTION_END();
1409
1410 HANDLE_INSTRUCTION_START(SPUT_CHAR) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001411 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001412 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1413 }
1414 HANDLE_INSTRUCTION_END();
1415
1416 HANDLE_INSTRUCTION_START(SPUT_SHORT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001417 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001418 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1419 }
1420 HANDLE_INSTRUCTION_END();
1421
1422 HANDLE_INSTRUCTION_START(SPUT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001423 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001424 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1425 }
1426 HANDLE_INSTRUCTION_END();
1427
1428 HANDLE_INSTRUCTION_START(SPUT_WIDE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001429 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001430 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1431 }
1432 HANDLE_INSTRUCTION_END();
1433
1434 HANDLE_INSTRUCTION_START(SPUT_OBJECT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001435 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001436 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1437 }
1438 HANDLE_INSTRUCTION_END();
1439
1440 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001441 bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001442 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001443 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1444 }
1445 HANDLE_INSTRUCTION_END();
1446
1447 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001448 bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001449 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001450 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1451 }
1452 HANDLE_INSTRUCTION_END();
1453
1454 HANDLE_INSTRUCTION_START(INVOKE_SUPER) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001455 bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001456 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001457 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1458 }
1459 HANDLE_INSTRUCTION_END();
1460
1461 HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001462 bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001463 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001464 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1465 }
1466 HANDLE_INSTRUCTION_END();
1467
1468 HANDLE_INSTRUCTION_START(INVOKE_DIRECT) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001469 bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001470 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001471 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1472 }
1473 HANDLE_INSTRUCTION_END();
1474
1475 HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001476 bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001477 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001478 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1479 }
1480 HANDLE_INSTRUCTION_END();
1481
1482 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001483 bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001484 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001485 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1486 }
1487 HANDLE_INSTRUCTION_END();
1488
1489 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001490 bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001491 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001492 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1493 }
1494 HANDLE_INSTRUCTION_END();
1495
1496 HANDLE_INSTRUCTION_START(INVOKE_STATIC) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001497 bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001498 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001499 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1500 }
1501 HANDLE_INSTRUCTION_END();
1502
1503 HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001504 bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001505 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001506 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1507 }
1508 HANDLE_INSTRUCTION_END();
1509
1510 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001511 bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001512 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001513 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1514 }
1515 HANDLE_INSTRUCTION_END();
1516
1517 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001518 bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001519 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001520 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1521 }
1522 HANDLE_INSTRUCTION_END();
1523
1524 HANDLE_INSTRUCTION_START(NEG_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001525 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001526 ADVANCE(1);
1527 HANDLE_INSTRUCTION_END();
1528
1529 HANDLE_INSTRUCTION_START(NOT_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001530 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001531 ADVANCE(1);
1532 HANDLE_INSTRUCTION_END();
1533
1534 HANDLE_INSTRUCTION_START(NEG_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001535 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001536 ADVANCE(1);
1537 HANDLE_INSTRUCTION_END();
1538
1539 HANDLE_INSTRUCTION_START(NOT_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001540 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001541 ADVANCE(1);
1542 HANDLE_INSTRUCTION_END();
1543
1544 HANDLE_INSTRUCTION_START(NEG_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001545 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001546 ADVANCE(1);
1547 HANDLE_INSTRUCTION_END();
1548
1549 HANDLE_INSTRUCTION_START(NEG_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001550 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001551 ADVANCE(1);
1552 HANDLE_INSTRUCTION_END();
1553
1554 HANDLE_INSTRUCTION_START(INT_TO_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001555 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001556 ADVANCE(1);
1557 HANDLE_INSTRUCTION_END();
1558
1559 HANDLE_INSTRUCTION_START(INT_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001560 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001561 ADVANCE(1);
1562 HANDLE_INSTRUCTION_END();
1563
1564 HANDLE_INSTRUCTION_START(INT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001565 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001566 ADVANCE(1);
1567 HANDLE_INSTRUCTION_END();
1568
1569 HANDLE_INSTRUCTION_START(LONG_TO_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001570 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001571 ADVANCE(1);
1572 HANDLE_INSTRUCTION_END();
1573
1574 HANDLE_INSTRUCTION_START(LONG_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001575 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001576 ADVANCE(1);
1577 HANDLE_INSTRUCTION_END();
1578
1579 HANDLE_INSTRUCTION_START(LONG_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001580 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001581 ADVANCE(1);
1582 HANDLE_INSTRUCTION_END();
1583
1584 HANDLE_INSTRUCTION_START(FLOAT_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001585 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001586 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001587 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001588 ADVANCE(1);
1589 }
1590 HANDLE_INSTRUCTION_END();
1591
1592 HANDLE_INSTRUCTION_START(FLOAT_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001593 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001594 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001595 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001596 ADVANCE(1);
1597 }
1598 HANDLE_INSTRUCTION_END();
1599
1600 HANDLE_INSTRUCTION_START(FLOAT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001601 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001602 ADVANCE(1);
1603 HANDLE_INSTRUCTION_END();
1604
1605 HANDLE_INSTRUCTION_START(DOUBLE_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001606 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001607 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001608 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001609 ADVANCE(1);
1610 }
1611 HANDLE_INSTRUCTION_END();
1612
1613 HANDLE_INSTRUCTION_START(DOUBLE_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001614 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001615 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001616 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001617 ADVANCE(1);
1618 }
1619 HANDLE_INSTRUCTION_END();
1620
1621 HANDLE_INSTRUCTION_START(DOUBLE_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001622 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001623 ADVANCE(1);
1624 HANDLE_INSTRUCTION_END();
1625
1626 HANDLE_INSTRUCTION_START(INT_TO_BYTE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001627 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1628 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001629 ADVANCE(1);
1630 HANDLE_INSTRUCTION_END();
1631
1632 HANDLE_INSTRUCTION_START(INT_TO_CHAR)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001633 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1634 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001635 ADVANCE(1);
1636 HANDLE_INSTRUCTION_END();
1637
1638 HANDLE_INSTRUCTION_START(INT_TO_SHORT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001639 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1640 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001641 ADVANCE(1);
1642 HANDLE_INSTRUCTION_END();
1643
1644 HANDLE_INSTRUCTION_START(ADD_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001645 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001646 shadow_frame.GetVReg(inst->VRegB_23x()) +
1647 shadow_frame.GetVReg(inst->VRegC_23x()));
1648 ADVANCE(2);
1649 HANDLE_INSTRUCTION_END();
1650
1651 HANDLE_INSTRUCTION_START(SUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001652 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001653 shadow_frame.GetVReg(inst->VRegB_23x()) -
1654 shadow_frame.GetVReg(inst->VRegC_23x()));
1655 ADVANCE(2);
1656 HANDLE_INSTRUCTION_END();
1657
1658 HANDLE_INSTRUCTION_START(MUL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001659 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001660 shadow_frame.GetVReg(inst->VRegB_23x()) *
1661 shadow_frame.GetVReg(inst->VRegC_23x()));
1662 ADVANCE(2);
1663 HANDLE_INSTRUCTION_END();
1664
1665 HANDLE_INSTRUCTION_START(DIV_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001666 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
1667 shadow_frame.GetVReg(inst->VRegB_23x()),
1668 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001669 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1670 }
1671 HANDLE_INSTRUCTION_END();
1672
1673 HANDLE_INSTRUCTION_START(REM_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001674 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1675 shadow_frame.GetVReg(inst->VRegB_23x()),
1676 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001677 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1678 }
1679 HANDLE_INSTRUCTION_END();
1680
1681 HANDLE_INSTRUCTION_START(SHL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001682 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001683 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1684 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1685 ADVANCE(2);
1686 HANDLE_INSTRUCTION_END();
1687
1688 HANDLE_INSTRUCTION_START(SHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001689 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001690 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1691 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1692 ADVANCE(2);
1693 HANDLE_INSTRUCTION_END();
1694
1695 HANDLE_INSTRUCTION_START(USHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001696 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001697 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1698 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1699 ADVANCE(2);
1700 HANDLE_INSTRUCTION_END();
1701
1702 HANDLE_INSTRUCTION_START(AND_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001703 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001704 shadow_frame.GetVReg(inst->VRegB_23x()) &
1705 shadow_frame.GetVReg(inst->VRegC_23x()));
1706 ADVANCE(2);
1707 HANDLE_INSTRUCTION_END();
1708
1709 HANDLE_INSTRUCTION_START(OR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001710 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001711 shadow_frame.GetVReg(inst->VRegB_23x()) |
1712 shadow_frame.GetVReg(inst->VRegC_23x()));
1713 ADVANCE(2);
1714 HANDLE_INSTRUCTION_END();
1715
1716 HANDLE_INSTRUCTION_START(XOR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001717 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001718 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1719 shadow_frame.GetVReg(inst->VRegC_23x()));
1720 ADVANCE(2);
1721 HANDLE_INSTRUCTION_END();
1722
1723 HANDLE_INSTRUCTION_START(ADD_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001724 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001725 shadow_frame.GetVRegLong(inst->VRegB_23x()) +
1726 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1727 ADVANCE(2);
1728 HANDLE_INSTRUCTION_END();
1729
1730 HANDLE_INSTRUCTION_START(SUB_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001731 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001732 shadow_frame.GetVRegLong(inst->VRegB_23x()) -
1733 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1734 ADVANCE(2);
1735 HANDLE_INSTRUCTION_END();
1736
1737 HANDLE_INSTRUCTION_START(MUL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001738 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001739 shadow_frame.GetVRegLong(inst->VRegB_23x()) *
1740 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1741 ADVANCE(2);
1742 HANDLE_INSTRUCTION_END();
1743
1744 HANDLE_INSTRUCTION_START(DIV_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001745 bool success = DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
1746 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1747 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001748 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1749 }
1750 HANDLE_INSTRUCTION_END();
1751
1752 HANDLE_INSTRUCTION_START(REM_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001753 bool success = DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1754 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1755 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001756 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1757 }
1758 HANDLE_INSTRUCTION_END();
1759
1760 HANDLE_INSTRUCTION_START(AND_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001761 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001762 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1763 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1764 ADVANCE(2);
1765 HANDLE_INSTRUCTION_END();
1766
1767 HANDLE_INSTRUCTION_START(OR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001768 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001769 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1770 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1771 ADVANCE(2);
1772 HANDLE_INSTRUCTION_END();
1773
1774 HANDLE_INSTRUCTION_START(XOR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001775 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001776 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1777 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1778 ADVANCE(2);
1779 HANDLE_INSTRUCTION_END();
1780
1781 HANDLE_INSTRUCTION_START(SHL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001782 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001783 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1784 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1785 ADVANCE(2);
1786 HANDLE_INSTRUCTION_END();
1787
1788 HANDLE_INSTRUCTION_START(SHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001789 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001790 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1791 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1792 ADVANCE(2);
1793 HANDLE_INSTRUCTION_END();
1794
1795 HANDLE_INSTRUCTION_START(USHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001796 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001797 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1798 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1799 ADVANCE(2);
1800 HANDLE_INSTRUCTION_END();
1801
1802 HANDLE_INSTRUCTION_START(ADD_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001803 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001804 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1805 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1806 ADVANCE(2);
1807 HANDLE_INSTRUCTION_END();
1808
1809 HANDLE_INSTRUCTION_START(SUB_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001810 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001811 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1812 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1813 ADVANCE(2);
1814 HANDLE_INSTRUCTION_END();
1815
1816 HANDLE_INSTRUCTION_START(MUL_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001817 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001818 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1819 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1820 ADVANCE(2);
1821 HANDLE_INSTRUCTION_END();
1822
1823 HANDLE_INSTRUCTION_START(DIV_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001824 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001825 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1826 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1827 ADVANCE(2);
1828 HANDLE_INSTRUCTION_END();
1829
1830 HANDLE_INSTRUCTION_START(REM_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001831 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001832 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1833 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1834 ADVANCE(2);
1835 HANDLE_INSTRUCTION_END();
1836
1837 HANDLE_INSTRUCTION_START(ADD_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001838 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001839 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1840 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1841 ADVANCE(2);
1842 HANDLE_INSTRUCTION_END();
1843
1844 HANDLE_INSTRUCTION_START(SUB_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001845 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001846 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1847 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1848 ADVANCE(2);
1849 HANDLE_INSTRUCTION_END();
1850
1851 HANDLE_INSTRUCTION_START(MUL_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001852 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001853 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1854 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1855 ADVANCE(2);
1856 HANDLE_INSTRUCTION_END();
1857
1858 HANDLE_INSTRUCTION_START(DIV_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001859 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001860 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1861 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1862 ADVANCE(2);
1863 HANDLE_INSTRUCTION_END();
1864
1865 HANDLE_INSTRUCTION_START(REM_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001866 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001867 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1868 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1869 ADVANCE(2);
1870 HANDLE_INSTRUCTION_END();
1871
1872 HANDLE_INSTRUCTION_START(ADD_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001873 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001874 shadow_frame.SetVReg(vregA,
1875 shadow_frame.GetVReg(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001876 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001877 ADVANCE(1);
1878 }
1879 HANDLE_INSTRUCTION_END();
1880
1881 HANDLE_INSTRUCTION_START(SUB_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001882 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001883 shadow_frame.SetVReg(vregA,
1884 shadow_frame.GetVReg(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001885 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001886 ADVANCE(1);
1887 }
1888 HANDLE_INSTRUCTION_END();
1889
1890 HANDLE_INSTRUCTION_START(MUL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001891 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001892 shadow_frame.SetVReg(vregA,
1893 shadow_frame.GetVReg(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001894 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001895 ADVANCE(1);
1896 }
1897 HANDLE_INSTRUCTION_END();
1898
1899 HANDLE_INSTRUCTION_START(DIV_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001900 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001901 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001902 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001903 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1904 }
1905 HANDLE_INSTRUCTION_END();
1906
1907 HANDLE_INSTRUCTION_START(REM_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001908 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001909 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001910 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001911 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1912 }
1913 HANDLE_INSTRUCTION_END();
1914
1915 HANDLE_INSTRUCTION_START(SHL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001916 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001917 shadow_frame.SetVReg(vregA,
1918 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001919 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001920 ADVANCE(1);
1921 }
1922 HANDLE_INSTRUCTION_END();
1923
1924 HANDLE_INSTRUCTION_START(SHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001925 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001926 shadow_frame.SetVReg(vregA,
1927 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001928 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001929 ADVANCE(1);
1930 }
1931 HANDLE_INSTRUCTION_END();
1932
1933 HANDLE_INSTRUCTION_START(USHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001934 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001935 shadow_frame.SetVReg(vregA,
1936 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001937 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001938 ADVANCE(1);
1939 }
1940 HANDLE_INSTRUCTION_END();
1941
1942 HANDLE_INSTRUCTION_START(AND_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001943 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001944 shadow_frame.SetVReg(vregA,
1945 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001946 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001947 ADVANCE(1);
1948 }
1949 HANDLE_INSTRUCTION_END();
1950
1951 HANDLE_INSTRUCTION_START(OR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001952 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001953 shadow_frame.SetVReg(vregA,
1954 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001955 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001956 ADVANCE(1);
1957 }
1958 HANDLE_INSTRUCTION_END();
1959
1960 HANDLE_INSTRUCTION_START(XOR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001961 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001962 shadow_frame.SetVReg(vregA,
1963 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001964 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001965 ADVANCE(1);
1966 }
1967 HANDLE_INSTRUCTION_END();
1968
1969 HANDLE_INSTRUCTION_START(ADD_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001970 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001971 shadow_frame.SetVRegLong(vregA,
1972 shadow_frame.GetVRegLong(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001973 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001974 ADVANCE(1);
1975 }
1976 HANDLE_INSTRUCTION_END();
1977
1978 HANDLE_INSTRUCTION_START(SUB_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001979 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001980 shadow_frame.SetVRegLong(vregA,
1981 shadow_frame.GetVRegLong(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001982 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001983 ADVANCE(1);
1984 }
1985 HANDLE_INSTRUCTION_END();
1986
1987 HANDLE_INSTRUCTION_START(MUL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001988 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001989 shadow_frame.SetVRegLong(vregA,
1990 shadow_frame.GetVRegLong(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001991 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001992 ADVANCE(1);
1993 }
1994 HANDLE_INSTRUCTION_END();
1995
1996 HANDLE_INSTRUCTION_START(DIV_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001997 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001998 bool success = DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001999 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002000 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2001 }
2002 HANDLE_INSTRUCTION_END();
2003
2004 HANDLE_INSTRUCTION_START(REM_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002005 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002006 bool success = DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002007 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002008 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
2009 }
2010 HANDLE_INSTRUCTION_END();
2011
2012 HANDLE_INSTRUCTION_START(AND_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002013 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002014 shadow_frame.SetVRegLong(vregA,
2015 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002016 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002017 ADVANCE(1);
2018 }
2019 HANDLE_INSTRUCTION_END();
2020
2021 HANDLE_INSTRUCTION_START(OR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002022 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002023 shadow_frame.SetVRegLong(vregA,
2024 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002025 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002026 ADVANCE(1);
2027 }
2028 HANDLE_INSTRUCTION_END();
2029
2030 HANDLE_INSTRUCTION_START(XOR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002031 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002032 shadow_frame.SetVRegLong(vregA,
2033 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002034 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002035 ADVANCE(1);
2036 }
2037 HANDLE_INSTRUCTION_END();
2038
2039 HANDLE_INSTRUCTION_START(SHL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002040 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002041 shadow_frame.SetVRegLong(vregA,
2042 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002043 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002044 ADVANCE(1);
2045 }
2046 HANDLE_INSTRUCTION_END();
2047
2048 HANDLE_INSTRUCTION_START(SHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002049 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002050 shadow_frame.SetVRegLong(vregA,
2051 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002052 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002053 ADVANCE(1);
2054 }
2055 HANDLE_INSTRUCTION_END();
2056
2057 HANDLE_INSTRUCTION_START(USHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002058 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002059 shadow_frame.SetVRegLong(vregA,
2060 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002061 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002062 ADVANCE(1);
2063 }
2064 HANDLE_INSTRUCTION_END();
2065
2066 HANDLE_INSTRUCTION_START(ADD_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002067 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002068 shadow_frame.SetVRegFloat(vregA,
2069 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002070 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002071 ADVANCE(1);
2072 }
2073 HANDLE_INSTRUCTION_END();
2074
2075 HANDLE_INSTRUCTION_START(SUB_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002076 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002077 shadow_frame.SetVRegFloat(vregA,
2078 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002079 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002080 ADVANCE(1);
2081 }
2082 HANDLE_INSTRUCTION_END();
2083
2084 HANDLE_INSTRUCTION_START(MUL_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002085 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002086 shadow_frame.SetVRegFloat(vregA,
2087 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002088 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002089 ADVANCE(1);
2090 }
2091 HANDLE_INSTRUCTION_END();
2092
2093 HANDLE_INSTRUCTION_START(DIV_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002094 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002095 shadow_frame.SetVRegFloat(vregA,
2096 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002097 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002098 ADVANCE(1);
2099 }
2100 HANDLE_INSTRUCTION_END();
2101
2102 HANDLE_INSTRUCTION_START(REM_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002103 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002104 shadow_frame.SetVRegFloat(vregA,
2105 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002106 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002107 ADVANCE(1);
2108 }
2109 HANDLE_INSTRUCTION_END();
2110
2111 HANDLE_INSTRUCTION_START(ADD_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002112 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002113 shadow_frame.SetVRegDouble(vregA,
2114 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002115 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002116 ADVANCE(1);
2117 }
2118 HANDLE_INSTRUCTION_END();
2119
2120 HANDLE_INSTRUCTION_START(SUB_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002121 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002122 shadow_frame.SetVRegDouble(vregA,
2123 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002124 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002125 ADVANCE(1);
2126 }
2127 HANDLE_INSTRUCTION_END();
2128
2129 HANDLE_INSTRUCTION_START(MUL_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002130 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002131 shadow_frame.SetVRegDouble(vregA,
2132 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002133 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002134 ADVANCE(1);
2135 }
2136 HANDLE_INSTRUCTION_END();
2137
2138 HANDLE_INSTRUCTION_START(DIV_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002139 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002140 shadow_frame.SetVRegDouble(vregA,
2141 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002142 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002143 ADVANCE(1);
2144 }
2145 HANDLE_INSTRUCTION_END();
2146
2147 HANDLE_INSTRUCTION_START(REM_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002148 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002149 shadow_frame.SetVRegDouble(vregA,
2150 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002151 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002152 ADVANCE(1);
2153 }
2154 HANDLE_INSTRUCTION_END();
2155
2156 HANDLE_INSTRUCTION_START(ADD_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002157 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2158 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) +
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002159 inst->VRegC_22s());
2160 ADVANCE(2);
2161 HANDLE_INSTRUCTION_END();
2162
2163 HANDLE_INSTRUCTION_START(RSUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002164 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002165 inst->VRegC_22s() -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002166 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002167 ADVANCE(2);
2168 HANDLE_INSTRUCTION_END();
2169
2170 HANDLE_INSTRUCTION_START(MUL_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002171 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2172 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) *
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002173 inst->VRegC_22s());
2174 ADVANCE(2);
2175 HANDLE_INSTRUCTION_END();
2176
2177 HANDLE_INSTRUCTION_START(DIV_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002178 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
2179 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002180 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2181 }
2182 HANDLE_INSTRUCTION_END();
2183
2184 HANDLE_INSTRUCTION_START(REM_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002185 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
2186 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002187 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2188 }
2189 HANDLE_INSTRUCTION_END();
2190
2191 HANDLE_INSTRUCTION_START(AND_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002192 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2193 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002194 inst->VRegC_22s());
2195 ADVANCE(2);
2196 HANDLE_INSTRUCTION_END();
2197
2198 HANDLE_INSTRUCTION_START(OR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002199 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2200 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002201 inst->VRegC_22s());
2202 ADVANCE(2);
2203 HANDLE_INSTRUCTION_END();
2204
2205 HANDLE_INSTRUCTION_START(XOR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002206 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2207 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002208 inst->VRegC_22s());
2209 ADVANCE(2);
2210 HANDLE_INSTRUCTION_END();
2211
2212 HANDLE_INSTRUCTION_START(ADD_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002213 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002214 shadow_frame.GetVReg(inst->VRegB_22b()) +
2215 inst->VRegC_22b());
2216 ADVANCE(2);
2217 HANDLE_INSTRUCTION_END();
2218
2219 HANDLE_INSTRUCTION_START(RSUB_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002220 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002221 inst->VRegC_22b() -
2222 shadow_frame.GetVReg(inst->VRegB_22b()));
2223 ADVANCE(2);
2224 HANDLE_INSTRUCTION_END();
2225
2226 HANDLE_INSTRUCTION_START(MUL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002227 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002228 shadow_frame.GetVReg(inst->VRegB_22b()) *
2229 inst->VRegC_22b());
2230 ADVANCE(2);
2231 HANDLE_INSTRUCTION_END();
2232
2233 HANDLE_INSTRUCTION_START(DIV_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002234 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
2235 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002236 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2237 }
2238 HANDLE_INSTRUCTION_END();
2239
2240 HANDLE_INSTRUCTION_START(REM_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002241 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
2242 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002243 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2244 }
2245 HANDLE_INSTRUCTION_END();
2246
2247 HANDLE_INSTRUCTION_START(AND_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002248 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002249 shadow_frame.GetVReg(inst->VRegB_22b()) &
2250 inst->VRegC_22b());
2251 ADVANCE(2);
2252 HANDLE_INSTRUCTION_END();
2253
2254 HANDLE_INSTRUCTION_START(OR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002255 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002256 shadow_frame.GetVReg(inst->VRegB_22b()) |
2257 inst->VRegC_22b());
2258 ADVANCE(2);
2259 HANDLE_INSTRUCTION_END();
2260
2261 HANDLE_INSTRUCTION_START(XOR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002262 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002263 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2264 inst->VRegC_22b());
2265 ADVANCE(2);
2266 HANDLE_INSTRUCTION_END();
2267
2268 HANDLE_INSTRUCTION_START(SHL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002269 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002270 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2271 (inst->VRegC_22b() & 0x1f));
2272 ADVANCE(2);
2273 HANDLE_INSTRUCTION_END();
2274
2275 HANDLE_INSTRUCTION_START(SHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002276 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002277 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2278 (inst->VRegC_22b() & 0x1f));
2279 ADVANCE(2);
2280 HANDLE_INSTRUCTION_END();
2281
2282 HANDLE_INSTRUCTION_START(USHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002283 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002284 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2285 (inst->VRegC_22b() & 0x1f));
2286 ADVANCE(2);
2287 HANDLE_INSTRUCTION_END();
2288
2289 HANDLE_INSTRUCTION_START(UNUSED_3E)
2290 UnexpectedOpcode(inst, mh);
2291 HANDLE_INSTRUCTION_END();
2292
2293 HANDLE_INSTRUCTION_START(UNUSED_3F)
2294 UnexpectedOpcode(inst, mh);
2295 HANDLE_INSTRUCTION_END();
2296
2297 HANDLE_INSTRUCTION_START(UNUSED_40)
2298 UnexpectedOpcode(inst, mh);
2299 HANDLE_INSTRUCTION_END();
2300
2301 HANDLE_INSTRUCTION_START(UNUSED_41)
2302 UnexpectedOpcode(inst, mh);
2303 HANDLE_INSTRUCTION_END();
2304
2305 HANDLE_INSTRUCTION_START(UNUSED_42)
2306 UnexpectedOpcode(inst, mh);
2307 HANDLE_INSTRUCTION_END();
2308
2309 HANDLE_INSTRUCTION_START(UNUSED_43)
2310 UnexpectedOpcode(inst, mh);
2311 HANDLE_INSTRUCTION_END();
2312
2313 HANDLE_INSTRUCTION_START(UNUSED_79)
2314 UnexpectedOpcode(inst, mh);
2315 HANDLE_INSTRUCTION_END();
2316
2317 HANDLE_INSTRUCTION_START(UNUSED_7A)
2318 UnexpectedOpcode(inst, mh);
2319 HANDLE_INSTRUCTION_END();
2320
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002321 HANDLE_INSTRUCTION_START(UNUSED_EF)
2322 UnexpectedOpcode(inst, mh);
2323 HANDLE_INSTRUCTION_END();
2324
2325 HANDLE_INSTRUCTION_START(UNUSED_F0)
2326 UnexpectedOpcode(inst, mh);
2327 HANDLE_INSTRUCTION_END();
2328
2329 HANDLE_INSTRUCTION_START(UNUSED_F1)
2330 UnexpectedOpcode(inst, mh);
2331 HANDLE_INSTRUCTION_END();
2332
2333 HANDLE_INSTRUCTION_START(UNUSED_F2)
2334 UnexpectedOpcode(inst, mh);
2335 HANDLE_INSTRUCTION_END();
2336
2337 HANDLE_INSTRUCTION_START(UNUSED_F3)
2338 UnexpectedOpcode(inst, mh);
2339 HANDLE_INSTRUCTION_END();
2340
2341 HANDLE_INSTRUCTION_START(UNUSED_F4)
2342 UnexpectedOpcode(inst, mh);
2343 HANDLE_INSTRUCTION_END();
2344
2345 HANDLE_INSTRUCTION_START(UNUSED_F5)
2346 UnexpectedOpcode(inst, mh);
2347 HANDLE_INSTRUCTION_END();
2348
2349 HANDLE_INSTRUCTION_START(UNUSED_F6)
2350 UnexpectedOpcode(inst, mh);
2351 HANDLE_INSTRUCTION_END();
2352
2353 HANDLE_INSTRUCTION_START(UNUSED_F7)
2354 UnexpectedOpcode(inst, mh);
2355 HANDLE_INSTRUCTION_END();
2356
2357 HANDLE_INSTRUCTION_START(UNUSED_F8)
2358 UnexpectedOpcode(inst, mh);
2359 HANDLE_INSTRUCTION_END();
2360
2361 HANDLE_INSTRUCTION_START(UNUSED_F9)
2362 UnexpectedOpcode(inst, mh);
2363 HANDLE_INSTRUCTION_END();
2364
2365 HANDLE_INSTRUCTION_START(UNUSED_FA)
2366 UnexpectedOpcode(inst, mh);
2367 HANDLE_INSTRUCTION_END();
2368
2369 HANDLE_INSTRUCTION_START(UNUSED_FB)
2370 UnexpectedOpcode(inst, mh);
2371 HANDLE_INSTRUCTION_END();
2372
2373 HANDLE_INSTRUCTION_START(UNUSED_FC)
2374 UnexpectedOpcode(inst, mh);
2375 HANDLE_INSTRUCTION_END();
2376
2377 HANDLE_INSTRUCTION_START(UNUSED_FD)
2378 UnexpectedOpcode(inst, mh);
2379 HANDLE_INSTRUCTION_END();
2380
2381 HANDLE_INSTRUCTION_START(UNUSED_FE)
2382 UnexpectedOpcode(inst, mh);
2383 HANDLE_INSTRUCTION_END();
2384
2385 HANDLE_INSTRUCTION_START(UNUSED_FF)
2386 UnexpectedOpcode(inst, mh);
2387 HANDLE_INSTRUCTION_END();
2388
2389 exception_pending_label: {
2390 CHECK(self->IsExceptionPending());
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002391 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -07002392 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002393 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002394 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002395 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002396 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc,
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002397 instrumentation);
2398 if (found_dex_pc == DexFile::kDexNoIndex) {
2399 return JValue(); /* Handled in caller. */
2400 } else {
2401 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc);
2402 ADVANCE(displacement);
2403 }
2404 }
2405
Sebastien Hertz8379b222014-02-24 17:38:15 +01002406// Create alternative instruction handlers dedicated to instrumentation.
2407// Return instructions must not call Instrumentation::DexPcMovedEvent since they already call
2408// Instrumentation::MethodExited. This is to avoid posting debugger events twice for this location.
Sebastien Hertze713d932014-05-15 10:48:53 +02002409// Note: we do not use the kReturn instruction flag here (to test the instruction is a return). The
2410// compiler seems to not evaluate "(Instruction::FlagsOf(Instruction::code) & kReturn) != 0" to
2411// a constant condition that would remove the "if" statement so the test is free.
Sebastien Hertz8379b222014-02-24 17:38:15 +01002412#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
2413 alt_op_##code: { \
2414 if (Instruction::code != Instruction::RETURN_VOID && \
2415 Instruction::code != Instruction::RETURN_VOID_BARRIER && \
2416 Instruction::code != Instruction::RETURN && \
2417 Instruction::code != Instruction::RETURN_WIDE && \
2418 Instruction::code != Instruction::RETURN_OBJECT) { \
2419 if (LIKELY(!notified_method_entry_event)) { \
2420 Runtime* runtime = Runtime::Current(); \
2421 const instrumentation::Instrumentation* instrumentation = runtime->GetInstrumentation(); \
2422 if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
2423 Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_); \
2424 instrumentation->DexPcMovedEvent(self, this_object, shadow_frame.GetMethod(), dex_pc); \
2425 } \
2426 } else { \
2427 notified_method_entry_event = false; \
2428 } \
2429 } \
2430 UPDATE_HANDLER_TABLE(); \
2431 goto *handlersTable[instrumentation::kMainHandlerTable][Instruction::code]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002432 }
2433#include "dex_instruction_list.h"
2434 DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER)
2435#undef DEX_INSTRUCTION_LIST
2436#undef INSTRUMENTATION_INSTRUCTION_HANDLER
2437} // NOLINT(readability/fn_size)
2438
2439// Explicit definitions of ExecuteGotoImpl.
Sebastien Hertzc6714852013-09-30 16:42:32 +02002440template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002441JValue ExecuteGotoImpl<true, false>(Thread* self, MethodHelper& mh,
2442 const DexFile::CodeItem* code_item,
2443 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertzc6714852013-09-30 16:42:32 +02002444template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002445JValue ExecuteGotoImpl<false, false>(Thread* self, MethodHelper& mh,
2446 const DexFile::CodeItem* code_item,
2447 ShadowFrame& shadow_frame, JValue result_register);
2448template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
2449JValue ExecuteGotoImpl<true, true>(Thread* self, MethodHelper& mh,
2450 const DexFile::CodeItem* code_item,
2451 ShadowFrame& shadow_frame, JValue result_register);
2452template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
2453JValue ExecuteGotoImpl<false, true>(Thread* self, MethodHelper& mh,
2454 const DexFile::CodeItem* code_item,
2455 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002456
2457} // namespace interpreter
2458} // namespace art