blob: db7c45281900fa4a786cc40de8b43d4c7dd5e5cc [file] [log] [blame]
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "interpreter_common.h"
18
19namespace art {
20namespace interpreter {
21
22// In the following macros, we expect the following local variables exist:
23// - "self": the current Thread*.
24// - "inst" : the current Instruction*.
Sebastien Hertz3b588e02013-09-11 14:33:18 +020025// - "inst_data" : the current instruction's first 16 bits.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020026// - "dex_pc": the current pc.
27// - "shadow_frame": the current shadow frame.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020028// - "mh": the current MethodHelper.
29// - "currentHandlersTable": the current table of pointer to each instruction handler.
30
31// Advance to the next instruction and updates interpreter state.
Sebastien Hertz8ece0502013-08-07 11:26:41 +020032#define ADVANCE(_offset) \
33 do { \
34 int32_t disp = static_cast<int32_t>(_offset); \
35 inst = inst->RelativeAt(disp); \
36 dex_pc = static_cast<uint32_t>(static_cast<int32_t>(dex_pc) + disp); \
37 shadow_frame.SetDexPC(dex_pc); \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020038 TraceExecution(shadow_frame, inst, dex_pc, mh); \
Sebastien Hertz3b588e02013-09-11 14:33:18 +020039 inst_data = inst->Fetch16(0); \
40 goto *currentHandlersTable[inst->Opcode(inst_data)]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020041 } while (false)
42
43#define HANDLE_PENDING_EXCEPTION() goto exception_pending_label
44
45#define POSSIBLY_HANDLE_PENDING_EXCEPTION(_is_exception_pending, _offset) \
46 do { \
47 if (UNLIKELY(_is_exception_pending)) { \
48 HANDLE_PENDING_EXCEPTION(); \
49 } else { \
50 ADVANCE(_offset); \
51 } \
52 } while (false)
53
Sebastien Hertzee1997a2013-09-19 14:47:09 +020054#define UPDATE_HANDLER_TABLE() \
55 currentHandlersTable = handlersTable[Runtime::Current()->GetInstrumentation()->GetInterpreterHandlerTable()]
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +020056
Sebastien Hertz8ece0502013-08-07 11:26:41 +020057#define UNREACHABLE_CODE_CHECK() \
58 do { \
59 if (kIsDebugBuild) { \
60 LOG(FATAL) << "We should not be here !"; \
61 } \
62 } while (false)
63
64#define HANDLE_INSTRUCTION_START(opcode) op_##opcode: // NOLINT(whitespace/labels)
65#define HANDLE_INSTRUCTION_END() UNREACHABLE_CODE_CHECK()
66
Sebastien Hertzee1997a2013-09-19 14:47:09 +020067/**
68 * Interpreter based on computed goto tables.
69 *
70 * Each instruction is associated to a handler. This handler is responsible for executing the
71 * instruction and jump to the next instruction's handler.
72 * In order to limit the cost of instrumentation, we have two handler tables:
73 * - the "main" handler table: it contains handlers for normal execution of each instruction without
74 * handling of instrumentation.
75 * - the "alternative" handler table: it contains alternative handlers which first handle
76 * instrumentation before jumping to the corresponding "normal" instruction's handler.
77 *
78 * When instrumentation is active, the interpreter uses the "alternative" handler table. Otherwise
79 * it uses the "main" handler table.
80 *
81 * The current handler table is the handler table being used by the interpreter. It is updated:
82 * - on backward branch (goto, if and switch instructions)
83 * - after invoke
84 * - when an exception is thrown.
85 * This allows to support an attaching debugger to an already running application for instance.
86 *
87 * For a fast handler table update, handler tables are stored in an array of handler tables. Each
88 * handler table is represented by the InterpreterHandlerTable enum which allows to associate it
89 * to an index in this array of handler tables ((see Instrumentation::GetInterpreterHandlerTable).
90 *
91 * Here's the current layout of this array of handler tables:
92 *
93 * ---------------------+---------------+
94 * | NOP | (handler for NOP instruction)
95 * +---------------+
96 * "main" | MOVE | (handler for MOVE instruction)
97 * handler table +---------------+
98 * | ... |
99 * +---------------+
100 * | UNUSED_FF | (handler for UNUSED_FF instruction)
101 * ---------------------+---------------+
102 * | NOP | (alternative handler for NOP instruction)
103 * +---------------+
104 * "alternative" | MOVE | (alternative handler for MOVE instruction)
105 * handler table +---------------+
106 * | ... |
107 * +---------------+
108 * | UNUSED_FF | (alternative handler for UNUSED_FF instruction)
109 * ---------------------+---------------+
110 *
111 */
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100112template<bool do_access_check, bool transaction_active>
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200113JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item,
114 ShadowFrame& shadow_frame, JValue result_register) {
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200115 // Define handler tables:
116 // - The main handler table contains execution handlers for each instruction.
117 // - The alternative handler table contains prelude handlers which check for thread suspend and
118 // manage instrumentation before jumping to the execution handler.
119 static const void* const handlersTable[instrumentation::kNumHandlerTables][kNumPackedOpcodes] = {
120 {
121 // Main handler table.
122#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&op_##code,
123#include "dex_instruction_list.h"
124 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
125#undef DEX_INSTRUCTION_LIST
126#undef INSTRUCTION_HANDLER
127 }, {
128 // Alternative handler table.
129#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&alt_op_##code,
130#include "dex_instruction_list.h"
131 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
132#undef DEX_INSTRUCTION_LIST
133#undef INSTRUCTION_HANDLER
134 }
135 };
136
137 const bool do_assignability_check = do_access_check;
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200138 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
139 LOG(FATAL) << "Invalid shadow frame for interpreter use";
140 return JValue();
141 }
142 self->VerifyStack();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200143
144 uint32_t dex_pc = shadow_frame.GetDexPC();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200145 const Instruction* inst = Instruction::At(code_item->insns_ + dex_pc);
146 uint16_t inst_data;
147 const void* const* currentHandlersTable;
Sebastien Hertz8379b222014-02-24 17:38:15 +0100148 bool notified_method_entry_event = false;
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200149 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200150 if (LIKELY(dex_pc == 0)) { // We are entering the method as opposed to deoptimizing..
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200151 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200152 if (UNLIKELY(instrumentation->HasMethodEntryListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200153 instrumentation->MethodEnterEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200154 shadow_frame.GetMethod(), 0);
Sebastien Hertz8379b222014-02-24 17:38:15 +0100155 notified_method_entry_event = true;
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200156 }
157 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200158
159 // Jump to first instruction.
160 ADVANCE(0);
161 UNREACHABLE_CODE_CHECK();
162
163 HANDLE_INSTRUCTION_START(NOP)
164 ADVANCE(1);
165 HANDLE_INSTRUCTION_END();
166
167 HANDLE_INSTRUCTION_START(MOVE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200168 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
169 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200170 ADVANCE(1);
171 HANDLE_INSTRUCTION_END();
172
173 HANDLE_INSTRUCTION_START(MOVE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200174 shadow_frame.SetVReg(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200175 shadow_frame.GetVReg(inst->VRegB_22x()));
176 ADVANCE(2);
177 HANDLE_INSTRUCTION_END();
178
179 HANDLE_INSTRUCTION_START(MOVE_16)
180 shadow_frame.SetVReg(inst->VRegA_32x(),
181 shadow_frame.GetVReg(inst->VRegB_32x()));
182 ADVANCE(3);
183 HANDLE_INSTRUCTION_END();
184
185 HANDLE_INSTRUCTION_START(MOVE_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200186 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
187 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200188 ADVANCE(1);
189 HANDLE_INSTRUCTION_END();
190
191 HANDLE_INSTRUCTION_START(MOVE_WIDE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200192 shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200193 shadow_frame.GetVRegLong(inst->VRegB_22x()));
194 ADVANCE(2);
195 HANDLE_INSTRUCTION_END();
196
197 HANDLE_INSTRUCTION_START(MOVE_WIDE_16)
198 shadow_frame.SetVRegLong(inst->VRegA_32x(),
199 shadow_frame.GetVRegLong(inst->VRegB_32x()));
200 ADVANCE(3);
201 HANDLE_INSTRUCTION_END();
202
203 HANDLE_INSTRUCTION_START(MOVE_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200204 shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data),
205 shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200206 ADVANCE(1);
207 HANDLE_INSTRUCTION_END();
208
209 HANDLE_INSTRUCTION_START(MOVE_OBJECT_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200210 shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200211 shadow_frame.GetVRegReference(inst->VRegB_22x()));
212 ADVANCE(2);
213 HANDLE_INSTRUCTION_END();
214
215 HANDLE_INSTRUCTION_START(MOVE_OBJECT_16)
216 shadow_frame.SetVRegReference(inst->VRegA_32x(),
217 shadow_frame.GetVRegReference(inst->VRegB_32x()));
218 ADVANCE(3);
219 HANDLE_INSTRUCTION_END();
220
221 HANDLE_INSTRUCTION_START(MOVE_RESULT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200222 shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200223 ADVANCE(1);
224 HANDLE_INSTRUCTION_END();
225
226 HANDLE_INSTRUCTION_START(MOVE_RESULT_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200227 shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200228 ADVANCE(1);
229 HANDLE_INSTRUCTION_END();
230
231 HANDLE_INSTRUCTION_START(MOVE_RESULT_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200232 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200233 ADVANCE(1);
234 HANDLE_INSTRUCTION_END();
235
236 HANDLE_INSTRUCTION_START(MOVE_EXCEPTION) {
Sebastien Hertz5c004902014-05-21 10:07:42 +0200237 Throwable* exception = self->GetException(nullptr);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200238 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception);
Sebastien Hertz5c004902014-05-21 10:07:42 +0200239 self->ClearException();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200240 ADVANCE(1);
241 }
242 HANDLE_INSTRUCTION_END();
243
244 HANDLE_INSTRUCTION_START(RETURN_VOID) {
245 JValue result;
Sebastien Hertz043036f2013-09-09 18:26:48 +0200246 if (do_access_check) {
247 // If access checks are required then the dex-to-dex compiler and analysis of
248 // whether the class has final fields hasn't been performed. Conservatively
249 // perform the memory barrier now.
Hans Boehm30359612014-05-21 17:46:23 -0700250 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz043036f2013-09-09 18:26:48 +0200251 }
Ian Rogers7b078e82014-09-10 14:44:24 -0700252 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200253 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200254 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200255 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200256 shadow_frame.GetMethod(), dex_pc,
257 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200258 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
259 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
260 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200261 }
262 return result;
263 }
264 HANDLE_INSTRUCTION_END();
265
266 HANDLE_INSTRUCTION_START(RETURN_VOID_BARRIER) {
Hans Boehm30359612014-05-21 17:46:23 -0700267 QuasiAtomic::ThreadFenceForConstructor();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200268 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700269 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200270 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200271 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200272 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200273 shadow_frame.GetMethod(), dex_pc,
274 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200275 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
276 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
277 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200278 }
279 return result;
280 }
281 HANDLE_INSTRUCTION_END();
282
283 HANDLE_INSTRUCTION_START(RETURN) {
284 JValue result;
285 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200286 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700287 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200288 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200289 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200290 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200291 shadow_frame.GetMethod(), dex_pc,
292 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200293 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
294 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
295 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200296 }
297 return result;
298 }
299 HANDLE_INSTRUCTION_END();
300
301 HANDLE_INSTRUCTION_START(RETURN_WIDE) {
302 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200303 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Ian Rogers7b078e82014-09-10 14:44:24 -0700304 self->AllowThreadSuspension();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200305 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200306 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200307 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200308 shadow_frame.GetMethod(), dex_pc,
309 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200310 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
311 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
312 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200313 }
314 return result;
315 }
316 HANDLE_INSTRUCTION_END();
317
318 HANDLE_INSTRUCTION_START(RETURN_OBJECT) {
319 JValue result;
Ian Rogers7b078e82014-09-10 14:44:24 -0700320 self->AllowThreadSuspension();
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700321 const uint8_t vreg_index = inst->VRegA_11x(inst_data);
322 Object* obj_result = shadow_frame.GetVRegReference(vreg_index);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700323 if (do_assignability_check && obj_result != NULL) {
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700324 StackHandleScope<1> hs(self);
325 MethodHelper mh(hs.NewHandle(shadow_frame.GetMethod()));
326 Class* return_type = mh.GetReturnType();
327 obj_result = shadow_frame.GetVRegReference(vreg_index);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700328 if (return_type == NULL) {
329 // Return the pending exception.
330 HANDLE_PENDING_EXCEPTION();
331 }
332 if (!obj_result->VerifierInstanceOf(return_type)) {
333 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700334 std::string temp1, temp2;
Jeff Haoa3faaf42013-09-03 19:07:00 -0700335 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
336 "Ljava/lang/VirtualMachineError;",
337 "Returning '%s' that is not instance of return type '%s'",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700338 obj_result->GetClass()->GetDescriptor(&temp1),
339 return_type->GetDescriptor(&temp2));
Jeff Haoa3faaf42013-09-03 19:07:00 -0700340 HANDLE_PENDING_EXCEPTION();
341 }
342 }
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700343 result.SetL(obj_result);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200344 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200345 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200346 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200347 shadow_frame.GetMethod(), dex_pc,
348 result);
Sebastien Hertze713d932014-05-15 10:48:53 +0200349 } else if (UNLIKELY(instrumentation->HasDexPcListeners())) {
350 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
351 shadow_frame.GetMethod(), dex_pc);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200352 }
353 return result;
354 }
355 HANDLE_INSTRUCTION_END();
356
357 HANDLE_INSTRUCTION_START(CONST_4) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200358 uint32_t dst = inst->VRegA_11n(inst_data);
359 int32_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200360 shadow_frame.SetVReg(dst, val);
361 if (val == 0) {
362 shadow_frame.SetVRegReference(dst, NULL);
363 }
364 ADVANCE(1);
365 }
366 HANDLE_INSTRUCTION_END();
367
368 HANDLE_INSTRUCTION_START(CONST_16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200369 uint32_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200370 int32_t val = inst->VRegB_21s();
371 shadow_frame.SetVReg(dst, val);
372 if (val == 0) {
373 shadow_frame.SetVRegReference(dst, NULL);
374 }
375 ADVANCE(2);
376 }
377 HANDLE_INSTRUCTION_END();
378
379 HANDLE_INSTRUCTION_START(CONST) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200380 uint32_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200381 int32_t val = inst->VRegB_31i();
382 shadow_frame.SetVReg(dst, val);
383 if (val == 0) {
384 shadow_frame.SetVRegReference(dst, NULL);
385 }
386 ADVANCE(3);
387 }
388 HANDLE_INSTRUCTION_END();
389
390 HANDLE_INSTRUCTION_START(CONST_HIGH16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200391 uint32_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200392 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
393 shadow_frame.SetVReg(dst, val);
394 if (val == 0) {
395 shadow_frame.SetVRegReference(dst, NULL);
396 }
397 ADVANCE(2);
398 }
399 HANDLE_INSTRUCTION_END();
400
401 HANDLE_INSTRUCTION_START(CONST_WIDE_16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200402 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200403 ADVANCE(2);
404 HANDLE_INSTRUCTION_END();
405
406 HANDLE_INSTRUCTION_START(CONST_WIDE_32)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200407 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200408 ADVANCE(3);
409 HANDLE_INSTRUCTION_END();
410
411 HANDLE_INSTRUCTION_START(CONST_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200412 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200413 ADVANCE(5);
414 HANDLE_INSTRUCTION_END();
415
416 HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200417 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200418 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
419 ADVANCE(2);
420 HANDLE_INSTRUCTION_END();
421
422 HANDLE_INSTRUCTION_START(CONST_STRING) {
423 String* s = ResolveString(self, mh, inst->VRegB_21c());
424 if (UNLIKELY(s == NULL)) {
425 HANDLE_PENDING_EXCEPTION();
426 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200427 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200428 ADVANCE(2);
429 }
430 }
431 HANDLE_INSTRUCTION_END();
432
433 HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
434 String* s = ResolveString(self, mh, inst->VRegB_31c());
435 if (UNLIKELY(s == NULL)) {
436 HANDLE_PENDING_EXCEPTION();
437 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200438 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200439 ADVANCE(3);
440 }
441 }
442 HANDLE_INSTRUCTION_END();
443
444 HANDLE_INSTRUCTION_START(CONST_CLASS) {
445 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
446 self, false, do_access_check);
447 if (UNLIKELY(c == NULL)) {
448 HANDLE_PENDING_EXCEPTION();
449 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200450 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200451 ADVANCE(2);
452 }
453 }
454 HANDLE_INSTRUCTION_END();
455
456 HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200457 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200458 if (UNLIKELY(obj == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200459 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200460 HANDLE_PENDING_EXCEPTION();
461 } else {
462 DoMonitorEnter(self, obj);
463 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
464 }
465 }
466 HANDLE_INSTRUCTION_END();
467
468 HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200469 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200470 if (UNLIKELY(obj == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200471 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200472 HANDLE_PENDING_EXCEPTION();
473 } else {
474 DoMonitorExit(self, obj);
475 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
476 }
477 }
478 HANDLE_INSTRUCTION_END();
479
480 HANDLE_INSTRUCTION_START(CHECK_CAST) {
481 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
482 self, false, do_access_check);
483 if (UNLIKELY(c == NULL)) {
484 HANDLE_PENDING_EXCEPTION();
485 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200486 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200487 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
488 ThrowClassCastException(c, obj->GetClass());
489 HANDLE_PENDING_EXCEPTION();
490 } else {
491 ADVANCE(2);
492 }
493 }
494 }
495 HANDLE_INSTRUCTION_END();
496
497 HANDLE_INSTRUCTION_START(INSTANCE_OF) {
498 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
499 self, false, do_access_check);
500 if (UNLIKELY(c == NULL)) {
501 HANDLE_PENDING_EXCEPTION();
502 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200503 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
504 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200505 ADVANCE(2);
506 }
507 }
508 HANDLE_INSTRUCTION_END();
509
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700510 HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200511 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200512 if (UNLIKELY(array == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200513 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200514 HANDLE_PENDING_EXCEPTION();
515 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200516 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200517 ADVANCE(1);
518 }
519 }
520 HANDLE_INSTRUCTION_END();
521
522 HANDLE_INSTRUCTION_START(NEW_INSTANCE) {
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700523 Runtime* runtime = Runtime::Current();
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800524 Object* obj = AllocObjectFromCode<do_access_check, true>(
525 inst->VRegB_21c(), shadow_frame.GetMethod(), self,
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700526 runtime->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200527 if (UNLIKELY(obj == NULL)) {
528 HANDLE_PENDING_EXCEPTION();
529 } else {
Sebastien Hertz4e99b3d2014-06-24 14:35:40 +0200530 obj->GetClass()->AssertInitializedOrInitializingInThread(self);
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700531 // Don't allow finalizable objects to be allocated during a transaction since these can't be
532 // finalized without a started runtime.
533 if (transaction_active && obj->GetClass()->IsFinalizable()) {
Ian Rogers2fa98e22014-05-06 15:26:39 -0700534 AbortTransaction(self, "Allocating finalizable object in transaction: %s",
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700535 PrettyTypeOf(obj).c_str());
536 HANDLE_PENDING_EXCEPTION();
537 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200538 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200539 ADVANCE(2);
540 }
541 }
542 HANDLE_INSTRUCTION_END();
543
544 HANDLE_INSTRUCTION_START(NEW_ARRAY) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200545 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800546 Object* obj = AllocArrayFromCode<do_access_check, true>(
547 inst->VRegC_22c(), shadow_frame.GetMethod(), length, self,
548 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200549 if (UNLIKELY(obj == NULL)) {
550 HANDLE_PENDING_EXCEPTION();
551 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200552 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200553 ADVANCE(2);
554 }
555 }
556 HANDLE_INSTRUCTION_END();
557
558 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100559 bool success =
560 DoFilledNewArray<false, do_access_check, transaction_active>(inst, shadow_frame,
561 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200562 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
563 }
564 HANDLE_INSTRUCTION_END();
565
566 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100567 bool success =
568 DoFilledNewArray<true, do_access_check, transaction_active>(inst, shadow_frame,
569 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200570 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
571 }
572 HANDLE_INSTRUCTION_END();
573
574 HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200575 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Ian Rogers832336b2014-10-08 15:35:22 -0700576 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
577 const Instruction::ArrayDataPayload* payload =
578 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
579 bool success = FillArrayData(obj, payload);
580 if (transaction_active && success) {
581 RecordArrayElementsInTransaction(obj->AsArray(), payload->element_count);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200582 }
Ian Rogers832336b2014-10-08 15:35:22 -0700583 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200584 }
585 HANDLE_INSTRUCTION_END();
586
587 HANDLE_INSTRUCTION_START(THROW) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200588 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200589 if (UNLIKELY(exception == NULL)) {
590 ThrowNullPointerException(NULL, "throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700591 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
592 // This should never happen.
Ian Rogers1ff3c982014-08-12 02:30:58 -0700593 std::string temp;
Jeff Haoa3faaf42013-09-03 19:07:00 -0700594 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
595 "Ljava/lang/VirtualMachineError;",
596 "Throwing '%s' that is not instance of Throwable",
Ian Rogers1ff3c982014-08-12 02:30:58 -0700597 exception->GetClass()->GetDescriptor(&temp));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200598 } else {
599 self->SetException(shadow_frame.GetCurrentLocationForThrow(), exception->AsThrowable());
600 }
601 HANDLE_PENDING_EXCEPTION();
602 }
603 HANDLE_INSTRUCTION_END();
604
605 HANDLE_INSTRUCTION_START(GOTO) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200606 int8_t offset = inst->VRegA_10t(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200607 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200608 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700609 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200610 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200611 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200612 }
613 ADVANCE(offset);
614 }
615 HANDLE_INSTRUCTION_END();
616
617 HANDLE_INSTRUCTION_START(GOTO_16) {
618 int16_t offset = inst->VRegA_20t();
619 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200620 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700621 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200622 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200623 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200624 }
625 ADVANCE(offset);
626 }
627 HANDLE_INSTRUCTION_END();
628
629 HANDLE_INSTRUCTION_START(GOTO_32) {
630 int32_t offset = inst->VRegA_30t();
631 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200632 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700633 self->CheckSuspend();
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(PACKED_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200642 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200643 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200644 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700645 self->CheckSuspend();
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(SPARSE_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200654 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200655 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200656 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700657 self->CheckSuspend();
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(CMPL_FLOAT) {
666 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
667 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
668 int32_t result;
669 if (val1 > val2) {
670 result = 1;
671 } else if (val1 == val2) {
672 result = 0;
673 } else {
674 result = -1;
675 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200676 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200677 ADVANCE(2);
678 }
679 HANDLE_INSTRUCTION_END();
680
681 HANDLE_INSTRUCTION_START(CMPG_FLOAT) {
682 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
683 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
684 int32_t result;
685 if (val1 < val2) {
686 result = -1;
687 } else if (val1 == val2) {
688 result = 0;
689 } else {
690 result = 1;
691 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200692 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200693 ADVANCE(2);
694 }
695 HANDLE_INSTRUCTION_END();
696
697 HANDLE_INSTRUCTION_START(CMPL_DOUBLE) {
698 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
699 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
700 int32_t result;
701 if (val1 > val2) {
702 result = 1;
703 } else if (val1 == val2) {
704 result = 0;
705 } else {
706 result = -1;
707 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200708 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200709 ADVANCE(2);
710 }
711 HANDLE_INSTRUCTION_END();
712
713 HANDLE_INSTRUCTION_START(CMPG_DOUBLE) {
714 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
715 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
716 int32_t result;
717 if (val1 < val2) {
718 result = -1;
719 } else if (val1 == val2) {
720 result = 0;
721 } else {
722 result = 1;
723 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200724 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200725 ADVANCE(2);
726 }
727 HANDLE_INSTRUCTION_END();
728
729 HANDLE_INSTRUCTION_START(CMP_LONG) {
730 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
731 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
732 int32_t result;
733 if (val1 > val2) {
734 result = 1;
735 } else if (val1 == val2) {
736 result = 0;
737 } else {
738 result = -1;
739 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200740 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200741 ADVANCE(2);
742 }
743 HANDLE_INSTRUCTION_END();
744
745 HANDLE_INSTRUCTION_START(IF_EQ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200746 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200747 int16_t offset = inst->VRegC_22t();
748 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200749 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700750 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200751 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200752 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200753 }
754 ADVANCE(offset);
755 } else {
756 ADVANCE(2);
757 }
758 }
759 HANDLE_INSTRUCTION_END();
760
761 HANDLE_INSTRUCTION_START(IF_NE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200762 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) != shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200763 int16_t offset = inst->VRegC_22t();
764 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200765 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700766 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200767 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200768 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200769 }
770 ADVANCE(offset);
771 } else {
772 ADVANCE(2);
773 }
774 }
775 HANDLE_INSTRUCTION_END();
776
777 HANDLE_INSTRUCTION_START(IF_LT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200778 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) < shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200779 int16_t offset = inst->VRegC_22t();
780 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200781 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700782 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200783 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200784 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200785 }
786 ADVANCE(offset);
787 } else {
788 ADVANCE(2);
789 }
790 }
791 HANDLE_INSTRUCTION_END();
792
793 HANDLE_INSTRUCTION_START(IF_GE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200794 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200795 int16_t offset = inst->VRegC_22t();
796 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200797 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700798 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200799 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200800 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200801 }
802 ADVANCE(offset);
803 } else {
804 ADVANCE(2);
805 }
806 }
807 HANDLE_INSTRUCTION_END();
808
809 HANDLE_INSTRUCTION_START(IF_GT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200810 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200811 int16_t offset = inst->VRegC_22t();
812 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200813 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700814 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200815 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200816 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200817 }
818 ADVANCE(offset);
819 } else {
820 ADVANCE(2);
821 }
822 }
823 HANDLE_INSTRUCTION_END();
824
825 HANDLE_INSTRUCTION_START(IF_LE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200826 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200827 int16_t offset = inst->VRegC_22t();
828 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200829 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700830 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200831 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200832 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200833 }
834 ADVANCE(offset);
835 } else {
836 ADVANCE(2);
837 }
838 }
839 HANDLE_INSTRUCTION_END();
840
841 HANDLE_INSTRUCTION_START(IF_EQZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200842 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200843 int16_t offset = inst->VRegB_21t();
844 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200845 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700846 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200847 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200848 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200849 }
850 ADVANCE(offset);
851 } else {
852 ADVANCE(2);
853 }
854 }
855 HANDLE_INSTRUCTION_END();
856
857 HANDLE_INSTRUCTION_START(IF_NEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200858 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200859 int16_t offset = inst->VRegB_21t();
860 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200861 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700862 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200863 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200864 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200865 }
866 ADVANCE(offset);
867 } else {
868 ADVANCE(2);
869 }
870 }
871 HANDLE_INSTRUCTION_END();
872
873 HANDLE_INSTRUCTION_START(IF_LTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200874 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200875 int16_t offset = inst->VRegB_21t();
876 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200877 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700878 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200879 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200880 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200881 }
882 ADVANCE(offset);
883 } else {
884 ADVANCE(2);
885 }
886 }
887 HANDLE_INSTRUCTION_END();
888
889 HANDLE_INSTRUCTION_START(IF_GEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200890 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200891 int16_t offset = inst->VRegB_21t();
892 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200893 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700894 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200895 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200896 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200897 }
898 ADVANCE(offset);
899 } else {
900 ADVANCE(2);
901 }
902 }
903 HANDLE_INSTRUCTION_END();
904
905 HANDLE_INSTRUCTION_START(IF_GTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200906 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200907 int16_t offset = inst->VRegB_21t();
908 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200909 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700910 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200911 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200912 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200913 }
914 ADVANCE(offset);
915 } else {
916 ADVANCE(2);
917 }
918 }
919 HANDLE_INSTRUCTION_END();
920
921 HANDLE_INSTRUCTION_START(IF_LEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200922 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200923 int16_t offset = inst->VRegB_21t();
924 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200925 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -0700926 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200927 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200928 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200929 }
930 ADVANCE(offset);
931 } else {
932 ADVANCE(2);
933 }
934 }
935 HANDLE_INSTRUCTION_END();
936
937 HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
938 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
939 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200940 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200941 HANDLE_PENDING_EXCEPTION();
942 } else {
943 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
944 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100945 if (LIKELY(array->CheckIsValidIndex(index))) {
946 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200947 ADVANCE(2);
948 } else {
949 HANDLE_PENDING_EXCEPTION();
950 }
951 }
952 }
953 HANDLE_INSTRUCTION_END();
954
955 HANDLE_INSTRUCTION_START(AGET_BYTE) {
956 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
957 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200958 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200959 HANDLE_PENDING_EXCEPTION();
960 } else {
961 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
962 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100963 if (LIKELY(array->CheckIsValidIndex(index))) {
964 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200965 ADVANCE(2);
966 } else {
967 HANDLE_PENDING_EXCEPTION();
968 }
969 }
970 }
971 HANDLE_INSTRUCTION_END();
972
973 HANDLE_INSTRUCTION_START(AGET_CHAR) {
974 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
975 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200976 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200977 HANDLE_PENDING_EXCEPTION();
978 } else {
979 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
980 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100981 if (LIKELY(array->CheckIsValidIndex(index))) {
982 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200983 ADVANCE(2);
984 } else {
985 HANDLE_PENDING_EXCEPTION();
986 }
987 }
988 }
989 HANDLE_INSTRUCTION_END();
990
991 HANDLE_INSTRUCTION_START(AGET_SHORT) {
992 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
993 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +0200994 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200995 HANDLE_PENDING_EXCEPTION();
996 } else {
997 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
998 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100999 if (LIKELY(array->CheckIsValidIndex(index))) {
1000 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001001 ADVANCE(2);
1002 } else {
1003 HANDLE_PENDING_EXCEPTION();
1004 }
1005 }
1006 }
1007 HANDLE_INSTRUCTION_END();
1008
1009 HANDLE_INSTRUCTION_START(AGET) {
1010 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1011 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001012 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001013 HANDLE_PENDING_EXCEPTION();
1014 } else {
1015 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1016 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001017 if (LIKELY(array->CheckIsValidIndex(index))) {
1018 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001019 ADVANCE(2);
1020 } else {
1021 HANDLE_PENDING_EXCEPTION();
1022 }
1023 }
1024 }
1025 HANDLE_INSTRUCTION_END();
1026
1027 HANDLE_INSTRUCTION_START(AGET_WIDE) {
1028 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1029 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001030 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001031 HANDLE_PENDING_EXCEPTION();
1032 } else {
1033 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1034 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001035 if (LIKELY(array->CheckIsValidIndex(index))) {
1036 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001037 ADVANCE(2);
1038 } else {
1039 HANDLE_PENDING_EXCEPTION();
1040 }
1041 }
1042 }
1043 HANDLE_INSTRUCTION_END();
1044
1045 HANDLE_INSTRUCTION_START(AGET_OBJECT) {
1046 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1047 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001048 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001049 HANDLE_PENDING_EXCEPTION();
1050 } else {
1051 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1052 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001053 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001054 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001055 ADVANCE(2);
1056 } else {
1057 HANDLE_PENDING_EXCEPTION();
1058 }
1059 }
1060 }
1061 HANDLE_INSTRUCTION_END();
1062
1063 HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
1064 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1065 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001066 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001067 HANDLE_PENDING_EXCEPTION();
1068 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001069 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001070 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1071 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001072 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001073 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001074 ADVANCE(2);
1075 } else {
1076 HANDLE_PENDING_EXCEPTION();
1077 }
1078 }
1079 }
1080 HANDLE_INSTRUCTION_END();
1081
1082 HANDLE_INSTRUCTION_START(APUT_BYTE) {
1083 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1084 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001085 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001086 HANDLE_PENDING_EXCEPTION();
1087 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001088 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001089 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1090 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001091 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001092 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001093 ADVANCE(2);
1094 } else {
1095 HANDLE_PENDING_EXCEPTION();
1096 }
1097 }
1098 }
1099 HANDLE_INSTRUCTION_END();
1100
1101 HANDLE_INSTRUCTION_START(APUT_CHAR) {
1102 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1103 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001104 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001105 HANDLE_PENDING_EXCEPTION();
1106 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001107 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001108 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1109 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001110 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001111 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001112 ADVANCE(2);
1113 } else {
1114 HANDLE_PENDING_EXCEPTION();
1115 }
1116 }
1117 }
1118 HANDLE_INSTRUCTION_END();
1119
1120 HANDLE_INSTRUCTION_START(APUT_SHORT) {
1121 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1122 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001123 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001124 HANDLE_PENDING_EXCEPTION();
1125 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001126 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001127 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1128 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001129 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001130 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001131 ADVANCE(2);
1132 } else {
1133 HANDLE_PENDING_EXCEPTION();
1134 }
1135 }
1136 }
1137 HANDLE_INSTRUCTION_END();
1138
1139 HANDLE_INSTRUCTION_START(APUT) {
1140 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1141 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001142 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001143 HANDLE_PENDING_EXCEPTION();
1144 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001145 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001146 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1147 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001148 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001149 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001150 ADVANCE(2);
1151 } else {
1152 HANDLE_PENDING_EXCEPTION();
1153 }
1154 }
1155 }
1156 HANDLE_INSTRUCTION_END();
1157
1158 HANDLE_INSTRUCTION_START(APUT_WIDE) {
1159 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1160 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001161 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001162 HANDLE_PENDING_EXCEPTION();
1163 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001164 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001165 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1166 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001167 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001168 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001169 ADVANCE(2);
1170 } else {
1171 HANDLE_PENDING_EXCEPTION();
1172 }
1173 }
1174 }
1175 HANDLE_INSTRUCTION_END();
1176
1177 HANDLE_INSTRUCTION_START(APUT_OBJECT) {
1178 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1179 if (UNLIKELY(a == NULL)) {
Sebastien Hertzda843e12014-05-28 19:28:31 +02001180 ThrowNullPointerExceptionFromInterpreter(shadow_frame);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001181 HANDLE_PENDING_EXCEPTION();
1182 } else {
1183 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001184 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001185 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001186 if (LIKELY(array->CheckIsValidIndex(index) && array->CheckAssignable(val))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001187 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001188 ADVANCE(2);
1189 } else {
1190 HANDLE_PENDING_EXCEPTION();
1191 }
1192 }
1193 }
1194 HANDLE_INSTRUCTION_END();
1195
1196 HANDLE_INSTRUCTION_START(IGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001197 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001198 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1199 }
1200 HANDLE_INSTRUCTION_END();
1201
1202 HANDLE_INSTRUCTION_START(IGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001203 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001204 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1205 }
1206 HANDLE_INSTRUCTION_END();
1207
1208 HANDLE_INSTRUCTION_START(IGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001209 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001210 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1211 }
1212 HANDLE_INSTRUCTION_END();
1213
1214 HANDLE_INSTRUCTION_START(IGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001215 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001216 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1217 }
1218 HANDLE_INSTRUCTION_END();
1219
1220 HANDLE_INSTRUCTION_START(IGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001221 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, 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_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001227 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, 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_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001233 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, 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_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001239 bool success = DoIGetQuick<Primitive::kPrimInt>(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_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001245 bool success = DoIGetQuick<Primitive::kPrimLong>(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_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001251 bool success = DoIGetQuick<Primitive::kPrimNot>(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(SGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001257 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, 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(SGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001263 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001264 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1265 }
1266 HANDLE_INSTRUCTION_END();
1267
1268 HANDLE_INSTRUCTION_START(SGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001269 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(self, 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(SGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001275 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(self, 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) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001281 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, 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_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001287 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, 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_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001293 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, 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(IPUT_BOOLEAN) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001299 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(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(IPUT_BYTE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001305 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(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(IPUT_CHAR) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001311 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(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(IPUT_SHORT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001317 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(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) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001323 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, 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_WIDE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001329 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, 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_OBJECT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001335 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, 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_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001341 bool success = DoIPutQuick<Primitive::kPrimInt, transaction_active>(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
Fred Shih37f05ef2014-07-16 18:38:08 -07001346 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN_QUICK) {
1347 bool success = DoIPutQuick<Primitive::kPrimBoolean, transaction_active>(shadow_frame, inst, inst_data);
1348 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1349 }
1350 HANDLE_INSTRUCTION_END();
1351
1352 HANDLE_INSTRUCTION_START(IPUT_BYTE_QUICK) {
1353 bool success = DoIPutQuick<Primitive::kPrimByte, transaction_active>(shadow_frame, inst, inst_data);
1354 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1355 }
1356 HANDLE_INSTRUCTION_END();
1357
1358 HANDLE_INSTRUCTION_START(IPUT_CHAR_QUICK) {
1359 bool success = DoIPutQuick<Primitive::kPrimChar, transaction_active>(shadow_frame, inst, inst_data);
1360 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1361 }
1362 HANDLE_INSTRUCTION_END();
1363
1364 HANDLE_INSTRUCTION_START(IPUT_SHORT_QUICK) {
1365 bool success = DoIPutQuick<Primitive::kPrimShort, transaction_active>(shadow_frame, inst, inst_data);
1366 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1367 }
1368 HANDLE_INSTRUCTION_END();
1369
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001370 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
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002305 HANDLE_INSTRUCTION_START(UNUSED_EF)
2306 UnexpectedOpcode(inst, mh);
2307 HANDLE_INSTRUCTION_END();
2308
2309 HANDLE_INSTRUCTION_START(UNUSED_F0)
2310 UnexpectedOpcode(inst, mh);
2311 HANDLE_INSTRUCTION_END();
2312
2313 HANDLE_INSTRUCTION_START(UNUSED_F1)
2314 UnexpectedOpcode(inst, mh);
2315 HANDLE_INSTRUCTION_END();
2316
2317 HANDLE_INSTRUCTION_START(UNUSED_F2)
2318 UnexpectedOpcode(inst, mh);
2319 HANDLE_INSTRUCTION_END();
2320
2321 HANDLE_INSTRUCTION_START(UNUSED_F3)
2322 UnexpectedOpcode(inst, mh);
2323 HANDLE_INSTRUCTION_END();
2324
2325 HANDLE_INSTRUCTION_START(UNUSED_F4)
2326 UnexpectedOpcode(inst, mh);
2327 HANDLE_INSTRUCTION_END();
2328
2329 HANDLE_INSTRUCTION_START(UNUSED_F5)
2330 UnexpectedOpcode(inst, mh);
2331 HANDLE_INSTRUCTION_END();
2332
2333 HANDLE_INSTRUCTION_START(UNUSED_F6)
2334 UnexpectedOpcode(inst, mh);
2335 HANDLE_INSTRUCTION_END();
2336
2337 HANDLE_INSTRUCTION_START(UNUSED_F7)
2338 UnexpectedOpcode(inst, mh);
2339 HANDLE_INSTRUCTION_END();
2340
2341 HANDLE_INSTRUCTION_START(UNUSED_F8)
2342 UnexpectedOpcode(inst, mh);
2343 HANDLE_INSTRUCTION_END();
2344
2345 HANDLE_INSTRUCTION_START(UNUSED_F9)
2346 UnexpectedOpcode(inst, mh);
2347 HANDLE_INSTRUCTION_END();
2348
2349 HANDLE_INSTRUCTION_START(UNUSED_FA)
2350 UnexpectedOpcode(inst, mh);
2351 HANDLE_INSTRUCTION_END();
2352
2353 HANDLE_INSTRUCTION_START(UNUSED_FB)
2354 UnexpectedOpcode(inst, mh);
2355 HANDLE_INSTRUCTION_END();
2356
2357 HANDLE_INSTRUCTION_START(UNUSED_FC)
2358 UnexpectedOpcode(inst, mh);
2359 HANDLE_INSTRUCTION_END();
2360
2361 HANDLE_INSTRUCTION_START(UNUSED_FD)
2362 UnexpectedOpcode(inst, mh);
2363 HANDLE_INSTRUCTION_END();
2364
2365 HANDLE_INSTRUCTION_START(UNUSED_FE)
2366 UnexpectedOpcode(inst, mh);
2367 HANDLE_INSTRUCTION_END();
2368
2369 HANDLE_INSTRUCTION_START(UNUSED_FF)
2370 UnexpectedOpcode(inst, mh);
2371 HANDLE_INSTRUCTION_END();
2372
2373 exception_pending_label: {
2374 CHECK(self->IsExceptionPending());
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002375 if (UNLIKELY(self->TestAllFlags())) {
Ian Rogers7b078e82014-09-10 14:44:24 -07002376 self->CheckSuspend();
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002377 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002378 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002379 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002380 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc,
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002381 instrumentation);
2382 if (found_dex_pc == DexFile::kDexNoIndex) {
2383 return JValue(); /* Handled in caller. */
2384 } else {
2385 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc);
2386 ADVANCE(displacement);
2387 }
2388 }
2389
Sebastien Hertz8379b222014-02-24 17:38:15 +01002390// Create alternative instruction handlers dedicated to instrumentation.
2391// Return instructions must not call Instrumentation::DexPcMovedEvent since they already call
2392// Instrumentation::MethodExited. This is to avoid posting debugger events twice for this location.
Sebastien Hertze713d932014-05-15 10:48:53 +02002393// Note: we do not use the kReturn instruction flag here (to test the instruction is a return). The
2394// compiler seems to not evaluate "(Instruction::FlagsOf(Instruction::code) & kReturn) != 0" to
2395// a constant condition that would remove the "if" statement so the test is free.
Sebastien Hertz8379b222014-02-24 17:38:15 +01002396#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
2397 alt_op_##code: { \
2398 if (Instruction::code != Instruction::RETURN_VOID && \
2399 Instruction::code != Instruction::RETURN_VOID_BARRIER && \
2400 Instruction::code != Instruction::RETURN && \
2401 Instruction::code != Instruction::RETURN_WIDE && \
2402 Instruction::code != Instruction::RETURN_OBJECT) { \
2403 if (LIKELY(!notified_method_entry_event)) { \
2404 Runtime* runtime = Runtime::Current(); \
2405 const instrumentation::Instrumentation* instrumentation = runtime->GetInstrumentation(); \
2406 if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
2407 Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_); \
2408 instrumentation->DexPcMovedEvent(self, this_object, shadow_frame.GetMethod(), dex_pc); \
2409 } \
2410 } else { \
2411 notified_method_entry_event = false; \
2412 } \
2413 } \
2414 UPDATE_HANDLER_TABLE(); \
2415 goto *handlersTable[instrumentation::kMainHandlerTable][Instruction::code]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002416 }
2417#include "dex_instruction_list.h"
2418 DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER)
2419#undef DEX_INSTRUCTION_LIST
2420#undef INSTRUMENTATION_INSTRUCTION_HANDLER
2421} // NOLINT(readability/fn_size)
2422
2423// Explicit definitions of ExecuteGotoImpl.
Sebastien Hertzc6714852013-09-30 16:42:32 +02002424template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002425JValue ExecuteGotoImpl<true, false>(Thread* self, MethodHelper& mh,
2426 const DexFile::CodeItem* code_item,
2427 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertzc6714852013-09-30 16:42:32 +02002428template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002429JValue ExecuteGotoImpl<false, false>(Thread* self, MethodHelper& mh,
2430 const DexFile::CodeItem* code_item,
2431 ShadowFrame& shadow_frame, JValue result_register);
2432template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
2433JValue ExecuteGotoImpl<true, true>(Thread* self, MethodHelper& mh,
2434 const DexFile::CodeItem* code_item,
2435 ShadowFrame& shadow_frame, JValue result_register);
2436template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
2437JValue ExecuteGotoImpl<false, true>(Thread* self, MethodHelper& mh,
2438 const DexFile::CodeItem* code_item,
2439 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002440
2441} // namespace interpreter
2442} // namespace art