blob: abd4b44d38879c90cf0623f4c68420f4760ffd8e [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 }
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200252 if (UNLIKELY(self->TestAllFlags())) {
253 CheckSuspend(self);
254 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200255 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200256 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200257 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200258 shadow_frame.GetMethod(), dex_pc,
259 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200260 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
261 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
262 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200263 }
264 return result;
265 }
266 HANDLE_INSTRUCTION_END();
267
268 HANDLE_INSTRUCTION_START(RETURN_VOID_BARRIER) {
Hans Boehm30359612014-05-21 17:46:23 -0700269 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200270 JValue result;
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200271 if (UNLIKELY(self->TestAllFlags())) {
272 CheckSuspend(self);
273 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200274 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200275 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200276 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200277 shadow_frame.GetMethod(), dex_pc,
278 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200279 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
280 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
281 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200282 }
283 return result;
284 }
285 HANDLE_INSTRUCTION_END();
286
287 HANDLE_INSTRUCTION_START(RETURN) {
288 JValue result;
289 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200290 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200291 if (UNLIKELY(self->TestAllFlags())) {
292 CheckSuspend(self);
293 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200294 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200295 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200296 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200297 shadow_frame.GetMethod(), dex_pc,
298 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200299 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
300 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
301 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200302 }
303 return result;
304 }
305 HANDLE_INSTRUCTION_END();
306
307 HANDLE_INSTRUCTION_START(RETURN_WIDE) {
308 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200309 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200310 if (UNLIKELY(self->TestAllFlags())) {
311 CheckSuspend(self);
312 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200313 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200314 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200315 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200316 shadow_frame.GetMethod(), dex_pc,
317 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200318 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
319 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
320 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200321 }
322 return result;
323 }
324 HANDLE_INSTRUCTION_END();
325
326 HANDLE_INSTRUCTION_START(RETURN_OBJECT) {
327 JValue result;
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200328 if (UNLIKELY(self->TestAllFlags())) {
329 CheckSuspend(self);
330 }
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700331 const uint8_t vreg_index = inst->VRegA_11x(inst_data);
332 Object* obj_result = shadow_frame.GetVRegReference(vreg_index);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700333 if (do_assignability_check && obj_result != NULL) {
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700334 StackHandleScope<1> hs(self);
335 MethodHelper mh(hs.NewHandle(shadow_frame.GetMethod()));
336 Class* return_type = mh.GetReturnType();
337 obj_result = shadow_frame.GetVRegReference(vreg_index);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700338 if (return_type == NULL) {
339 // Return the pending exception.
340 HANDLE_PENDING_EXCEPTION();
341 }
342 if (!obj_result->VerifierInstanceOf(return_type)) {
343 // This should never happen.
344 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
345 "Ljava/lang/VirtualMachineError;",
346 "Returning '%s' that is not instance of return type '%s'",
Mathieu Chartierf8322842014-05-16 10:59:25 -0700347 obj_result->GetClass()->GetDescriptor().c_str(),
348 return_type->GetDescriptor().c_str());
Jeff Haoa3faaf42013-09-03 19:07:00 -0700349 HANDLE_PENDING_EXCEPTION();
350 }
351 }
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700352 result.SetL(obj_result);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200353 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200354 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200355 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200356 shadow_frame.GetMethod(), dex_pc,
357 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200358 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
359 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
360 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200361 }
362 return result;
363 }
364 HANDLE_INSTRUCTION_END();
365
366 HANDLE_INSTRUCTION_START(CONST_4) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200367 uint32_t dst = inst->VRegA_11n(inst_data);
368 int32_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200369 shadow_frame.SetVReg(dst, val);
370 if (val == 0) {
371 shadow_frame.SetVRegReference(dst, NULL);
372 }
373 ADVANCE(1);
374 }
375 HANDLE_INSTRUCTION_END();
376
377 HANDLE_INSTRUCTION_START(CONST_16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200378 uint32_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200379 int32_t val = inst->VRegB_21s();
380 shadow_frame.SetVReg(dst, val);
381 if (val == 0) {
382 shadow_frame.SetVRegReference(dst, NULL);
383 }
384 ADVANCE(2);
385 }
386 HANDLE_INSTRUCTION_END();
387
388 HANDLE_INSTRUCTION_START(CONST) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200389 uint32_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200390 int32_t val = inst->VRegB_31i();
391 shadow_frame.SetVReg(dst, val);
392 if (val == 0) {
393 shadow_frame.SetVRegReference(dst, NULL);
394 }
395 ADVANCE(3);
396 }
397 HANDLE_INSTRUCTION_END();
398
399 HANDLE_INSTRUCTION_START(CONST_HIGH16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200400 uint32_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200401 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
402 shadow_frame.SetVReg(dst, val);
403 if (val == 0) {
404 shadow_frame.SetVRegReference(dst, NULL);
405 }
406 ADVANCE(2);
407 }
408 HANDLE_INSTRUCTION_END();
409
410 HANDLE_INSTRUCTION_START(CONST_WIDE_16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200411 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200412 ADVANCE(2);
413 HANDLE_INSTRUCTION_END();
414
415 HANDLE_INSTRUCTION_START(CONST_WIDE_32)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200416 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200417 ADVANCE(3);
418 HANDLE_INSTRUCTION_END();
419
420 HANDLE_INSTRUCTION_START(CONST_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200421 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200422 ADVANCE(5);
423 HANDLE_INSTRUCTION_END();
424
425 HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200426 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200427 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
428 ADVANCE(2);
429 HANDLE_INSTRUCTION_END();
430
431 HANDLE_INSTRUCTION_START(CONST_STRING) {
432 String* s = ResolveString(self, mh, inst->VRegB_21c());
433 if (UNLIKELY(s == NULL)) {
434 HANDLE_PENDING_EXCEPTION();
435 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200436 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200437 ADVANCE(2);
438 }
439 }
440 HANDLE_INSTRUCTION_END();
441
442 HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
443 String* s = ResolveString(self, mh, inst->VRegB_31c());
444 if (UNLIKELY(s == NULL)) {
445 HANDLE_PENDING_EXCEPTION();
446 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200447 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200448 ADVANCE(3);
449 }
450 }
451 HANDLE_INSTRUCTION_END();
452
453 HANDLE_INSTRUCTION_START(CONST_CLASS) {
454 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
455 self, false, do_access_check);
456 if (UNLIKELY(c == NULL)) {
457 HANDLE_PENDING_EXCEPTION();
458 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200459 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200460 ADVANCE(2);
461 }
462 }
463 HANDLE_INSTRUCTION_END();
464
465 HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200466 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200467 if (UNLIKELY(obj == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200468 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200469 HANDLE_PENDING_EXCEPTION();
470 } else {
471 DoMonitorEnter(self, obj);
472 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
473 }
474 }
475 HANDLE_INSTRUCTION_END();
476
477 HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200478 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200479 if (UNLIKELY(obj == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200480 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200481 HANDLE_PENDING_EXCEPTION();
482 } else {
483 DoMonitorExit(self, obj);
484 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
485 }
486 }
487 HANDLE_INSTRUCTION_END();
488
489 HANDLE_INSTRUCTION_START(CHECK_CAST) {
490 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
491 self, false, do_access_check);
492 if (UNLIKELY(c == NULL)) {
493 HANDLE_PENDING_EXCEPTION();
494 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200495 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200496 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
497 ThrowClassCastException(c, obj->GetClass());
498 HANDLE_PENDING_EXCEPTION();
499 } else {
500 ADVANCE(2);
501 }
502 }
503 }
504 HANDLE_INSTRUCTION_END();
505
506 HANDLE_INSTRUCTION_START(INSTANCE_OF) {
507 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
508 self, false, do_access_check);
509 if (UNLIKELY(c == NULL)) {
510 HANDLE_PENDING_EXCEPTION();
511 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200512 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
513 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200514 ADVANCE(2);
515 }
516 }
517 HANDLE_INSTRUCTION_END();
518
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700519 HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200520 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200521 if (UNLIKELY(array == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200522 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200523 HANDLE_PENDING_EXCEPTION();
524 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200525 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200526 ADVANCE(1);
527 }
528 }
529 HANDLE_INSTRUCTION_END();
530
531 HANDLE_INSTRUCTION_START(NEW_INSTANCE) {
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700532 Runtime* runtime = Runtime::Current();
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800533 Object* obj = AllocObjectFromCode<do_access_check, true>(
534 inst->VRegB_21c(), shadow_frame.GetMethod(), self,
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700535 runtime->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200536 if (UNLIKELY(obj == NULL)) {
537 HANDLE_PENDING_EXCEPTION();
538 } else {
Sebastien Hertz4e99b3d2014-06-24 14:35:40 +0200539 obj->GetClass()->AssertInitializedOrInitializingInThread(self);
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700540 // Don't allow finalizable objects to be allocated during a transaction since these can't be
541 // finalized without a started runtime.
542 if (transaction_active && obj->GetClass()->IsFinalizable()) {
Ian Rogers2fa98e22014-05-06 15:26:39 -0700543 AbortTransaction(self, "Allocating finalizable object in transaction: %s",
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700544 PrettyTypeOf(obj).c_str());
545 HANDLE_PENDING_EXCEPTION();
546 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200547 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200548 ADVANCE(2);
549 }
550 }
551 HANDLE_INSTRUCTION_END();
552
553 HANDLE_INSTRUCTION_START(NEW_ARRAY) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200554 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800555 Object* obj = AllocArrayFromCode<do_access_check, true>(
556 inst->VRegC_22c(), shadow_frame.GetMethod(), length, self,
557 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200558 if (UNLIKELY(obj == NULL)) {
559 HANDLE_PENDING_EXCEPTION();
560 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200561 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200562 ADVANCE(2);
563 }
564 }
565 HANDLE_INSTRUCTION_END();
566
567 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100568 bool success =
569 DoFilledNewArray<false, do_access_check, transaction_active>(inst, shadow_frame,
570 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200571 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
572 }
573 HANDLE_INSTRUCTION_END();
574
575 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100576 bool success =
577 DoFilledNewArray<true, do_access_check, transaction_active>(inst, shadow_frame,
578 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200579 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
580 }
581 HANDLE_INSTRUCTION_END();
582
583 HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200584 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200585 if (UNLIKELY(obj == NULL)) {
586 ThrowNullPointerException(NULL, "null array in FILL_ARRAY_DATA");
587 HANDLE_PENDING_EXCEPTION();
588 } else {
589 Array* array = obj->AsArray();
590 DCHECK(array->IsArrayInstance() && !array->IsObjectArray());
591 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
592 const Instruction::ArrayDataPayload* payload =
593 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
594 if (UNLIKELY(static_cast<int32_t>(payload->element_count) > array->GetLength())) {
595 self->ThrowNewExceptionF(shadow_frame.GetCurrentLocationForThrow(),
596 "Ljava/lang/ArrayIndexOutOfBoundsException;",
597 "failed FILL_ARRAY_DATA; length=%d, index=%d",
598 array->GetLength(), payload->element_count);
599 HANDLE_PENDING_EXCEPTION();
600 } else {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100601 if (transaction_active) {
602 RecordArrayElementsInTransaction(array, payload->element_count);
603 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200604 uint32_t size_in_bytes = payload->element_count * payload->element_width;
Ian Rogersef7d42f2014-01-06 12:55:46 -0800605 memcpy(array->GetRawData(payload->element_width, 0), payload->data, size_in_bytes);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200606 ADVANCE(3);
607 }
608 }
609 }
610 HANDLE_INSTRUCTION_END();
611
612 HANDLE_INSTRUCTION_START(THROW) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200613 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200614 if (UNLIKELY(exception == NULL)) {
615 ThrowNullPointerException(NULL, "throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700616 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
617 // This should never happen.
618 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
619 "Ljava/lang/VirtualMachineError;",
620 "Throwing '%s' that is not instance of Throwable",
Mathieu Chartierf8322842014-05-16 10:59:25 -0700621 exception->GetClass()->GetDescriptor().c_str());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200622 } else {
623 self->SetException(shadow_frame.GetCurrentLocationForThrow(), exception->AsThrowable());
624 }
625 HANDLE_PENDING_EXCEPTION();
626 }
627 HANDLE_INSTRUCTION_END();
628
629 HANDLE_INSTRUCTION_START(GOTO) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200630 int8_t offset = inst->VRegA_10t(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200631 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200632 if (UNLIKELY(self->TestAllFlags())) {
633 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200634 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200635 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200636 }
637 ADVANCE(offset);
638 }
639 HANDLE_INSTRUCTION_END();
640
641 HANDLE_INSTRUCTION_START(GOTO_16) {
642 int16_t offset = inst->VRegA_20t();
643 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200644 if (UNLIKELY(self->TestAllFlags())) {
645 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200646 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200647 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200648 }
649 ADVANCE(offset);
650 }
651 HANDLE_INSTRUCTION_END();
652
653 HANDLE_INSTRUCTION_START(GOTO_32) {
654 int32_t offset = inst->VRegA_30t();
655 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200656 if (UNLIKELY(self->TestAllFlags())) {
657 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200658 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200659 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200660 }
661 ADVANCE(offset);
662 }
663 HANDLE_INSTRUCTION_END();
664
665 HANDLE_INSTRUCTION_START(PACKED_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200666 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200667 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200668 if (UNLIKELY(self->TestAllFlags())) {
669 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200670 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200671 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200672 }
673 ADVANCE(offset);
674 }
675 HANDLE_INSTRUCTION_END();
676
677 HANDLE_INSTRUCTION_START(SPARSE_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200678 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200679 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200680 if (UNLIKELY(self->TestAllFlags())) {
681 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200682 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200683 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200684 }
685 ADVANCE(offset);
686 }
687 HANDLE_INSTRUCTION_END();
688
689 HANDLE_INSTRUCTION_START(CMPL_FLOAT) {
690 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
691 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
692 int32_t result;
693 if (val1 > val2) {
694 result = 1;
695 } else if (val1 == val2) {
696 result = 0;
697 } else {
698 result = -1;
699 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200700 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200701 ADVANCE(2);
702 }
703 HANDLE_INSTRUCTION_END();
704
705 HANDLE_INSTRUCTION_START(CMPG_FLOAT) {
706 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
707 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
708 int32_t result;
709 if (val1 < val2) {
710 result = -1;
711 } else if (val1 == val2) {
712 result = 0;
713 } else {
714 result = 1;
715 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200716 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200717 ADVANCE(2);
718 }
719 HANDLE_INSTRUCTION_END();
720
721 HANDLE_INSTRUCTION_START(CMPL_DOUBLE) {
722 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
723 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
724 int32_t result;
725 if (val1 > val2) {
726 result = 1;
727 } else if (val1 == val2) {
728 result = 0;
729 } else {
730 result = -1;
731 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200732 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200733 ADVANCE(2);
734 }
735 HANDLE_INSTRUCTION_END();
736
737 HANDLE_INSTRUCTION_START(CMPG_DOUBLE) {
738 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
739 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
740 int32_t result;
741 if (val1 < val2) {
742 result = -1;
743 } else if (val1 == val2) {
744 result = 0;
745 } else {
746 result = 1;
747 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200748 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200749 ADVANCE(2);
750 }
751 HANDLE_INSTRUCTION_END();
752
753 HANDLE_INSTRUCTION_START(CMP_LONG) {
754 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
755 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
756 int32_t result;
757 if (val1 > val2) {
758 result = 1;
759 } else if (val1 == val2) {
760 result = 0;
761 } else {
762 result = -1;
763 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200764 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200765 ADVANCE(2);
766 }
767 HANDLE_INSTRUCTION_END();
768
769 HANDLE_INSTRUCTION_START(IF_EQ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200770 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200771 int16_t offset = inst->VRegC_22t();
772 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200773 if (UNLIKELY(self->TestAllFlags())) {
774 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200775 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200776 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200777 }
778 ADVANCE(offset);
779 } else {
780 ADVANCE(2);
781 }
782 }
783 HANDLE_INSTRUCTION_END();
784
785 HANDLE_INSTRUCTION_START(IF_NE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200786 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) != shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200787 int16_t offset = inst->VRegC_22t();
788 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200789 if (UNLIKELY(self->TestAllFlags())) {
790 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200791 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200792 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200793 }
794 ADVANCE(offset);
795 } else {
796 ADVANCE(2);
797 }
798 }
799 HANDLE_INSTRUCTION_END();
800
801 HANDLE_INSTRUCTION_START(IF_LT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200802 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) < shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200803 int16_t offset = inst->VRegC_22t();
804 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200805 if (UNLIKELY(self->TestAllFlags())) {
806 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200807 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200808 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200809 }
810 ADVANCE(offset);
811 } else {
812 ADVANCE(2);
813 }
814 }
815 HANDLE_INSTRUCTION_END();
816
817 HANDLE_INSTRUCTION_START(IF_GE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200818 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200819 int16_t offset = inst->VRegC_22t();
820 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200821 if (UNLIKELY(self->TestAllFlags())) {
822 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200823 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200824 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200825 }
826 ADVANCE(offset);
827 } else {
828 ADVANCE(2);
829 }
830 }
831 HANDLE_INSTRUCTION_END();
832
833 HANDLE_INSTRUCTION_START(IF_GT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200834 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200835 int16_t offset = inst->VRegC_22t();
836 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200837 if (UNLIKELY(self->TestAllFlags())) {
838 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200839 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200840 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200841 }
842 ADVANCE(offset);
843 } else {
844 ADVANCE(2);
845 }
846 }
847 HANDLE_INSTRUCTION_END();
848
849 HANDLE_INSTRUCTION_START(IF_LE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200850 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200851 int16_t offset = inst->VRegC_22t();
852 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200853 if (UNLIKELY(self->TestAllFlags())) {
854 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200855 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200856 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200857 }
858 ADVANCE(offset);
859 } else {
860 ADVANCE(2);
861 }
862 }
863 HANDLE_INSTRUCTION_END();
864
865 HANDLE_INSTRUCTION_START(IF_EQZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200866 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200867 int16_t offset = inst->VRegB_21t();
868 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200869 if (UNLIKELY(self->TestAllFlags())) {
870 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200871 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200872 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200873 }
874 ADVANCE(offset);
875 } else {
876 ADVANCE(2);
877 }
878 }
879 HANDLE_INSTRUCTION_END();
880
881 HANDLE_INSTRUCTION_START(IF_NEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200882 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200883 int16_t offset = inst->VRegB_21t();
884 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200885 if (UNLIKELY(self->TestAllFlags())) {
886 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200887 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200888 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200889 }
890 ADVANCE(offset);
891 } else {
892 ADVANCE(2);
893 }
894 }
895 HANDLE_INSTRUCTION_END();
896
897 HANDLE_INSTRUCTION_START(IF_LTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200898 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200899 int16_t offset = inst->VRegB_21t();
900 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200901 if (UNLIKELY(self->TestAllFlags())) {
902 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200903 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200904 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200905 }
906 ADVANCE(offset);
907 } else {
908 ADVANCE(2);
909 }
910 }
911 HANDLE_INSTRUCTION_END();
912
913 HANDLE_INSTRUCTION_START(IF_GEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200914 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200915 int16_t offset = inst->VRegB_21t();
916 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200917 if (UNLIKELY(self->TestAllFlags())) {
918 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200919 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200920 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200921 }
922 ADVANCE(offset);
923 } else {
924 ADVANCE(2);
925 }
926 }
927 HANDLE_INSTRUCTION_END();
928
929 HANDLE_INSTRUCTION_START(IF_GTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200930 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200931 int16_t offset = inst->VRegB_21t();
932 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200933 if (UNLIKELY(self->TestAllFlags())) {
934 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200935 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200936 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200937 }
938 ADVANCE(offset);
939 } else {
940 ADVANCE(2);
941 }
942 }
943 HANDLE_INSTRUCTION_END();
944
945 HANDLE_INSTRUCTION_START(IF_LEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200946 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200947 int16_t offset = inst->VRegB_21t();
948 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200949 if (UNLIKELY(self->TestAllFlags())) {
950 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200951 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200952 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200953 }
954 ADVANCE(offset);
955 } else {
956 ADVANCE(2);
957 }
958 }
959 HANDLE_INSTRUCTION_END();
960
961 HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
962 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
963 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200964 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200965 HANDLE_PENDING_EXCEPTION();
966 } else {
967 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
968 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100969 if (LIKELY(array->CheckIsValidIndex(index))) {
970 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200971 ADVANCE(2);
972 } else {
973 HANDLE_PENDING_EXCEPTION();
974 }
975 }
976 }
977 HANDLE_INSTRUCTION_END();
978
979 HANDLE_INSTRUCTION_START(AGET_BYTE) {
980 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
981 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200982 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200983 HANDLE_PENDING_EXCEPTION();
984 } else {
985 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
986 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100987 if (LIKELY(array->CheckIsValidIndex(index))) {
988 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200989 ADVANCE(2);
990 } else {
991 HANDLE_PENDING_EXCEPTION();
992 }
993 }
994 }
995 HANDLE_INSTRUCTION_END();
996
997 HANDLE_INSTRUCTION_START(AGET_CHAR) {
998 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
999 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001000 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001001 HANDLE_PENDING_EXCEPTION();
1002 } else {
1003 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1004 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001005 if (LIKELY(array->CheckIsValidIndex(index))) {
1006 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001007 ADVANCE(2);
1008 } else {
1009 HANDLE_PENDING_EXCEPTION();
1010 }
1011 }
1012 }
1013 HANDLE_INSTRUCTION_END();
1014
1015 HANDLE_INSTRUCTION_START(AGET_SHORT) {
1016 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1017 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001018 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001019 HANDLE_PENDING_EXCEPTION();
1020 } else {
1021 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1022 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001023 if (LIKELY(array->CheckIsValidIndex(index))) {
1024 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001025 ADVANCE(2);
1026 } else {
1027 HANDLE_PENDING_EXCEPTION();
1028 }
1029 }
1030 }
1031 HANDLE_INSTRUCTION_END();
1032
1033 HANDLE_INSTRUCTION_START(AGET) {
1034 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1035 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001036 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001037 HANDLE_PENDING_EXCEPTION();
1038 } else {
1039 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1040 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001041 if (LIKELY(array->CheckIsValidIndex(index))) {
1042 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001043 ADVANCE(2);
1044 } else {
1045 HANDLE_PENDING_EXCEPTION();
1046 }
1047 }
1048 }
1049 HANDLE_INSTRUCTION_END();
1050
1051 HANDLE_INSTRUCTION_START(AGET_WIDE) {
1052 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1053 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001054 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001055 HANDLE_PENDING_EXCEPTION();
1056 } else {
1057 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1058 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001059 if (LIKELY(array->CheckIsValidIndex(index))) {
1060 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001061 ADVANCE(2);
1062 } else {
1063 HANDLE_PENDING_EXCEPTION();
1064 }
1065 }
1066 }
1067 HANDLE_INSTRUCTION_END();
1068
1069 HANDLE_INSTRUCTION_START(AGET_OBJECT) {
1070 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1071 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001072 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001073 HANDLE_PENDING_EXCEPTION();
1074 } else {
1075 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1076 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001077 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001078 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001079 ADVANCE(2);
1080 } else {
1081 HANDLE_PENDING_EXCEPTION();
1082 }
1083 }
1084 }
1085 HANDLE_INSTRUCTION_END();
1086
1087 HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
1088 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1089 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001090 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001091 HANDLE_PENDING_EXCEPTION();
1092 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001093 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001094 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1095 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001096 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001097 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001098 ADVANCE(2);
1099 } else {
1100 HANDLE_PENDING_EXCEPTION();
1101 }
1102 }
1103 }
1104 HANDLE_INSTRUCTION_END();
1105
1106 HANDLE_INSTRUCTION_START(APUT_BYTE) {
1107 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1108 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001109 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001110 HANDLE_PENDING_EXCEPTION();
1111 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001112 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001113 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1114 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001115 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001116 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001117 ADVANCE(2);
1118 } else {
1119 HANDLE_PENDING_EXCEPTION();
1120 }
1121 }
1122 }
1123 HANDLE_INSTRUCTION_END();
1124
1125 HANDLE_INSTRUCTION_START(APUT_CHAR) {
1126 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1127 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001128 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001129 HANDLE_PENDING_EXCEPTION();
1130 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001131 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001132 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1133 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001134 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001135 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001136 ADVANCE(2);
1137 } else {
1138 HANDLE_PENDING_EXCEPTION();
1139 }
1140 }
1141 }
1142 HANDLE_INSTRUCTION_END();
1143
1144 HANDLE_INSTRUCTION_START(APUT_SHORT) {
1145 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1146 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001147 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001148 HANDLE_PENDING_EXCEPTION();
1149 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001150 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001151 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1152 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001153 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001154 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001155 ADVANCE(2);
1156 } else {
1157 HANDLE_PENDING_EXCEPTION();
1158 }
1159 }
1160 }
1161 HANDLE_INSTRUCTION_END();
1162
1163 HANDLE_INSTRUCTION_START(APUT) {
1164 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1165 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001166 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001167 HANDLE_PENDING_EXCEPTION();
1168 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001169 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001170 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1171 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001172 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001173 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001174 ADVANCE(2);
1175 } else {
1176 HANDLE_PENDING_EXCEPTION();
1177 }
1178 }
1179 }
1180 HANDLE_INSTRUCTION_END();
1181
1182 HANDLE_INSTRUCTION_START(APUT_WIDE) {
1183 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1184 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001185 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001186 HANDLE_PENDING_EXCEPTION();
1187 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001188 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001189 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1190 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001191 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001192 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001193 ADVANCE(2);
1194 } else {
1195 HANDLE_PENDING_EXCEPTION();
1196 }
1197 }
1198 }
1199 HANDLE_INSTRUCTION_END();
1200
1201 HANDLE_INSTRUCTION_START(APUT_OBJECT) {
1202 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1203 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001204 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001205 HANDLE_PENDING_EXCEPTION();
1206 } else {
1207 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001208 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001209 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001210 if (LIKELY(array->CheckIsValidIndex(index) && array->CheckAssignable(val))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001211 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001212 ADVANCE(2);
1213 } else {
1214 HANDLE_PENDING_EXCEPTION();
1215 }
1216 }
1217 }
1218 HANDLE_INSTRUCTION_END();
1219
1220 HANDLE_INSTRUCTION_START(IGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001221 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001222 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1223 }
1224 HANDLE_INSTRUCTION_END();
1225
1226 HANDLE_INSTRUCTION_START(IGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001227 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001228 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1229 }
1230 HANDLE_INSTRUCTION_END();
1231
1232 HANDLE_INSTRUCTION_START(IGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001233 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001234 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1235 }
1236 HANDLE_INSTRUCTION_END();
1237
1238 HANDLE_INSTRUCTION_START(IGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001239 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001240 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1241 }
1242 HANDLE_INSTRUCTION_END();
1243
1244 HANDLE_INSTRUCTION_START(IGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001245 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001246 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1247 }
1248 HANDLE_INSTRUCTION_END();
1249
1250 HANDLE_INSTRUCTION_START(IGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001251 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001252 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1253 }
1254 HANDLE_INSTRUCTION_END();
1255
1256 HANDLE_INSTRUCTION_START(IGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001257 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001258 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1259 }
1260 HANDLE_INSTRUCTION_END();
1261
1262 HANDLE_INSTRUCTION_START(IGET_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001263 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001264 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1265 }
1266 HANDLE_INSTRUCTION_END();
1267
1268 HANDLE_INSTRUCTION_START(IGET_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001269 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001270 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1271 }
1272 HANDLE_INSTRUCTION_END();
1273
1274 HANDLE_INSTRUCTION_START(IGET_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001275 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001276 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1277 }
1278 HANDLE_INSTRUCTION_END();
1279
1280 HANDLE_INSTRUCTION_START(SGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001281 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001282 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1283 }
1284 HANDLE_INSTRUCTION_END();
1285
1286 HANDLE_INSTRUCTION_START(SGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001287 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001288 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1289 }
1290 HANDLE_INSTRUCTION_END();
1291
1292 HANDLE_INSTRUCTION_START(SGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001293 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001294 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1295 }
1296 HANDLE_INSTRUCTION_END();
1297
1298 HANDLE_INSTRUCTION_START(SGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001299 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001300 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1301 }
1302 HANDLE_INSTRUCTION_END();
1303
1304 HANDLE_INSTRUCTION_START(SGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001305 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001306 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1307 }
1308 HANDLE_INSTRUCTION_END();
1309
1310 HANDLE_INSTRUCTION_START(SGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001311 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001312 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1313 }
1314 HANDLE_INSTRUCTION_END();
1315
1316 HANDLE_INSTRUCTION_START(SGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001317 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001318 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1319 }
1320 HANDLE_INSTRUCTION_END();
1321
1322 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001323 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001324 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1325 }
1326 HANDLE_INSTRUCTION_END();
1327
1328 HANDLE_INSTRUCTION_START(IPUT_BYTE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001329 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001330 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1331 }
1332 HANDLE_INSTRUCTION_END();
1333
1334 HANDLE_INSTRUCTION_START(IPUT_CHAR) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001335 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001336 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1337 }
1338 HANDLE_INSTRUCTION_END();
1339
1340 HANDLE_INSTRUCTION_START(IPUT_SHORT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001341 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001342 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1343 }
1344 HANDLE_INSTRUCTION_END();
1345
1346 HANDLE_INSTRUCTION_START(IPUT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001347 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001348 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1349 }
1350 HANDLE_INSTRUCTION_END();
1351
1352 HANDLE_INSTRUCTION_START(IPUT_WIDE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001353 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001354 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1355 }
1356 HANDLE_INSTRUCTION_END();
1357
1358 HANDLE_INSTRUCTION_START(IPUT_OBJECT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001359 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001360 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1361 }
1362 HANDLE_INSTRUCTION_END();
1363
1364 HANDLE_INSTRUCTION_START(IPUT_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001365 bool success = DoIPutQuick<Primitive::kPrimInt, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001366 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1367 }
1368 HANDLE_INSTRUCTION_END();
1369
1370 HANDLE_INSTRUCTION_START(IPUT_WIDE_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001371 bool success = DoIPutQuick<Primitive::kPrimLong, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001372 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1373 }
1374 HANDLE_INSTRUCTION_END();
1375
1376 HANDLE_INSTRUCTION_START(IPUT_OBJECT_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001377 bool success = DoIPutQuick<Primitive::kPrimNot, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001378 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1379 }
1380 HANDLE_INSTRUCTION_END();
1381
1382 HANDLE_INSTRUCTION_START(SPUT_BOOLEAN) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001383 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001384 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1385 }
1386 HANDLE_INSTRUCTION_END();
1387
1388 HANDLE_INSTRUCTION_START(SPUT_BYTE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001389 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001390 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1391 }
1392 HANDLE_INSTRUCTION_END();
1393
1394 HANDLE_INSTRUCTION_START(SPUT_CHAR) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001395 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001396 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1397 }
1398 HANDLE_INSTRUCTION_END();
1399
1400 HANDLE_INSTRUCTION_START(SPUT_SHORT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001401 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001402 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1403 }
1404 HANDLE_INSTRUCTION_END();
1405
1406 HANDLE_INSTRUCTION_START(SPUT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001407 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001408 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1409 }
1410 HANDLE_INSTRUCTION_END();
1411
1412 HANDLE_INSTRUCTION_START(SPUT_WIDE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001413 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001414 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1415 }
1416 HANDLE_INSTRUCTION_END();
1417
1418 HANDLE_INSTRUCTION_START(SPUT_OBJECT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001419 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001420 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1421 }
1422 HANDLE_INSTRUCTION_END();
1423
1424 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001425 bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001426 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001427 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1428 }
1429 HANDLE_INSTRUCTION_END();
1430
1431 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001432 bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001433 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001434 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1435 }
1436 HANDLE_INSTRUCTION_END();
1437
1438 HANDLE_INSTRUCTION_START(INVOKE_SUPER) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001439 bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001440 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001441 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1442 }
1443 HANDLE_INSTRUCTION_END();
1444
1445 HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001446 bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001447 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001448 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1449 }
1450 HANDLE_INSTRUCTION_END();
1451
1452 HANDLE_INSTRUCTION_START(INVOKE_DIRECT) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001453 bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001454 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001455 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1456 }
1457 HANDLE_INSTRUCTION_END();
1458
1459 HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001460 bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001461 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001462 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1463 }
1464 HANDLE_INSTRUCTION_END();
1465
1466 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001467 bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001468 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001469 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1470 }
1471 HANDLE_INSTRUCTION_END();
1472
1473 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001474 bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001475 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001476 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1477 }
1478 HANDLE_INSTRUCTION_END();
1479
1480 HANDLE_INSTRUCTION_START(INVOKE_STATIC) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001481 bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001482 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001483 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1484 }
1485 HANDLE_INSTRUCTION_END();
1486
1487 HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001488 bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001489 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001490 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1491 }
1492 HANDLE_INSTRUCTION_END();
1493
1494 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001495 bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001496 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001497 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1498 }
1499 HANDLE_INSTRUCTION_END();
1500
1501 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001502 bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001503 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001504 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1505 }
1506 HANDLE_INSTRUCTION_END();
1507
1508 HANDLE_INSTRUCTION_START(NEG_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001509 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001510 ADVANCE(1);
1511 HANDLE_INSTRUCTION_END();
1512
1513 HANDLE_INSTRUCTION_START(NOT_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001514 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001515 ADVANCE(1);
1516 HANDLE_INSTRUCTION_END();
1517
1518 HANDLE_INSTRUCTION_START(NEG_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001519 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001520 ADVANCE(1);
1521 HANDLE_INSTRUCTION_END();
1522
1523 HANDLE_INSTRUCTION_START(NOT_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001524 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001525 ADVANCE(1);
1526 HANDLE_INSTRUCTION_END();
1527
1528 HANDLE_INSTRUCTION_START(NEG_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001529 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001530 ADVANCE(1);
1531 HANDLE_INSTRUCTION_END();
1532
1533 HANDLE_INSTRUCTION_START(NEG_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001534 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001535 ADVANCE(1);
1536 HANDLE_INSTRUCTION_END();
1537
1538 HANDLE_INSTRUCTION_START(INT_TO_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001539 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001540 ADVANCE(1);
1541 HANDLE_INSTRUCTION_END();
1542
1543 HANDLE_INSTRUCTION_START(INT_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001544 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001545 ADVANCE(1);
1546 HANDLE_INSTRUCTION_END();
1547
1548 HANDLE_INSTRUCTION_START(INT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001549 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001550 ADVANCE(1);
1551 HANDLE_INSTRUCTION_END();
1552
1553 HANDLE_INSTRUCTION_START(LONG_TO_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001554 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001555 ADVANCE(1);
1556 HANDLE_INSTRUCTION_END();
1557
1558 HANDLE_INSTRUCTION_START(LONG_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001559 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001560 ADVANCE(1);
1561 HANDLE_INSTRUCTION_END();
1562
1563 HANDLE_INSTRUCTION_START(LONG_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001564 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001565 ADVANCE(1);
1566 HANDLE_INSTRUCTION_END();
1567
1568 HANDLE_INSTRUCTION_START(FLOAT_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001569 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001570 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001571 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001572 ADVANCE(1);
1573 }
1574 HANDLE_INSTRUCTION_END();
1575
1576 HANDLE_INSTRUCTION_START(FLOAT_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001577 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001578 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001579 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001580 ADVANCE(1);
1581 }
1582 HANDLE_INSTRUCTION_END();
1583
1584 HANDLE_INSTRUCTION_START(FLOAT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001585 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001586 ADVANCE(1);
1587 HANDLE_INSTRUCTION_END();
1588
1589 HANDLE_INSTRUCTION_START(DOUBLE_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001590 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001591 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001592 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001593 ADVANCE(1);
1594 }
1595 HANDLE_INSTRUCTION_END();
1596
1597 HANDLE_INSTRUCTION_START(DOUBLE_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001598 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001599 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001600 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001601 ADVANCE(1);
1602 }
1603 HANDLE_INSTRUCTION_END();
1604
1605 HANDLE_INSTRUCTION_START(DOUBLE_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001606 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001607 ADVANCE(1);
1608 HANDLE_INSTRUCTION_END();
1609
1610 HANDLE_INSTRUCTION_START(INT_TO_BYTE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001611 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1612 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001613 ADVANCE(1);
1614 HANDLE_INSTRUCTION_END();
1615
1616 HANDLE_INSTRUCTION_START(INT_TO_CHAR)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001617 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1618 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001619 ADVANCE(1);
1620 HANDLE_INSTRUCTION_END();
1621
1622 HANDLE_INSTRUCTION_START(INT_TO_SHORT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001623 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1624 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001625 ADVANCE(1);
1626 HANDLE_INSTRUCTION_END();
1627
1628 HANDLE_INSTRUCTION_START(ADD_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001629 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001630 shadow_frame.GetVReg(inst->VRegB_23x()) +
1631 shadow_frame.GetVReg(inst->VRegC_23x()));
1632 ADVANCE(2);
1633 HANDLE_INSTRUCTION_END();
1634
1635 HANDLE_INSTRUCTION_START(SUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001636 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001637 shadow_frame.GetVReg(inst->VRegB_23x()) -
1638 shadow_frame.GetVReg(inst->VRegC_23x()));
1639 ADVANCE(2);
1640 HANDLE_INSTRUCTION_END();
1641
1642 HANDLE_INSTRUCTION_START(MUL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001643 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001644 shadow_frame.GetVReg(inst->VRegB_23x()) *
1645 shadow_frame.GetVReg(inst->VRegC_23x()));
1646 ADVANCE(2);
1647 HANDLE_INSTRUCTION_END();
1648
1649 HANDLE_INSTRUCTION_START(DIV_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001650 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
1651 shadow_frame.GetVReg(inst->VRegB_23x()),
1652 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001653 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1654 }
1655 HANDLE_INSTRUCTION_END();
1656
1657 HANDLE_INSTRUCTION_START(REM_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001658 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1659 shadow_frame.GetVReg(inst->VRegB_23x()),
1660 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001661 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1662 }
1663 HANDLE_INSTRUCTION_END();
1664
1665 HANDLE_INSTRUCTION_START(SHL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001666 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001667 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1668 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1669 ADVANCE(2);
1670 HANDLE_INSTRUCTION_END();
1671
1672 HANDLE_INSTRUCTION_START(SHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001673 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001674 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1675 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1676 ADVANCE(2);
1677 HANDLE_INSTRUCTION_END();
1678
1679 HANDLE_INSTRUCTION_START(USHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001680 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001681 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1682 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1683 ADVANCE(2);
1684 HANDLE_INSTRUCTION_END();
1685
1686 HANDLE_INSTRUCTION_START(AND_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001687 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001688 shadow_frame.GetVReg(inst->VRegB_23x()) &
1689 shadow_frame.GetVReg(inst->VRegC_23x()));
1690 ADVANCE(2);
1691 HANDLE_INSTRUCTION_END();
1692
1693 HANDLE_INSTRUCTION_START(OR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001694 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001695 shadow_frame.GetVReg(inst->VRegB_23x()) |
1696 shadow_frame.GetVReg(inst->VRegC_23x()));
1697 ADVANCE(2);
1698 HANDLE_INSTRUCTION_END();
1699
1700 HANDLE_INSTRUCTION_START(XOR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001701 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001702 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1703 shadow_frame.GetVReg(inst->VRegC_23x()));
1704 ADVANCE(2);
1705 HANDLE_INSTRUCTION_END();
1706
1707 HANDLE_INSTRUCTION_START(ADD_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001708 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001709 shadow_frame.GetVRegLong(inst->VRegB_23x()) +
1710 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1711 ADVANCE(2);
1712 HANDLE_INSTRUCTION_END();
1713
1714 HANDLE_INSTRUCTION_START(SUB_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001715 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001716 shadow_frame.GetVRegLong(inst->VRegB_23x()) -
1717 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1718 ADVANCE(2);
1719 HANDLE_INSTRUCTION_END();
1720
1721 HANDLE_INSTRUCTION_START(MUL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001722 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001723 shadow_frame.GetVRegLong(inst->VRegB_23x()) *
1724 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1725 ADVANCE(2);
1726 HANDLE_INSTRUCTION_END();
1727
1728 HANDLE_INSTRUCTION_START(DIV_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001729 bool success = DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
1730 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1731 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001732 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1733 }
1734 HANDLE_INSTRUCTION_END();
1735
1736 HANDLE_INSTRUCTION_START(REM_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001737 bool success = DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1738 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1739 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001740 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1741 }
1742 HANDLE_INSTRUCTION_END();
1743
1744 HANDLE_INSTRUCTION_START(AND_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001745 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001746 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1747 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1748 ADVANCE(2);
1749 HANDLE_INSTRUCTION_END();
1750
1751 HANDLE_INSTRUCTION_START(OR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001752 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001753 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1754 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1755 ADVANCE(2);
1756 HANDLE_INSTRUCTION_END();
1757
1758 HANDLE_INSTRUCTION_START(XOR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001759 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001760 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1761 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1762 ADVANCE(2);
1763 HANDLE_INSTRUCTION_END();
1764
1765 HANDLE_INSTRUCTION_START(SHL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001766 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001767 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1768 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1769 ADVANCE(2);
1770 HANDLE_INSTRUCTION_END();
1771
1772 HANDLE_INSTRUCTION_START(SHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001773 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001774 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1775 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1776 ADVANCE(2);
1777 HANDLE_INSTRUCTION_END();
1778
1779 HANDLE_INSTRUCTION_START(USHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001780 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001781 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1782 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1783 ADVANCE(2);
1784 HANDLE_INSTRUCTION_END();
1785
1786 HANDLE_INSTRUCTION_START(ADD_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001787 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001788 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1789 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1790 ADVANCE(2);
1791 HANDLE_INSTRUCTION_END();
1792
1793 HANDLE_INSTRUCTION_START(SUB_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001794 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001795 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1796 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1797 ADVANCE(2);
1798 HANDLE_INSTRUCTION_END();
1799
1800 HANDLE_INSTRUCTION_START(MUL_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001801 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001802 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1803 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1804 ADVANCE(2);
1805 HANDLE_INSTRUCTION_END();
1806
1807 HANDLE_INSTRUCTION_START(DIV_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001808 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001809 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1810 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1811 ADVANCE(2);
1812 HANDLE_INSTRUCTION_END();
1813
1814 HANDLE_INSTRUCTION_START(REM_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001815 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001816 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1817 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1818 ADVANCE(2);
1819 HANDLE_INSTRUCTION_END();
1820
1821 HANDLE_INSTRUCTION_START(ADD_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001822 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001823 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1824 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1825 ADVANCE(2);
1826 HANDLE_INSTRUCTION_END();
1827
1828 HANDLE_INSTRUCTION_START(SUB_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001829 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001830 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1831 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1832 ADVANCE(2);
1833 HANDLE_INSTRUCTION_END();
1834
1835 HANDLE_INSTRUCTION_START(MUL_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001836 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001837 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1838 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1839 ADVANCE(2);
1840 HANDLE_INSTRUCTION_END();
1841
1842 HANDLE_INSTRUCTION_START(DIV_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001843 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001844 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1845 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1846 ADVANCE(2);
1847 HANDLE_INSTRUCTION_END();
1848
1849 HANDLE_INSTRUCTION_START(REM_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001850 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001851 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1852 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1853 ADVANCE(2);
1854 HANDLE_INSTRUCTION_END();
1855
1856 HANDLE_INSTRUCTION_START(ADD_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001857 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001858 shadow_frame.SetVReg(vregA,
1859 shadow_frame.GetVReg(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001860 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001861 ADVANCE(1);
1862 }
1863 HANDLE_INSTRUCTION_END();
1864
1865 HANDLE_INSTRUCTION_START(SUB_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001866 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001867 shadow_frame.SetVReg(vregA,
1868 shadow_frame.GetVReg(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001869 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001870 ADVANCE(1);
1871 }
1872 HANDLE_INSTRUCTION_END();
1873
1874 HANDLE_INSTRUCTION_START(MUL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001875 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001876 shadow_frame.SetVReg(vregA,
1877 shadow_frame.GetVReg(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001878 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001879 ADVANCE(1);
1880 }
1881 HANDLE_INSTRUCTION_END();
1882
1883 HANDLE_INSTRUCTION_START(DIV_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001884 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001885 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001886 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001887 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1888 }
1889 HANDLE_INSTRUCTION_END();
1890
1891 HANDLE_INSTRUCTION_START(REM_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001892 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001893 bool success = DoIntRemainder(shadow_frame, vregA, 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 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1896 }
1897 HANDLE_INSTRUCTION_END();
1898
1899 HANDLE_INSTRUCTION_START(SHL_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 shadow_frame.SetVReg(vregA,
1902 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001903 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001904 ADVANCE(1);
1905 }
1906 HANDLE_INSTRUCTION_END();
1907
1908 HANDLE_INSTRUCTION_START(SHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001909 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001910 shadow_frame.SetVReg(vregA,
1911 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001912 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001913 ADVANCE(1);
1914 }
1915 HANDLE_INSTRUCTION_END();
1916
1917 HANDLE_INSTRUCTION_START(USHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001918 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001919 shadow_frame.SetVReg(vregA,
1920 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001921 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001922 ADVANCE(1);
1923 }
1924 HANDLE_INSTRUCTION_END();
1925
1926 HANDLE_INSTRUCTION_START(AND_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001927 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001928 shadow_frame.SetVReg(vregA,
1929 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001930 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001931 ADVANCE(1);
1932 }
1933 HANDLE_INSTRUCTION_END();
1934
1935 HANDLE_INSTRUCTION_START(OR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001936 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001937 shadow_frame.SetVReg(vregA,
1938 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001939 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001940 ADVANCE(1);
1941 }
1942 HANDLE_INSTRUCTION_END();
1943
1944 HANDLE_INSTRUCTION_START(XOR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001945 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001946 shadow_frame.SetVReg(vregA,
1947 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001948 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001949 ADVANCE(1);
1950 }
1951 HANDLE_INSTRUCTION_END();
1952
1953 HANDLE_INSTRUCTION_START(ADD_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001954 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001955 shadow_frame.SetVRegLong(vregA,
1956 shadow_frame.GetVRegLong(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001957 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001958 ADVANCE(1);
1959 }
1960 HANDLE_INSTRUCTION_END();
1961
1962 HANDLE_INSTRUCTION_START(SUB_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001963 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001964 shadow_frame.SetVRegLong(vregA,
1965 shadow_frame.GetVRegLong(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001966 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001967 ADVANCE(1);
1968 }
1969 HANDLE_INSTRUCTION_END();
1970
1971 HANDLE_INSTRUCTION_START(MUL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001972 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001973 shadow_frame.SetVRegLong(vregA,
1974 shadow_frame.GetVRegLong(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001975 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001976 ADVANCE(1);
1977 }
1978 HANDLE_INSTRUCTION_END();
1979
1980 HANDLE_INSTRUCTION_START(DIV_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001981 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001982 bool success = DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001983 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001984 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1985 }
1986 HANDLE_INSTRUCTION_END();
1987
1988 HANDLE_INSTRUCTION_START(REM_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001989 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001990 bool success = DoLongRemainder(shadow_frame, vregA, 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 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1993 }
1994 HANDLE_INSTRUCTION_END();
1995
1996 HANDLE_INSTRUCTION_START(AND_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 shadow_frame.SetVRegLong(vregA,
1999 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002000 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002001 ADVANCE(1);
2002 }
2003 HANDLE_INSTRUCTION_END();
2004
2005 HANDLE_INSTRUCTION_START(OR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002006 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002007 shadow_frame.SetVRegLong(vregA,
2008 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002009 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002010 ADVANCE(1);
2011 }
2012 HANDLE_INSTRUCTION_END();
2013
2014 HANDLE_INSTRUCTION_START(XOR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002015 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002016 shadow_frame.SetVRegLong(vregA,
2017 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002018 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002019 ADVANCE(1);
2020 }
2021 HANDLE_INSTRUCTION_END();
2022
2023 HANDLE_INSTRUCTION_START(SHL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002024 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002025 shadow_frame.SetVRegLong(vregA,
2026 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002027 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002028 ADVANCE(1);
2029 }
2030 HANDLE_INSTRUCTION_END();
2031
2032 HANDLE_INSTRUCTION_START(SHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002033 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002034 shadow_frame.SetVRegLong(vregA,
2035 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002036 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002037 ADVANCE(1);
2038 }
2039 HANDLE_INSTRUCTION_END();
2040
2041 HANDLE_INSTRUCTION_START(USHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002042 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002043 shadow_frame.SetVRegLong(vregA,
2044 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002045 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002046 ADVANCE(1);
2047 }
2048 HANDLE_INSTRUCTION_END();
2049
2050 HANDLE_INSTRUCTION_START(ADD_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002051 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002052 shadow_frame.SetVRegFloat(vregA,
2053 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002054 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002055 ADVANCE(1);
2056 }
2057 HANDLE_INSTRUCTION_END();
2058
2059 HANDLE_INSTRUCTION_START(SUB_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002060 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002061 shadow_frame.SetVRegFloat(vregA,
2062 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002063 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002064 ADVANCE(1);
2065 }
2066 HANDLE_INSTRUCTION_END();
2067
2068 HANDLE_INSTRUCTION_START(MUL_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002069 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002070 shadow_frame.SetVRegFloat(vregA,
2071 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002072 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002073 ADVANCE(1);
2074 }
2075 HANDLE_INSTRUCTION_END();
2076
2077 HANDLE_INSTRUCTION_START(DIV_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002078 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002079 shadow_frame.SetVRegFloat(vregA,
2080 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002081 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002082 ADVANCE(1);
2083 }
2084 HANDLE_INSTRUCTION_END();
2085
2086 HANDLE_INSTRUCTION_START(REM_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002087 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002088 shadow_frame.SetVRegFloat(vregA,
2089 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002090 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002091 ADVANCE(1);
2092 }
2093 HANDLE_INSTRUCTION_END();
2094
2095 HANDLE_INSTRUCTION_START(ADD_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002096 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002097 shadow_frame.SetVRegDouble(vregA,
2098 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002099 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002100 ADVANCE(1);
2101 }
2102 HANDLE_INSTRUCTION_END();
2103
2104 HANDLE_INSTRUCTION_START(SUB_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002105 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002106 shadow_frame.SetVRegDouble(vregA,
2107 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002108 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002109 ADVANCE(1);
2110 }
2111 HANDLE_INSTRUCTION_END();
2112
2113 HANDLE_INSTRUCTION_START(MUL_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002114 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002115 shadow_frame.SetVRegDouble(vregA,
2116 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002117 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002118 ADVANCE(1);
2119 }
2120 HANDLE_INSTRUCTION_END();
2121
2122 HANDLE_INSTRUCTION_START(DIV_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002123 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002124 shadow_frame.SetVRegDouble(vregA,
2125 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002126 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002127 ADVANCE(1);
2128 }
2129 HANDLE_INSTRUCTION_END();
2130
2131 HANDLE_INSTRUCTION_START(REM_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002132 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002133 shadow_frame.SetVRegDouble(vregA,
2134 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002135 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002136 ADVANCE(1);
2137 }
2138 HANDLE_INSTRUCTION_END();
2139
2140 HANDLE_INSTRUCTION_START(ADD_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002141 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2142 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) +
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002143 inst->VRegC_22s());
2144 ADVANCE(2);
2145 HANDLE_INSTRUCTION_END();
2146
2147 HANDLE_INSTRUCTION_START(RSUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002148 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002149 inst->VRegC_22s() -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002150 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002151 ADVANCE(2);
2152 HANDLE_INSTRUCTION_END();
2153
2154 HANDLE_INSTRUCTION_START(MUL_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002155 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2156 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) *
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002157 inst->VRegC_22s());
2158 ADVANCE(2);
2159 HANDLE_INSTRUCTION_END();
2160
2161 HANDLE_INSTRUCTION_START(DIV_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002162 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
2163 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002164 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2165 }
2166 HANDLE_INSTRUCTION_END();
2167
2168 HANDLE_INSTRUCTION_START(REM_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002169 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
2170 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002171 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2172 }
2173 HANDLE_INSTRUCTION_END();
2174
2175 HANDLE_INSTRUCTION_START(AND_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002176 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2177 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002178 inst->VRegC_22s());
2179 ADVANCE(2);
2180 HANDLE_INSTRUCTION_END();
2181
2182 HANDLE_INSTRUCTION_START(OR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002183 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2184 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002185 inst->VRegC_22s());
2186 ADVANCE(2);
2187 HANDLE_INSTRUCTION_END();
2188
2189 HANDLE_INSTRUCTION_START(XOR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002190 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2191 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002192 inst->VRegC_22s());
2193 ADVANCE(2);
2194 HANDLE_INSTRUCTION_END();
2195
2196 HANDLE_INSTRUCTION_START(ADD_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002197 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002198 shadow_frame.GetVReg(inst->VRegB_22b()) +
2199 inst->VRegC_22b());
2200 ADVANCE(2);
2201 HANDLE_INSTRUCTION_END();
2202
2203 HANDLE_INSTRUCTION_START(RSUB_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002204 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002205 inst->VRegC_22b() -
2206 shadow_frame.GetVReg(inst->VRegB_22b()));
2207 ADVANCE(2);
2208 HANDLE_INSTRUCTION_END();
2209
2210 HANDLE_INSTRUCTION_START(MUL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002211 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002212 shadow_frame.GetVReg(inst->VRegB_22b()) *
2213 inst->VRegC_22b());
2214 ADVANCE(2);
2215 HANDLE_INSTRUCTION_END();
2216
2217 HANDLE_INSTRUCTION_START(DIV_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002218 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
2219 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002220 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2221 }
2222 HANDLE_INSTRUCTION_END();
2223
2224 HANDLE_INSTRUCTION_START(REM_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002225 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
2226 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002227 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2228 }
2229 HANDLE_INSTRUCTION_END();
2230
2231 HANDLE_INSTRUCTION_START(AND_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002232 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002233 shadow_frame.GetVReg(inst->VRegB_22b()) &
2234 inst->VRegC_22b());
2235 ADVANCE(2);
2236 HANDLE_INSTRUCTION_END();
2237
2238 HANDLE_INSTRUCTION_START(OR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002239 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002240 shadow_frame.GetVReg(inst->VRegB_22b()) |
2241 inst->VRegC_22b());
2242 ADVANCE(2);
2243 HANDLE_INSTRUCTION_END();
2244
2245 HANDLE_INSTRUCTION_START(XOR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002246 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002247 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2248 inst->VRegC_22b());
2249 ADVANCE(2);
2250 HANDLE_INSTRUCTION_END();
2251
2252 HANDLE_INSTRUCTION_START(SHL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002253 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002254 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2255 (inst->VRegC_22b() & 0x1f));
2256 ADVANCE(2);
2257 HANDLE_INSTRUCTION_END();
2258
2259 HANDLE_INSTRUCTION_START(SHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002260 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002261 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2262 (inst->VRegC_22b() & 0x1f));
2263 ADVANCE(2);
2264 HANDLE_INSTRUCTION_END();
2265
2266 HANDLE_INSTRUCTION_START(USHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002267 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002268 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2269 (inst->VRegC_22b() & 0x1f));
2270 ADVANCE(2);
2271 HANDLE_INSTRUCTION_END();
2272
2273 HANDLE_INSTRUCTION_START(UNUSED_3E)
2274 UnexpectedOpcode(inst, mh);
2275 HANDLE_INSTRUCTION_END();
2276
2277 HANDLE_INSTRUCTION_START(UNUSED_3F)
2278 UnexpectedOpcode(inst, mh);
2279 HANDLE_INSTRUCTION_END();
2280
2281 HANDLE_INSTRUCTION_START(UNUSED_40)
2282 UnexpectedOpcode(inst, mh);
2283 HANDLE_INSTRUCTION_END();
2284
2285 HANDLE_INSTRUCTION_START(UNUSED_41)
2286 UnexpectedOpcode(inst, mh);
2287 HANDLE_INSTRUCTION_END();
2288
2289 HANDLE_INSTRUCTION_START(UNUSED_42)
2290 UnexpectedOpcode(inst, mh);
2291 HANDLE_INSTRUCTION_END();
2292
2293 HANDLE_INSTRUCTION_START(UNUSED_43)
2294 UnexpectedOpcode(inst, mh);
2295 HANDLE_INSTRUCTION_END();
2296
2297 HANDLE_INSTRUCTION_START(UNUSED_79)
2298 UnexpectedOpcode(inst, mh);
2299 HANDLE_INSTRUCTION_END();
2300
2301 HANDLE_INSTRUCTION_START(UNUSED_7A)
2302 UnexpectedOpcode(inst, mh);
2303 HANDLE_INSTRUCTION_END();
2304
2305 HANDLE_INSTRUCTION_START(UNUSED_EB)
2306 UnexpectedOpcode(inst, mh);
2307 HANDLE_INSTRUCTION_END();
2308
2309 HANDLE_INSTRUCTION_START(UNUSED_EC)
2310 UnexpectedOpcode(inst, mh);
2311 HANDLE_INSTRUCTION_END();
2312
2313 HANDLE_INSTRUCTION_START(UNUSED_ED)
2314 UnexpectedOpcode(inst, mh);
2315 HANDLE_INSTRUCTION_END();
2316
2317 HANDLE_INSTRUCTION_START(UNUSED_EE)
2318 UnexpectedOpcode(inst, mh);
2319 HANDLE_INSTRUCTION_END();
2320
2321 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())) {
2392 CheckSuspend(self);
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