blob: d70b80eb937d66c2beea1419a74b582e6e9fa332 [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.
32// TODO: move check suspend to backward branch, return and exception handling.
33#define ADVANCE(_offset) \
34 do { \
35 int32_t disp = static_cast<int32_t>(_offset); \
36 inst = inst->RelativeAt(disp); \
37 dex_pc = static_cast<uint32_t>(static_cast<int32_t>(dex_pc) + disp); \
38 shadow_frame.SetDexPC(dex_pc); \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020039 TraceExecution(shadow_frame, inst, dex_pc, mh); \
Sebastien Hertz3b588e02013-09-11 14:33:18 +020040 inst_data = inst->Fetch16(0); \
41 goto *currentHandlersTable[inst->Opcode(inst_data)]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +020042 } while (false)
43
44#define HANDLE_PENDING_EXCEPTION() goto exception_pending_label
45
46#define POSSIBLY_HANDLE_PENDING_EXCEPTION(_is_exception_pending, _offset) \
47 do { \
48 if (UNLIKELY(_is_exception_pending)) { \
49 HANDLE_PENDING_EXCEPTION(); \
50 } else { \
51 ADVANCE(_offset); \
52 } \
53 } while (false)
54
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +020055#define UPDATE_HANDLER_TABLE() \
56 do { \
57 if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
58 currentHandlersTable = instrumentationHandlersTable; \
59 } else { \
60 currentHandlersTable = handlersTable; \
61 } \
62 } while (false);
63
Sebastien Hertz8ece0502013-08-07 11:26:41 +020064#define UNREACHABLE_CODE_CHECK() \
65 do { \
66 if (kIsDebugBuild) { \
67 LOG(FATAL) << "We should not be here !"; \
68 } \
69 } while (false)
70
71#define HANDLE_INSTRUCTION_START(opcode) op_##opcode: // NOLINT(whitespace/labels)
72#define HANDLE_INSTRUCTION_END() UNREACHABLE_CODE_CHECK()
73
Sebastien Hertz8ece0502013-08-07 11:26:41 +020074template<bool do_access_check>
75JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item,
76 ShadowFrame& shadow_frame, JValue result_register) {
77 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
78 LOG(FATAL) << "Invalid shadow frame for interpreter use";
79 return JValue();
80 }
81 self->VerifyStack();
Sebastien Hertz8ece0502013-08-07 11:26:41 +020082
83 uint32_t dex_pc = shadow_frame.GetDexPC();
Sebastien Hertz947ff082013-09-17 14:10:13 +020084 const instrumentation::Instrumentation* const instrumentation = Runtime::Current()->GetInstrumentation();
Sebastien Hertz8ece0502013-08-07 11:26:41 +020085 if (LIKELY(dex_pc == 0)) { // We are entering the method as opposed to deoptimizing..
86 if (UNLIKELY(instrumentation->HasMethodEntryListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +020087 instrumentation->MethodEnterEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +020088 shadow_frame.GetMethod(), 0);
89 }
90 }
Sebastien Hertz947ff082013-09-17 14:10:13 +020091 const Instruction* inst = Instruction::At(code_item->insns_ + dex_pc);
Sebastien Hertz3b588e02013-09-11 14:33:18 +020092 uint16_t inst_data;
Sebastien Hertz8ece0502013-08-07 11:26:41 +020093
94 // Define handlers table.
95 static const void* handlersTable[kNumPackedOpcodes] = {
96#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&op_##code,
97#include "dex_instruction_list.h"
98 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
99#undef DEX_INSTRUCTION_LIST
100#undef INSTRUCTION_HANDLER
101 };
102
103 static const void* instrumentationHandlersTable[kNumPackedOpcodes] = {
104#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&instrumentation_op_##code,
105#include "dex_instruction_list.h"
106 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
107#undef DEX_INSTRUCTION_LIST
108#undef INSTRUCTION_HANDLER
109 };
110
111 const void** currentHandlersTable;
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200112 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200113
114 // Jump to first instruction.
115 ADVANCE(0);
116 UNREACHABLE_CODE_CHECK();
117
118 HANDLE_INSTRUCTION_START(NOP)
119 ADVANCE(1);
120 HANDLE_INSTRUCTION_END();
121
122 HANDLE_INSTRUCTION_START(MOVE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200123 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
124 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200125 ADVANCE(1);
126 HANDLE_INSTRUCTION_END();
127
128 HANDLE_INSTRUCTION_START(MOVE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200129 shadow_frame.SetVReg(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200130 shadow_frame.GetVReg(inst->VRegB_22x()));
131 ADVANCE(2);
132 HANDLE_INSTRUCTION_END();
133
134 HANDLE_INSTRUCTION_START(MOVE_16)
135 shadow_frame.SetVReg(inst->VRegA_32x(),
136 shadow_frame.GetVReg(inst->VRegB_32x()));
137 ADVANCE(3);
138 HANDLE_INSTRUCTION_END();
139
140 HANDLE_INSTRUCTION_START(MOVE_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200141 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data),
142 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200143 ADVANCE(1);
144 HANDLE_INSTRUCTION_END();
145
146 HANDLE_INSTRUCTION_START(MOVE_WIDE_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200147 shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200148 shadow_frame.GetVRegLong(inst->VRegB_22x()));
149 ADVANCE(2);
150 HANDLE_INSTRUCTION_END();
151
152 HANDLE_INSTRUCTION_START(MOVE_WIDE_16)
153 shadow_frame.SetVRegLong(inst->VRegA_32x(),
154 shadow_frame.GetVRegLong(inst->VRegB_32x()));
155 ADVANCE(3);
156 HANDLE_INSTRUCTION_END();
157
158 HANDLE_INSTRUCTION_START(MOVE_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200159 shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data),
160 shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200161 ADVANCE(1);
162 HANDLE_INSTRUCTION_END();
163
164 HANDLE_INSTRUCTION_START(MOVE_OBJECT_FROM16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200165 shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200166 shadow_frame.GetVRegReference(inst->VRegB_22x()));
167 ADVANCE(2);
168 HANDLE_INSTRUCTION_END();
169
170 HANDLE_INSTRUCTION_START(MOVE_OBJECT_16)
171 shadow_frame.SetVRegReference(inst->VRegA_32x(),
172 shadow_frame.GetVRegReference(inst->VRegB_32x()));
173 ADVANCE(3);
174 HANDLE_INSTRUCTION_END();
175
176 HANDLE_INSTRUCTION_START(MOVE_RESULT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200177 shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200178 ADVANCE(1);
179 HANDLE_INSTRUCTION_END();
180
181 HANDLE_INSTRUCTION_START(MOVE_RESULT_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200182 shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200183 ADVANCE(1);
184 HANDLE_INSTRUCTION_END();
185
186 HANDLE_INSTRUCTION_START(MOVE_RESULT_OBJECT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200187 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200188 ADVANCE(1);
189 HANDLE_INSTRUCTION_END();
190
191 HANDLE_INSTRUCTION_START(MOVE_EXCEPTION) {
192 Throwable* exception = self->GetException(NULL);
193 self->ClearException();
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200194 shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200195 ADVANCE(1);
196 }
197 HANDLE_INSTRUCTION_END();
198
199 HANDLE_INSTRUCTION_START(RETURN_VOID) {
200 JValue result;
Sebastien Hertz043036f2013-09-09 18:26:48 +0200201 if (do_access_check) {
202 // If access checks are required then the dex-to-dex compiler and analysis of
203 // whether the class has final fields hasn't been performed. Conservatively
204 // perform the memory barrier now.
205 ANDROID_MEMBAR_STORE();
206 }
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200207 if (UNLIKELY(self->TestAllFlags())) {
208 CheckSuspend(self);
209 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200210 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200211 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200212 shadow_frame.GetMethod(), dex_pc,
213 result);
214 }
215 return result;
216 }
217 HANDLE_INSTRUCTION_END();
218
219 HANDLE_INSTRUCTION_START(RETURN_VOID_BARRIER) {
220 ANDROID_MEMBAR_STORE();
221 JValue result;
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200222 if (UNLIKELY(self->TestAllFlags())) {
223 CheckSuspend(self);
224 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200225 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200226 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200227 shadow_frame.GetMethod(), dex_pc,
228 result);
229 }
230 return result;
231 }
232 HANDLE_INSTRUCTION_END();
233
234 HANDLE_INSTRUCTION_START(RETURN) {
235 JValue result;
236 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200237 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data)));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200238 if (UNLIKELY(self->TestAllFlags())) {
239 CheckSuspend(self);
240 }
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200241 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
Sebastien Hertz947ff082013-09-17 14:10:13 +0200242 instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200243 shadow_frame.GetMethod(), dex_pc,
244 result);
245 }
246 return result;
247 }
248 HANDLE_INSTRUCTION_END();
249
250 HANDLE_INSTRUCTION_START(RETURN_WIDE) {
251 JValue result;
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200252 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data)));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200253 if (UNLIKELY(self->TestAllFlags())) {
254 CheckSuspend(self);
255 }
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_OBJECT) {
266 JValue result;
267 result.SetJ(0);
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200268 result.SetL(shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data)));
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200269 if (UNLIKELY(self->TestAllFlags())) {
270 CheckSuspend(self);
271 }
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(CONST_4) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200282 uint32_t dst = inst->VRegA_11n(inst_data);
283 int32_t val = inst->VRegB_11n(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200284 shadow_frame.SetVReg(dst, val);
285 if (val == 0) {
286 shadow_frame.SetVRegReference(dst, NULL);
287 }
288 ADVANCE(1);
289 }
290 HANDLE_INSTRUCTION_END();
291
292 HANDLE_INSTRUCTION_START(CONST_16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200293 uint32_t dst = inst->VRegA_21s(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200294 int32_t val = inst->VRegB_21s();
295 shadow_frame.SetVReg(dst, val);
296 if (val == 0) {
297 shadow_frame.SetVRegReference(dst, NULL);
298 }
299 ADVANCE(2);
300 }
301 HANDLE_INSTRUCTION_END();
302
303 HANDLE_INSTRUCTION_START(CONST) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200304 uint32_t dst = inst->VRegA_31i(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200305 int32_t val = inst->VRegB_31i();
306 shadow_frame.SetVReg(dst, val);
307 if (val == 0) {
308 shadow_frame.SetVRegReference(dst, NULL);
309 }
310 ADVANCE(3);
311 }
312 HANDLE_INSTRUCTION_END();
313
314 HANDLE_INSTRUCTION_START(CONST_HIGH16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200315 uint32_t dst = inst->VRegA_21h(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200316 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
317 shadow_frame.SetVReg(dst, val);
318 if (val == 0) {
319 shadow_frame.SetVRegReference(dst, NULL);
320 }
321 ADVANCE(2);
322 }
323 HANDLE_INSTRUCTION_END();
324
325 HANDLE_INSTRUCTION_START(CONST_WIDE_16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200326 shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200327 ADVANCE(2);
328 HANDLE_INSTRUCTION_END();
329
330 HANDLE_INSTRUCTION_START(CONST_WIDE_32)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200331 shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200332 ADVANCE(3);
333 HANDLE_INSTRUCTION_END();
334
335 HANDLE_INSTRUCTION_START(CONST_WIDE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200336 shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200337 ADVANCE(5);
338 HANDLE_INSTRUCTION_END();
339
340 HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200341 shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200342 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
343 ADVANCE(2);
344 HANDLE_INSTRUCTION_END();
345
346 HANDLE_INSTRUCTION_START(CONST_STRING) {
347 String* s = ResolveString(self, mh, inst->VRegB_21c());
348 if (UNLIKELY(s == NULL)) {
349 HANDLE_PENDING_EXCEPTION();
350 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200351 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200352 ADVANCE(2);
353 }
354 }
355 HANDLE_INSTRUCTION_END();
356
357 HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
358 String* s = ResolveString(self, mh, inst->VRegB_31c());
359 if (UNLIKELY(s == NULL)) {
360 HANDLE_PENDING_EXCEPTION();
361 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200362 shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200363 ADVANCE(3);
364 }
365 }
366 HANDLE_INSTRUCTION_END();
367
368 HANDLE_INSTRUCTION_START(CONST_CLASS) {
369 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
370 self, false, do_access_check);
371 if (UNLIKELY(c == NULL)) {
372 HANDLE_PENDING_EXCEPTION();
373 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200374 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200375 ADVANCE(2);
376 }
377 }
378 HANDLE_INSTRUCTION_END();
379
380 HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200381 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200382 if (UNLIKELY(obj == NULL)) {
383 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
384 HANDLE_PENDING_EXCEPTION();
385 } else {
386 DoMonitorEnter(self, obj);
387 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
388 }
389 }
390 HANDLE_INSTRUCTION_END();
391
392 HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200393 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200394 if (UNLIKELY(obj == NULL)) {
395 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
396 HANDLE_PENDING_EXCEPTION();
397 } else {
398 DoMonitorExit(self, obj);
399 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
400 }
401 }
402 HANDLE_INSTRUCTION_END();
403
404 HANDLE_INSTRUCTION_START(CHECK_CAST) {
405 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
406 self, false, do_access_check);
407 if (UNLIKELY(c == NULL)) {
408 HANDLE_PENDING_EXCEPTION();
409 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200410 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200411 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
412 ThrowClassCastException(c, obj->GetClass());
413 HANDLE_PENDING_EXCEPTION();
414 } else {
415 ADVANCE(2);
416 }
417 }
418 }
419 HANDLE_INSTRUCTION_END();
420
421 HANDLE_INSTRUCTION_START(INSTANCE_OF) {
422 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
423 self, false, do_access_check);
424 if (UNLIKELY(c == NULL)) {
425 HANDLE_PENDING_EXCEPTION();
426 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200427 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
428 shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200429 ADVANCE(2);
430 }
431 }
432 HANDLE_INSTRUCTION_END();
433
434 HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200435 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200436 if (UNLIKELY(array == NULL)) {
437 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
438 HANDLE_PENDING_EXCEPTION();
439 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200440 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200441 ADVANCE(1);
442 }
443 }
444 HANDLE_INSTRUCTION_END();
445
446 HANDLE_INSTRUCTION_START(NEW_INSTANCE) {
447 Object* obj = AllocObjectFromCode(inst->VRegB_21c(), shadow_frame.GetMethod(),
448 self, do_access_check);
449 if (UNLIKELY(obj == NULL)) {
450 HANDLE_PENDING_EXCEPTION();
451 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200452 shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200453 ADVANCE(2);
454 }
455 }
456 HANDLE_INSTRUCTION_END();
457
458 HANDLE_INSTRUCTION_START(NEW_ARRAY) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200459 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200460 Object* obj = AllocArrayFromCode(inst->VRegC_22c(), shadow_frame.GetMethod(),
461 length, self, do_access_check);
462 if (UNLIKELY(obj == NULL)) {
463 HANDLE_PENDING_EXCEPTION();
464 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200465 shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200466 ADVANCE(2);
467 }
468 }
469 HANDLE_INSTRUCTION_END();
470
471 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) {
472 bool success = DoFilledNewArray<false, do_access_check>(inst, shadow_frame,
473 self, &result_register);
474 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
475 }
476 HANDLE_INSTRUCTION_END();
477
478 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) {
479 bool success = DoFilledNewArray<true, do_access_check>(inst, shadow_frame,
480 self, &result_register);
481 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
482 }
483 HANDLE_INSTRUCTION_END();
484
485 HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200486 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200487 if (UNLIKELY(obj == NULL)) {
488 ThrowNullPointerException(NULL, "null array in FILL_ARRAY_DATA");
489 HANDLE_PENDING_EXCEPTION();
490 } else {
491 Array* array = obj->AsArray();
492 DCHECK(array->IsArrayInstance() && !array->IsObjectArray());
493 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
494 const Instruction::ArrayDataPayload* payload =
495 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
496 if (UNLIKELY(static_cast<int32_t>(payload->element_count) > array->GetLength())) {
497 self->ThrowNewExceptionF(shadow_frame.GetCurrentLocationForThrow(),
498 "Ljava/lang/ArrayIndexOutOfBoundsException;",
499 "failed FILL_ARRAY_DATA; length=%d, index=%d",
500 array->GetLength(), payload->element_count);
501 HANDLE_PENDING_EXCEPTION();
502 } else {
503 uint32_t size_in_bytes = payload->element_count * payload->element_width;
504 memcpy(array->GetRawData(payload->element_width), payload->data, size_in_bytes);
505 ADVANCE(3);
506 }
507 }
508 }
509 HANDLE_INSTRUCTION_END();
510
511 HANDLE_INSTRUCTION_START(THROW) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200512 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200513 if (UNLIKELY(exception == NULL)) {
514 ThrowNullPointerException(NULL, "throw with null exception");
515 } else {
516 self->SetException(shadow_frame.GetCurrentLocationForThrow(), exception->AsThrowable());
517 }
518 HANDLE_PENDING_EXCEPTION();
519 }
520 HANDLE_INSTRUCTION_END();
521
522 HANDLE_INSTRUCTION_START(GOTO) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200523 int8_t offset = inst->VRegA_10t(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200524 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200525 if (UNLIKELY(self->TestAllFlags())) {
526 CheckSuspend(self);
527 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200528 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200529 }
530 ADVANCE(offset);
531 }
532 HANDLE_INSTRUCTION_END();
533
534 HANDLE_INSTRUCTION_START(GOTO_16) {
535 int16_t offset = inst->VRegA_20t();
536 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200537 if (UNLIKELY(self->TestAllFlags())) {
538 CheckSuspend(self);
539 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200540 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200541 }
542 ADVANCE(offset);
543 }
544 HANDLE_INSTRUCTION_END();
545
546 HANDLE_INSTRUCTION_START(GOTO_32) {
547 int32_t offset = inst->VRegA_30t();
548 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200549 if (UNLIKELY(self->TestAllFlags())) {
550 CheckSuspend(self);
551 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200552 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200553 }
554 ADVANCE(offset);
555 }
556 HANDLE_INSTRUCTION_END();
557
558 HANDLE_INSTRUCTION_START(PACKED_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200559 int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200560 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200561 if (UNLIKELY(self->TestAllFlags())) {
562 CheckSuspend(self);
563 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200564 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200565 }
566 ADVANCE(offset);
567 }
568 HANDLE_INSTRUCTION_END();
569
570 HANDLE_INSTRUCTION_START(SPARSE_SWITCH) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200571 int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200572 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200573 if (UNLIKELY(self->TestAllFlags())) {
574 CheckSuspend(self);
575 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200576 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200577 }
578 ADVANCE(offset);
579 }
580 HANDLE_INSTRUCTION_END();
581
582 HANDLE_INSTRUCTION_START(CMPL_FLOAT) {
583 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
584 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
585 int32_t result;
586 if (val1 > val2) {
587 result = 1;
588 } else if (val1 == val2) {
589 result = 0;
590 } else {
591 result = -1;
592 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200593 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200594 ADVANCE(2);
595 }
596 HANDLE_INSTRUCTION_END();
597
598 HANDLE_INSTRUCTION_START(CMPG_FLOAT) {
599 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
600 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
601 int32_t result;
602 if (val1 < val2) {
603 result = -1;
604 } else if (val1 == val2) {
605 result = 0;
606 } else {
607 result = 1;
608 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200609 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200610 ADVANCE(2);
611 }
612 HANDLE_INSTRUCTION_END();
613
614 HANDLE_INSTRUCTION_START(CMPL_DOUBLE) {
615 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
616 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
617 int32_t result;
618 if (val1 > val2) {
619 result = 1;
620 } else if (val1 == val2) {
621 result = 0;
622 } else {
623 result = -1;
624 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200625 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200626 ADVANCE(2);
627 }
628 HANDLE_INSTRUCTION_END();
629
630 HANDLE_INSTRUCTION_START(CMPG_DOUBLE) {
631 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
632 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
633 int32_t result;
634 if (val1 < val2) {
635 result = -1;
636 } else if (val1 == val2) {
637 result = 0;
638 } else {
639 result = 1;
640 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200641 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200642 ADVANCE(2);
643 }
644 HANDLE_INSTRUCTION_END();
645
646 HANDLE_INSTRUCTION_START(CMP_LONG) {
647 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
648 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
649 int32_t result;
650 if (val1 > val2) {
651 result = 1;
652 } else if (val1 == val2) {
653 result = 0;
654 } else {
655 result = -1;
656 }
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200657 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200658 ADVANCE(2);
659 }
660 HANDLE_INSTRUCTION_END();
661
662 HANDLE_INSTRUCTION_START(IF_EQ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200663 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200664 int16_t offset = inst->VRegC_22t();
665 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200666 if (UNLIKELY(self->TestAllFlags())) {
667 CheckSuspend(self);
668 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200669 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200670 }
671 ADVANCE(offset);
672 } else {
673 ADVANCE(2);
674 }
675 }
676 HANDLE_INSTRUCTION_END();
677
678 HANDLE_INSTRUCTION_START(IF_NE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200679 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) != shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200680 int16_t offset = inst->VRegC_22t();
681 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200682 if (UNLIKELY(self->TestAllFlags())) {
683 CheckSuspend(self);
684 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200685 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200686 }
687 ADVANCE(offset);
688 } else {
689 ADVANCE(2);
690 }
691 }
692 HANDLE_INSTRUCTION_END();
693
694 HANDLE_INSTRUCTION_START(IF_LT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200695 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) < shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200696 int16_t offset = inst->VRegC_22t();
697 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200698 if (UNLIKELY(self->TestAllFlags())) {
699 CheckSuspend(self);
700 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200701 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200702 }
703 ADVANCE(offset);
704 } else {
705 ADVANCE(2);
706 }
707 }
708 HANDLE_INSTRUCTION_END();
709
710 HANDLE_INSTRUCTION_START(IF_GE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200711 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200712 int16_t offset = inst->VRegC_22t();
713 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200714 if (UNLIKELY(self->TestAllFlags())) {
715 CheckSuspend(self);
716 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200717 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200718 }
719 ADVANCE(offset);
720 } else {
721 ADVANCE(2);
722 }
723 }
724 HANDLE_INSTRUCTION_END();
725
726 HANDLE_INSTRUCTION_START(IF_GT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200727 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200728 int16_t offset = inst->VRegC_22t();
729 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200730 if (UNLIKELY(self->TestAllFlags())) {
731 CheckSuspend(self);
732 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200733 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200734 }
735 ADVANCE(offset);
736 } else {
737 ADVANCE(2);
738 }
739 }
740 HANDLE_INSTRUCTION_END();
741
742 HANDLE_INSTRUCTION_START(IF_LE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200743 if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200744 int16_t offset = inst->VRegC_22t();
745 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200746 if (UNLIKELY(self->TestAllFlags())) {
747 CheckSuspend(self);
748 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200749 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200750 }
751 ADVANCE(offset);
752 } else {
753 ADVANCE(2);
754 }
755 }
756 HANDLE_INSTRUCTION_END();
757
758 HANDLE_INSTRUCTION_START(IF_EQZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200759 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200760 int16_t offset = inst->VRegB_21t();
761 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200762 if (UNLIKELY(self->TestAllFlags())) {
763 CheckSuspend(self);
764 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200765 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200766 }
767 ADVANCE(offset);
768 } else {
769 ADVANCE(2);
770 }
771 }
772 HANDLE_INSTRUCTION_END();
773
774 HANDLE_INSTRUCTION_START(IF_NEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200775 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200776 int16_t offset = inst->VRegB_21t();
777 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200778 if (UNLIKELY(self->TestAllFlags())) {
779 CheckSuspend(self);
780 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200781 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200782 }
783 ADVANCE(offset);
784 } else {
785 ADVANCE(2);
786 }
787 }
788 HANDLE_INSTRUCTION_END();
789
790 HANDLE_INSTRUCTION_START(IF_LTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200791 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200792 int16_t offset = inst->VRegB_21t();
793 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200794 if (UNLIKELY(self->TestAllFlags())) {
795 CheckSuspend(self);
796 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200797 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200798 }
799 ADVANCE(offset);
800 } else {
801 ADVANCE(2);
802 }
803 }
804 HANDLE_INSTRUCTION_END();
805
806 HANDLE_INSTRUCTION_START(IF_GEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200807 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200808 int16_t offset = inst->VRegB_21t();
809 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200810 if (UNLIKELY(self->TestAllFlags())) {
811 CheckSuspend(self);
812 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200813 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200814 }
815 ADVANCE(offset);
816 } else {
817 ADVANCE(2);
818 }
819 }
820 HANDLE_INSTRUCTION_END();
821
822 HANDLE_INSTRUCTION_START(IF_GTZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200823 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200824 int16_t offset = inst->VRegB_21t();
825 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200826 if (UNLIKELY(self->TestAllFlags())) {
827 CheckSuspend(self);
828 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200829 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200830 }
831 ADVANCE(offset);
832 } else {
833 ADVANCE(2);
834 }
835 }
836 HANDLE_INSTRUCTION_END();
837
838 HANDLE_INSTRUCTION_START(IF_LEZ) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200839 if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) {
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200840 int16_t offset = inst->VRegB_21t();
841 if (IsBackwardBranch(offset)) {
Sebastien Hertz1eda2262013-09-09 16:53:14 +0200842 if (UNLIKELY(self->TestAllFlags())) {
843 CheckSuspend(self);
844 }
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +0200845 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200846 }
847 ADVANCE(offset);
848 } else {
849 ADVANCE(2);
850 }
851 }
852 HANDLE_INSTRUCTION_END();
853
854 HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
855 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
856 if (UNLIKELY(a == NULL)) {
857 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
858 HANDLE_PENDING_EXCEPTION();
859 } else {
860 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
861 BooleanArray* array = a->AsBooleanArray();
862 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200863 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200864 ADVANCE(2);
865 } else {
866 HANDLE_PENDING_EXCEPTION();
867 }
868 }
869 }
870 HANDLE_INSTRUCTION_END();
871
872 HANDLE_INSTRUCTION_START(AGET_BYTE) {
873 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
874 if (UNLIKELY(a == NULL)) {
875 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
876 HANDLE_PENDING_EXCEPTION();
877 } else {
878 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
879 ByteArray* array = a->AsByteArray();
880 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200881 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200882 ADVANCE(2);
883 } else {
884 HANDLE_PENDING_EXCEPTION();
885 }
886 }
887 }
888 HANDLE_INSTRUCTION_END();
889
890 HANDLE_INSTRUCTION_START(AGET_CHAR) {
891 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
892 if (UNLIKELY(a == NULL)) {
893 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
894 HANDLE_PENDING_EXCEPTION();
895 } else {
896 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
897 CharArray* array = a->AsCharArray();
898 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200899 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200900 ADVANCE(2);
901 } else {
902 HANDLE_PENDING_EXCEPTION();
903 }
904 }
905 }
906 HANDLE_INSTRUCTION_END();
907
908 HANDLE_INSTRUCTION_START(AGET_SHORT) {
909 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
910 if (UNLIKELY(a == NULL)) {
911 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
912 HANDLE_PENDING_EXCEPTION();
913 } else {
914 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
915 ShortArray* array = a->AsShortArray();
916 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200917 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200918 ADVANCE(2);
919 } else {
920 HANDLE_PENDING_EXCEPTION();
921 }
922 }
923 }
924 HANDLE_INSTRUCTION_END();
925
926 HANDLE_INSTRUCTION_START(AGET) {
927 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
928 if (UNLIKELY(a == NULL)) {
929 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
930 HANDLE_PENDING_EXCEPTION();
931 } else {
932 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
933 IntArray* array = a->AsIntArray();
934 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200935 shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200936 ADVANCE(2);
937 } else {
938 HANDLE_PENDING_EXCEPTION();
939 }
940 }
941 }
942 HANDLE_INSTRUCTION_END();
943
944 HANDLE_INSTRUCTION_START(AGET_WIDE) {
945 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
946 if (UNLIKELY(a == NULL)) {
947 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
948 HANDLE_PENDING_EXCEPTION();
949 } else {
950 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
951 LongArray* array = a->AsLongArray();
952 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200953 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetData()[index]);
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200954 ADVANCE(2);
955 } else {
956 HANDLE_PENDING_EXCEPTION();
957 }
958 }
959 }
960 HANDLE_INSTRUCTION_END();
961
962 HANDLE_INSTRUCTION_START(AGET_OBJECT) {
963 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
964 if (UNLIKELY(a == NULL)) {
965 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
966 HANDLE_PENDING_EXCEPTION();
967 } else {
968 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
969 ObjectArray<Object>* array = a->AsObjectArray<Object>();
970 if (LIKELY(array->IsValidIndex(index))) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200971 shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200972 ADVANCE(2);
973 } else {
974 HANDLE_PENDING_EXCEPTION();
975 }
976 }
977 }
978 HANDLE_INSTRUCTION_END();
979
980 HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
981 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
982 if (UNLIKELY(a == NULL)) {
983 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
984 HANDLE_PENDING_EXCEPTION();
985 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +0200986 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +0200987 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
988 BooleanArray* array = a->AsBooleanArray();
989 if (LIKELY(array->IsValidIndex(index))) {
990 array->GetData()[index] = val;
991 ADVANCE(2);
992 } else {
993 HANDLE_PENDING_EXCEPTION();
994 }
995 }
996 }
997 HANDLE_INSTRUCTION_END();
998
999 HANDLE_INSTRUCTION_START(APUT_BYTE) {
1000 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1001 if (UNLIKELY(a == NULL)) {
1002 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1003 HANDLE_PENDING_EXCEPTION();
1004 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001005 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001006 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1007 ByteArray* array = a->AsByteArray();
1008 if (LIKELY(array->IsValidIndex(index))) {
1009 array->GetData()[index] = val;
1010 ADVANCE(2);
1011 } else {
1012 HANDLE_PENDING_EXCEPTION();
1013 }
1014 }
1015 }
1016 HANDLE_INSTRUCTION_END();
1017
1018 HANDLE_INSTRUCTION_START(APUT_CHAR) {
1019 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1020 if (UNLIKELY(a == NULL)) {
1021 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1022 HANDLE_PENDING_EXCEPTION();
1023 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001024 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001025 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1026 CharArray* array = a->AsCharArray();
1027 if (LIKELY(array->IsValidIndex(index))) {
1028 array->GetData()[index] = val;
1029 ADVANCE(2);
1030 } else {
1031 HANDLE_PENDING_EXCEPTION();
1032 }
1033 }
1034 }
1035 HANDLE_INSTRUCTION_END();
1036
1037 HANDLE_INSTRUCTION_START(APUT_SHORT) {
1038 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1039 if (UNLIKELY(a == NULL)) {
1040 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1041 HANDLE_PENDING_EXCEPTION();
1042 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001043 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001044 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1045 ShortArray* array = a->AsShortArray();
1046 if (LIKELY(array->IsValidIndex(index))) {
1047 array->GetData()[index] = val;
1048 ADVANCE(2);
1049 } else {
1050 HANDLE_PENDING_EXCEPTION();
1051 }
1052 }
1053 }
1054 HANDLE_INSTRUCTION_END();
1055
1056 HANDLE_INSTRUCTION_START(APUT) {
1057 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1058 if (UNLIKELY(a == NULL)) {
1059 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1060 HANDLE_PENDING_EXCEPTION();
1061 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001062 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001063 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1064 IntArray* array = a->AsIntArray();
1065 if (LIKELY(array->IsValidIndex(index))) {
1066 array->GetData()[index] = val;
1067 ADVANCE(2);
1068 } else {
1069 HANDLE_PENDING_EXCEPTION();
1070 }
1071 }
1072 }
1073 HANDLE_INSTRUCTION_END();
1074
1075 HANDLE_INSTRUCTION_START(APUT_WIDE) {
1076 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1077 if (UNLIKELY(a == NULL)) {
1078 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1079 HANDLE_PENDING_EXCEPTION();
1080 } else {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001081 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001082 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1083 LongArray* array = a->AsLongArray();
1084 if (LIKELY(array->IsValidIndex(index))) {
1085 array->GetData()[index] = val;
1086 ADVANCE(2);
1087 } else {
1088 HANDLE_PENDING_EXCEPTION();
1089 }
1090 }
1091 }
1092 HANDLE_INSTRUCTION_END();
1093
1094 HANDLE_INSTRUCTION_START(APUT_OBJECT) {
1095 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1096 if (UNLIKELY(a == NULL)) {
1097 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1098 HANDLE_PENDING_EXCEPTION();
1099 } else {
1100 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001101 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001102 ObjectArray<Object>* array = a->AsObjectArray<Object>();
1103 if (LIKELY(array->IsValidIndex(index) && array->CheckAssignable(val))) {
1104 array->SetWithoutChecks(index, val);
1105 ADVANCE(2);
1106 } else {
1107 HANDLE_PENDING_EXCEPTION();
1108 }
1109 }
1110 }
1111 HANDLE_INSTRUCTION_END();
1112
1113 HANDLE_INSTRUCTION_START(IGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001114 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001115 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1116 }
1117 HANDLE_INSTRUCTION_END();
1118
1119 HANDLE_INSTRUCTION_START(IGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001120 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001121 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1122 }
1123 HANDLE_INSTRUCTION_END();
1124
1125 HANDLE_INSTRUCTION_START(IGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001126 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001127 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1128 }
1129 HANDLE_INSTRUCTION_END();
1130
1131 HANDLE_INSTRUCTION_START(IGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001132 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001133 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1134 }
1135 HANDLE_INSTRUCTION_END();
1136
1137 HANDLE_INSTRUCTION_START(IGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001138 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001139 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1140 }
1141 HANDLE_INSTRUCTION_END();
1142
1143 HANDLE_INSTRUCTION_START(IGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001144 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001145 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1146 }
1147 HANDLE_INSTRUCTION_END();
1148
1149 HANDLE_INSTRUCTION_START(IGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001150 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001151 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1152 }
1153 HANDLE_INSTRUCTION_END();
1154
1155 HANDLE_INSTRUCTION_START(IGET_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001156 bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001157 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1158 }
1159 HANDLE_INSTRUCTION_END();
1160
1161 HANDLE_INSTRUCTION_START(IGET_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001162 bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001163 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1164 }
1165 HANDLE_INSTRUCTION_END();
1166
1167 HANDLE_INSTRUCTION_START(IGET_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001168 bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001169 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1170 }
1171 HANDLE_INSTRUCTION_END();
1172
1173 HANDLE_INSTRUCTION_START(SGET_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001174 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001175 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1176 }
1177 HANDLE_INSTRUCTION_END();
1178
1179 HANDLE_INSTRUCTION_START(SGET_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001180 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001181 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1182 }
1183 HANDLE_INSTRUCTION_END();
1184
1185 HANDLE_INSTRUCTION_START(SGET_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001186 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001187 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1188 }
1189 HANDLE_INSTRUCTION_END();
1190
1191 HANDLE_INSTRUCTION_START(SGET_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001192 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001193 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1194 }
1195 HANDLE_INSTRUCTION_END();
1196
1197 HANDLE_INSTRUCTION_START(SGET) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001198 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001199 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1200 }
1201 HANDLE_INSTRUCTION_END();
1202
1203 HANDLE_INSTRUCTION_START(SGET_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001204 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001205 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1206 }
1207 HANDLE_INSTRUCTION_END();
1208
1209 HANDLE_INSTRUCTION_START(SGET_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001210 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001211 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1212 }
1213 HANDLE_INSTRUCTION_END();
1214
1215 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001216 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001217 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1218 }
1219 HANDLE_INSTRUCTION_END();
1220
1221 HANDLE_INSTRUCTION_START(IPUT_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001222 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001223 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1224 }
1225 HANDLE_INSTRUCTION_END();
1226
1227 HANDLE_INSTRUCTION_START(IPUT_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001228 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001229 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1230 }
1231 HANDLE_INSTRUCTION_END();
1232
1233 HANDLE_INSTRUCTION_START(IPUT_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001234 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001235 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1236 }
1237 HANDLE_INSTRUCTION_END();
1238
1239 HANDLE_INSTRUCTION_START(IPUT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001240 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001241 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1242 }
1243 HANDLE_INSTRUCTION_END();
1244
1245 HANDLE_INSTRUCTION_START(IPUT_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001246 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001247 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1248 }
1249 HANDLE_INSTRUCTION_END();
1250
1251 HANDLE_INSTRUCTION_START(IPUT_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001252 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001253 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1254 }
1255 HANDLE_INSTRUCTION_END();
1256
1257 HANDLE_INSTRUCTION_START(IPUT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001258 bool success = DoIPutQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001259 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1260 }
1261 HANDLE_INSTRUCTION_END();
1262
1263 HANDLE_INSTRUCTION_START(IPUT_WIDE_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001264 bool success = DoIPutQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001265 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1266 }
1267 HANDLE_INSTRUCTION_END();
1268
1269 HANDLE_INSTRUCTION_START(IPUT_OBJECT_QUICK) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001270 bool success = DoIPutQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001271 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1272 }
1273 HANDLE_INSTRUCTION_END();
1274
1275 HANDLE_INSTRUCTION_START(SPUT_BOOLEAN) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001276 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001277 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1278 }
1279 HANDLE_INSTRUCTION_END();
1280
1281 HANDLE_INSTRUCTION_START(SPUT_BYTE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001282 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001283 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1284 }
1285 HANDLE_INSTRUCTION_END();
1286
1287 HANDLE_INSTRUCTION_START(SPUT_CHAR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001288 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001289 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1290 }
1291 HANDLE_INSTRUCTION_END();
1292
1293 HANDLE_INSTRUCTION_START(SPUT_SHORT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001294 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001295 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1296 }
1297 HANDLE_INSTRUCTION_END();
1298
1299 HANDLE_INSTRUCTION_START(SPUT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001300 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001301 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1302 }
1303 HANDLE_INSTRUCTION_END();
1304
1305 HANDLE_INSTRUCTION_START(SPUT_WIDE) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001306 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001307 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1308 }
1309 HANDLE_INSTRUCTION_END();
1310
1311 HANDLE_INSTRUCTION_START(SPUT_OBJECT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001312 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst, inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001313 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1314 }
1315 HANDLE_INSTRUCTION_END();
1316
1317 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL) {
1318 bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001319 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001320 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1321 }
1322 HANDLE_INSTRUCTION_END();
1323
1324 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) {
1325 bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001326 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001327 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1328 }
1329 HANDLE_INSTRUCTION_END();
1330
1331 HANDLE_INSTRUCTION_START(INVOKE_SUPER) {
1332 bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001333 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001334 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1335 }
1336 HANDLE_INSTRUCTION_END();
1337
1338 HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) {
1339 bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001340 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001341 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1342 }
1343 HANDLE_INSTRUCTION_END();
1344
1345 HANDLE_INSTRUCTION_START(INVOKE_DIRECT) {
1346 bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001347 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001348 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1349 }
1350 HANDLE_INSTRUCTION_END();
1351
1352 HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) {
1353 bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001354 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001355 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1356 }
1357 HANDLE_INSTRUCTION_END();
1358
1359 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) {
1360 bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001361 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001362 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1363 }
1364 HANDLE_INSTRUCTION_END();
1365
1366 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) {
1367 bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001368 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001369 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1370 }
1371 HANDLE_INSTRUCTION_END();
1372
1373 HANDLE_INSTRUCTION_START(INVOKE_STATIC) {
1374 bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001375 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001376 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1377 }
1378 HANDLE_INSTRUCTION_END();
1379
1380 HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) {
1381 bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001382 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001383 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1384 }
1385 HANDLE_INSTRUCTION_END();
1386
1387 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) {
1388 bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001389 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001390 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1391 }
1392 HANDLE_INSTRUCTION_END();
1393
1394 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) {
1395 bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, &result_register);
Sebastien Hertzcdf2d4c2013-09-13 14:57:51 +02001396 UPDATE_HANDLER_TABLE();
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001397 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1398 }
1399 HANDLE_INSTRUCTION_END();
1400
1401 HANDLE_INSTRUCTION_START(NEG_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001402 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001403 ADVANCE(1);
1404 HANDLE_INSTRUCTION_END();
1405
1406 HANDLE_INSTRUCTION_START(NOT_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001407 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001408 ADVANCE(1);
1409 HANDLE_INSTRUCTION_END();
1410
1411 HANDLE_INSTRUCTION_START(NEG_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001412 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001413 ADVANCE(1);
1414 HANDLE_INSTRUCTION_END();
1415
1416 HANDLE_INSTRUCTION_START(NOT_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001417 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001418 ADVANCE(1);
1419 HANDLE_INSTRUCTION_END();
1420
1421 HANDLE_INSTRUCTION_START(NEG_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001422 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001423 ADVANCE(1);
1424 HANDLE_INSTRUCTION_END();
1425
1426 HANDLE_INSTRUCTION_START(NEG_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001427 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001428 ADVANCE(1);
1429 HANDLE_INSTRUCTION_END();
1430
1431 HANDLE_INSTRUCTION_START(INT_TO_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001432 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001433 ADVANCE(1);
1434 HANDLE_INSTRUCTION_END();
1435
1436 HANDLE_INSTRUCTION_START(INT_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001437 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001438 ADVANCE(1);
1439 HANDLE_INSTRUCTION_END();
1440
1441 HANDLE_INSTRUCTION_START(INT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001442 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001443 ADVANCE(1);
1444 HANDLE_INSTRUCTION_END();
1445
1446 HANDLE_INSTRUCTION_START(LONG_TO_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001447 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001448 ADVANCE(1);
1449 HANDLE_INSTRUCTION_END();
1450
1451 HANDLE_INSTRUCTION_START(LONG_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001452 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001453 ADVANCE(1);
1454 HANDLE_INSTRUCTION_END();
1455
1456 HANDLE_INSTRUCTION_START(LONG_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001457 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001458 ADVANCE(1);
1459 HANDLE_INSTRUCTION_END();
1460
1461 HANDLE_INSTRUCTION_START(FLOAT_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001462 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001463 int32_t result = art_float_to_integral<int32_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001464 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001465 ADVANCE(1);
1466 }
1467 HANDLE_INSTRUCTION_END();
1468
1469 HANDLE_INSTRUCTION_START(FLOAT_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001470 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001471 int64_t result = art_float_to_integral<int64_t, float>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001472 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001473 ADVANCE(1);
1474 }
1475 HANDLE_INSTRUCTION_END();
1476
1477 HANDLE_INSTRUCTION_START(FLOAT_TO_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001478 shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001479 ADVANCE(1);
1480 HANDLE_INSTRUCTION_END();
1481
1482 HANDLE_INSTRUCTION_START(DOUBLE_TO_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001483 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001484 int32_t result = art_float_to_integral<int32_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001485 shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001486 ADVANCE(1);
1487 }
1488 HANDLE_INSTRUCTION_END();
1489
1490 HANDLE_INSTRUCTION_START(DOUBLE_TO_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001491 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data));
Ian Rogers450dcb52013-09-20 17:36:02 -07001492 int64_t result = art_float_to_integral<int64_t, double>(val);
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001493 shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001494 ADVANCE(1);
1495 }
1496 HANDLE_INSTRUCTION_END();
1497
1498 HANDLE_INSTRUCTION_START(DOUBLE_TO_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001499 shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001500 ADVANCE(1);
1501 HANDLE_INSTRUCTION_END();
1502
1503 HANDLE_INSTRUCTION_START(INT_TO_BYTE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001504 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1505 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001506 ADVANCE(1);
1507 HANDLE_INSTRUCTION_END();
1508
1509 HANDLE_INSTRUCTION_START(INT_TO_CHAR)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001510 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1511 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001512 ADVANCE(1);
1513 HANDLE_INSTRUCTION_END();
1514
1515 HANDLE_INSTRUCTION_START(INT_TO_SHORT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001516 shadow_frame.SetVReg(inst->VRegA_12x(inst_data),
1517 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001518 ADVANCE(1);
1519 HANDLE_INSTRUCTION_END();
1520
1521 HANDLE_INSTRUCTION_START(ADD_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001522 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001523 shadow_frame.GetVReg(inst->VRegB_23x()) +
1524 shadow_frame.GetVReg(inst->VRegC_23x()));
1525 ADVANCE(2);
1526 HANDLE_INSTRUCTION_END();
1527
1528 HANDLE_INSTRUCTION_START(SUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001529 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001530 shadow_frame.GetVReg(inst->VRegB_23x()) -
1531 shadow_frame.GetVReg(inst->VRegC_23x()));
1532 ADVANCE(2);
1533 HANDLE_INSTRUCTION_END();
1534
1535 HANDLE_INSTRUCTION_START(MUL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001536 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001537 shadow_frame.GetVReg(inst->VRegB_23x()) *
1538 shadow_frame.GetVReg(inst->VRegC_23x()));
1539 ADVANCE(2);
1540 HANDLE_INSTRUCTION_END();
1541
1542 HANDLE_INSTRUCTION_START(DIV_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001543 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data),
1544 shadow_frame.GetVReg(inst->VRegB_23x()),
1545 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001546 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1547 }
1548 HANDLE_INSTRUCTION_END();
1549
1550 HANDLE_INSTRUCTION_START(REM_INT) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001551 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1552 shadow_frame.GetVReg(inst->VRegB_23x()),
1553 shadow_frame.GetVReg(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001554 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1555 }
1556 HANDLE_INSTRUCTION_END();
1557
1558 HANDLE_INSTRUCTION_START(SHL_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001559 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001560 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1561 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1562 ADVANCE(2);
1563 HANDLE_INSTRUCTION_END();
1564
1565 HANDLE_INSTRUCTION_START(SHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001566 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001567 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1568 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1569 ADVANCE(2);
1570 HANDLE_INSTRUCTION_END();
1571
1572 HANDLE_INSTRUCTION_START(USHR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001573 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001574 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1575 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1576 ADVANCE(2);
1577 HANDLE_INSTRUCTION_END();
1578
1579 HANDLE_INSTRUCTION_START(AND_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001580 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001581 shadow_frame.GetVReg(inst->VRegB_23x()) &
1582 shadow_frame.GetVReg(inst->VRegC_23x()));
1583 ADVANCE(2);
1584 HANDLE_INSTRUCTION_END();
1585
1586 HANDLE_INSTRUCTION_START(OR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001587 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001588 shadow_frame.GetVReg(inst->VRegB_23x()) |
1589 shadow_frame.GetVReg(inst->VRegC_23x()));
1590 ADVANCE(2);
1591 HANDLE_INSTRUCTION_END();
1592
1593 HANDLE_INSTRUCTION_START(XOR_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001594 shadow_frame.SetVReg(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001595 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1596 shadow_frame.GetVReg(inst->VRegC_23x()));
1597 ADVANCE(2);
1598 HANDLE_INSTRUCTION_END();
1599
1600 HANDLE_INSTRUCTION_START(ADD_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001601 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001602 shadow_frame.GetVRegLong(inst->VRegB_23x()) +
1603 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1604 ADVANCE(2);
1605 HANDLE_INSTRUCTION_END();
1606
1607 HANDLE_INSTRUCTION_START(SUB_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001608 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001609 shadow_frame.GetVRegLong(inst->VRegB_23x()) -
1610 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1611 ADVANCE(2);
1612 HANDLE_INSTRUCTION_END();
1613
1614 HANDLE_INSTRUCTION_START(MUL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001615 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001616 shadow_frame.GetVRegLong(inst->VRegB_23x()) *
1617 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1618 ADVANCE(2);
1619 HANDLE_INSTRUCTION_END();
1620
1621 HANDLE_INSTRUCTION_START(DIV_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001622 bool success = DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data),
1623 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1624 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001625 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1626 }
1627 HANDLE_INSTRUCTION_END();
1628
1629 HANDLE_INSTRUCTION_START(REM_LONG) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001630 bool success = DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data),
1631 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1632 shadow_frame.GetVRegLong(inst->VRegC_23x()));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001633 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1634 }
1635 HANDLE_INSTRUCTION_END();
1636
1637 HANDLE_INSTRUCTION_START(AND_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001638 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001639 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1640 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1641 ADVANCE(2);
1642 HANDLE_INSTRUCTION_END();
1643
1644 HANDLE_INSTRUCTION_START(OR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001645 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001646 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1647 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1648 ADVANCE(2);
1649 HANDLE_INSTRUCTION_END();
1650
1651 HANDLE_INSTRUCTION_START(XOR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001652 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001653 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1654 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1655 ADVANCE(2);
1656 HANDLE_INSTRUCTION_END();
1657
1658 HANDLE_INSTRUCTION_START(SHL_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001659 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001660 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1661 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1662 ADVANCE(2);
1663 HANDLE_INSTRUCTION_END();
1664
1665 HANDLE_INSTRUCTION_START(SHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001666 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001667 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1668 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1669 ADVANCE(2);
1670 HANDLE_INSTRUCTION_END();
1671
1672 HANDLE_INSTRUCTION_START(USHR_LONG)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001673 shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001674 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1675 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1676 ADVANCE(2);
1677 HANDLE_INSTRUCTION_END();
1678
1679 HANDLE_INSTRUCTION_START(ADD_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001680 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001681 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1682 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1683 ADVANCE(2);
1684 HANDLE_INSTRUCTION_END();
1685
1686 HANDLE_INSTRUCTION_START(SUB_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001687 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001688 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1689 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1690 ADVANCE(2);
1691 HANDLE_INSTRUCTION_END();
1692
1693 HANDLE_INSTRUCTION_START(MUL_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001694 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001695 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1696 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1697 ADVANCE(2);
1698 HANDLE_INSTRUCTION_END();
1699
1700 HANDLE_INSTRUCTION_START(DIV_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001701 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001702 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1703 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1704 ADVANCE(2);
1705 HANDLE_INSTRUCTION_END();
1706
1707 HANDLE_INSTRUCTION_START(REM_FLOAT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001708 shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001709 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1710 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1711 ADVANCE(2);
1712 HANDLE_INSTRUCTION_END();
1713
1714 HANDLE_INSTRUCTION_START(ADD_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001715 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001716 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1717 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1718 ADVANCE(2);
1719 HANDLE_INSTRUCTION_END();
1720
1721 HANDLE_INSTRUCTION_START(SUB_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001722 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001723 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1724 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1725 ADVANCE(2);
1726 HANDLE_INSTRUCTION_END();
1727
1728 HANDLE_INSTRUCTION_START(MUL_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001729 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001730 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1731 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1732 ADVANCE(2);
1733 HANDLE_INSTRUCTION_END();
1734
1735 HANDLE_INSTRUCTION_START(DIV_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001736 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001737 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1738 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1739 ADVANCE(2);
1740 HANDLE_INSTRUCTION_END();
1741
1742 HANDLE_INSTRUCTION_START(REM_DOUBLE)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001743 shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001744 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1745 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1746 ADVANCE(2);
1747 HANDLE_INSTRUCTION_END();
1748
1749 HANDLE_INSTRUCTION_START(ADD_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001750 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001751 shadow_frame.SetVReg(vregA,
1752 shadow_frame.GetVReg(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001753 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001754 ADVANCE(1);
1755 }
1756 HANDLE_INSTRUCTION_END();
1757
1758 HANDLE_INSTRUCTION_START(SUB_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001759 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001760 shadow_frame.SetVReg(vregA,
1761 shadow_frame.GetVReg(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001762 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001763 ADVANCE(1);
1764 }
1765 HANDLE_INSTRUCTION_END();
1766
1767 HANDLE_INSTRUCTION_START(MUL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001768 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001769 shadow_frame.SetVReg(vregA,
1770 shadow_frame.GetVReg(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001771 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001772 ADVANCE(1);
1773 }
1774 HANDLE_INSTRUCTION_END();
1775
1776 HANDLE_INSTRUCTION_START(DIV_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001777 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001778 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001779 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001780 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1781 }
1782 HANDLE_INSTRUCTION_END();
1783
1784 HANDLE_INSTRUCTION_START(REM_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001785 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001786 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001787 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001788 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1789 }
1790 HANDLE_INSTRUCTION_END();
1791
1792 HANDLE_INSTRUCTION_START(SHL_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001793 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001794 shadow_frame.SetVReg(vregA,
1795 shadow_frame.GetVReg(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001796 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001797 ADVANCE(1);
1798 }
1799 HANDLE_INSTRUCTION_END();
1800
1801 HANDLE_INSTRUCTION_START(SHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001802 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001803 shadow_frame.SetVReg(vregA,
1804 shadow_frame.GetVReg(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001805 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001806 ADVANCE(1);
1807 }
1808 HANDLE_INSTRUCTION_END();
1809
1810 HANDLE_INSTRUCTION_START(USHR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001811 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001812 shadow_frame.SetVReg(vregA,
1813 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001814 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001815 ADVANCE(1);
1816 }
1817 HANDLE_INSTRUCTION_END();
1818
1819 HANDLE_INSTRUCTION_START(AND_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001820 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001821 shadow_frame.SetVReg(vregA,
1822 shadow_frame.GetVReg(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001823 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001824 ADVANCE(1);
1825 }
1826 HANDLE_INSTRUCTION_END();
1827
1828 HANDLE_INSTRUCTION_START(OR_INT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001829 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001830 shadow_frame.SetVReg(vregA,
1831 shadow_frame.GetVReg(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001832 shadow_frame.GetVReg(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001833 ADVANCE(1);
1834 }
1835 HANDLE_INSTRUCTION_END();
1836
1837 HANDLE_INSTRUCTION_START(XOR_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(ADD_LONG_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.SetVRegLong(vregA,
1849 shadow_frame.GetVRegLong(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001850 shadow_frame.GetVRegLong(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(SUB_LONG_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.SetVRegLong(vregA,
1858 shadow_frame.GetVRegLong(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001859 shadow_frame.GetVRegLong(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(MUL_LONG_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 shadow_frame.SetVRegLong(vregA,
1867 shadow_frame.GetVRegLong(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001868 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001869 ADVANCE(1);
1870 }
1871 HANDLE_INSTRUCTION_END();
1872
1873 HANDLE_INSTRUCTION_START(DIV_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001874 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001875 bool success = DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001876 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001877 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1878 }
1879 HANDLE_INSTRUCTION_END();
1880
1881 HANDLE_INSTRUCTION_START(REM_LONG_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001882 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001883 bool success = DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001884 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001885 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1886 }
1887 HANDLE_INSTRUCTION_END();
1888
1889 HANDLE_INSTRUCTION_START(AND_LONG_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.SetVRegLong(vregA,
1892 shadow_frame.GetVRegLong(vregA) &
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001893 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001894 ADVANCE(1);
1895 }
1896 HANDLE_INSTRUCTION_END();
1897
1898 HANDLE_INSTRUCTION_START(OR_LONG_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.SetVRegLong(vregA,
1901 shadow_frame.GetVRegLong(vregA) |
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001902 shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001903 ADVANCE(1);
1904 }
1905 HANDLE_INSTRUCTION_END();
1906
1907 HANDLE_INSTRUCTION_START(XOR_LONG_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.SetVRegLong(vregA,
1910 shadow_frame.GetVRegLong(vregA) ^
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001911 shadow_frame.GetVRegLong(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(SHL_LONG_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.SetVRegLong(vregA,
1919 shadow_frame.GetVRegLong(vregA) <<
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001920 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001921 ADVANCE(1);
1922 }
1923 HANDLE_INSTRUCTION_END();
1924
1925 HANDLE_INSTRUCTION_START(SHR_LONG_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.SetVRegLong(vregA,
1928 shadow_frame.GetVRegLong(vregA) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001929 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001930 ADVANCE(1);
1931 }
1932 HANDLE_INSTRUCTION_END();
1933
1934 HANDLE_INSTRUCTION_START(USHR_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 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001938 (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001939 ADVANCE(1);
1940 }
1941 HANDLE_INSTRUCTION_END();
1942
1943 HANDLE_INSTRUCTION_START(ADD_FLOAT_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.SetVRegFloat(vregA,
1946 shadow_frame.GetVRegFloat(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001947 shadow_frame.GetVRegFloat(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(SUB_FLOAT_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.SetVRegFloat(vregA,
1955 shadow_frame.GetVRegFloat(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001956 shadow_frame.GetVRegFloat(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(MUL_FLOAT_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 shadow_frame.SetVRegFloat(vregA,
1964 shadow_frame.GetVRegFloat(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001965 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001966 ADVANCE(1);
1967 }
1968 HANDLE_INSTRUCTION_END();
1969
1970 HANDLE_INSTRUCTION_START(DIV_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001971 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001972 shadow_frame.SetVRegFloat(vregA,
1973 shadow_frame.GetVRegFloat(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001974 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001975 ADVANCE(1);
1976 }
1977 HANDLE_INSTRUCTION_END();
1978
1979 HANDLE_INSTRUCTION_START(REM_FLOAT_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001980 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001981 shadow_frame.SetVRegFloat(vregA,
1982 fmodf(shadow_frame.GetVRegFloat(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001983 shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001984 ADVANCE(1);
1985 }
1986 HANDLE_INSTRUCTION_END();
1987
1988 HANDLE_INSTRUCTION_START(ADD_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001989 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001990 shadow_frame.SetVRegDouble(vregA,
1991 shadow_frame.GetVRegDouble(vregA) +
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001992 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001993 ADVANCE(1);
1994 }
1995 HANDLE_INSTRUCTION_END();
1996
1997 HANDLE_INSTRUCTION_START(SUB_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02001998 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001999 shadow_frame.SetVRegDouble(vregA,
2000 shadow_frame.GetVRegDouble(vregA) -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002001 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002002 ADVANCE(1);
2003 }
2004 HANDLE_INSTRUCTION_END();
2005
2006 HANDLE_INSTRUCTION_START(MUL_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002007 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002008 shadow_frame.SetVRegDouble(vregA,
2009 shadow_frame.GetVRegDouble(vregA) *
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002010 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002011 ADVANCE(1);
2012 }
2013 HANDLE_INSTRUCTION_END();
2014
2015 HANDLE_INSTRUCTION_START(DIV_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002016 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002017 shadow_frame.SetVRegDouble(vregA,
2018 shadow_frame.GetVRegDouble(vregA) /
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002019 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002020 ADVANCE(1);
2021 }
2022 HANDLE_INSTRUCTION_END();
2023
2024 HANDLE_INSTRUCTION_START(REM_DOUBLE_2ADDR) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002025 uint32_t vregA = inst->VRegA_12x(inst_data);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002026 shadow_frame.SetVRegDouble(vregA,
2027 fmod(shadow_frame.GetVRegDouble(vregA),
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002028 shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002029 ADVANCE(1);
2030 }
2031 HANDLE_INSTRUCTION_END();
2032
2033 HANDLE_INSTRUCTION_START(ADD_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002034 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2035 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) +
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002036 inst->VRegC_22s());
2037 ADVANCE(2);
2038 HANDLE_INSTRUCTION_END();
2039
2040 HANDLE_INSTRUCTION_START(RSUB_INT)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002041 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002042 inst->VRegC_22s() -
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002043 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)));
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002044 ADVANCE(2);
2045 HANDLE_INSTRUCTION_END();
2046
2047 HANDLE_INSTRUCTION_START(MUL_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002048 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2049 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) *
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002050 inst->VRegC_22s());
2051 ADVANCE(2);
2052 HANDLE_INSTRUCTION_END();
2053
2054 HANDLE_INSTRUCTION_START(DIV_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002055 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data),
2056 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002057 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2058 }
2059 HANDLE_INSTRUCTION_END();
2060
2061 HANDLE_INSTRUCTION_START(REM_INT_LIT16) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002062 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data),
2063 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), inst->VRegC_22s());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002064 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2065 }
2066 HANDLE_INSTRUCTION_END();
2067
2068 HANDLE_INSTRUCTION_START(AND_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002069 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2070 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) &
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002071 inst->VRegC_22s());
2072 ADVANCE(2);
2073 HANDLE_INSTRUCTION_END();
2074
2075 HANDLE_INSTRUCTION_START(OR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002076 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2077 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) |
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002078 inst->VRegC_22s());
2079 ADVANCE(2);
2080 HANDLE_INSTRUCTION_END();
2081
2082 HANDLE_INSTRUCTION_START(XOR_INT_LIT16)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002083 shadow_frame.SetVReg(inst->VRegA_22s(inst_data),
2084 shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002085 inst->VRegC_22s());
2086 ADVANCE(2);
2087 HANDLE_INSTRUCTION_END();
2088
2089 HANDLE_INSTRUCTION_START(ADD_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002090 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002091 shadow_frame.GetVReg(inst->VRegB_22b()) +
2092 inst->VRegC_22b());
2093 ADVANCE(2);
2094 HANDLE_INSTRUCTION_END();
2095
2096 HANDLE_INSTRUCTION_START(RSUB_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002097 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002098 inst->VRegC_22b() -
2099 shadow_frame.GetVReg(inst->VRegB_22b()));
2100 ADVANCE(2);
2101 HANDLE_INSTRUCTION_END();
2102
2103 HANDLE_INSTRUCTION_START(MUL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002104 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002105 shadow_frame.GetVReg(inst->VRegB_22b()) *
2106 inst->VRegC_22b());
2107 ADVANCE(2);
2108 HANDLE_INSTRUCTION_END();
2109
2110 HANDLE_INSTRUCTION_START(DIV_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002111 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data),
2112 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002113 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2114 }
2115 HANDLE_INSTRUCTION_END();
2116
2117 HANDLE_INSTRUCTION_START(REM_INT_LIT8) {
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002118 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data),
2119 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002120 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2121 }
2122 HANDLE_INSTRUCTION_END();
2123
2124 HANDLE_INSTRUCTION_START(AND_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002125 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002126 shadow_frame.GetVReg(inst->VRegB_22b()) &
2127 inst->VRegC_22b());
2128 ADVANCE(2);
2129 HANDLE_INSTRUCTION_END();
2130
2131 HANDLE_INSTRUCTION_START(OR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002132 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002133 shadow_frame.GetVReg(inst->VRegB_22b()) |
2134 inst->VRegC_22b());
2135 ADVANCE(2);
2136 HANDLE_INSTRUCTION_END();
2137
2138 HANDLE_INSTRUCTION_START(XOR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002139 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002140 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2141 inst->VRegC_22b());
2142 ADVANCE(2);
2143 HANDLE_INSTRUCTION_END();
2144
2145 HANDLE_INSTRUCTION_START(SHL_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002146 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002147 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2148 (inst->VRegC_22b() & 0x1f));
2149 ADVANCE(2);
2150 HANDLE_INSTRUCTION_END();
2151
2152 HANDLE_INSTRUCTION_START(SHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002153 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002154 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2155 (inst->VRegC_22b() & 0x1f));
2156 ADVANCE(2);
2157 HANDLE_INSTRUCTION_END();
2158
2159 HANDLE_INSTRUCTION_START(USHR_INT_LIT8)
Sebastien Hertz3b588e02013-09-11 14:33:18 +02002160 shadow_frame.SetVReg(inst->VRegA_22b(inst_data),
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002161 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2162 (inst->VRegC_22b() & 0x1f));
2163 ADVANCE(2);
2164 HANDLE_INSTRUCTION_END();
2165
2166 HANDLE_INSTRUCTION_START(UNUSED_3E)
2167 UnexpectedOpcode(inst, mh);
2168 HANDLE_INSTRUCTION_END();
2169
2170 HANDLE_INSTRUCTION_START(UNUSED_3F)
2171 UnexpectedOpcode(inst, mh);
2172 HANDLE_INSTRUCTION_END();
2173
2174 HANDLE_INSTRUCTION_START(UNUSED_40)
2175 UnexpectedOpcode(inst, mh);
2176 HANDLE_INSTRUCTION_END();
2177
2178 HANDLE_INSTRUCTION_START(UNUSED_41)
2179 UnexpectedOpcode(inst, mh);
2180 HANDLE_INSTRUCTION_END();
2181
2182 HANDLE_INSTRUCTION_START(UNUSED_42)
2183 UnexpectedOpcode(inst, mh);
2184 HANDLE_INSTRUCTION_END();
2185
2186 HANDLE_INSTRUCTION_START(UNUSED_43)
2187 UnexpectedOpcode(inst, mh);
2188 HANDLE_INSTRUCTION_END();
2189
2190 HANDLE_INSTRUCTION_START(UNUSED_79)
2191 UnexpectedOpcode(inst, mh);
2192 HANDLE_INSTRUCTION_END();
2193
2194 HANDLE_INSTRUCTION_START(UNUSED_7A)
2195 UnexpectedOpcode(inst, mh);
2196 HANDLE_INSTRUCTION_END();
2197
2198 HANDLE_INSTRUCTION_START(UNUSED_EB)
2199 UnexpectedOpcode(inst, mh);
2200 HANDLE_INSTRUCTION_END();
2201
2202 HANDLE_INSTRUCTION_START(UNUSED_EC)
2203 UnexpectedOpcode(inst, mh);
2204 HANDLE_INSTRUCTION_END();
2205
2206 HANDLE_INSTRUCTION_START(UNUSED_ED)
2207 UnexpectedOpcode(inst, mh);
2208 HANDLE_INSTRUCTION_END();
2209
2210 HANDLE_INSTRUCTION_START(UNUSED_EE)
2211 UnexpectedOpcode(inst, mh);
2212 HANDLE_INSTRUCTION_END();
2213
2214 HANDLE_INSTRUCTION_START(UNUSED_EF)
2215 UnexpectedOpcode(inst, mh);
2216 HANDLE_INSTRUCTION_END();
2217
2218 HANDLE_INSTRUCTION_START(UNUSED_F0)
2219 UnexpectedOpcode(inst, mh);
2220 HANDLE_INSTRUCTION_END();
2221
2222 HANDLE_INSTRUCTION_START(UNUSED_F1)
2223 UnexpectedOpcode(inst, mh);
2224 HANDLE_INSTRUCTION_END();
2225
2226 HANDLE_INSTRUCTION_START(UNUSED_F2)
2227 UnexpectedOpcode(inst, mh);
2228 HANDLE_INSTRUCTION_END();
2229
2230 HANDLE_INSTRUCTION_START(UNUSED_F3)
2231 UnexpectedOpcode(inst, mh);
2232 HANDLE_INSTRUCTION_END();
2233
2234 HANDLE_INSTRUCTION_START(UNUSED_F4)
2235 UnexpectedOpcode(inst, mh);
2236 HANDLE_INSTRUCTION_END();
2237
2238 HANDLE_INSTRUCTION_START(UNUSED_F5)
2239 UnexpectedOpcode(inst, mh);
2240 HANDLE_INSTRUCTION_END();
2241
2242 HANDLE_INSTRUCTION_START(UNUSED_F6)
2243 UnexpectedOpcode(inst, mh);
2244 HANDLE_INSTRUCTION_END();
2245
2246 HANDLE_INSTRUCTION_START(UNUSED_F7)
2247 UnexpectedOpcode(inst, mh);
2248 HANDLE_INSTRUCTION_END();
2249
2250 HANDLE_INSTRUCTION_START(UNUSED_F8)
2251 UnexpectedOpcode(inst, mh);
2252 HANDLE_INSTRUCTION_END();
2253
2254 HANDLE_INSTRUCTION_START(UNUSED_F9)
2255 UnexpectedOpcode(inst, mh);
2256 HANDLE_INSTRUCTION_END();
2257
2258 HANDLE_INSTRUCTION_START(UNUSED_FA)
2259 UnexpectedOpcode(inst, mh);
2260 HANDLE_INSTRUCTION_END();
2261
2262 HANDLE_INSTRUCTION_START(UNUSED_FB)
2263 UnexpectedOpcode(inst, mh);
2264 HANDLE_INSTRUCTION_END();
2265
2266 HANDLE_INSTRUCTION_START(UNUSED_FC)
2267 UnexpectedOpcode(inst, mh);
2268 HANDLE_INSTRUCTION_END();
2269
2270 HANDLE_INSTRUCTION_START(UNUSED_FD)
2271 UnexpectedOpcode(inst, mh);
2272 HANDLE_INSTRUCTION_END();
2273
2274 HANDLE_INSTRUCTION_START(UNUSED_FE)
2275 UnexpectedOpcode(inst, mh);
2276 HANDLE_INSTRUCTION_END();
2277
2278 HANDLE_INSTRUCTION_START(UNUSED_FF)
2279 UnexpectedOpcode(inst, mh);
2280 HANDLE_INSTRUCTION_END();
2281
2282 exception_pending_label: {
2283 CHECK(self->IsExceptionPending());
Sebastien Hertz1eda2262013-09-09 16:53:14 +02002284 if (UNLIKELY(self->TestAllFlags())) {
2285 CheckSuspend(self);
2286 }
Sebastien Hertz947ff082013-09-17 14:10:13 +02002287 Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_);
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002288 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc,
Sebastien Hertz947ff082013-09-17 14:10:13 +02002289 this_object,
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002290 instrumentation);
2291 if (found_dex_pc == DexFile::kDexNoIndex) {
2292 return JValue(); /* Handled in caller. */
2293 } else {
2294 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc);
2295 ADVANCE(displacement);
2296 }
2297 }
2298
2299 // Create alternative instruction handlers dedicated to instrumentation.
Sebastien Hertz947ff082013-09-17 14:10:13 +02002300#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
2301 instrumentation_op_##code: { \
2302 instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), \
2303 shadow_frame.GetMethod(), dex_pc); \
2304 goto *handlersTable[Instruction::code]; \
Sebastien Hertz8ece0502013-08-07 11:26:41 +02002305 }
2306#include "dex_instruction_list.h"
2307 DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER)
2308#undef DEX_INSTRUCTION_LIST
2309#undef INSTRUMENTATION_INSTRUCTION_HANDLER
2310} // NOLINT(readability/fn_size)
2311
2312// Explicit definitions of ExecuteGotoImpl.
2313template JValue ExecuteGotoImpl<true>(Thread* self, MethodHelper& mh,
2314 const DexFile::CodeItem* code_item,
2315 ShadowFrame& shadow_frame, JValue result_register);
2316template JValue ExecuteGotoImpl<false>(Thread* self, MethodHelper& mh,
2317 const DexFile::CodeItem* code_item,
2318 ShadowFrame& shadow_frame, JValue result_register);
2319
2320} // namespace interpreter
2321} // namespace art