blob: 74f386c92221a5f505a72d4fac59d36432a42bff [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) {
237 Throwable* exception = self->GetException(NULL);
238 self->ClearException();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200239 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception);
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.
Ian Rogersb122a4b2013-11-19 18:00:50 -0800250 QuasiAtomic::MembarStoreLoad();
Sebastien Hertz043036f2013-09-09 18:26:48 +0200251 }
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200252 if (UNLIKELY(self->TestAllFlags())) {
253 CheckSuspend(self);
254 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200255 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200256 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200257 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200258 shadow_frame.GetMethod(), dex_pc,
259 result);
260 }
261 return result;
262 }
263 HANDLE_INSTRUCTION_END();
264
265 HANDLE_INSTRUCTION_START(RETURN_VOID_BARRIER) {
Ian Rogersb122a4b2013-11-19 18:00:50 -0800266 QuasiAtomic::MembarStoreLoad();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200267 JValue result;
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200268 if (UNLIKELY(self->TestAllFlags())) {
269 CheckSuspend(self);
270 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200271 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200272 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200273 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200274 shadow_frame.GetMethod(), dex_pc,
275 result);
276 }
277 return result;
278 }
279 HANDLE_INSTRUCTION_END();
280
281 HANDLE_INSTRUCTION_START(RETURN) {
282 JValue result;
283 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200284 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200285 if (UNLIKELY(self->TestAllFlags())) {
286 CheckSuspend(self);
287 }
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);
293 }
294 return result;
295 }
296 HANDLE_INSTRUCTION_END();
297
298 HANDLE_INSTRUCTION_START(RETURN_WIDE) {
299 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200300 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200301 if (UNLIKELY(self->TestAllFlags())) {
302 CheckSuspend(self);
303 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200304 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200305 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200306 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200307 shadow_frame.GetMethod(), dex_pc,
308 result);
309 }
310 return result;
311 }
312 HANDLE_INSTRUCTION_END();
313
314 HANDLE_INSTRUCTION_START(RETURN_OBJECT) {
315 JValue result;
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200316 if (UNLIKELY(self->TestAllFlags())) {
317 CheckSuspend(self);
318 }
Mathieu Chartiere861ebd2013-10-09 15:01:21 -0700319 Object* obj_result = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
320 result.SetJ(0);
321 result.SetL(obj_result);
Jeff Haoa3faaf42013-09-03 19:07:00 -0700322 if (do_assignability_check && obj_result != NULL) {
323 Class* return_type = MethodHelper(shadow_frame.GetMethod()).GetReturnType();
324 if (return_type == NULL) {
325 // Return the pending exception.
326 HANDLE_PENDING_EXCEPTION();
327 }
328 if (!obj_result->VerifierInstanceOf(return_type)) {
329 // This should never happen.
330 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
331 "Ljava/lang/VirtualMachineError;",
332 "Returning '%s' that is not instance of return type '%s'",
333 ClassHelper(obj_result->GetClass()).GetDescriptor(),
334 ClassHelper(return_type).GetDescriptor());
335 HANDLE_PENDING_EXCEPTION();
336 }
337 }
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200338 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200339 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200340 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200341 shadow_frame.GetMethod(), dex_pc,
342 result);
343 }
344 return result;
345 }
346 HANDLE_INSTRUCTION_END();
347
348 HANDLE_INSTRUCTION_START(CONST_4) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200349 uint32_t dst = inst->VRegA_11n(inst_data);
350 int32_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200351 shadow_frame.SetVReg(dst, val);
352 if (val == 0) {
353 shadow_frame.SetVRegReference(dst, NULL);
354 }
355 ADVANCE(1);
356 }
357 HANDLE_INSTRUCTION_END();
358
359 HANDLE_INSTRUCTION_START(CONST_16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200360 uint32_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200361 int32_t val = inst->VRegB_21s();
362 shadow_frame.SetVReg(dst, val);
363 if (val == 0) {
364 shadow_frame.SetVRegReference(dst, NULL);
365 }
366 ADVANCE(2);
367 }
368 HANDLE_INSTRUCTION_END();
369
370 HANDLE_INSTRUCTION_START(CONST) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200371 uint32_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200372 int32_t val = inst->VRegB_31i();
373 shadow_frame.SetVReg(dst, val);
374 if (val == 0) {
375 shadow_frame.SetVRegReference(dst, NULL);
376 }
377 ADVANCE(3);
378 }
379 HANDLE_INSTRUCTION_END();
380
381 HANDLE_INSTRUCTION_START(CONST_HIGH16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200382 uint32_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200383 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
384 shadow_frame.SetVReg(dst, val);
385 if (val == 0) {
386 shadow_frame.SetVRegReference(dst, NULL);
387 }
388 ADVANCE(2);
389 }
390 HANDLE_INSTRUCTION_END();
391
392 HANDLE_INSTRUCTION_START(CONST_WIDE_16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200393 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200394 ADVANCE(2);
395 HANDLE_INSTRUCTION_END();
396
397 HANDLE_INSTRUCTION_START(CONST_WIDE_32)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200398 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200399 ADVANCE(3);
400 HANDLE_INSTRUCTION_END();
401
402 HANDLE_INSTRUCTION_START(CONST_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200403 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200404 ADVANCE(5);
405 HANDLE_INSTRUCTION_END();
406
407 HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200408 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200409 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
410 ADVANCE(2);
411 HANDLE_INSTRUCTION_END();
412
413 HANDLE_INSTRUCTION_START(CONST_STRING) {
414 String* s = ResolveString(self, mh, inst->VRegB_21c());
415 if (UNLIKELY(s == NULL)) {
416 HANDLE_PENDING_EXCEPTION();
417 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200418 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200419 ADVANCE(2);
420 }
421 }
422 HANDLE_INSTRUCTION_END();
423
424 HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
425 String* s = ResolveString(self, mh, inst->VRegB_31c());
426 if (UNLIKELY(s == NULL)) {
427 HANDLE_PENDING_EXCEPTION();
428 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200429 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200430 ADVANCE(3);
431 }
432 }
433 HANDLE_INSTRUCTION_END();
434
435 HANDLE_INSTRUCTION_START(CONST_CLASS) {
436 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
437 self, false, do_access_check);
438 if (UNLIKELY(c == NULL)) {
439 HANDLE_PENDING_EXCEPTION();
440 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200441 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200442 ADVANCE(2);
443 }
444 }
445 HANDLE_INSTRUCTION_END();
446
447 HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200448 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200449 if (UNLIKELY(obj == NULL)) {
450 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
451 HANDLE_PENDING_EXCEPTION();
452 } else {
453 DoMonitorEnter(self, obj);
454 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
455 }
456 }
457 HANDLE_INSTRUCTION_END();
458
459 HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200460 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200461 if (UNLIKELY(obj == NULL)) {
462 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
463 HANDLE_PENDING_EXCEPTION();
464 } else {
465 DoMonitorExit(self, obj);
466 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
467 }
468 }
469 HANDLE_INSTRUCTION_END();
470
471 HANDLE_INSTRUCTION_START(CHECK_CAST) {
472 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
473 self, false, do_access_check);
474 if (UNLIKELY(c == NULL)) {
475 HANDLE_PENDING_EXCEPTION();
476 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200477 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200478 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
479 ThrowClassCastException(c, obj->GetClass());
480 HANDLE_PENDING_EXCEPTION();
481 } else {
482 ADVANCE(2);
483 }
484 }
485 }
486 HANDLE_INSTRUCTION_END();
487
488 HANDLE_INSTRUCTION_START(INSTANCE_OF) {
489 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
490 self, false, do_access_check);
491 if (UNLIKELY(c == NULL)) {
492 HANDLE_PENDING_EXCEPTION();
493 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200494 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
495 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200496 ADVANCE(2);
497 }
498 }
499 HANDLE_INSTRUCTION_END();
500
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700501 HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200502 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200503 if (UNLIKELY(array == NULL)) {
504 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
505 HANDLE_PENDING_EXCEPTION();
506 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200507 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200508 ADVANCE(1);
509 }
510 }
511 HANDLE_INSTRUCTION_END();
512
513 HANDLE_INSTRUCTION_START(NEW_INSTANCE) {
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700514 Runtime* runtime = Runtime::Current();
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800515 Object* obj = AllocObjectFromCode<do_access_check, true>(
516 inst->VRegB_21c(), shadow_frame.GetMethod(), self,
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700517 runtime->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200518 if (UNLIKELY(obj == NULL)) {
519 HANDLE_PENDING_EXCEPTION();
520 } else {
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700521 // Don't allow finalizable objects to be allocated during a transaction since these can't be
522 // finalized without a started runtime.
523 if (transaction_active && obj->GetClass()->IsFinalizable()) {
Ian Rogers2fa98e22014-05-06 15:26:39 -0700524 AbortTransaction(self, "Allocating finalizable object in transaction: %s",
Mathieu Chartierb2c7ead2014-04-29 11:13:16 -0700525 PrettyTypeOf(obj).c_str());
526 HANDLE_PENDING_EXCEPTION();
527 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200528 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200529 ADVANCE(2);
530 }
531 }
532 HANDLE_INSTRUCTION_END();
533
534 HANDLE_INSTRUCTION_START(NEW_ARRAY) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200535 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800536 Object* obj = AllocArrayFromCode<do_access_check, true>(
537 inst->VRegC_22c(), shadow_frame.GetMethod(), length, self,
538 Runtime::Current()->GetHeap()->GetCurrentAllocator());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200539 if (UNLIKELY(obj == NULL)) {
540 HANDLE_PENDING_EXCEPTION();
541 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200542 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200543 ADVANCE(2);
544 }
545 }
546 HANDLE_INSTRUCTION_END();
547
548 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100549 bool success =
550 DoFilledNewArray<false, do_access_check, transaction_active>(inst, shadow_frame,
551 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200552 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
553 }
554 HANDLE_INSTRUCTION_END();
555
556 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100557 bool success =
558 DoFilledNewArray<true, do_access_check, transaction_active>(inst, shadow_frame,
559 self, &result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200560 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
561 }
562 HANDLE_INSTRUCTION_END();
563
564 HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200565 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200566 if (UNLIKELY(obj == NULL)) {
567 ThrowNullPointerException(NULL, "null array in FILL_ARRAY_DATA");
568 HANDLE_PENDING_EXCEPTION();
569 } else {
570 Array* array = obj->AsArray();
571 DCHECK(array->IsArrayInstance() && !array->IsObjectArray());
572 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
573 const Instruction::ArrayDataPayload* payload =
574 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
575 if (UNLIKELY(static_cast<int32_t>(payload->element_count) > array->GetLength())) {
576 self->ThrowNewExceptionF(shadow_frame.GetCurrentLocationForThrow(),
577 "Ljava/lang/ArrayIndexOutOfBoundsException;",
578 "failed FILL_ARRAY_DATA; length=%d, index=%d",
579 array->GetLength(), payload->element_count);
580 HANDLE_PENDING_EXCEPTION();
581 } else {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100582 if (transaction_active) {
583 RecordArrayElementsInTransaction(array, payload->element_count);
584 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200585 uint32_t size_in_bytes = payload->element_count * payload->element_width;
Ian Rogersef7d42f2014-01-06 12:55:46 -0800586 memcpy(array->GetRawData(payload->element_width, 0), payload->data, size_in_bytes);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200587 ADVANCE(3);
588 }
589 }
590 }
591 HANDLE_INSTRUCTION_END();
592
593 HANDLE_INSTRUCTION_START(THROW) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200594 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200595 if (UNLIKELY(exception == NULL)) {
596 ThrowNullPointerException(NULL, "throw with null exception");
Jeff Haoa3faaf42013-09-03 19:07:00 -0700597 } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
598 // This should never happen.
599 self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
600 "Ljava/lang/VirtualMachineError;",
601 "Throwing '%s' that is not instance of Throwable",
602 ClassHelper(exception->GetClass()).GetDescriptor());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200603 } else {
604 self->SetException(shadow_frame.GetCurrentLocationForThrow(), exception->AsThrowable());
605 }
606 HANDLE_PENDING_EXCEPTION();
607 }
608 HANDLE_INSTRUCTION_END();
609
610 HANDLE_INSTRUCTION_START(GOTO) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200611 int8_t offset = inst->VRegA_10t(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200612 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200613 if (UNLIKELY(self->TestAllFlags())) {
614 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200615 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200616 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200617 }
618 ADVANCE(offset);
619 }
620 HANDLE_INSTRUCTION_END();
621
622 HANDLE_INSTRUCTION_START(GOTO_16) {
623 int16_t offset = inst->VRegA_20t();
624 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200625 if (UNLIKELY(self->TestAllFlags())) {
626 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200627 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200628 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200629 }
630 ADVANCE(offset);
631 }
632 HANDLE_INSTRUCTION_END();
633
634 HANDLE_INSTRUCTION_START(GOTO_32) {
635 int32_t offset = inst->VRegA_30t();
636 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200637 if (UNLIKELY(self->TestAllFlags())) {
638 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200639 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200640 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200641 }
642 ADVANCE(offset);
643 }
644 HANDLE_INSTRUCTION_END();
645
646 HANDLE_INSTRUCTION_START(PACKED_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200647 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200648 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200649 if (UNLIKELY(self->TestAllFlags())) {
650 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200651 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200652 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200653 }
654 ADVANCE(offset);
655 }
656 HANDLE_INSTRUCTION_END();
657
658 HANDLE_INSTRUCTION_START(SPARSE_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200659 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200660 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200661 if (UNLIKELY(self->TestAllFlags())) {
662 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200663 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200664 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200665 }
666 ADVANCE(offset);
667 }
668 HANDLE_INSTRUCTION_END();
669
670 HANDLE_INSTRUCTION_START(CMPL_FLOAT) {
671 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
672 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
673 int32_t result;
674 if (val1 > val2) {
675 result = 1;
676 } else if (val1 == val2) {
677 result = 0;
678 } else {
679 result = -1;
680 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200681 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200682 ADVANCE(2);
683 }
684 HANDLE_INSTRUCTION_END();
685
686 HANDLE_INSTRUCTION_START(CMPG_FLOAT) {
687 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
688 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
689 int32_t result;
690 if (val1 < val2) {
691 result = -1;
692 } else if (val1 == val2) {
693 result = 0;
694 } else {
695 result = 1;
696 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200697 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200698 ADVANCE(2);
699 }
700 HANDLE_INSTRUCTION_END();
701
702 HANDLE_INSTRUCTION_START(CMPL_DOUBLE) {
703 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
704 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
705 int32_t result;
706 if (val1 > val2) {
707 result = 1;
708 } else if (val1 == val2) {
709 result = 0;
710 } else {
711 result = -1;
712 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200713 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200714 ADVANCE(2);
715 }
716 HANDLE_INSTRUCTION_END();
717
718 HANDLE_INSTRUCTION_START(CMPG_DOUBLE) {
719 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
720 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
721 int32_t result;
722 if (val1 < val2) {
723 result = -1;
724 } else if (val1 == val2) {
725 result = 0;
726 } else {
727 result = 1;
728 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200729 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200730 ADVANCE(2);
731 }
732 HANDLE_INSTRUCTION_END();
733
734 HANDLE_INSTRUCTION_START(CMP_LONG) {
735 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
736 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
737 int32_t result;
738 if (val1 > val2) {
739 result = 1;
740 } else if (val1 == val2) {
741 result = 0;
742 } else {
743 result = -1;
744 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200745 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200746 ADVANCE(2);
747 }
748 HANDLE_INSTRUCTION_END();
749
750 HANDLE_INSTRUCTION_START(IF_EQ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200751 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200752 int16_t offset = inst->VRegC_22t();
753 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200754 if (UNLIKELY(self->TestAllFlags())) {
755 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200756 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200757 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200758 }
759 ADVANCE(offset);
760 } else {
761 ADVANCE(2);
762 }
763 }
764 HANDLE_INSTRUCTION_END();
765
766 HANDLE_INSTRUCTION_START(IF_NE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200767 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) != shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200768 int16_t offset = inst->VRegC_22t();
769 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200770 if (UNLIKELY(self->TestAllFlags())) {
771 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200772 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200773 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200774 }
775 ADVANCE(offset);
776 } else {
777 ADVANCE(2);
778 }
779 }
780 HANDLE_INSTRUCTION_END();
781
782 HANDLE_INSTRUCTION_START(IF_LT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200783 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) < shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200784 int16_t offset = inst->VRegC_22t();
785 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200786 if (UNLIKELY(self->TestAllFlags())) {
787 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200788 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200789 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200790 }
791 ADVANCE(offset);
792 } else {
793 ADVANCE(2);
794 }
795 }
796 HANDLE_INSTRUCTION_END();
797
798 HANDLE_INSTRUCTION_START(IF_GE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200799 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200800 int16_t offset = inst->VRegC_22t();
801 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200802 if (UNLIKELY(self->TestAllFlags())) {
803 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200804 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200805 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200806 }
807 ADVANCE(offset);
808 } else {
809 ADVANCE(2);
810 }
811 }
812 HANDLE_INSTRUCTION_END();
813
814 HANDLE_INSTRUCTION_START(IF_GT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200815 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200816 int16_t offset = inst->VRegC_22t();
817 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200818 if (UNLIKELY(self->TestAllFlags())) {
819 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200820 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200821 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200822 }
823 ADVANCE(offset);
824 } else {
825 ADVANCE(2);
826 }
827 }
828 HANDLE_INSTRUCTION_END();
829
830 HANDLE_INSTRUCTION_START(IF_LE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200831 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200832 int16_t offset = inst->VRegC_22t();
833 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200834 if (UNLIKELY(self->TestAllFlags())) {
835 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200836 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200837 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200838 }
839 ADVANCE(offset);
840 } else {
841 ADVANCE(2);
842 }
843 }
844 HANDLE_INSTRUCTION_END();
845
846 HANDLE_INSTRUCTION_START(IF_EQZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200847 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200848 int16_t offset = inst->VRegB_21t();
849 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200850 if (UNLIKELY(self->TestAllFlags())) {
851 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200852 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200853 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200854 }
855 ADVANCE(offset);
856 } else {
857 ADVANCE(2);
858 }
859 }
860 HANDLE_INSTRUCTION_END();
861
862 HANDLE_INSTRUCTION_START(IF_NEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200863 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200864 int16_t offset = inst->VRegB_21t();
865 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200866 if (UNLIKELY(self->TestAllFlags())) {
867 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200868 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200869 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200870 }
871 ADVANCE(offset);
872 } else {
873 ADVANCE(2);
874 }
875 }
876 HANDLE_INSTRUCTION_END();
877
878 HANDLE_INSTRUCTION_START(IF_LTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200879 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200880 int16_t offset = inst->VRegB_21t();
881 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200882 if (UNLIKELY(self->TestAllFlags())) {
883 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200884 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200885 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200886 }
887 ADVANCE(offset);
888 } else {
889 ADVANCE(2);
890 }
891 }
892 HANDLE_INSTRUCTION_END();
893
894 HANDLE_INSTRUCTION_START(IF_GEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200895 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200896 int16_t offset = inst->VRegB_21t();
897 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200898 if (UNLIKELY(self->TestAllFlags())) {
899 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200900 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200901 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200902 }
903 ADVANCE(offset);
904 } else {
905 ADVANCE(2);
906 }
907 }
908 HANDLE_INSTRUCTION_END();
909
910 HANDLE_INSTRUCTION_START(IF_GTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200911 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200912 int16_t offset = inst->VRegB_21t();
913 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200914 if (UNLIKELY(self->TestAllFlags())) {
915 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200916 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200917 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200918 }
919 ADVANCE(offset);
920 } else {
921 ADVANCE(2);
922 }
923 }
924 HANDLE_INSTRUCTION_END();
925
926 HANDLE_INSTRUCTION_START(IF_LEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200927 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200928 int16_t offset = inst->VRegB_21t();
929 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200930 if (UNLIKELY(self->TestAllFlags())) {
931 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +0200932 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200933 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200934 }
935 ADVANCE(offset);
936 } else {
937 ADVANCE(2);
938 }
939 }
940 HANDLE_INSTRUCTION_END();
941
942 HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
943 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
944 if (UNLIKELY(a == NULL)) {
945 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
946 HANDLE_PENDING_EXCEPTION();
947 } else {
948 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
949 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100950 if (LIKELY(array->CheckIsValidIndex(index))) {
951 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200952 ADVANCE(2);
953 } else {
954 HANDLE_PENDING_EXCEPTION();
955 }
956 }
957 }
958 HANDLE_INSTRUCTION_END();
959
960 HANDLE_INSTRUCTION_START(AGET_BYTE) {
961 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
962 if (UNLIKELY(a == NULL)) {
963 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
964 HANDLE_PENDING_EXCEPTION();
965 } else {
966 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
967 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100968 if (LIKELY(array->CheckIsValidIndex(index))) {
969 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200970 ADVANCE(2);
971 } else {
972 HANDLE_PENDING_EXCEPTION();
973 }
974 }
975 }
976 HANDLE_INSTRUCTION_END();
977
978 HANDLE_INSTRUCTION_START(AGET_CHAR) {
979 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
980 if (UNLIKELY(a == NULL)) {
981 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
982 HANDLE_PENDING_EXCEPTION();
983 } else {
984 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
985 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +0100986 if (LIKELY(array->CheckIsValidIndex(index))) {
987 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200988 ADVANCE(2);
989 } else {
990 HANDLE_PENDING_EXCEPTION();
991 }
992 }
993 }
994 HANDLE_INSTRUCTION_END();
995
996 HANDLE_INSTRUCTION_START(AGET_SHORT) {
997 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
998 if (UNLIKELY(a == NULL)) {
999 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1000 HANDLE_PENDING_EXCEPTION();
1001 } else {
1002 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1003 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001004 if (LIKELY(array->CheckIsValidIndex(index))) {
1005 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001006 ADVANCE(2);
1007 } else {
1008 HANDLE_PENDING_EXCEPTION();
1009 }
1010 }
1011 }
1012 HANDLE_INSTRUCTION_END();
1013
1014 HANDLE_INSTRUCTION_START(AGET) {
1015 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1016 if (UNLIKELY(a == NULL)) {
1017 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1018 HANDLE_PENDING_EXCEPTION();
1019 } else {
1020 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1021 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001022 if (LIKELY(array->CheckIsValidIndex(index))) {
1023 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001024 ADVANCE(2);
1025 } else {
1026 HANDLE_PENDING_EXCEPTION();
1027 }
1028 }
1029 }
1030 HANDLE_INSTRUCTION_END();
1031
1032 HANDLE_INSTRUCTION_START(AGET_WIDE) {
1033 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1034 if (UNLIKELY(a == NULL)) {
1035 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1036 HANDLE_PENDING_EXCEPTION();
1037 } else {
1038 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1039 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001040 if (LIKELY(array->CheckIsValidIndex(index))) {
1041 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001042 ADVANCE(2);
1043 } else {
1044 HANDLE_PENDING_EXCEPTION();
1045 }
1046 }
1047 }
1048 HANDLE_INSTRUCTION_END();
1049
1050 HANDLE_INSTRUCTION_START(AGET_OBJECT) {
1051 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1052 if (UNLIKELY(a == NULL)) {
1053 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1054 HANDLE_PENDING_EXCEPTION();
1055 } else {
1056 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1057 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001058 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001059 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001060 ADVANCE(2);
1061 } else {
1062 HANDLE_PENDING_EXCEPTION();
1063 }
1064 }
1065 }
1066 HANDLE_INSTRUCTION_END();
1067
1068 HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
1069 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1070 if (UNLIKELY(a == NULL)) {
1071 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1072 HANDLE_PENDING_EXCEPTION();
1073 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001074 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001075 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1076 BooleanArray* array = a->AsBooleanArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001077 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001078 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001079 ADVANCE(2);
1080 } else {
1081 HANDLE_PENDING_EXCEPTION();
1082 }
1083 }
1084 }
1085 HANDLE_INSTRUCTION_END();
1086
1087 HANDLE_INSTRUCTION_START(APUT_BYTE) {
1088 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1089 if (UNLIKELY(a == NULL)) {
1090 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1091 HANDLE_PENDING_EXCEPTION();
1092 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001093 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001094 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1095 ByteArray* array = a->AsByteArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001096 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001097 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001098 ADVANCE(2);
1099 } else {
1100 HANDLE_PENDING_EXCEPTION();
1101 }
1102 }
1103 }
1104 HANDLE_INSTRUCTION_END();
1105
1106 HANDLE_INSTRUCTION_START(APUT_CHAR) {
1107 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1108 if (UNLIKELY(a == NULL)) {
1109 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1110 HANDLE_PENDING_EXCEPTION();
1111 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001112 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001113 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1114 CharArray* array = a->AsCharArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001115 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001116 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001117 ADVANCE(2);
1118 } else {
1119 HANDLE_PENDING_EXCEPTION();
1120 }
1121 }
1122 }
1123 HANDLE_INSTRUCTION_END();
1124
1125 HANDLE_INSTRUCTION_START(APUT_SHORT) {
1126 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1127 if (UNLIKELY(a == NULL)) {
1128 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1129 HANDLE_PENDING_EXCEPTION();
1130 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001131 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001132 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1133 ShortArray* array = a->AsShortArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001134 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001135 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001136 ADVANCE(2);
1137 } else {
1138 HANDLE_PENDING_EXCEPTION();
1139 }
1140 }
1141 }
1142 HANDLE_INSTRUCTION_END();
1143
1144 HANDLE_INSTRUCTION_START(APUT) {
1145 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1146 if (UNLIKELY(a == NULL)) {
1147 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1148 HANDLE_PENDING_EXCEPTION();
1149 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001150 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001151 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1152 IntArray* array = a->AsIntArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001153 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001154 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001155 ADVANCE(2);
1156 } else {
1157 HANDLE_PENDING_EXCEPTION();
1158 }
1159 }
1160 }
1161 HANDLE_INSTRUCTION_END();
1162
1163 HANDLE_INSTRUCTION_START(APUT_WIDE) {
1164 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1165 if (UNLIKELY(a == NULL)) {
1166 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1167 HANDLE_PENDING_EXCEPTION();
1168 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001169 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001170 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1171 LongArray* array = a->AsLongArray();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001172 if (LIKELY(array->CheckIsValidIndex(index))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001173 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001174 ADVANCE(2);
1175 } else {
1176 HANDLE_PENDING_EXCEPTION();
1177 }
1178 }
1179 }
1180 HANDLE_INSTRUCTION_END();
1181
1182 HANDLE_INSTRUCTION_START(APUT_OBJECT) {
1183 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1184 if (UNLIKELY(a == NULL)) {
1185 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1186 HANDLE_PENDING_EXCEPTION();
1187 } else {
1188 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001189 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001190 ObjectArray<Object>* array = a->AsObjectArray<Object>();
Sebastien Hertzabff6432014-01-27 18:01:39 +01001191 if (LIKELY(array->CheckIsValidIndex(index) && array->CheckAssignable(val))) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001192 array->SetWithoutChecks<transaction_active>(index, val);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001193 ADVANCE(2);
1194 } else {
1195 HANDLE_PENDING_EXCEPTION();
1196 }
1197 }
1198 }
1199 HANDLE_INSTRUCTION_END();
1200
1201 HANDLE_INSTRUCTION_START(IGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001202 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001203 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1204 }
1205 HANDLE_INSTRUCTION_END();
1206
1207 HANDLE_INSTRUCTION_START(IGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001208 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001209 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1210 }
1211 HANDLE_INSTRUCTION_END();
1212
1213 HANDLE_INSTRUCTION_START(IGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001214 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001215 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1216 }
1217 HANDLE_INSTRUCTION_END();
1218
1219 HANDLE_INSTRUCTION_START(IGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001220 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001221 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1222 }
1223 HANDLE_INSTRUCTION_END();
1224
1225 HANDLE_INSTRUCTION_START(IGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001226 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001227 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1228 }
1229 HANDLE_INSTRUCTION_END();
1230
1231 HANDLE_INSTRUCTION_START(IGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001232 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001233 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1234 }
1235 HANDLE_INSTRUCTION_END();
1236
1237 HANDLE_INSTRUCTION_START(IGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001238 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001239 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1240 }
1241 HANDLE_INSTRUCTION_END();
1242
1243 HANDLE_INSTRUCTION_START(IGET_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001244 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001245 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1246 }
1247 HANDLE_INSTRUCTION_END();
1248
1249 HANDLE_INSTRUCTION_START(IGET_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001250 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001251 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1252 }
1253 HANDLE_INSTRUCTION_END();
1254
1255 HANDLE_INSTRUCTION_START(IGET_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001256 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001257 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1258 }
1259 HANDLE_INSTRUCTION_END();
1260
1261 HANDLE_INSTRUCTION_START(SGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001262 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001263 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1264 }
1265 HANDLE_INSTRUCTION_END();
1266
1267 HANDLE_INSTRUCTION_START(SGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001268 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001269 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1270 }
1271 HANDLE_INSTRUCTION_END();
1272
1273 HANDLE_INSTRUCTION_START(SGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001274 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001275 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1276 }
1277 HANDLE_INSTRUCTION_END();
1278
1279 HANDLE_INSTRUCTION_START(SGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001280 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001281 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1282 }
1283 HANDLE_INSTRUCTION_END();
1284
1285 HANDLE_INSTRUCTION_START(SGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001286 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001287 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1288 }
1289 HANDLE_INSTRUCTION_END();
1290
1291 HANDLE_INSTRUCTION_START(SGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001292 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001293 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1294 }
1295 HANDLE_INSTRUCTION_END();
1296
1297 HANDLE_INSTRUCTION_START(SGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001298 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001299 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1300 }
1301 HANDLE_INSTRUCTION_END();
1302
1303 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001304 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001305 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1306 }
1307 HANDLE_INSTRUCTION_END();
1308
1309 HANDLE_INSTRUCTION_START(IPUT_BYTE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001310 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001311 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1312 }
1313 HANDLE_INSTRUCTION_END();
1314
1315 HANDLE_INSTRUCTION_START(IPUT_CHAR) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001316 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001317 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1318 }
1319 HANDLE_INSTRUCTION_END();
1320
1321 HANDLE_INSTRUCTION_START(IPUT_SHORT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001322 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001323 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1324 }
1325 HANDLE_INSTRUCTION_END();
1326
1327 HANDLE_INSTRUCTION_START(IPUT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001328 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001329 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1330 }
1331 HANDLE_INSTRUCTION_END();
1332
1333 HANDLE_INSTRUCTION_START(IPUT_WIDE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001334 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001335 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1336 }
1337 HANDLE_INSTRUCTION_END();
1338
1339 HANDLE_INSTRUCTION_START(IPUT_OBJECT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001340 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001341 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1342 }
1343 HANDLE_INSTRUCTION_END();
1344
1345 HANDLE_INSTRUCTION_START(IPUT_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001346 bool success = DoIPutQuick<Primitive::kPrimInt, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001347 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1348 }
1349 HANDLE_INSTRUCTION_END();
1350
1351 HANDLE_INSTRUCTION_START(IPUT_WIDE_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001352 bool success = DoIPutQuick<Primitive::kPrimLong, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001353 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1354 }
1355 HANDLE_INSTRUCTION_END();
1356
1357 HANDLE_INSTRUCTION_START(IPUT_OBJECT_QUICK) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001358 bool success = DoIPutQuick<Primitive::kPrimNot, transaction_active>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001359 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1360 }
1361 HANDLE_INSTRUCTION_END();
1362
1363 HANDLE_INSTRUCTION_START(SPUT_BOOLEAN) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001364 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001365 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1366 }
1367 HANDLE_INSTRUCTION_END();
1368
1369 HANDLE_INSTRUCTION_START(SPUT_BYTE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001370 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001371 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1372 }
1373 HANDLE_INSTRUCTION_END();
1374
1375 HANDLE_INSTRUCTION_START(SPUT_CHAR) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001376 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001377 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1378 }
1379 HANDLE_INSTRUCTION_END();
1380
1381 HANDLE_INSTRUCTION_START(SPUT_SHORT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001382 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001383 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1384 }
1385 HANDLE_INSTRUCTION_END();
1386
1387 HANDLE_INSTRUCTION_START(SPUT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001388 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001389 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1390 }
1391 HANDLE_INSTRUCTION_END();
1392
1393 HANDLE_INSTRUCTION_START(SPUT_WIDE) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001394 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001395 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1396 }
1397 HANDLE_INSTRUCTION_END();
1398
1399 HANDLE_INSTRUCTION_START(SPUT_OBJECT) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01001400 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check, transaction_active>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001401 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1402 }
1403 HANDLE_INSTRUCTION_END();
1404
1405 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001406 bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001407 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001408 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1409 }
1410 HANDLE_INSTRUCTION_END();
1411
1412 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001413 bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001414 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001415 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1416 }
1417 HANDLE_INSTRUCTION_END();
1418
1419 HANDLE_INSTRUCTION_START(INVOKE_SUPER) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001420 bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001421 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001422 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1423 }
1424 HANDLE_INSTRUCTION_END();
1425
1426 HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001427 bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001428 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001429 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1430 }
1431 HANDLE_INSTRUCTION_END();
1432
1433 HANDLE_INSTRUCTION_START(INVOKE_DIRECT) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001434 bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001435 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001436 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1437 }
1438 HANDLE_INSTRUCTION_END();
1439
1440 HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001441 bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001442 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001443 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1444 }
1445 HANDLE_INSTRUCTION_END();
1446
1447 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001448 bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001449 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001450 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1451 }
1452 HANDLE_INSTRUCTION_END();
1453
1454 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001455 bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001456 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001457 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1458 }
1459 HANDLE_INSTRUCTION_END();
1460
1461 HANDLE_INSTRUCTION_START(INVOKE_STATIC) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001462 bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001463 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001464 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1465 }
1466 HANDLE_INSTRUCTION_END();
1467
1468 HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001469 bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001470 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001471 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1472 }
1473 HANDLE_INSTRUCTION_END();
1474
1475 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001476 bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001477 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001478 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1479 }
1480 HANDLE_INSTRUCTION_END();
1481
1482 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) {
Sebastien Hertzc61124b2013-09-10 11:44:19 +02001483 bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, inst_data, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001484 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001485 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1486 }
1487 HANDLE_INSTRUCTION_END();
1488
1489 HANDLE_INSTRUCTION_START(NEG_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001490 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001491 ADVANCE(1);
1492 HANDLE_INSTRUCTION_END();
1493
1494 HANDLE_INSTRUCTION_START(NOT_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001495 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001496 ADVANCE(1);
1497 HANDLE_INSTRUCTION_END();
1498
1499 HANDLE_INSTRUCTION_START(NEG_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001500 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001501 ADVANCE(1);
1502 HANDLE_INSTRUCTION_END();
1503
1504 HANDLE_INSTRUCTION_START(NOT_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001505 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001506 ADVANCE(1);
1507 HANDLE_INSTRUCTION_END();
1508
1509 HANDLE_INSTRUCTION_START(NEG_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001510 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001511 ADVANCE(1);
1512 HANDLE_INSTRUCTION_END();
1513
1514 HANDLE_INSTRUCTION_START(NEG_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001515 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001516 ADVANCE(1);
1517 HANDLE_INSTRUCTION_END();
1518
1519 HANDLE_INSTRUCTION_START(INT_TO_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001520 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001521 ADVANCE(1);
1522 HANDLE_INSTRUCTION_END();
1523
1524 HANDLE_INSTRUCTION_START(INT_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001525 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001526 ADVANCE(1);
1527 HANDLE_INSTRUCTION_END();
1528
1529 HANDLE_INSTRUCTION_START(INT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001530 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001531 ADVANCE(1);
1532 HANDLE_INSTRUCTION_END();
1533
1534 HANDLE_INSTRUCTION_START(LONG_TO_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001535 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001536 ADVANCE(1);
1537 HANDLE_INSTRUCTION_END();
1538
1539 HANDLE_INSTRUCTION_START(LONG_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001540 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001541 ADVANCE(1);
1542 HANDLE_INSTRUCTION_END();
1543
1544 HANDLE_INSTRUCTION_START(LONG_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001545 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001546 ADVANCE(1);
1547 HANDLE_INSTRUCTION_END();
1548
1549 HANDLE_INSTRUCTION_START(FLOAT_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001550 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001551 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001552 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001553 ADVANCE(1);
1554 }
1555 HANDLE_INSTRUCTION_END();
1556
1557 HANDLE_INSTRUCTION_START(FLOAT_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001558 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001559 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001560 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001561 ADVANCE(1);
1562 }
1563 HANDLE_INSTRUCTION_END();
1564
1565 HANDLE_INSTRUCTION_START(FLOAT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001566 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001567 ADVANCE(1);
1568 HANDLE_INSTRUCTION_END();
1569
1570 HANDLE_INSTRUCTION_START(DOUBLE_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001571 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001572 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001573 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001574 ADVANCE(1);
1575 }
1576 HANDLE_INSTRUCTION_END();
1577
1578 HANDLE_INSTRUCTION_START(DOUBLE_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001579 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001580 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001581 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001582 ADVANCE(1);
1583 }
1584 HANDLE_INSTRUCTION_END();
1585
1586 HANDLE_INSTRUCTION_START(DOUBLE_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001587 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001588 ADVANCE(1);
1589 HANDLE_INSTRUCTION_END();
1590
1591 HANDLE_INSTRUCTION_START(INT_TO_BYTE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001592 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1593 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001594 ADVANCE(1);
1595 HANDLE_INSTRUCTION_END();
1596
1597 HANDLE_INSTRUCTION_START(INT_TO_CHAR)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001598 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1599 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001600 ADVANCE(1);
1601 HANDLE_INSTRUCTION_END();
1602
1603 HANDLE_INSTRUCTION_START(INT_TO_SHORT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001604 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1605 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001606 ADVANCE(1);
1607 HANDLE_INSTRUCTION_END();
1608
1609 HANDLE_INSTRUCTION_START(ADD_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001610 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001611 shadow_frame.GetVReg(inst->VRegB_23x()) +
1612 shadow_frame.GetVReg(inst->VRegC_23x()));
1613 ADVANCE(2);
1614 HANDLE_INSTRUCTION_END();
1615
1616 HANDLE_INSTRUCTION_START(SUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001617 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001618 shadow_frame.GetVReg(inst->VRegB_23x()) -
1619 shadow_frame.GetVReg(inst->VRegC_23x()));
1620 ADVANCE(2);
1621 HANDLE_INSTRUCTION_END();
1622
1623 HANDLE_INSTRUCTION_START(MUL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001624 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001625 shadow_frame.GetVReg(inst->VRegB_23x()) *
1626 shadow_frame.GetVReg(inst->VRegC_23x()));
1627 ADVANCE(2);
1628 HANDLE_INSTRUCTION_END();
1629
1630 HANDLE_INSTRUCTION_START(DIV_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001631 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
1632 shadow_frame.GetVReg(inst->VRegB_23x()),
1633 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001634 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1635 }
1636 HANDLE_INSTRUCTION_END();
1637
1638 HANDLE_INSTRUCTION_START(REM_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001639 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1640 shadow_frame.GetVReg(inst->VRegB_23x()),
1641 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001642 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1643 }
1644 HANDLE_INSTRUCTION_END();
1645
1646 HANDLE_INSTRUCTION_START(SHL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001647 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001648 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1649 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1650 ADVANCE(2);
1651 HANDLE_INSTRUCTION_END();
1652
1653 HANDLE_INSTRUCTION_START(SHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001654 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001655 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1656 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1657 ADVANCE(2);
1658 HANDLE_INSTRUCTION_END();
1659
1660 HANDLE_INSTRUCTION_START(USHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001661 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001662 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1663 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1664 ADVANCE(2);
1665 HANDLE_INSTRUCTION_END();
1666
1667 HANDLE_INSTRUCTION_START(AND_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001668 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001669 shadow_frame.GetVReg(inst->VRegB_23x()) &
1670 shadow_frame.GetVReg(inst->VRegC_23x()));
1671 ADVANCE(2);
1672 HANDLE_INSTRUCTION_END();
1673
1674 HANDLE_INSTRUCTION_START(OR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001675 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001676 shadow_frame.GetVReg(inst->VRegB_23x()) |
1677 shadow_frame.GetVReg(inst->VRegC_23x()));
1678 ADVANCE(2);
1679 HANDLE_INSTRUCTION_END();
1680
1681 HANDLE_INSTRUCTION_START(XOR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001682 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001683 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1684 shadow_frame.GetVReg(inst->VRegC_23x()));
1685 ADVANCE(2);
1686 HANDLE_INSTRUCTION_END();
1687
1688 HANDLE_INSTRUCTION_START(ADD_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001689 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001690 shadow_frame.GetVRegLong(inst->VRegB_23x()) +
1691 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1692 ADVANCE(2);
1693 HANDLE_INSTRUCTION_END();
1694
1695 HANDLE_INSTRUCTION_START(SUB_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001696 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001697 shadow_frame.GetVRegLong(inst->VRegB_23x()) -
1698 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1699 ADVANCE(2);
1700 HANDLE_INSTRUCTION_END();
1701
1702 HANDLE_INSTRUCTION_START(MUL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001703 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001704 shadow_frame.GetVRegLong(inst->VRegB_23x()) *
1705 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1706 ADVANCE(2);
1707 HANDLE_INSTRUCTION_END();
1708
1709 HANDLE_INSTRUCTION_START(DIV_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001710 bool success = DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
1711 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1712 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001713 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1714 }
1715 HANDLE_INSTRUCTION_END();
1716
1717 HANDLE_INSTRUCTION_START(REM_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001718 bool success = DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1719 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1720 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001721 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1722 }
1723 HANDLE_INSTRUCTION_END();
1724
1725 HANDLE_INSTRUCTION_START(AND_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001726 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001727 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1728 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1729 ADVANCE(2);
1730 HANDLE_INSTRUCTION_END();
1731
1732 HANDLE_INSTRUCTION_START(OR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001733 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001734 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1735 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1736 ADVANCE(2);
1737 HANDLE_INSTRUCTION_END();
1738
1739 HANDLE_INSTRUCTION_START(XOR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001740 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001741 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1742 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1743 ADVANCE(2);
1744 HANDLE_INSTRUCTION_END();
1745
1746 HANDLE_INSTRUCTION_START(SHL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001747 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001748 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1749 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1750 ADVANCE(2);
1751 HANDLE_INSTRUCTION_END();
1752
1753 HANDLE_INSTRUCTION_START(SHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001754 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001755 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1756 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1757 ADVANCE(2);
1758 HANDLE_INSTRUCTION_END();
1759
1760 HANDLE_INSTRUCTION_START(USHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001761 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001762 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1763 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1764 ADVANCE(2);
1765 HANDLE_INSTRUCTION_END();
1766
1767 HANDLE_INSTRUCTION_START(ADD_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001768 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001769 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1770 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1771 ADVANCE(2);
1772 HANDLE_INSTRUCTION_END();
1773
1774 HANDLE_INSTRUCTION_START(SUB_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001775 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001776 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1777 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1778 ADVANCE(2);
1779 HANDLE_INSTRUCTION_END();
1780
1781 HANDLE_INSTRUCTION_START(MUL_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001782 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001783 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1784 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1785 ADVANCE(2);
1786 HANDLE_INSTRUCTION_END();
1787
1788 HANDLE_INSTRUCTION_START(DIV_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001789 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001790 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1791 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1792 ADVANCE(2);
1793 HANDLE_INSTRUCTION_END();
1794
1795 HANDLE_INSTRUCTION_START(REM_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001796 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001797 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1798 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1799 ADVANCE(2);
1800 HANDLE_INSTRUCTION_END();
1801
1802 HANDLE_INSTRUCTION_START(ADD_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001803 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001804 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1805 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1806 ADVANCE(2);
1807 HANDLE_INSTRUCTION_END();
1808
1809 HANDLE_INSTRUCTION_START(SUB_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001810 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001811 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1812 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1813 ADVANCE(2);
1814 HANDLE_INSTRUCTION_END();
1815
1816 HANDLE_INSTRUCTION_START(MUL_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001817 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001818 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1819 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1820 ADVANCE(2);
1821 HANDLE_INSTRUCTION_END();
1822
1823 HANDLE_INSTRUCTION_START(DIV_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001824 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001825 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1826 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1827 ADVANCE(2);
1828 HANDLE_INSTRUCTION_END();
1829
1830 HANDLE_INSTRUCTION_START(REM_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001831 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001832 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1833 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1834 ADVANCE(2);
1835 HANDLE_INSTRUCTION_END();
1836
1837 HANDLE_INSTRUCTION_START(ADD_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001838 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001839 shadow_frame.SetVReg(vregA,
1840 shadow_frame.GetVReg(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001841 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001842 ADVANCE(1);
1843 }
1844 HANDLE_INSTRUCTION_END();
1845
1846 HANDLE_INSTRUCTION_START(SUB_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001847 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001848 shadow_frame.SetVReg(vregA,
1849 shadow_frame.GetVReg(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001850 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001851 ADVANCE(1);
1852 }
1853 HANDLE_INSTRUCTION_END();
1854
1855 HANDLE_INSTRUCTION_START(MUL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001856 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001857 shadow_frame.SetVReg(vregA,
1858 shadow_frame.GetVReg(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001859 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001860 ADVANCE(1);
1861 }
1862 HANDLE_INSTRUCTION_END();
1863
1864 HANDLE_INSTRUCTION_START(DIV_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001865 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001866 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001867 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001868 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1869 }
1870 HANDLE_INSTRUCTION_END();
1871
1872 HANDLE_INSTRUCTION_START(REM_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001873 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001874 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001875 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001876 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1877 }
1878 HANDLE_INSTRUCTION_END();
1879
1880 HANDLE_INSTRUCTION_START(SHL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001881 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001882 shadow_frame.SetVReg(vregA,
1883 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001884 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001885 ADVANCE(1);
1886 }
1887 HANDLE_INSTRUCTION_END();
1888
1889 HANDLE_INSTRUCTION_START(SHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001890 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001891 shadow_frame.SetVReg(vregA,
1892 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001893 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001894 ADVANCE(1);
1895 }
1896 HANDLE_INSTRUCTION_END();
1897
1898 HANDLE_INSTRUCTION_START(USHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001899 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001900 shadow_frame.SetVReg(vregA,
1901 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001902 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001903 ADVANCE(1);
1904 }
1905 HANDLE_INSTRUCTION_END();
1906
1907 HANDLE_INSTRUCTION_START(AND_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001908 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001909 shadow_frame.SetVReg(vregA,
1910 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001911 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001912 ADVANCE(1);
1913 }
1914 HANDLE_INSTRUCTION_END();
1915
1916 HANDLE_INSTRUCTION_START(OR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001917 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001918 shadow_frame.SetVReg(vregA,
1919 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001920 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001921 ADVANCE(1);
1922 }
1923 HANDLE_INSTRUCTION_END();
1924
1925 HANDLE_INSTRUCTION_START(XOR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001926 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001927 shadow_frame.SetVReg(vregA,
1928 shadow_frame.GetVReg(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001929 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001930 ADVANCE(1);
1931 }
1932 HANDLE_INSTRUCTION_END();
1933
1934 HANDLE_INSTRUCTION_START(ADD_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001935 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001936 shadow_frame.SetVRegLong(vregA,
1937 shadow_frame.GetVRegLong(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001938 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001939 ADVANCE(1);
1940 }
1941 HANDLE_INSTRUCTION_END();
1942
1943 HANDLE_INSTRUCTION_START(SUB_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001944 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001945 shadow_frame.SetVRegLong(vregA,
1946 shadow_frame.GetVRegLong(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001947 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001948 ADVANCE(1);
1949 }
1950 HANDLE_INSTRUCTION_END();
1951
1952 HANDLE_INSTRUCTION_START(MUL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001953 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001954 shadow_frame.SetVRegLong(vregA,
1955 shadow_frame.GetVRegLong(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001956 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001957 ADVANCE(1);
1958 }
1959 HANDLE_INSTRUCTION_END();
1960
1961 HANDLE_INSTRUCTION_START(DIV_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001962 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001963 bool success = DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001964 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001965 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1966 }
1967 HANDLE_INSTRUCTION_END();
1968
1969 HANDLE_INSTRUCTION_START(REM_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001970 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001971 bool success = DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001972 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001973 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1974 }
1975 HANDLE_INSTRUCTION_END();
1976
1977 HANDLE_INSTRUCTION_START(AND_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001978 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001979 shadow_frame.SetVRegLong(vregA,
1980 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001981 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001982 ADVANCE(1);
1983 }
1984 HANDLE_INSTRUCTION_END();
1985
1986 HANDLE_INSTRUCTION_START(OR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001987 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001988 shadow_frame.SetVRegLong(vregA,
1989 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001990 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001991 ADVANCE(1);
1992 }
1993 HANDLE_INSTRUCTION_END();
1994
1995 HANDLE_INSTRUCTION_START(XOR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001996 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001997 shadow_frame.SetVRegLong(vregA,
1998 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001999 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002000 ADVANCE(1);
2001 }
2002 HANDLE_INSTRUCTION_END();
2003
2004 HANDLE_INSTRUCTION_START(SHL_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002005 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002006 shadow_frame.SetVRegLong(vregA,
2007 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002008 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002009 ADVANCE(1);
2010 }
2011 HANDLE_INSTRUCTION_END();
2012
2013 HANDLE_INSTRUCTION_START(SHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002014 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002015 shadow_frame.SetVRegLong(vregA,
2016 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002017 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002018 ADVANCE(1);
2019 }
2020 HANDLE_INSTRUCTION_END();
2021
2022 HANDLE_INSTRUCTION_START(USHR_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002023 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002024 shadow_frame.SetVRegLong(vregA,
2025 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002026 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002027 ADVANCE(1);
2028 }
2029 HANDLE_INSTRUCTION_END();
2030
2031 HANDLE_INSTRUCTION_START(ADD_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002032 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002033 shadow_frame.SetVRegFloat(vregA,
2034 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002035 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002036 ADVANCE(1);
2037 }
2038 HANDLE_INSTRUCTION_END();
2039
2040 HANDLE_INSTRUCTION_START(SUB_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002041 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002042 shadow_frame.SetVRegFloat(vregA,
2043 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002044 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002045 ADVANCE(1);
2046 }
2047 HANDLE_INSTRUCTION_END();
2048
2049 HANDLE_INSTRUCTION_START(MUL_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002050 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002051 shadow_frame.SetVRegFloat(vregA,
2052 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002053 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002054 ADVANCE(1);
2055 }
2056 HANDLE_INSTRUCTION_END();
2057
2058 HANDLE_INSTRUCTION_START(DIV_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002059 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002060 shadow_frame.SetVRegFloat(vregA,
2061 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002062 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002063 ADVANCE(1);
2064 }
2065 HANDLE_INSTRUCTION_END();
2066
2067 HANDLE_INSTRUCTION_START(REM_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002068 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002069 shadow_frame.SetVRegFloat(vregA,
2070 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002071 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002072 ADVANCE(1);
2073 }
2074 HANDLE_INSTRUCTION_END();
2075
2076 HANDLE_INSTRUCTION_START(ADD_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002077 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002078 shadow_frame.SetVRegDouble(vregA,
2079 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002080 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002081 ADVANCE(1);
2082 }
2083 HANDLE_INSTRUCTION_END();
2084
2085 HANDLE_INSTRUCTION_START(SUB_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002086 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002087 shadow_frame.SetVRegDouble(vregA,
2088 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002089 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002090 ADVANCE(1);
2091 }
2092 HANDLE_INSTRUCTION_END();
2093
2094 HANDLE_INSTRUCTION_START(MUL_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002095 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002096 shadow_frame.SetVRegDouble(vregA,
2097 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002098 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002099 ADVANCE(1);
2100 }
2101 HANDLE_INSTRUCTION_END();
2102
2103 HANDLE_INSTRUCTION_START(DIV_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002104 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002105 shadow_frame.SetVRegDouble(vregA,
2106 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002107 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002108 ADVANCE(1);
2109 }
2110 HANDLE_INSTRUCTION_END();
2111
2112 HANDLE_INSTRUCTION_START(REM_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002113 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002114 shadow_frame.SetVRegDouble(vregA,
2115 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002116 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002117 ADVANCE(1);
2118 }
2119 HANDLE_INSTRUCTION_END();
2120
2121 HANDLE_INSTRUCTION_START(ADD_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002122 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2123 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) +
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002124 inst->VRegC_22s());
2125 ADVANCE(2);
2126 HANDLE_INSTRUCTION_END();
2127
2128 HANDLE_INSTRUCTION_START(RSUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002129 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002130 inst->VRegC_22s() -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002131 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002132 ADVANCE(2);
2133 HANDLE_INSTRUCTION_END();
2134
2135 HANDLE_INSTRUCTION_START(MUL_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002136 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2137 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) *
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002138 inst->VRegC_22s());
2139 ADVANCE(2);
2140 HANDLE_INSTRUCTION_END();
2141
2142 HANDLE_INSTRUCTION_START(DIV_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002143 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
2144 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002145 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2146 }
2147 HANDLE_INSTRUCTION_END();
2148
2149 HANDLE_INSTRUCTION_START(REM_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002150 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
2151 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002152 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2153 }
2154 HANDLE_INSTRUCTION_END();
2155
2156 HANDLE_INSTRUCTION_START(AND_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002157 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2158 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002159 inst->VRegC_22s());
2160 ADVANCE(2);
2161 HANDLE_INSTRUCTION_END();
2162
2163 HANDLE_INSTRUCTION_START(OR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002164 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2165 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002166 inst->VRegC_22s());
2167 ADVANCE(2);
2168 HANDLE_INSTRUCTION_END();
2169
2170 HANDLE_INSTRUCTION_START(XOR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002171 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2172 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002173 inst->VRegC_22s());
2174 ADVANCE(2);
2175 HANDLE_INSTRUCTION_END();
2176
2177 HANDLE_INSTRUCTION_START(ADD_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002178 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002179 shadow_frame.GetVReg(inst->VRegB_22b()) +
2180 inst->VRegC_22b());
2181 ADVANCE(2);
2182 HANDLE_INSTRUCTION_END();
2183
2184 HANDLE_INSTRUCTION_START(RSUB_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002185 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002186 inst->VRegC_22b() -
2187 shadow_frame.GetVReg(inst->VRegB_22b()));
2188 ADVANCE(2);
2189 HANDLE_INSTRUCTION_END();
2190
2191 HANDLE_INSTRUCTION_START(MUL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002192 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002193 shadow_frame.GetVReg(inst->VRegB_22b()) *
2194 inst->VRegC_22b());
2195 ADVANCE(2);
2196 HANDLE_INSTRUCTION_END();
2197
2198 HANDLE_INSTRUCTION_START(DIV_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002199 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
2200 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002201 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2202 }
2203 HANDLE_INSTRUCTION_END();
2204
2205 HANDLE_INSTRUCTION_START(REM_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002206 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
2207 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002208 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2209 }
2210 HANDLE_INSTRUCTION_END();
2211
2212 HANDLE_INSTRUCTION_START(AND_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002213 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002214 shadow_frame.GetVReg(inst->VRegB_22b()) &
2215 inst->VRegC_22b());
2216 ADVANCE(2);
2217 HANDLE_INSTRUCTION_END();
2218
2219 HANDLE_INSTRUCTION_START(OR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002220 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002221 shadow_frame.GetVReg(inst->VRegB_22b()) |
2222 inst->VRegC_22b());
2223 ADVANCE(2);
2224 HANDLE_INSTRUCTION_END();
2225
2226 HANDLE_INSTRUCTION_START(XOR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002227 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002228 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2229 inst->VRegC_22b());
2230 ADVANCE(2);
2231 HANDLE_INSTRUCTION_END();
2232
2233 HANDLE_INSTRUCTION_START(SHL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002234 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002235 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2236 (inst->VRegC_22b() & 0x1f));
2237 ADVANCE(2);
2238 HANDLE_INSTRUCTION_END();
2239
2240 HANDLE_INSTRUCTION_START(SHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002241 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002242 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2243 (inst->VRegC_22b() & 0x1f));
2244 ADVANCE(2);
2245 HANDLE_INSTRUCTION_END();
2246
2247 HANDLE_INSTRUCTION_START(USHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002248 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002249 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2250 (inst->VRegC_22b() & 0x1f));
2251 ADVANCE(2);
2252 HANDLE_INSTRUCTION_END();
2253
2254 HANDLE_INSTRUCTION_START(UNUSED_3E)
2255 UnexpectedOpcode(inst, mh);
2256 HANDLE_INSTRUCTION_END();
2257
2258 HANDLE_INSTRUCTION_START(UNUSED_3F)
2259 UnexpectedOpcode(inst, mh);
2260 HANDLE_INSTRUCTION_END();
2261
2262 HANDLE_INSTRUCTION_START(UNUSED_40)
2263 UnexpectedOpcode(inst, mh);
2264 HANDLE_INSTRUCTION_END();
2265
2266 HANDLE_INSTRUCTION_START(UNUSED_41)
2267 UnexpectedOpcode(inst, mh);
2268 HANDLE_INSTRUCTION_END();
2269
2270 HANDLE_INSTRUCTION_START(UNUSED_42)
2271 UnexpectedOpcode(inst, mh);
2272 HANDLE_INSTRUCTION_END();
2273
2274 HANDLE_INSTRUCTION_START(UNUSED_43)
2275 UnexpectedOpcode(inst, mh);
2276 HANDLE_INSTRUCTION_END();
2277
2278 HANDLE_INSTRUCTION_START(UNUSED_79)
2279 UnexpectedOpcode(inst, mh);
2280 HANDLE_INSTRUCTION_END();
2281
2282 HANDLE_INSTRUCTION_START(UNUSED_7A)
2283 UnexpectedOpcode(inst, mh);
2284 HANDLE_INSTRUCTION_END();
2285
2286 HANDLE_INSTRUCTION_START(UNUSED_EB)
2287 UnexpectedOpcode(inst, mh);
2288 HANDLE_INSTRUCTION_END();
2289
2290 HANDLE_INSTRUCTION_START(UNUSED_EC)
2291 UnexpectedOpcode(inst, mh);
2292 HANDLE_INSTRUCTION_END();
2293
2294 HANDLE_INSTRUCTION_START(UNUSED_ED)
2295 UnexpectedOpcode(inst, mh);
2296 HANDLE_INSTRUCTION_END();
2297
2298 HANDLE_INSTRUCTION_START(UNUSED_EE)
2299 UnexpectedOpcode(inst, mh);
2300 HANDLE_INSTRUCTION_END();
2301
2302 HANDLE_INSTRUCTION_START(UNUSED_EF)
2303 UnexpectedOpcode(inst, mh);
2304 HANDLE_INSTRUCTION_END();
2305
2306 HANDLE_INSTRUCTION_START(UNUSED_F0)
2307 UnexpectedOpcode(inst, mh);
2308 HANDLE_INSTRUCTION_END();
2309
2310 HANDLE_INSTRUCTION_START(UNUSED_F1)
2311 UnexpectedOpcode(inst, mh);
2312 HANDLE_INSTRUCTION_END();
2313
2314 HANDLE_INSTRUCTION_START(UNUSED_F2)
2315 UnexpectedOpcode(inst, mh);
2316 HANDLE_INSTRUCTION_END();
2317
2318 HANDLE_INSTRUCTION_START(UNUSED_F3)
2319 UnexpectedOpcode(inst, mh);
2320 HANDLE_INSTRUCTION_END();
2321
2322 HANDLE_INSTRUCTION_START(UNUSED_F4)
2323 UnexpectedOpcode(inst, mh);
2324 HANDLE_INSTRUCTION_END();
2325
2326 HANDLE_INSTRUCTION_START(UNUSED_F5)
2327 UnexpectedOpcode(inst, mh);
2328 HANDLE_INSTRUCTION_END();
2329
2330 HANDLE_INSTRUCTION_START(UNUSED_F6)
2331 UnexpectedOpcode(inst, mh);
2332 HANDLE_INSTRUCTION_END();
2333
2334 HANDLE_INSTRUCTION_START(UNUSED_F7)
2335 UnexpectedOpcode(inst, mh);
2336 HANDLE_INSTRUCTION_END();
2337
2338 HANDLE_INSTRUCTION_START(UNUSED_F8)
2339 UnexpectedOpcode(inst, mh);
2340 HANDLE_INSTRUCTION_END();
2341
2342 HANDLE_INSTRUCTION_START(UNUSED_F9)
2343 UnexpectedOpcode(inst, mh);
2344 HANDLE_INSTRUCTION_END();
2345
2346 HANDLE_INSTRUCTION_START(UNUSED_FA)
2347 UnexpectedOpcode(inst, mh);
2348 HANDLE_INSTRUCTION_END();
2349
2350 HANDLE_INSTRUCTION_START(UNUSED_FB)
2351 UnexpectedOpcode(inst, mh);
2352 HANDLE_INSTRUCTION_END();
2353
2354 HANDLE_INSTRUCTION_START(UNUSED_FC)
2355 UnexpectedOpcode(inst, mh);
2356 HANDLE_INSTRUCTION_END();
2357
2358 HANDLE_INSTRUCTION_START(UNUSED_FD)
2359 UnexpectedOpcode(inst, mh);
2360 HANDLE_INSTRUCTION_END();
2361
2362 HANDLE_INSTRUCTION_START(UNUSED_FE)
2363 UnexpectedOpcode(inst, mh);
2364 HANDLE_INSTRUCTION_END();
2365
2366 HANDLE_INSTRUCTION_START(UNUSED_FF)
2367 UnexpectedOpcode(inst, mh);
2368 HANDLE_INSTRUCTION_END();
2369
2370 exception_pending_label: {
2371 CHECK(self->IsExceptionPending());
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002372 if (UNLIKELY(self->TestAllFlags())) {
2373 CheckSuspend(self);
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002374 UPDATE_HANDLER_TABLE();
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002375 }
Sebastien Hertz947ff082013-09-17 14:10:13 +02002376 Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_);
Sebastien Hertzee1997a2013-09-19 14:47:09 +02002377 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002378 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc,
Sebastien Hertz947ff082013-09-17 14:10:13 +02002379 this_object,
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002380 instrumentation);
2381 if (found_dex_pc == DexFile::kDexNoIndex) {
2382 return JValue(); /* Handled in caller. */
2383 } else {
2384 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc);
2385 ADVANCE(displacement);
2386 }
2387 }
2388
Sebastien Hertz8379b222014-02-24 17:38:15 +01002389// Create alternative instruction handlers dedicated to instrumentation.
2390// Return instructions must not call Instrumentation::DexPcMovedEvent since they already call
2391// Instrumentation::MethodExited. This is to avoid posting debugger events twice for this location.
2392#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
2393 alt_op_##code: { \
2394 if (Instruction::code != Instruction::RETURN_VOID && \
2395 Instruction::code != Instruction::RETURN_VOID_BARRIER && \
2396 Instruction::code != Instruction::RETURN && \
2397 Instruction::code != Instruction::RETURN_WIDE && \
2398 Instruction::code != Instruction::RETURN_OBJECT) { \
2399 if (LIKELY(!notified_method_entry_event)) { \
2400 Runtime* runtime = Runtime::Current(); \
2401 const instrumentation::Instrumentation* instrumentation = runtime->GetInstrumentation(); \
2402 if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
2403 Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_); \
2404 instrumentation->DexPcMovedEvent(self, this_object, shadow_frame.GetMethod(), dex_pc); \
2405 } \
2406 } else { \
2407 notified_method_entry_event = false; \
2408 } \
2409 } \
2410 UPDATE_HANDLER_TABLE(); \
2411 goto *handlersTable[instrumentation::kMainHandlerTable][Instruction::code]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002412 }
2413#include "dex_instruction_list.h"
2414 DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER)
2415#undef DEX_INSTRUCTION_LIST
2416#undef INSTRUMENTATION_INSTRUCTION_HANDLER
2417} // NOLINT(readability/fn_size)
2418
2419// Explicit definitions of ExecuteGotoImpl.
Sebastien Hertzc6714852013-09-30 16:42:32 +02002420template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) HOT_ATTR
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +01002421JValue ExecuteGotoImpl<true, false>(Thread* self, MethodHelper& mh,
2422 const DexFile::CodeItem* code_item,
2423 ShadowFrame& shadow_frame, JValue result_register);
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<false, false>(Thread* self, MethodHelper& mh,
2426 const DexFile::CodeItem* code_item,
2427 ShadowFrame& shadow_frame, JValue result_register);
2428template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
2429JValue ExecuteGotoImpl<true, true>(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<false, true>(Thread* self, MethodHelper& mh,
2434 const DexFile::CodeItem* code_item,
2435 ShadowFrame& shadow_frame, JValue result_register);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002436
2437} // namespace interpreter
2438} // namespace art