Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
Igor Murashkin | 6918bf1 | 2015-09-27 19:19:06 -0700 | [diff] [blame] | 17 | #include "base/stl_util.h" // MakeUnique |
Alex Light | eb7c144 | 2015-08-31 13:17:42 -0700 | [diff] [blame] | 18 | #include "experimental_flags.h" |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 19 | #include "interpreter_common.h" |
Nicolas Geoffray | b331feb | 2016-02-05 16:51:53 +0000 | [diff] [blame] | 20 | #include "jit/jit.h" |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 21 | #include "safe_math.h" |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 22 | |
Igor Murashkin | 6918bf1 | 2015-09-27 19:19:06 -0700 | [diff] [blame] | 23 | #include <memory> // std::unique_ptr |
| 24 | |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 25 | namespace art { |
| 26 | namespace interpreter { |
| 27 | |
| 28 | #define HANDLE_PENDING_EXCEPTION() \ |
| 29 | do { \ |
Sebastien Hertz | 82aeddb | 2014-05-20 20:09:45 +0200 | [diff] [blame] | 30 | DCHECK(self->IsExceptionPending()); \ |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 31 | self->AllowThreadSuspension(); \ |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 32 | uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, \ |
| 33 | inst->GetDexPc(insns), \ |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 34 | instrumentation); \ |
| 35 | if (found_dex_pc == DexFile::kDexNoIndex) { \ |
Andreas Gampe | 03ec930 | 2015-08-27 17:41:47 -0700 | [diff] [blame] | 36 | /* Structured locking is to be enforced for abnormal termination, too. */ \ |
| 37 | shadow_frame.GetLockCountData(). \ |
| 38 | CheckAllMonitorsReleasedOrThrow<do_assignability_check>(self); \ |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 39 | if (interpret_one_instruction) { \ |
| 40 | shadow_frame.SetDexPC(DexFile::kDexNoIndex); \ |
| 41 | } \ |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 42 | return JValue(); /* Handled in caller. */ \ |
| 43 | } else { \ |
| 44 | int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc); \ |
| 45 | inst = inst->RelativeAt(displacement); \ |
| 46 | } \ |
| 47 | } while (false) |
| 48 | |
| 49 | #define POSSIBLY_HANDLE_PENDING_EXCEPTION(_is_exception_pending, _next_function) \ |
| 50 | do { \ |
| 51 | if (UNLIKELY(_is_exception_pending)) { \ |
| 52 | HANDLE_PENDING_EXCEPTION(); \ |
| 53 | } else { \ |
| 54 | inst = inst->_next_function(); \ |
| 55 | } \ |
| 56 | } while (false) |
| 57 | |
Andreas Gampe | 03ec930 | 2015-08-27 17:41:47 -0700 | [diff] [blame] | 58 | #define HANDLE_MONITOR_CHECKS() \ |
| 59 | if (!shadow_frame.GetLockCountData(). \ |
| 60 | CheckAllMonitorsReleasedOrThrow<do_assignability_check>(self)) { \ |
| 61 | HANDLE_PENDING_EXCEPTION(); \ |
| 62 | } |
| 63 | |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 64 | // Code to run before each dex instruction. |
Sebastien Hertz | 8379b22 | 2014-02-24 17:38:15 +0100 | [diff] [blame] | 65 | #define PREAMBLE() \ |
| 66 | do { \ |
Sebastien Hertz | 9d6bf69 | 2015-04-10 12:12:33 +0200 | [diff] [blame] | 67 | if (UNLIKELY(instrumentation->HasDexPcListeners())) { \ |
Sebastien Hertz | 8379b22 | 2014-02-24 17:38:15 +0100 | [diff] [blame] | 68 | instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), \ |
| 69 | shadow_frame.GetMethod(), dex_pc); \ |
| 70 | } \ |
| 71 | } while (false) |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 72 | |
Nicolas Geoffray | b331feb | 2016-02-05 16:51:53 +0000 | [diff] [blame] | 73 | #define BRANCH_INSTRUMENTATION(offset) \ |
| 74 | do { \ |
| 75 | ArtMethod* method = shadow_frame.GetMethod(); \ |
| 76 | instrumentation->Branch(self, method, dex_pc, offset); \ |
| 77 | JValue result; \ |
| 78 | if (jit::Jit::MaybeDoOnStackReplacement(self, method, dex_pc, offset, &result)) { \ |
| 79 | return result; \ |
| 80 | } \ |
Nicolas Geoffray | 3108daf | 2015-11-24 16:32:33 +0000 | [diff] [blame] | 81 | } while (false) |
| 82 | |
Igor Murashkin | 158f35c | 2015-06-10 15:55:30 -0700 | [diff] [blame] | 83 | static bool IsExperimentalInstructionEnabled(const Instruction *inst) { |
| 84 | DCHECK(inst->IsExperimental()); |
Alex Light | eb7c144 | 2015-08-31 13:17:42 -0700 | [diff] [blame] | 85 | return Runtime::Current()->AreExperimentalFlagsEnabled(ExperimentalFlags::kLambdas); |
Igor Murashkin | 158f35c | 2015-06-10 15:55:30 -0700 | [diff] [blame] | 86 | } |
| 87 | |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 88 | template<bool do_access_check, bool transaction_active> |
Ian Rogers | e94652f | 2014-12-02 11:13:19 -0800 | [diff] [blame] | 89 | JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 90 | ShadowFrame& shadow_frame, JValue result_register, |
| 91 | bool interpret_one_instruction) { |
Igor Murashkin | c449e8b | 2015-06-10 15:56:42 -0700 | [diff] [blame] | 92 | constexpr bool do_assignability_check = do_access_check; |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 93 | if (UNLIKELY(!shadow_frame.HasReferenceArray())) { |
| 94 | LOG(FATAL) << "Invalid shadow frame for interpreter use"; |
| 95 | return JValue(); |
| 96 | } |
| 97 | self->VerifyStack(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 98 | |
| 99 | uint32_t dex_pc = shadow_frame.GetDexPC(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 100 | const auto* const instrumentation = Runtime::Current()->GetInstrumentation(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 101 | const uint16_t* const insns = code_item->insns_; |
| 102 | const Instruction* inst = Instruction::At(insns + dex_pc); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 103 | uint16_t inst_data; |
Igor Murashkin | 6918bf1 | 2015-09-27 19:19:06 -0700 | [diff] [blame] | 104 | |
| 105 | // TODO: collapse capture-variable+create-lambda into one opcode, then we won't need |
| 106 | // to keep this live for the scope of the entire function call. |
| 107 | std::unique_ptr<lambda::ClosureBuilder> lambda_closure_builder; |
| 108 | size_t lambda_captured_variable_index = 0; |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 109 | do { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 110 | dex_pc = inst->GetDexPc(insns); |
| 111 | shadow_frame.SetDexPC(dex_pc); |
Ian Rogers | e94652f | 2014-12-02 11:13:19 -0800 | [diff] [blame] | 112 | TraceExecution(shadow_frame, inst, dex_pc); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 113 | inst_data = inst->Fetch16(0); |
| 114 | switch (inst->Opcode(inst_data)) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 115 | case Instruction::NOP: |
| 116 | PREAMBLE(); |
| 117 | inst = inst->Next_1xx(); |
| 118 | break; |
| 119 | case Instruction::MOVE: |
| 120 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 121 | shadow_frame.SetVReg(inst->VRegA_12x(inst_data), |
| 122 | shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 123 | inst = inst->Next_1xx(); |
| 124 | break; |
| 125 | case Instruction::MOVE_FROM16: |
| 126 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 127 | shadow_frame.SetVReg(inst->VRegA_22x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 128 | shadow_frame.GetVReg(inst->VRegB_22x())); |
| 129 | inst = inst->Next_2xx(); |
| 130 | break; |
| 131 | case Instruction::MOVE_16: |
| 132 | PREAMBLE(); |
| 133 | shadow_frame.SetVReg(inst->VRegA_32x(), |
| 134 | shadow_frame.GetVReg(inst->VRegB_32x())); |
| 135 | inst = inst->Next_3xx(); |
| 136 | break; |
| 137 | case Instruction::MOVE_WIDE: |
| 138 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 139 | shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), |
| 140 | shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 141 | inst = inst->Next_1xx(); |
| 142 | break; |
| 143 | case Instruction::MOVE_WIDE_FROM16: |
| 144 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 145 | shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 146 | shadow_frame.GetVRegLong(inst->VRegB_22x())); |
| 147 | inst = inst->Next_2xx(); |
| 148 | break; |
| 149 | case Instruction::MOVE_WIDE_16: |
| 150 | PREAMBLE(); |
| 151 | shadow_frame.SetVRegLong(inst->VRegA_32x(), |
| 152 | shadow_frame.GetVRegLong(inst->VRegB_32x())); |
| 153 | inst = inst->Next_3xx(); |
| 154 | break; |
| 155 | case Instruction::MOVE_OBJECT: |
| 156 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 157 | shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data), |
| 158 | shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 159 | inst = inst->Next_1xx(); |
| 160 | break; |
| 161 | case Instruction::MOVE_OBJECT_FROM16: |
| 162 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 163 | shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 164 | shadow_frame.GetVRegReference(inst->VRegB_22x())); |
| 165 | inst = inst->Next_2xx(); |
| 166 | break; |
| 167 | case Instruction::MOVE_OBJECT_16: |
| 168 | PREAMBLE(); |
| 169 | shadow_frame.SetVRegReference(inst->VRegA_32x(), |
| 170 | shadow_frame.GetVRegReference(inst->VRegB_32x())); |
| 171 | inst = inst->Next_3xx(); |
| 172 | break; |
| 173 | case Instruction::MOVE_RESULT: |
| 174 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 175 | shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI()); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 176 | inst = inst->Next_1xx(); |
| 177 | break; |
| 178 | case Instruction::MOVE_RESULT_WIDE: |
| 179 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 180 | shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ()); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 181 | inst = inst->Next_1xx(); |
| 182 | break; |
| 183 | case Instruction::MOVE_RESULT_OBJECT: |
| 184 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 185 | shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL()); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 186 | inst = inst->Next_1xx(); |
| 187 | break; |
| 188 | case Instruction::MOVE_EXCEPTION: { |
| 189 | PREAMBLE(); |
Nicolas Geoffray | 14691c5 | 2015-03-05 10:40:17 +0000 | [diff] [blame] | 190 | Throwable* exception = self->GetException(); |
Sebastien Hertz | 270a0e1 | 2015-01-16 19:49:09 +0100 | [diff] [blame] | 191 | DCHECK(exception != nullptr) << "No pending exception on MOVE_EXCEPTION instruction"; |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 192 | shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception); |
Sebastien Hertz | 5c00490 | 2014-05-21 10:07:42 +0200 | [diff] [blame] | 193 | self->ClearException(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 194 | inst = inst->Next_1xx(); |
| 195 | break; |
| 196 | } |
Mathieu Chartier | d7cbf8a | 2015-03-19 12:43:20 -0700 | [diff] [blame] | 197 | case Instruction::RETURN_VOID_NO_BARRIER: { |
Sebastien Hertz | 9d6bf69 | 2015-04-10 12:12:33 +0200 | [diff] [blame] | 198 | PREAMBLE(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 199 | JValue result; |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 200 | self->AllowThreadSuspension(); |
Andreas Gampe | 03ec930 | 2015-08-27 17:41:47 -0700 | [diff] [blame] | 201 | HANDLE_MONITOR_CHECKS(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 202 | if (UNLIKELY(instrumentation->HasMethodExitListeners())) { |
Sebastien Hertz | 947ff08 | 2013-09-17 14:10:13 +0200 | [diff] [blame] | 203 | instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 204 | shadow_frame.GetMethod(), inst->GetDexPc(insns), |
| 205 | result); |
| 206 | } |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 207 | if (interpret_one_instruction) { |
| 208 | shadow_frame.SetDexPC(DexFile::kDexNoIndex); |
| 209 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 210 | return result; |
| 211 | } |
Mathieu Chartier | d7cbf8a | 2015-03-19 12:43:20 -0700 | [diff] [blame] | 212 | case Instruction::RETURN_VOID: { |
Sebastien Hertz | 9d6bf69 | 2015-04-10 12:12:33 +0200 | [diff] [blame] | 213 | PREAMBLE(); |
Hans Boehm | 3035961 | 2014-05-21 17:46:23 -0700 | [diff] [blame] | 214 | QuasiAtomic::ThreadFenceForConstructor(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 215 | JValue result; |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 216 | self->AllowThreadSuspension(); |
Andreas Gampe | 03ec930 | 2015-08-27 17:41:47 -0700 | [diff] [blame] | 217 | HANDLE_MONITOR_CHECKS(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 218 | if (UNLIKELY(instrumentation->HasMethodExitListeners())) { |
Sebastien Hertz | 947ff08 | 2013-09-17 14:10:13 +0200 | [diff] [blame] | 219 | instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 220 | shadow_frame.GetMethod(), inst->GetDexPc(insns), |
| 221 | result); |
| 222 | } |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 223 | if (interpret_one_instruction) { |
| 224 | shadow_frame.SetDexPC(DexFile::kDexNoIndex); |
| 225 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 226 | return result; |
| 227 | } |
| 228 | case Instruction::RETURN: { |
Sebastien Hertz | 9d6bf69 | 2015-04-10 12:12:33 +0200 | [diff] [blame] | 229 | PREAMBLE(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 230 | JValue result; |
| 231 | result.SetJ(0); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 232 | result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data))); |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 233 | self->AllowThreadSuspension(); |
Andreas Gampe | 03ec930 | 2015-08-27 17:41:47 -0700 | [diff] [blame] | 234 | HANDLE_MONITOR_CHECKS(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 235 | if (UNLIKELY(instrumentation->HasMethodExitListeners())) { |
Sebastien Hertz | 947ff08 | 2013-09-17 14:10:13 +0200 | [diff] [blame] | 236 | instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 237 | shadow_frame.GetMethod(), inst->GetDexPc(insns), |
| 238 | result); |
| 239 | } |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 240 | if (interpret_one_instruction) { |
| 241 | shadow_frame.SetDexPC(DexFile::kDexNoIndex); |
| 242 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 243 | return result; |
| 244 | } |
| 245 | case Instruction::RETURN_WIDE: { |
Sebastien Hertz | 9d6bf69 | 2015-04-10 12:12:33 +0200 | [diff] [blame] | 246 | PREAMBLE(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 247 | JValue result; |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 248 | result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data))); |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 249 | self->AllowThreadSuspension(); |
Andreas Gampe | 03ec930 | 2015-08-27 17:41:47 -0700 | [diff] [blame] | 250 | HANDLE_MONITOR_CHECKS(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 251 | if (UNLIKELY(instrumentation->HasMethodExitListeners())) { |
Sebastien Hertz | 947ff08 | 2013-09-17 14:10:13 +0200 | [diff] [blame] | 252 | instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 253 | shadow_frame.GetMethod(), inst->GetDexPc(insns), |
| 254 | result); |
| 255 | } |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 256 | if (interpret_one_instruction) { |
| 257 | shadow_frame.SetDexPC(DexFile::kDexNoIndex); |
| 258 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 259 | return result; |
| 260 | } |
| 261 | case Instruction::RETURN_OBJECT: { |
Sebastien Hertz | 9d6bf69 | 2015-04-10 12:12:33 +0200 | [diff] [blame] | 262 | PREAMBLE(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 263 | JValue result; |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 264 | self->AllowThreadSuspension(); |
Andreas Gampe | 03ec930 | 2015-08-27 17:41:47 -0700 | [diff] [blame] | 265 | HANDLE_MONITOR_CHECKS(); |
Mathieu Chartier | bfd9a43 | 2014-05-21 17:43:44 -0700 | [diff] [blame] | 266 | const size_t ref_idx = inst->VRegA_11x(inst_data); |
| 267 | Object* obj_result = shadow_frame.GetVRegReference(ref_idx); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 268 | if (do_assignability_check && obj_result != nullptr) { |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 269 | size_t pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize(); |
| 270 | Class* return_type = shadow_frame.GetMethod()->GetReturnType(true /* resolve */, |
| 271 | pointer_size); |
Mathieu Chartier | bfd9a43 | 2014-05-21 17:43:44 -0700 | [diff] [blame] | 272 | // Re-load since it might have moved. |
| 273 | obj_result = shadow_frame.GetVRegReference(ref_idx); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 274 | if (return_type == nullptr) { |
Jeff Hao | a3faaf4 | 2013-09-03 19:07:00 -0700 | [diff] [blame] | 275 | // Return the pending exception. |
| 276 | HANDLE_PENDING_EXCEPTION(); |
| 277 | } |
| 278 | if (!obj_result->VerifierInstanceOf(return_type)) { |
| 279 | // This should never happen. |
Ian Rogers | 1ff3c98 | 2014-08-12 02:30:58 -0700 | [diff] [blame] | 280 | std::string temp1, temp2; |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 281 | self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;", |
Jeff Hao | a3faaf4 | 2013-09-03 19:07:00 -0700 | [diff] [blame] | 282 | "Returning '%s' that is not instance of return type '%s'", |
Ian Rogers | 1ff3c98 | 2014-08-12 02:30:58 -0700 | [diff] [blame] | 283 | obj_result->GetClass()->GetDescriptor(&temp1), |
| 284 | return_type->GetDescriptor(&temp2)); |
Jeff Hao | a3faaf4 | 2013-09-03 19:07:00 -0700 | [diff] [blame] | 285 | HANDLE_PENDING_EXCEPTION(); |
| 286 | } |
| 287 | } |
Mathieu Chartier | bfd9a43 | 2014-05-21 17:43:44 -0700 | [diff] [blame] | 288 | result.SetL(obj_result); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 289 | if (UNLIKELY(instrumentation->HasMethodExitListeners())) { |
Sebastien Hertz | 947ff08 | 2013-09-17 14:10:13 +0200 | [diff] [blame] | 290 | instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 291 | shadow_frame.GetMethod(), inst->GetDexPc(insns), |
| 292 | result); |
| 293 | } |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 294 | if (interpret_one_instruction) { |
| 295 | shadow_frame.SetDexPC(DexFile::kDexNoIndex); |
| 296 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 297 | return result; |
| 298 | } |
| 299 | case Instruction::CONST_4: { |
| 300 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 301 | uint4_t dst = inst->VRegA_11n(inst_data); |
| 302 | int4_t val = inst->VRegB_11n(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 303 | shadow_frame.SetVReg(dst, val); |
| 304 | if (val == 0) { |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 305 | shadow_frame.SetVRegReference(dst, nullptr); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 306 | } |
| 307 | inst = inst->Next_1xx(); |
| 308 | break; |
| 309 | } |
| 310 | case Instruction::CONST_16: { |
| 311 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 312 | uint8_t dst = inst->VRegA_21s(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 313 | int16_t val = inst->VRegB_21s(); |
| 314 | shadow_frame.SetVReg(dst, val); |
| 315 | if (val == 0) { |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 316 | shadow_frame.SetVRegReference(dst, nullptr); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 317 | } |
| 318 | inst = inst->Next_2xx(); |
| 319 | break; |
| 320 | } |
| 321 | case Instruction::CONST: { |
| 322 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 323 | uint8_t dst = inst->VRegA_31i(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 324 | int32_t val = inst->VRegB_31i(); |
| 325 | shadow_frame.SetVReg(dst, val); |
| 326 | if (val == 0) { |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 327 | shadow_frame.SetVRegReference(dst, nullptr); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 328 | } |
| 329 | inst = inst->Next_3xx(); |
| 330 | break; |
| 331 | } |
| 332 | case Instruction::CONST_HIGH16: { |
| 333 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 334 | uint8_t dst = inst->VRegA_21h(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 335 | int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16); |
| 336 | shadow_frame.SetVReg(dst, val); |
| 337 | if (val == 0) { |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 338 | shadow_frame.SetVRegReference(dst, nullptr); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 339 | } |
| 340 | inst = inst->Next_2xx(); |
| 341 | break; |
| 342 | } |
| 343 | case Instruction::CONST_WIDE_16: |
| 344 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 345 | shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s()); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 346 | inst = inst->Next_2xx(); |
| 347 | break; |
| 348 | case Instruction::CONST_WIDE_32: |
| 349 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 350 | shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i()); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 351 | inst = inst->Next_3xx(); |
| 352 | break; |
| 353 | case Instruction::CONST_WIDE: |
| 354 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 355 | shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l()); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 356 | inst = inst->Next_51l(); |
| 357 | break; |
| 358 | case Instruction::CONST_WIDE_HIGH16: |
Sebastien Hertz | 3c5aec1 | 2014-06-04 09:41:21 +0200 | [diff] [blame] | 359 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 360 | shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 361 | static_cast<uint64_t>(inst->VRegB_21h()) << 48); |
| 362 | inst = inst->Next_2xx(); |
| 363 | break; |
| 364 | case Instruction::CONST_STRING: { |
| 365 | PREAMBLE(); |
Ian Rogers | 6786a58 | 2014-10-28 12:49:06 -0700 | [diff] [blame] | 366 | String* s = ResolveString(self, shadow_frame, inst->VRegB_21c()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 367 | if (UNLIKELY(s == nullptr)) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 368 | HANDLE_PENDING_EXCEPTION(); |
| 369 | } else { |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 370 | shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 371 | inst = inst->Next_2xx(); |
| 372 | } |
| 373 | break; |
| 374 | } |
| 375 | case Instruction::CONST_STRING_JUMBO: { |
| 376 | PREAMBLE(); |
Ian Rogers | 6786a58 | 2014-10-28 12:49:06 -0700 | [diff] [blame] | 377 | String* s = ResolveString(self, shadow_frame, inst->VRegB_31c()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 378 | if (UNLIKELY(s == nullptr)) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 379 | HANDLE_PENDING_EXCEPTION(); |
| 380 | } else { |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 381 | shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 382 | inst = inst->Next_3xx(); |
| 383 | } |
| 384 | break; |
| 385 | } |
| 386 | case Instruction::CONST_CLASS: { |
| 387 | PREAMBLE(); |
| 388 | Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(), |
| 389 | self, false, do_access_check); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 390 | if (UNLIKELY(c == nullptr)) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 391 | HANDLE_PENDING_EXCEPTION(); |
| 392 | } else { |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 393 | shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 394 | inst = inst->Next_2xx(); |
| 395 | } |
| 396 | break; |
| 397 | } |
| 398 | case Instruction::MONITOR_ENTER: { |
| 399 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 400 | Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data)); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 401 | if (UNLIKELY(obj == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 402 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 403 | HANDLE_PENDING_EXCEPTION(); |
| 404 | } else { |
Andreas Gampe | 03ec930 | 2015-08-27 17:41:47 -0700 | [diff] [blame] | 405 | DoMonitorEnter<do_assignability_check>(self, &shadow_frame, obj); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 406 | POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx); |
| 407 | } |
| 408 | break; |
| 409 | } |
| 410 | case Instruction::MONITOR_EXIT: { |
| 411 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 412 | Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data)); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 413 | if (UNLIKELY(obj == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 414 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 415 | HANDLE_PENDING_EXCEPTION(); |
| 416 | } else { |
Andreas Gampe | 03ec930 | 2015-08-27 17:41:47 -0700 | [diff] [blame] | 417 | DoMonitorExit<do_assignability_check>(self, &shadow_frame, obj); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 418 | POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx); |
| 419 | } |
| 420 | break; |
| 421 | } |
| 422 | case Instruction::CHECK_CAST: { |
| 423 | PREAMBLE(); |
| 424 | Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(), |
| 425 | self, false, do_access_check); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 426 | if (UNLIKELY(c == nullptr)) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 427 | HANDLE_PENDING_EXCEPTION(); |
| 428 | } else { |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 429 | Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data)); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 430 | if (UNLIKELY(obj != nullptr && !obj->InstanceOf(c))) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 431 | ThrowClassCastException(c, obj->GetClass()); |
| 432 | HANDLE_PENDING_EXCEPTION(); |
| 433 | } else { |
| 434 | inst = inst->Next_2xx(); |
| 435 | } |
| 436 | } |
| 437 | break; |
| 438 | } |
| 439 | case Instruction::INSTANCE_OF: { |
| 440 | PREAMBLE(); |
| 441 | Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(), |
| 442 | self, false, do_access_check); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 443 | if (UNLIKELY(c == nullptr)) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 444 | HANDLE_PENDING_EXCEPTION(); |
| 445 | } else { |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 446 | Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data)); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 447 | shadow_frame.SetVReg(inst->VRegA_22c(inst_data), |
| 448 | (obj != nullptr && obj->InstanceOf(c)) ? 1 : 0); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 449 | inst = inst->Next_2xx(); |
| 450 | } |
| 451 | break; |
| 452 | } |
| 453 | case Instruction::ARRAY_LENGTH: { |
| 454 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 455 | Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 456 | if (UNLIKELY(array == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 457 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 458 | HANDLE_PENDING_EXCEPTION(); |
| 459 | } else { |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 460 | shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength()); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 461 | inst = inst->Next_1xx(); |
| 462 | } |
| 463 | break; |
| 464 | } |
| 465 | case Instruction::NEW_INSTANCE: { |
| 466 | PREAMBLE(); |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 467 | Object* obj = nullptr; |
| 468 | Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(), |
| 469 | self, false, do_access_check); |
| 470 | if (LIKELY(c != nullptr)) { |
| 471 | if (UNLIKELY(c->IsStringClass())) { |
| 472 | gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator(); |
| 473 | mirror::SetStringCountVisitor visitor(0); |
| 474 | obj = String::Alloc<true>(self, 0, allocator_type, visitor); |
| 475 | } else { |
| 476 | obj = AllocObjectFromCode<do_access_check, true>( |
| 477 | inst->VRegB_21c(), shadow_frame.GetMethod(), self, |
| 478 | Runtime::Current()->GetHeap()->GetCurrentAllocator()); |
| 479 | } |
| 480 | } |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 481 | if (UNLIKELY(obj == nullptr)) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 482 | HANDLE_PENDING_EXCEPTION(); |
| 483 | } else { |
Sebastien Hertz | 4e99b3d | 2014-06-24 14:35:40 +0200 | [diff] [blame] | 484 | obj->GetClass()->AssertInitializedOrInitializingInThread(self); |
Mathieu Chartier | b2c7ead | 2014-04-29 11:13:16 -0700 | [diff] [blame] | 485 | // Don't allow finalizable objects to be allocated during a transaction since these can't |
| 486 | // be finalized without a started runtime. |
| 487 | if (transaction_active && obj->GetClass()->IsFinalizable()) { |
Sebastien Hertz | 45b1597 | 2015-04-03 16:07:05 +0200 | [diff] [blame] | 488 | AbortTransactionF(self, "Allocating finalizable object in transaction: %s", |
| 489 | PrettyTypeOf(obj).c_str()); |
Mathieu Chartier | b2c7ead | 2014-04-29 11:13:16 -0700 | [diff] [blame] | 490 | HANDLE_PENDING_EXCEPTION(); |
| 491 | break; |
| 492 | } |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 493 | shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 494 | inst = inst->Next_2xx(); |
| 495 | } |
| 496 | break; |
| 497 | } |
| 498 | case Instruction::NEW_ARRAY: { |
| 499 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 500 | int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data)); |
Mathieu Chartier | cbb2d20 | 2013-11-14 17:45:16 -0800 | [diff] [blame] | 501 | Object* obj = AllocArrayFromCode<do_access_check, true>( |
Andreas Gampe | 1cc7dba | 2014-12-17 18:43:01 -0800 | [diff] [blame] | 502 | inst->VRegC_22c(), length, shadow_frame.GetMethod(), self, |
Mathieu Chartier | cbb2d20 | 2013-11-14 17:45:16 -0800 | [diff] [blame] | 503 | Runtime::Current()->GetHeap()->GetCurrentAllocator()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 504 | if (UNLIKELY(obj == nullptr)) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 505 | HANDLE_PENDING_EXCEPTION(); |
| 506 | } else { |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 507 | shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 508 | inst = inst->Next_2xx(); |
| 509 | } |
| 510 | break; |
| 511 | } |
| 512 | case Instruction::FILLED_NEW_ARRAY: { |
| 513 | PREAMBLE(); |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 514 | bool success = |
| 515 | DoFilledNewArray<false, do_access_check, transaction_active>(inst, shadow_frame, self, |
| 516 | &result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 517 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx); |
| 518 | break; |
| 519 | } |
| 520 | case Instruction::FILLED_NEW_ARRAY_RANGE: { |
| 521 | PREAMBLE(); |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 522 | bool success = |
| 523 | DoFilledNewArray<true, do_access_check, transaction_active>(inst, shadow_frame, |
| 524 | self, &result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 525 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx); |
| 526 | break; |
| 527 | } |
| 528 | case Instruction::FILL_ARRAY_DATA: { |
| 529 | PREAMBLE(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 530 | const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t(); |
| 531 | const Instruction::ArrayDataPayload* payload = |
| 532 | reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr); |
Ian Rogers | 832336b | 2014-10-08 15:35:22 -0700 | [diff] [blame] | 533 | Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data)); |
| 534 | bool success = FillArrayData(obj, payload); |
| 535 | if (!success) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 536 | HANDLE_PENDING_EXCEPTION(); |
| 537 | break; |
| 538 | } |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 539 | if (transaction_active) { |
Ian Rogers | 832336b | 2014-10-08 15:35:22 -0700 | [diff] [blame] | 540 | RecordArrayElementsInTransaction(obj->AsArray(), payload->element_count); |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 541 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 542 | inst = inst->Next_3xx(); |
| 543 | break; |
| 544 | } |
| 545 | case Instruction::THROW: { |
| 546 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 547 | Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data)); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 548 | if (UNLIKELY(exception == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 549 | ThrowNullPointerException("throw with null exception"); |
Jeff Hao | a3faaf4 | 2013-09-03 19:07:00 -0700 | [diff] [blame] | 550 | } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) { |
| 551 | // This should never happen. |
Ian Rogers | 1ff3c98 | 2014-08-12 02:30:58 -0700 | [diff] [blame] | 552 | std::string temp; |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 553 | self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;", |
Jeff Hao | a3faaf4 | 2013-09-03 19:07:00 -0700 | [diff] [blame] | 554 | "Throwing '%s' that is not instance of Throwable", |
Ian Rogers | 1ff3c98 | 2014-08-12 02:30:58 -0700 | [diff] [blame] | 555 | exception->GetClass()->GetDescriptor(&temp)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 556 | } else { |
Nicolas Geoffray | 14691c5 | 2015-03-05 10:40:17 +0000 | [diff] [blame] | 557 | self->SetException(exception->AsThrowable()); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 558 | } |
| 559 | HANDLE_PENDING_EXCEPTION(); |
| 560 | break; |
| 561 | } |
| 562 | case Instruction::GOTO: { |
| 563 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 564 | int8_t offset = inst->VRegA_10t(inst_data); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 565 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 566 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 567 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 568 | } |
| 569 | inst = inst->RelativeAt(offset); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 570 | break; |
| 571 | } |
| 572 | case Instruction::GOTO_16: { |
| 573 | PREAMBLE(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 574 | int16_t offset = inst->VRegA_20t(); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 575 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 576 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 577 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 578 | } |
| 579 | inst = inst->RelativeAt(offset); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 580 | break; |
| 581 | } |
| 582 | case Instruction::GOTO_32: { |
| 583 | PREAMBLE(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 584 | int32_t offset = inst->VRegA_30t(); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 585 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 586 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 587 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 588 | } |
| 589 | inst = inst->RelativeAt(offset); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 590 | break; |
| 591 | } |
| 592 | case Instruction::PACKED_SWITCH: { |
| 593 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 594 | int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 595 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 596 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 597 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 598 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 599 | inst = inst->RelativeAt(offset); |
| 600 | break; |
| 601 | } |
| 602 | case Instruction::SPARSE_SWITCH: { |
| 603 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 604 | int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 605 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 606 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 607 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 608 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 609 | inst = inst->RelativeAt(offset); |
| 610 | break; |
| 611 | } |
Ian Rogers | 647b1a8 | 2014-10-10 11:02:11 -0700 | [diff] [blame] | 612 | |
| 613 | #if defined(__clang__) |
| 614 | #pragma clang diagnostic push |
| 615 | #pragma clang diagnostic ignored "-Wfloat-equal" |
| 616 | #endif |
| 617 | |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 618 | case Instruction::CMPL_FLOAT: { |
| 619 | PREAMBLE(); |
| 620 | float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x()); |
| 621 | float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x()); |
| 622 | int32_t result; |
| 623 | if (val1 > val2) { |
| 624 | result = 1; |
| 625 | } else if (val1 == val2) { |
| 626 | result = 0; |
| 627 | } else { |
| 628 | result = -1; |
| 629 | } |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 630 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 631 | inst = inst->Next_2xx(); |
| 632 | break; |
| 633 | } |
| 634 | case Instruction::CMPG_FLOAT: { |
| 635 | PREAMBLE(); |
| 636 | float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x()); |
| 637 | float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x()); |
| 638 | int32_t result; |
| 639 | if (val1 < val2) { |
| 640 | result = -1; |
| 641 | } else if (val1 == val2) { |
| 642 | result = 0; |
| 643 | } else { |
| 644 | result = 1; |
| 645 | } |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 646 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 647 | inst = inst->Next_2xx(); |
| 648 | break; |
| 649 | } |
| 650 | case Instruction::CMPL_DOUBLE: { |
| 651 | PREAMBLE(); |
| 652 | double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x()); |
| 653 | double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x()); |
| 654 | int32_t result; |
| 655 | if (val1 > val2) { |
| 656 | result = 1; |
| 657 | } else if (val1 == val2) { |
| 658 | result = 0; |
| 659 | } else { |
| 660 | result = -1; |
| 661 | } |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 662 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 663 | inst = inst->Next_2xx(); |
| 664 | break; |
| 665 | } |
| 666 | |
| 667 | case Instruction::CMPG_DOUBLE: { |
| 668 | PREAMBLE(); |
| 669 | double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x()); |
| 670 | double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x()); |
| 671 | int32_t result; |
| 672 | if (val1 < val2) { |
| 673 | result = -1; |
| 674 | } else if (val1 == val2) { |
| 675 | result = 0; |
| 676 | } else { |
| 677 | result = 1; |
| 678 | } |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 679 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 680 | inst = inst->Next_2xx(); |
| 681 | break; |
| 682 | } |
Ian Rogers | 647b1a8 | 2014-10-10 11:02:11 -0700 | [diff] [blame] | 683 | |
| 684 | #if defined(__clang__) |
| 685 | #pragma clang diagnostic pop |
| 686 | #endif |
| 687 | |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 688 | case Instruction::CMP_LONG: { |
| 689 | PREAMBLE(); |
| 690 | int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x()); |
| 691 | int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x()); |
| 692 | int32_t result; |
| 693 | if (val1 > val2) { |
| 694 | result = 1; |
| 695 | } else if (val1 == val2) { |
| 696 | result = 0; |
| 697 | } else { |
| 698 | result = -1; |
| 699 | } |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 700 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 701 | inst = inst->Next_2xx(); |
| 702 | break; |
| 703 | } |
| 704 | case Instruction::IF_EQ: { |
| 705 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 706 | if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == |
| 707 | shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) { |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 708 | int16_t offset = inst->VRegC_22t(); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 709 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 710 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 711 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 712 | } |
| 713 | inst = inst->RelativeAt(offset); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 714 | } else { |
| 715 | inst = inst->Next_2xx(); |
| 716 | } |
| 717 | break; |
| 718 | } |
| 719 | case Instruction::IF_NE: { |
| 720 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 721 | if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) != |
| 722 | shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) { |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 723 | int16_t offset = inst->VRegC_22t(); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 724 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 725 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 726 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 727 | } |
| 728 | inst = inst->RelativeAt(offset); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 729 | } else { |
| 730 | inst = inst->Next_2xx(); |
| 731 | } |
| 732 | break; |
| 733 | } |
| 734 | case Instruction::IF_LT: { |
| 735 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 736 | if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) < |
| 737 | shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) { |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 738 | int16_t offset = inst->VRegC_22t(); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 739 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 740 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 741 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 742 | } |
| 743 | inst = inst->RelativeAt(offset); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 744 | } else { |
| 745 | inst = inst->Next_2xx(); |
| 746 | } |
| 747 | break; |
| 748 | } |
| 749 | case Instruction::IF_GE: { |
| 750 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 751 | if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= |
| 752 | shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) { |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 753 | int16_t offset = inst->VRegC_22t(); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 754 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 755 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 756 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 757 | } |
| 758 | inst = inst->RelativeAt(offset); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 759 | } else { |
| 760 | inst = inst->Next_2xx(); |
| 761 | } |
| 762 | break; |
| 763 | } |
| 764 | case Instruction::IF_GT: { |
| 765 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 766 | if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > |
| 767 | shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) { |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 768 | int16_t offset = inst->VRegC_22t(); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 769 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 770 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 771 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 772 | } |
| 773 | inst = inst->RelativeAt(offset); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 774 | } else { |
| 775 | inst = inst->Next_2xx(); |
| 776 | } |
| 777 | break; |
| 778 | } |
| 779 | case Instruction::IF_LE: { |
| 780 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 781 | if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= |
| 782 | shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) { |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 783 | int16_t offset = inst->VRegC_22t(); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 784 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 785 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 786 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 787 | } |
| 788 | inst = inst->RelativeAt(offset); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 789 | } else { |
| 790 | inst = inst->Next_2xx(); |
| 791 | } |
| 792 | break; |
| 793 | } |
| 794 | case Instruction::IF_EQZ: { |
| 795 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 796 | if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) { |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 797 | int16_t offset = inst->VRegB_21t(); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 798 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 799 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 800 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 801 | } |
| 802 | inst = inst->RelativeAt(offset); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 803 | } else { |
| 804 | inst = inst->Next_2xx(); |
| 805 | } |
| 806 | break; |
| 807 | } |
| 808 | case Instruction::IF_NEZ: { |
| 809 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 810 | if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) { |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 811 | int16_t offset = inst->VRegB_21t(); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 812 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 813 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 814 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 815 | } |
| 816 | inst = inst->RelativeAt(offset); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 817 | } else { |
| 818 | inst = inst->Next_2xx(); |
| 819 | } |
| 820 | break; |
| 821 | } |
| 822 | case Instruction::IF_LTZ: { |
| 823 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 824 | if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) { |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 825 | int16_t offset = inst->VRegB_21t(); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 826 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 827 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 828 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 829 | } |
| 830 | inst = inst->RelativeAt(offset); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 831 | } else { |
| 832 | inst = inst->Next_2xx(); |
| 833 | } |
| 834 | break; |
| 835 | } |
| 836 | case Instruction::IF_GEZ: { |
| 837 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 838 | if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) { |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 839 | int16_t offset = inst->VRegB_21t(); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 840 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 841 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 842 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 843 | } |
| 844 | inst = inst->RelativeAt(offset); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 845 | } else { |
| 846 | inst = inst->Next_2xx(); |
| 847 | } |
| 848 | break; |
| 849 | } |
| 850 | case Instruction::IF_GTZ: { |
| 851 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 852 | if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) { |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 853 | int16_t offset = inst->VRegB_21t(); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 854 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 855 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 856 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 857 | } |
| 858 | inst = inst->RelativeAt(offset); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 859 | } else { |
| 860 | inst = inst->Next_2xx(); |
| 861 | } |
| 862 | break; |
| 863 | } |
| 864 | case Instruction::IF_LEZ: { |
| 865 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 866 | if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) { |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 867 | int16_t offset = inst->VRegB_21t(); |
Nicolas Geoffray | 81f0f95 | 2016-01-20 16:25:19 +0000 | [diff] [blame] | 868 | BRANCH_INSTRUMENTATION(offset); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 869 | if (IsBackwardBranch(offset)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 870 | self->AllowThreadSuspension(); |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 871 | } |
| 872 | inst = inst->RelativeAt(offset); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 873 | } else { |
| 874 | inst = inst->Next_2xx(); |
| 875 | } |
| 876 | break; |
| 877 | } |
| 878 | case Instruction::AGET_BOOLEAN: { |
| 879 | PREAMBLE(); |
| 880 | Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 881 | if (UNLIKELY(a == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 882 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 883 | HANDLE_PENDING_EXCEPTION(); |
| 884 | break; |
| 885 | } |
| 886 | int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); |
| 887 | BooleanArray* array = a->AsBooleanArray(); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 888 | if (array->CheckIsValidIndex(index)) { |
Sebastien Hertz | abff643 | 2014-01-27 18:01:39 +0100 | [diff] [blame] | 889 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 890 | inst = inst->Next_2xx(); |
| 891 | } else { |
| 892 | HANDLE_PENDING_EXCEPTION(); |
| 893 | } |
| 894 | break; |
| 895 | } |
| 896 | case Instruction::AGET_BYTE: { |
| 897 | PREAMBLE(); |
| 898 | Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 899 | if (UNLIKELY(a == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 900 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 901 | HANDLE_PENDING_EXCEPTION(); |
| 902 | break; |
| 903 | } |
| 904 | int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); |
| 905 | ByteArray* array = a->AsByteArray(); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 906 | if (array->CheckIsValidIndex(index)) { |
Sebastien Hertz | abff643 | 2014-01-27 18:01:39 +0100 | [diff] [blame] | 907 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 908 | inst = inst->Next_2xx(); |
| 909 | } else { |
| 910 | HANDLE_PENDING_EXCEPTION(); |
| 911 | } |
| 912 | break; |
| 913 | } |
| 914 | case Instruction::AGET_CHAR: { |
| 915 | PREAMBLE(); |
| 916 | Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 917 | if (UNLIKELY(a == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 918 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 919 | HANDLE_PENDING_EXCEPTION(); |
| 920 | break; |
| 921 | } |
| 922 | int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); |
| 923 | CharArray* array = a->AsCharArray(); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 924 | if (array->CheckIsValidIndex(index)) { |
Sebastien Hertz | abff643 | 2014-01-27 18:01:39 +0100 | [diff] [blame] | 925 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 926 | inst = inst->Next_2xx(); |
| 927 | } else { |
| 928 | HANDLE_PENDING_EXCEPTION(); |
| 929 | } |
| 930 | break; |
| 931 | } |
| 932 | case Instruction::AGET_SHORT: { |
| 933 | PREAMBLE(); |
| 934 | Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 935 | if (UNLIKELY(a == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 936 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 937 | HANDLE_PENDING_EXCEPTION(); |
| 938 | break; |
| 939 | } |
| 940 | int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); |
| 941 | ShortArray* array = a->AsShortArray(); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 942 | if (array->CheckIsValidIndex(index)) { |
Sebastien Hertz | abff643 | 2014-01-27 18:01:39 +0100 | [diff] [blame] | 943 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 944 | inst = inst->Next_2xx(); |
| 945 | } else { |
| 946 | HANDLE_PENDING_EXCEPTION(); |
| 947 | } |
| 948 | break; |
| 949 | } |
| 950 | case Instruction::AGET: { |
| 951 | PREAMBLE(); |
| 952 | Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 953 | if (UNLIKELY(a == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 954 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 955 | HANDLE_PENDING_EXCEPTION(); |
| 956 | break; |
| 957 | } |
| 958 | int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 959 | DCHECK(a->IsIntArray() || a->IsFloatArray()) << PrettyTypeOf(a); |
| 960 | auto* array = down_cast<IntArray*>(a); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 961 | if (array->CheckIsValidIndex(index)) { |
Sebastien Hertz | abff643 | 2014-01-27 18:01:39 +0100 | [diff] [blame] | 962 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 963 | inst = inst->Next_2xx(); |
| 964 | } else { |
| 965 | HANDLE_PENDING_EXCEPTION(); |
| 966 | } |
| 967 | break; |
| 968 | } |
| 969 | case Instruction::AGET_WIDE: { |
| 970 | PREAMBLE(); |
| 971 | Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 972 | if (UNLIKELY(a == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 973 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 974 | HANDLE_PENDING_EXCEPTION(); |
| 975 | break; |
| 976 | } |
| 977 | int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 978 | DCHECK(a->IsLongArray() || a->IsDoubleArray()) << PrettyTypeOf(a); |
| 979 | auto* array = down_cast<LongArray*>(a); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 980 | if (array->CheckIsValidIndex(index)) { |
Sebastien Hertz | abff643 | 2014-01-27 18:01:39 +0100 | [diff] [blame] | 981 | shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 982 | inst = inst->Next_2xx(); |
| 983 | } else { |
| 984 | HANDLE_PENDING_EXCEPTION(); |
| 985 | } |
| 986 | break; |
| 987 | } |
| 988 | case Instruction::AGET_OBJECT: { |
| 989 | PREAMBLE(); |
| 990 | Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 991 | if (UNLIKELY(a == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 992 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 993 | HANDLE_PENDING_EXCEPTION(); |
| 994 | break; |
| 995 | } |
| 996 | int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); |
| 997 | ObjectArray<Object>* array = a->AsObjectArray<Object>(); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 998 | if (array->CheckIsValidIndex(index)) { |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 999 | shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1000 | inst = inst->Next_2xx(); |
| 1001 | } else { |
| 1002 | HANDLE_PENDING_EXCEPTION(); |
| 1003 | } |
| 1004 | break; |
| 1005 | } |
| 1006 | case Instruction::APUT_BOOLEAN: { |
| 1007 | PREAMBLE(); |
| 1008 | Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1009 | if (UNLIKELY(a == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 1010 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1011 | HANDLE_PENDING_EXCEPTION(); |
| 1012 | break; |
| 1013 | } |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1014 | uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1015 | int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); |
| 1016 | BooleanArray* array = a->AsBooleanArray(); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 1017 | if (array->CheckIsValidIndex(index)) { |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 1018 | array->SetWithoutChecks<transaction_active>(index, val); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1019 | inst = inst->Next_2xx(); |
| 1020 | } else { |
| 1021 | HANDLE_PENDING_EXCEPTION(); |
| 1022 | } |
| 1023 | break; |
| 1024 | } |
| 1025 | case Instruction::APUT_BYTE: { |
| 1026 | PREAMBLE(); |
| 1027 | Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1028 | if (UNLIKELY(a == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 1029 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1030 | HANDLE_PENDING_EXCEPTION(); |
| 1031 | break; |
| 1032 | } |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1033 | int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1034 | int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); |
| 1035 | ByteArray* array = a->AsByteArray(); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 1036 | if (array->CheckIsValidIndex(index)) { |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 1037 | array->SetWithoutChecks<transaction_active>(index, val); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1038 | inst = inst->Next_2xx(); |
| 1039 | } else { |
| 1040 | HANDLE_PENDING_EXCEPTION(); |
| 1041 | } |
| 1042 | break; |
| 1043 | } |
| 1044 | case Instruction::APUT_CHAR: { |
| 1045 | PREAMBLE(); |
| 1046 | Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1047 | if (UNLIKELY(a == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 1048 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1049 | HANDLE_PENDING_EXCEPTION(); |
| 1050 | break; |
| 1051 | } |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1052 | uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1053 | int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); |
| 1054 | CharArray* array = a->AsCharArray(); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 1055 | if (array->CheckIsValidIndex(index)) { |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 1056 | array->SetWithoutChecks<transaction_active>(index, val); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1057 | inst = inst->Next_2xx(); |
| 1058 | } else { |
| 1059 | HANDLE_PENDING_EXCEPTION(); |
| 1060 | } |
| 1061 | break; |
| 1062 | } |
| 1063 | case Instruction::APUT_SHORT: { |
| 1064 | PREAMBLE(); |
| 1065 | Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1066 | if (UNLIKELY(a == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 1067 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1068 | HANDLE_PENDING_EXCEPTION(); |
| 1069 | break; |
| 1070 | } |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1071 | int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1072 | int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); |
| 1073 | ShortArray* array = a->AsShortArray(); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 1074 | if (array->CheckIsValidIndex(index)) { |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 1075 | array->SetWithoutChecks<transaction_active>(index, val); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1076 | inst = inst->Next_2xx(); |
| 1077 | } else { |
| 1078 | HANDLE_PENDING_EXCEPTION(); |
| 1079 | } |
| 1080 | break; |
| 1081 | } |
| 1082 | case Instruction::APUT: { |
| 1083 | PREAMBLE(); |
| 1084 | Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1085 | if (UNLIKELY(a == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 1086 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1087 | HANDLE_PENDING_EXCEPTION(); |
| 1088 | break; |
| 1089 | } |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1090 | int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1091 | int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 1092 | DCHECK(a->IsIntArray() || a->IsFloatArray()) << PrettyTypeOf(a); |
| 1093 | auto* array = down_cast<IntArray*>(a); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 1094 | if (array->CheckIsValidIndex(index)) { |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 1095 | array->SetWithoutChecks<transaction_active>(index, val); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1096 | inst = inst->Next_2xx(); |
| 1097 | } else { |
| 1098 | HANDLE_PENDING_EXCEPTION(); |
| 1099 | } |
| 1100 | break; |
| 1101 | } |
| 1102 | case Instruction::APUT_WIDE: { |
| 1103 | PREAMBLE(); |
| 1104 | Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1105 | if (UNLIKELY(a == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 1106 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1107 | HANDLE_PENDING_EXCEPTION(); |
| 1108 | break; |
| 1109 | } |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1110 | int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1111 | int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 1112 | DCHECK(a->IsLongArray() || a->IsDoubleArray()) << PrettyTypeOf(a); |
| 1113 | LongArray* array = down_cast<LongArray*>(a); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 1114 | if (array->CheckIsValidIndex(index)) { |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 1115 | array->SetWithoutChecks<transaction_active>(index, val); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1116 | inst = inst->Next_2xx(); |
| 1117 | } else { |
| 1118 | HANDLE_PENDING_EXCEPTION(); |
| 1119 | } |
| 1120 | break; |
| 1121 | } |
| 1122 | case Instruction::APUT_OBJECT: { |
| 1123 | PREAMBLE(); |
| 1124 | Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1125 | if (UNLIKELY(a == nullptr)) { |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 1126 | ThrowNullPointerExceptionFromInterpreter(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1127 | HANDLE_PENDING_EXCEPTION(); |
| 1128 | break; |
| 1129 | } |
| 1130 | int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1131 | Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1132 | ObjectArray<Object>* array = a->AsObjectArray<Object>(); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 1133 | if (array->CheckIsValidIndex(index) && array->CheckAssignable(val)) { |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 1134 | array->SetWithoutChecks<transaction_active>(index, val); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1135 | inst = inst->Next_2xx(); |
| 1136 | } else { |
| 1137 | HANDLE_PENDING_EXCEPTION(); |
| 1138 | } |
| 1139 | break; |
| 1140 | } |
| 1141 | case Instruction::IGET_BOOLEAN: { |
| 1142 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1143 | bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>( |
| 1144 | self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1145 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1146 | break; |
| 1147 | } |
| 1148 | case Instruction::IGET_BYTE: { |
| 1149 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1150 | bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>( |
| 1151 | self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1152 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1153 | break; |
| 1154 | } |
| 1155 | case Instruction::IGET_CHAR: { |
| 1156 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1157 | bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>( |
| 1158 | self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1159 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1160 | break; |
| 1161 | } |
| 1162 | case Instruction::IGET_SHORT: { |
| 1163 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1164 | bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>( |
| 1165 | self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1166 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1167 | break; |
| 1168 | } |
| 1169 | case Instruction::IGET: { |
| 1170 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1171 | bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>( |
| 1172 | self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1173 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1174 | break; |
| 1175 | } |
| 1176 | case Instruction::IGET_WIDE: { |
| 1177 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1178 | bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>( |
| 1179 | self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1180 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1181 | break; |
| 1182 | } |
| 1183 | case Instruction::IGET_OBJECT: { |
| 1184 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1185 | bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>( |
| 1186 | self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1187 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1188 | break; |
| 1189 | } |
| 1190 | case Instruction::IGET_QUICK: { |
| 1191 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1192 | bool success = DoIGetQuick<Primitive::kPrimInt>(shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1193 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1194 | break; |
| 1195 | } |
| 1196 | case Instruction::IGET_WIDE_QUICK: { |
| 1197 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1198 | bool success = DoIGetQuick<Primitive::kPrimLong>(shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1199 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1200 | break; |
| 1201 | } |
| 1202 | case Instruction::IGET_OBJECT_QUICK: { |
| 1203 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1204 | bool success = DoIGetQuick<Primitive::kPrimNot>(shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1205 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1206 | break; |
| 1207 | } |
Mathieu Chartier | ffc605c | 2014-12-10 10:35:44 -0800 | [diff] [blame] | 1208 | case Instruction::IGET_BOOLEAN_QUICK: { |
| 1209 | PREAMBLE(); |
| 1210 | bool success = DoIGetQuick<Primitive::kPrimBoolean>(shadow_frame, inst, inst_data); |
| 1211 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1212 | break; |
| 1213 | } |
| 1214 | case Instruction::IGET_BYTE_QUICK: { |
| 1215 | PREAMBLE(); |
| 1216 | bool success = DoIGetQuick<Primitive::kPrimByte>(shadow_frame, inst, inst_data); |
| 1217 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1218 | break; |
| 1219 | } |
| 1220 | case Instruction::IGET_CHAR_QUICK: { |
| 1221 | PREAMBLE(); |
| 1222 | bool success = DoIGetQuick<Primitive::kPrimChar>(shadow_frame, inst, inst_data); |
| 1223 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1224 | break; |
| 1225 | } |
| 1226 | case Instruction::IGET_SHORT_QUICK: { |
| 1227 | PREAMBLE(); |
| 1228 | bool success = DoIGetQuick<Primitive::kPrimShort>(shadow_frame, inst, inst_data); |
| 1229 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1230 | break; |
| 1231 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1232 | case Instruction::SGET_BOOLEAN: { |
| 1233 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1234 | bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>( |
| 1235 | self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1236 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1237 | break; |
| 1238 | } |
| 1239 | case Instruction::SGET_BYTE: { |
| 1240 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1241 | bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>( |
| 1242 | self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1243 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1244 | break; |
| 1245 | } |
| 1246 | case Instruction::SGET_CHAR: { |
| 1247 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1248 | bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>( |
| 1249 | self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1250 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1251 | break; |
| 1252 | } |
| 1253 | case Instruction::SGET_SHORT: { |
| 1254 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1255 | bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>( |
| 1256 | self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1257 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1258 | break; |
| 1259 | } |
| 1260 | case Instruction::SGET: { |
| 1261 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1262 | bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>( |
| 1263 | self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1264 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1265 | break; |
| 1266 | } |
| 1267 | case Instruction::SGET_WIDE: { |
| 1268 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1269 | bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>( |
| 1270 | self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1271 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1272 | break; |
| 1273 | } |
| 1274 | case Instruction::SGET_OBJECT: { |
| 1275 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1276 | bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>( |
| 1277 | self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1278 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1279 | break; |
| 1280 | } |
| 1281 | case Instruction::IPUT_BOOLEAN: { |
| 1282 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1283 | bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check, |
| 1284 | transaction_active>(self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1285 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1286 | break; |
| 1287 | } |
| 1288 | case Instruction::IPUT_BYTE: { |
| 1289 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1290 | bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check, |
| 1291 | transaction_active>(self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1292 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1293 | break; |
| 1294 | } |
| 1295 | case Instruction::IPUT_CHAR: { |
| 1296 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1297 | bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check, |
| 1298 | transaction_active>(self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1299 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1300 | break; |
| 1301 | } |
| 1302 | case Instruction::IPUT_SHORT: { |
| 1303 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1304 | bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check, |
| 1305 | transaction_active>(self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1306 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1307 | break; |
| 1308 | } |
| 1309 | case Instruction::IPUT: { |
| 1310 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1311 | bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check, |
| 1312 | transaction_active>(self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1313 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1314 | break; |
| 1315 | } |
| 1316 | case Instruction::IPUT_WIDE: { |
| 1317 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1318 | bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check, |
| 1319 | transaction_active>(self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1320 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1321 | break; |
| 1322 | } |
| 1323 | case Instruction::IPUT_OBJECT: { |
| 1324 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1325 | bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check, |
| 1326 | transaction_active>(self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1327 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1328 | break; |
| 1329 | } |
| 1330 | case Instruction::IPUT_QUICK: { |
| 1331 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1332 | bool success = DoIPutQuick<Primitive::kPrimInt, transaction_active>( |
| 1333 | shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1334 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1335 | break; |
| 1336 | } |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1337 | case Instruction::IPUT_BOOLEAN_QUICK: { |
| 1338 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1339 | bool success = DoIPutQuick<Primitive::kPrimBoolean, transaction_active>( |
| 1340 | shadow_frame, inst, inst_data); |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1341 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1342 | break; |
| 1343 | } |
| 1344 | case Instruction::IPUT_BYTE_QUICK: { |
| 1345 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1346 | bool success = DoIPutQuick<Primitive::kPrimByte, transaction_active>( |
| 1347 | shadow_frame, inst, inst_data); |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1348 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1349 | break; |
| 1350 | } |
| 1351 | case Instruction::IPUT_CHAR_QUICK: { |
| 1352 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1353 | bool success = DoIPutQuick<Primitive::kPrimChar, transaction_active>( |
| 1354 | shadow_frame, inst, inst_data); |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1355 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1356 | break; |
| 1357 | } |
| 1358 | case Instruction::IPUT_SHORT_QUICK: { |
| 1359 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1360 | bool success = DoIPutQuick<Primitive::kPrimShort, transaction_active>( |
| 1361 | shadow_frame, inst, inst_data); |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1362 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1363 | break; |
| 1364 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1365 | case Instruction::IPUT_WIDE_QUICK: { |
| 1366 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1367 | bool success = DoIPutQuick<Primitive::kPrimLong, transaction_active>( |
| 1368 | shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1369 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1370 | break; |
| 1371 | } |
| 1372 | case Instruction::IPUT_OBJECT_QUICK: { |
| 1373 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1374 | bool success = DoIPutQuick<Primitive::kPrimNot, transaction_active>( |
| 1375 | shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1376 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1377 | break; |
| 1378 | } |
| 1379 | case Instruction::SPUT_BOOLEAN: { |
| 1380 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1381 | bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check, |
| 1382 | transaction_active>(self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1383 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1384 | break; |
| 1385 | } |
| 1386 | case Instruction::SPUT_BYTE: { |
| 1387 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1388 | bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check, |
| 1389 | transaction_active>(self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1390 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1391 | break; |
| 1392 | } |
| 1393 | case Instruction::SPUT_CHAR: { |
| 1394 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1395 | bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check, |
| 1396 | transaction_active>(self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1397 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1398 | break; |
| 1399 | } |
| 1400 | case Instruction::SPUT_SHORT: { |
| 1401 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1402 | bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check, |
| 1403 | transaction_active>(self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1404 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1405 | break; |
| 1406 | } |
| 1407 | case Instruction::SPUT: { |
| 1408 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1409 | bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check, |
| 1410 | transaction_active>(self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1411 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1412 | break; |
| 1413 | } |
| 1414 | case Instruction::SPUT_WIDE: { |
| 1415 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1416 | bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check, |
| 1417 | transaction_active>(self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1418 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1419 | break; |
| 1420 | } |
| 1421 | case Instruction::SPUT_OBJECT: { |
| 1422 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1423 | bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check, |
| 1424 | transaction_active>(self, shadow_frame, inst, inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1425 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1426 | break; |
| 1427 | } |
| 1428 | case Instruction::INVOKE_VIRTUAL: { |
| 1429 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1430 | bool success = DoInvoke<kVirtual, false, do_access_check>( |
| 1431 | self, shadow_frame, inst, inst_data, &result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1432 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx); |
| 1433 | break; |
| 1434 | } |
| 1435 | case Instruction::INVOKE_VIRTUAL_RANGE: { |
| 1436 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1437 | bool success = DoInvoke<kVirtual, true, do_access_check>( |
| 1438 | self, shadow_frame, inst, inst_data, &result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1439 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx); |
| 1440 | break; |
| 1441 | } |
| 1442 | case Instruction::INVOKE_SUPER: { |
| 1443 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1444 | bool success = DoInvoke<kSuper, false, do_access_check>( |
| 1445 | self, shadow_frame, inst, inst_data, &result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1446 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx); |
| 1447 | break; |
| 1448 | } |
| 1449 | case Instruction::INVOKE_SUPER_RANGE: { |
| 1450 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1451 | bool success = DoInvoke<kSuper, true, do_access_check>( |
| 1452 | self, shadow_frame, inst, inst_data, &result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1453 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx); |
| 1454 | break; |
| 1455 | } |
| 1456 | case Instruction::INVOKE_DIRECT: { |
| 1457 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1458 | bool success = DoInvoke<kDirect, false, do_access_check>( |
| 1459 | self, shadow_frame, inst, inst_data, &result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1460 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx); |
| 1461 | break; |
| 1462 | } |
| 1463 | case Instruction::INVOKE_DIRECT_RANGE: { |
| 1464 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1465 | bool success = DoInvoke<kDirect, true, do_access_check>( |
| 1466 | self, shadow_frame, inst, inst_data, &result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1467 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx); |
| 1468 | break; |
| 1469 | } |
| 1470 | case Instruction::INVOKE_INTERFACE: { |
| 1471 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1472 | bool success = DoInvoke<kInterface, false, do_access_check>( |
| 1473 | self, shadow_frame, inst, inst_data, &result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1474 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx); |
| 1475 | break; |
| 1476 | } |
| 1477 | case Instruction::INVOKE_INTERFACE_RANGE: { |
| 1478 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1479 | bool success = DoInvoke<kInterface, true, do_access_check>( |
| 1480 | self, shadow_frame, inst, inst_data, &result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1481 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx); |
| 1482 | break; |
| 1483 | } |
| 1484 | case Instruction::INVOKE_STATIC: { |
| 1485 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1486 | bool success = DoInvoke<kStatic, false, do_access_check>( |
| 1487 | self, shadow_frame, inst, inst_data, &result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1488 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx); |
| 1489 | break; |
| 1490 | } |
| 1491 | case Instruction::INVOKE_STATIC_RANGE: { |
| 1492 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1493 | bool success = DoInvoke<kStatic, true, do_access_check>( |
| 1494 | self, shadow_frame, inst, inst_data, &result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1495 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx); |
| 1496 | break; |
| 1497 | } |
| 1498 | case Instruction::INVOKE_VIRTUAL_QUICK: { |
| 1499 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1500 | bool success = DoInvokeVirtualQuick<false>( |
| 1501 | self, shadow_frame, inst, inst_data, &result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1502 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx); |
| 1503 | break; |
| 1504 | } |
| 1505 | case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: { |
| 1506 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1507 | bool success = DoInvokeVirtualQuick<true>( |
| 1508 | self, shadow_frame, inst, inst_data, &result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1509 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_3xx); |
| 1510 | break; |
| 1511 | } |
| 1512 | case Instruction::NEG_INT: |
| 1513 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1514 | shadow_frame.SetVReg( |
| 1515 | inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1516 | inst = inst->Next_1xx(); |
| 1517 | break; |
| 1518 | case Instruction::NOT_INT: |
| 1519 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1520 | shadow_frame.SetVReg( |
| 1521 | inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1522 | inst = inst->Next_1xx(); |
| 1523 | break; |
| 1524 | case Instruction::NEG_LONG: |
| 1525 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1526 | shadow_frame.SetVRegLong( |
| 1527 | inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1528 | inst = inst->Next_1xx(); |
| 1529 | break; |
| 1530 | case Instruction::NOT_LONG: |
| 1531 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1532 | shadow_frame.SetVRegLong( |
| 1533 | inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1534 | inst = inst->Next_1xx(); |
| 1535 | break; |
| 1536 | case Instruction::NEG_FLOAT: |
| 1537 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1538 | shadow_frame.SetVRegFloat( |
| 1539 | inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1540 | inst = inst->Next_1xx(); |
| 1541 | break; |
| 1542 | case Instruction::NEG_DOUBLE: |
| 1543 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1544 | shadow_frame.SetVRegDouble( |
| 1545 | inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1546 | inst = inst->Next_1xx(); |
| 1547 | break; |
| 1548 | case Instruction::INT_TO_LONG: |
| 1549 | PREAMBLE(); |
Ian Rogers | 450dcb5 | 2013-09-20 17:36:02 -0700 | [diff] [blame] | 1550 | shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), |
| 1551 | shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1552 | inst = inst->Next_1xx(); |
| 1553 | break; |
| 1554 | case Instruction::INT_TO_FLOAT: |
| 1555 | PREAMBLE(); |
Ian Rogers | 450dcb5 | 2013-09-20 17:36:02 -0700 | [diff] [blame] | 1556 | shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), |
| 1557 | shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1558 | inst = inst->Next_1xx(); |
| 1559 | break; |
| 1560 | case Instruction::INT_TO_DOUBLE: |
| 1561 | PREAMBLE(); |
Ian Rogers | 450dcb5 | 2013-09-20 17:36:02 -0700 | [diff] [blame] | 1562 | shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), |
| 1563 | shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1564 | inst = inst->Next_1xx(); |
| 1565 | break; |
| 1566 | case Instruction::LONG_TO_INT: |
| 1567 | PREAMBLE(); |
Ian Rogers | 450dcb5 | 2013-09-20 17:36:02 -0700 | [diff] [blame] | 1568 | shadow_frame.SetVReg(inst->VRegA_12x(inst_data), |
| 1569 | shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1570 | inst = inst->Next_1xx(); |
| 1571 | break; |
| 1572 | case Instruction::LONG_TO_FLOAT: |
| 1573 | PREAMBLE(); |
Ian Rogers | 450dcb5 | 2013-09-20 17:36:02 -0700 | [diff] [blame] | 1574 | shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), |
| 1575 | shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1576 | inst = inst->Next_1xx(); |
| 1577 | break; |
| 1578 | case Instruction::LONG_TO_DOUBLE: |
| 1579 | PREAMBLE(); |
Ian Rogers | 450dcb5 | 2013-09-20 17:36:02 -0700 | [diff] [blame] | 1580 | shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), |
| 1581 | shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1582 | inst = inst->Next_1xx(); |
| 1583 | break; |
| 1584 | case Instruction::FLOAT_TO_INT: { |
| 1585 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1586 | float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)); |
Ian Rogers | 450dcb5 | 2013-09-20 17:36:02 -0700 | [diff] [blame] | 1587 | int32_t result = art_float_to_integral<int32_t, float>(val); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1588 | shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1589 | inst = inst->Next_1xx(); |
| 1590 | break; |
| 1591 | } |
| 1592 | case Instruction::FLOAT_TO_LONG: { |
| 1593 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1594 | float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)); |
Ian Rogers | 450dcb5 | 2013-09-20 17:36:02 -0700 | [diff] [blame] | 1595 | int64_t result = art_float_to_integral<int64_t, float>(val); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1596 | shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1597 | inst = inst->Next_1xx(); |
| 1598 | break; |
| 1599 | } |
| 1600 | case Instruction::FLOAT_TO_DOUBLE: |
| 1601 | PREAMBLE(); |
Ian Rogers | 450dcb5 | 2013-09-20 17:36:02 -0700 | [diff] [blame] | 1602 | shadow_frame.SetVRegDouble(inst->VRegA_12x(inst_data), |
| 1603 | shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1604 | inst = inst->Next_1xx(); |
| 1605 | break; |
| 1606 | case Instruction::DOUBLE_TO_INT: { |
| 1607 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1608 | double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)); |
Ian Rogers | 450dcb5 | 2013-09-20 17:36:02 -0700 | [diff] [blame] | 1609 | int32_t result = art_float_to_integral<int32_t, double>(val); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1610 | shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1611 | inst = inst->Next_1xx(); |
| 1612 | break; |
| 1613 | } |
| 1614 | case Instruction::DOUBLE_TO_LONG: { |
| 1615 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1616 | double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)); |
Ian Rogers | 450dcb5 | 2013-09-20 17:36:02 -0700 | [diff] [blame] | 1617 | int64_t result = art_float_to_integral<int64_t, double>(val); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1618 | shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1619 | inst = inst->Next_1xx(); |
| 1620 | break; |
| 1621 | } |
| 1622 | case Instruction::DOUBLE_TO_FLOAT: |
| 1623 | PREAMBLE(); |
Ian Rogers | 450dcb5 | 2013-09-20 17:36:02 -0700 | [diff] [blame] | 1624 | shadow_frame.SetVRegFloat(inst->VRegA_12x(inst_data), |
| 1625 | shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1626 | inst = inst->Next_1xx(); |
| 1627 | break; |
| 1628 | case Instruction::INT_TO_BYTE: |
| 1629 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1630 | shadow_frame.SetVReg(inst->VRegA_12x(inst_data), static_cast<int8_t>( |
| 1631 | shadow_frame.GetVReg(inst->VRegB_12x(inst_data)))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1632 | inst = inst->Next_1xx(); |
| 1633 | break; |
| 1634 | case Instruction::INT_TO_CHAR: |
| 1635 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1636 | shadow_frame.SetVReg(inst->VRegA_12x(inst_data), static_cast<uint16_t>( |
| 1637 | shadow_frame.GetVReg(inst->VRegB_12x(inst_data)))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1638 | inst = inst->Next_1xx(); |
| 1639 | break; |
| 1640 | case Instruction::INT_TO_SHORT: |
| 1641 | PREAMBLE(); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 1642 | shadow_frame.SetVReg(inst->VRegA_12x(inst_data), static_cast<int16_t>( |
| 1643 | shadow_frame.GetVReg(inst->VRegB_12x(inst_data)))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1644 | inst = inst->Next_1xx(); |
| 1645 | break; |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 1646 | case Instruction::ADD_INT: { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1647 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1648 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 1649 | SafeAdd(shadow_frame.GetVReg(inst->VRegB_23x()), |
| 1650 | shadow_frame.GetVReg(inst->VRegC_23x()))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1651 | inst = inst->Next_2xx(); |
| 1652 | break; |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 1653 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1654 | case Instruction::SUB_INT: |
| 1655 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1656 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 1657 | SafeSub(shadow_frame.GetVReg(inst->VRegB_23x()), |
| 1658 | shadow_frame.GetVReg(inst->VRegC_23x()))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1659 | inst = inst->Next_2xx(); |
| 1660 | break; |
| 1661 | case Instruction::MUL_INT: |
| 1662 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1663 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 1664 | SafeMul(shadow_frame.GetVReg(inst->VRegB_23x()), |
| 1665 | shadow_frame.GetVReg(inst->VRegC_23x()))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1666 | inst = inst->Next_2xx(); |
| 1667 | break; |
| 1668 | case Instruction::DIV_INT: { |
| 1669 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1670 | bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1671 | shadow_frame.GetVReg(inst->VRegB_23x()), |
| 1672 | shadow_frame.GetVReg(inst->VRegC_23x())); |
| 1673 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1674 | break; |
| 1675 | } |
| 1676 | case Instruction::REM_INT: { |
| 1677 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1678 | bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1679 | shadow_frame.GetVReg(inst->VRegB_23x()), |
| 1680 | shadow_frame.GetVReg(inst->VRegC_23x())); |
| 1681 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 1682 | break; |
| 1683 | } |
| 1684 | case Instruction::SHL_INT: |
| 1685 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1686 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1687 | shadow_frame.GetVReg(inst->VRegB_23x()) << |
| 1688 | (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f)); |
| 1689 | inst = inst->Next_2xx(); |
| 1690 | break; |
| 1691 | case Instruction::SHR_INT: |
| 1692 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1693 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1694 | shadow_frame.GetVReg(inst->VRegB_23x()) >> |
| 1695 | (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f)); |
| 1696 | inst = inst->Next_2xx(); |
| 1697 | break; |
| 1698 | case Instruction::USHR_INT: |
| 1699 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1700 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1701 | static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >> |
| 1702 | (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f)); |
| 1703 | inst = inst->Next_2xx(); |
| 1704 | break; |
| 1705 | case Instruction::AND_INT: |
| 1706 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1707 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1708 | shadow_frame.GetVReg(inst->VRegB_23x()) & |
| 1709 | shadow_frame.GetVReg(inst->VRegC_23x())); |
| 1710 | inst = inst->Next_2xx(); |
| 1711 | break; |
| 1712 | case Instruction::OR_INT: |
| 1713 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1714 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1715 | shadow_frame.GetVReg(inst->VRegB_23x()) | |
| 1716 | shadow_frame.GetVReg(inst->VRegC_23x())); |
| 1717 | inst = inst->Next_2xx(); |
| 1718 | break; |
| 1719 | case Instruction::XOR_INT: |
| 1720 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1721 | shadow_frame.SetVReg(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1722 | shadow_frame.GetVReg(inst->VRegB_23x()) ^ |
| 1723 | shadow_frame.GetVReg(inst->VRegC_23x())); |
| 1724 | inst = inst->Next_2xx(); |
| 1725 | break; |
| 1726 | case Instruction::ADD_LONG: |
| 1727 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1728 | shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 1729 | SafeAdd(shadow_frame.GetVRegLong(inst->VRegB_23x()), |
| 1730 | shadow_frame.GetVRegLong(inst->VRegC_23x()))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1731 | inst = inst->Next_2xx(); |
| 1732 | break; |
| 1733 | case Instruction::SUB_LONG: |
| 1734 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1735 | shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 1736 | SafeSub(shadow_frame.GetVRegLong(inst->VRegB_23x()), |
| 1737 | shadow_frame.GetVRegLong(inst->VRegC_23x()))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1738 | inst = inst->Next_2xx(); |
| 1739 | break; |
| 1740 | case Instruction::MUL_LONG: |
| 1741 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1742 | shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 1743 | SafeMul(shadow_frame.GetVRegLong(inst->VRegB_23x()), |
| 1744 | shadow_frame.GetVRegLong(inst->VRegC_23x()))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1745 | inst = inst->Next_2xx(); |
| 1746 | break; |
| 1747 | case Instruction::DIV_LONG: |
| 1748 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1749 | DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1750 | shadow_frame.GetVRegLong(inst->VRegB_23x()), |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 1751 | shadow_frame.GetVRegLong(inst->VRegC_23x())); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1752 | POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_2xx); |
| 1753 | break; |
| 1754 | case Instruction::REM_LONG: |
| 1755 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1756 | DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1757 | shadow_frame.GetVRegLong(inst->VRegB_23x()), |
| 1758 | shadow_frame.GetVRegLong(inst->VRegC_23x())); |
| 1759 | POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_2xx); |
| 1760 | break; |
| 1761 | case Instruction::AND_LONG: |
| 1762 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1763 | shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1764 | shadow_frame.GetVRegLong(inst->VRegB_23x()) & |
| 1765 | shadow_frame.GetVRegLong(inst->VRegC_23x())); |
| 1766 | inst = inst->Next_2xx(); |
| 1767 | break; |
| 1768 | case Instruction::OR_LONG: |
| 1769 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1770 | shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1771 | shadow_frame.GetVRegLong(inst->VRegB_23x()) | |
| 1772 | shadow_frame.GetVRegLong(inst->VRegC_23x())); |
| 1773 | inst = inst->Next_2xx(); |
| 1774 | break; |
| 1775 | case Instruction::XOR_LONG: |
| 1776 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1777 | shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1778 | shadow_frame.GetVRegLong(inst->VRegB_23x()) ^ |
| 1779 | shadow_frame.GetVRegLong(inst->VRegC_23x())); |
| 1780 | inst = inst->Next_2xx(); |
| 1781 | break; |
| 1782 | case Instruction::SHL_LONG: |
| 1783 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1784 | shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1785 | shadow_frame.GetVRegLong(inst->VRegB_23x()) << |
| 1786 | (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f)); |
| 1787 | inst = inst->Next_2xx(); |
| 1788 | break; |
| 1789 | case Instruction::SHR_LONG: |
| 1790 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1791 | shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1792 | shadow_frame.GetVRegLong(inst->VRegB_23x()) >> |
| 1793 | (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f)); |
| 1794 | inst = inst->Next_2xx(); |
| 1795 | break; |
| 1796 | case Instruction::USHR_LONG: |
| 1797 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1798 | shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1799 | static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >> |
| 1800 | (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f)); |
| 1801 | inst = inst->Next_2xx(); |
| 1802 | break; |
| 1803 | case Instruction::ADD_FLOAT: |
| 1804 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1805 | shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1806 | shadow_frame.GetVRegFloat(inst->VRegB_23x()) + |
| 1807 | shadow_frame.GetVRegFloat(inst->VRegC_23x())); |
| 1808 | inst = inst->Next_2xx(); |
| 1809 | break; |
| 1810 | case Instruction::SUB_FLOAT: |
| 1811 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1812 | shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1813 | shadow_frame.GetVRegFloat(inst->VRegB_23x()) - |
| 1814 | shadow_frame.GetVRegFloat(inst->VRegC_23x())); |
| 1815 | inst = inst->Next_2xx(); |
| 1816 | break; |
| 1817 | case Instruction::MUL_FLOAT: |
| 1818 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1819 | shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1820 | shadow_frame.GetVRegFloat(inst->VRegB_23x()) * |
| 1821 | shadow_frame.GetVRegFloat(inst->VRegC_23x())); |
| 1822 | inst = inst->Next_2xx(); |
| 1823 | break; |
| 1824 | case Instruction::DIV_FLOAT: |
| 1825 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1826 | shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1827 | shadow_frame.GetVRegFloat(inst->VRegB_23x()) / |
| 1828 | shadow_frame.GetVRegFloat(inst->VRegC_23x())); |
| 1829 | inst = inst->Next_2xx(); |
| 1830 | break; |
| 1831 | case Instruction::REM_FLOAT: |
| 1832 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1833 | shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1834 | fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()), |
| 1835 | shadow_frame.GetVRegFloat(inst->VRegC_23x()))); |
| 1836 | inst = inst->Next_2xx(); |
| 1837 | break; |
| 1838 | case Instruction::ADD_DOUBLE: |
| 1839 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1840 | shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1841 | shadow_frame.GetVRegDouble(inst->VRegB_23x()) + |
| 1842 | shadow_frame.GetVRegDouble(inst->VRegC_23x())); |
| 1843 | inst = inst->Next_2xx(); |
| 1844 | break; |
| 1845 | case Instruction::SUB_DOUBLE: |
| 1846 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1847 | shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1848 | shadow_frame.GetVRegDouble(inst->VRegB_23x()) - |
| 1849 | shadow_frame.GetVRegDouble(inst->VRegC_23x())); |
| 1850 | inst = inst->Next_2xx(); |
| 1851 | break; |
| 1852 | case Instruction::MUL_DOUBLE: |
| 1853 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1854 | shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1855 | shadow_frame.GetVRegDouble(inst->VRegB_23x()) * |
| 1856 | shadow_frame.GetVRegDouble(inst->VRegC_23x())); |
| 1857 | inst = inst->Next_2xx(); |
| 1858 | break; |
| 1859 | case Instruction::DIV_DOUBLE: |
| 1860 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1861 | shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1862 | shadow_frame.GetVRegDouble(inst->VRegB_23x()) / |
| 1863 | shadow_frame.GetVRegDouble(inst->VRegC_23x())); |
| 1864 | inst = inst->Next_2xx(); |
| 1865 | break; |
| 1866 | case Instruction::REM_DOUBLE: |
| 1867 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1868 | shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1869 | fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()), |
| 1870 | shadow_frame.GetVRegDouble(inst->VRegC_23x()))); |
| 1871 | inst = inst->Next_2xx(); |
| 1872 | break; |
| 1873 | case Instruction::ADD_INT_2ADDR: { |
| 1874 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1875 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 1876 | shadow_frame.SetVReg(vregA, SafeAdd(shadow_frame.GetVReg(vregA), |
| 1877 | shadow_frame.GetVReg(inst->VRegB_12x(inst_data)))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1878 | inst = inst->Next_1xx(); |
| 1879 | break; |
| 1880 | } |
| 1881 | case Instruction::SUB_INT_2ADDR: { |
| 1882 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1883 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1884 | shadow_frame.SetVReg(vregA, |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 1885 | SafeSub(shadow_frame.GetVReg(vregA), |
| 1886 | shadow_frame.GetVReg(inst->VRegB_12x(inst_data)))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1887 | inst = inst->Next_1xx(); |
| 1888 | break; |
| 1889 | } |
| 1890 | case Instruction::MUL_INT_2ADDR: { |
| 1891 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1892 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1893 | shadow_frame.SetVReg(vregA, |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 1894 | SafeMul(shadow_frame.GetVReg(vregA), |
| 1895 | shadow_frame.GetVReg(inst->VRegB_12x(inst_data)))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1896 | inst = inst->Next_1xx(); |
| 1897 | break; |
| 1898 | } |
| 1899 | case Instruction::DIV_INT_2ADDR: { |
| 1900 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1901 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1902 | bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA), |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1903 | shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1904 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx); |
| 1905 | break; |
| 1906 | } |
| 1907 | case Instruction::REM_INT_2ADDR: { |
| 1908 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1909 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1910 | bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA), |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1911 | shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1912 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_1xx); |
| 1913 | break; |
| 1914 | } |
| 1915 | case Instruction::SHL_INT_2ADDR: { |
| 1916 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1917 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1918 | shadow_frame.SetVReg(vregA, |
| 1919 | shadow_frame.GetVReg(vregA) << |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1920 | (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1921 | inst = inst->Next_1xx(); |
| 1922 | break; |
| 1923 | } |
| 1924 | case Instruction::SHR_INT_2ADDR: { |
| 1925 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1926 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1927 | shadow_frame.SetVReg(vregA, |
| 1928 | shadow_frame.GetVReg(vregA) >> |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1929 | (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1930 | inst = inst->Next_1xx(); |
| 1931 | break; |
| 1932 | } |
| 1933 | case Instruction::USHR_INT_2ADDR: { |
| 1934 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1935 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1936 | shadow_frame.SetVReg(vregA, |
| 1937 | static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >> |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1938 | (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1939 | inst = inst->Next_1xx(); |
| 1940 | break; |
| 1941 | } |
| 1942 | case Instruction::AND_INT_2ADDR: { |
| 1943 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1944 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1945 | shadow_frame.SetVReg(vregA, |
| 1946 | shadow_frame.GetVReg(vregA) & |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1947 | shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1948 | inst = inst->Next_1xx(); |
| 1949 | break; |
| 1950 | } |
| 1951 | case Instruction::OR_INT_2ADDR: { |
| 1952 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1953 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1954 | shadow_frame.SetVReg(vregA, |
| 1955 | shadow_frame.GetVReg(vregA) | |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1956 | shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1957 | inst = inst->Next_1xx(); |
| 1958 | break; |
| 1959 | } |
| 1960 | case Instruction::XOR_INT_2ADDR: { |
| 1961 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1962 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1963 | shadow_frame.SetVReg(vregA, |
| 1964 | shadow_frame.GetVReg(vregA) ^ |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1965 | shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1966 | inst = inst->Next_1xx(); |
| 1967 | break; |
| 1968 | } |
| 1969 | case Instruction::ADD_LONG_2ADDR: { |
| 1970 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1971 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1972 | shadow_frame.SetVRegLong(vregA, |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 1973 | SafeAdd(shadow_frame.GetVRegLong(vregA), |
| 1974 | shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1975 | inst = inst->Next_1xx(); |
| 1976 | break; |
| 1977 | } |
| 1978 | case Instruction::SUB_LONG_2ADDR: { |
| 1979 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1980 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1981 | shadow_frame.SetVRegLong(vregA, |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 1982 | SafeSub(shadow_frame.GetVRegLong(vregA), |
| 1983 | shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1984 | inst = inst->Next_1xx(); |
| 1985 | break; |
| 1986 | } |
| 1987 | case Instruction::MUL_LONG_2ADDR: { |
| 1988 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1989 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1990 | shadow_frame.SetVRegLong(vregA, |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 1991 | SafeMul(shadow_frame.GetVRegLong(vregA), |
| 1992 | shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1993 | inst = inst->Next_1xx(); |
| 1994 | break; |
| 1995 | } |
| 1996 | case Instruction::DIV_LONG_2ADDR: { |
| 1997 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 1998 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 1999 | DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA), |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2000 | shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2001 | POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx); |
| 2002 | break; |
| 2003 | } |
| 2004 | case Instruction::REM_LONG_2ADDR: { |
| 2005 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2006 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2007 | DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA), |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2008 | shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2009 | POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), Next_1xx); |
| 2010 | break; |
| 2011 | } |
| 2012 | case Instruction::AND_LONG_2ADDR: { |
| 2013 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2014 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2015 | shadow_frame.SetVRegLong(vregA, |
| 2016 | shadow_frame.GetVRegLong(vregA) & |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2017 | shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2018 | inst = inst->Next_1xx(); |
| 2019 | break; |
| 2020 | } |
| 2021 | case Instruction::OR_LONG_2ADDR: { |
| 2022 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2023 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2024 | shadow_frame.SetVRegLong(vregA, |
| 2025 | shadow_frame.GetVRegLong(vregA) | |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2026 | shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2027 | inst = inst->Next_1xx(); |
| 2028 | break; |
| 2029 | } |
| 2030 | case Instruction::XOR_LONG_2ADDR: { |
| 2031 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2032 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2033 | shadow_frame.SetVRegLong(vregA, |
| 2034 | shadow_frame.GetVRegLong(vregA) ^ |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2035 | shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2036 | inst = inst->Next_1xx(); |
| 2037 | break; |
| 2038 | } |
| 2039 | case Instruction::SHL_LONG_2ADDR: { |
| 2040 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2041 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2042 | shadow_frame.SetVRegLong(vregA, |
| 2043 | shadow_frame.GetVRegLong(vregA) << |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2044 | (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2045 | inst = inst->Next_1xx(); |
| 2046 | break; |
| 2047 | } |
| 2048 | case Instruction::SHR_LONG_2ADDR: { |
| 2049 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2050 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2051 | shadow_frame.SetVRegLong(vregA, |
| 2052 | shadow_frame.GetVRegLong(vregA) >> |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2053 | (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2054 | inst = inst->Next_1xx(); |
| 2055 | break; |
| 2056 | } |
| 2057 | case Instruction::USHR_LONG_2ADDR: { |
| 2058 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2059 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2060 | shadow_frame.SetVRegLong(vregA, |
| 2061 | static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >> |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2062 | (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2063 | inst = inst->Next_1xx(); |
| 2064 | break; |
| 2065 | } |
| 2066 | case Instruction::ADD_FLOAT_2ADDR: { |
| 2067 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2068 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2069 | shadow_frame.SetVRegFloat(vregA, |
| 2070 | shadow_frame.GetVRegFloat(vregA) + |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2071 | shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2072 | inst = inst->Next_1xx(); |
| 2073 | break; |
| 2074 | } |
| 2075 | case Instruction::SUB_FLOAT_2ADDR: { |
| 2076 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2077 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2078 | shadow_frame.SetVRegFloat(vregA, |
| 2079 | shadow_frame.GetVRegFloat(vregA) - |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2080 | shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2081 | inst = inst->Next_1xx(); |
| 2082 | break; |
| 2083 | } |
| 2084 | case Instruction::MUL_FLOAT_2ADDR: { |
| 2085 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2086 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2087 | shadow_frame.SetVRegFloat(vregA, |
| 2088 | shadow_frame.GetVRegFloat(vregA) * |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2089 | shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2090 | inst = inst->Next_1xx(); |
| 2091 | break; |
| 2092 | } |
| 2093 | case Instruction::DIV_FLOAT_2ADDR: { |
| 2094 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2095 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2096 | shadow_frame.SetVRegFloat(vregA, |
| 2097 | shadow_frame.GetVRegFloat(vregA) / |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2098 | shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2099 | inst = inst->Next_1xx(); |
| 2100 | break; |
| 2101 | } |
| 2102 | case Instruction::REM_FLOAT_2ADDR: { |
| 2103 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2104 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2105 | shadow_frame.SetVRegFloat(vregA, |
| 2106 | fmodf(shadow_frame.GetVRegFloat(vregA), |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2107 | shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2108 | inst = inst->Next_1xx(); |
| 2109 | break; |
| 2110 | } |
| 2111 | case Instruction::ADD_DOUBLE_2ADDR: { |
| 2112 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2113 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2114 | shadow_frame.SetVRegDouble(vregA, |
| 2115 | shadow_frame.GetVRegDouble(vregA) + |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2116 | shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2117 | inst = inst->Next_1xx(); |
| 2118 | break; |
| 2119 | } |
| 2120 | case Instruction::SUB_DOUBLE_2ADDR: { |
| 2121 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2122 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2123 | shadow_frame.SetVRegDouble(vregA, |
| 2124 | shadow_frame.GetVRegDouble(vregA) - |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2125 | shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2126 | inst = inst->Next_1xx(); |
| 2127 | break; |
| 2128 | } |
| 2129 | case Instruction::MUL_DOUBLE_2ADDR: { |
| 2130 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2131 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2132 | shadow_frame.SetVRegDouble(vregA, |
| 2133 | shadow_frame.GetVRegDouble(vregA) * |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2134 | shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2135 | inst = inst->Next_1xx(); |
| 2136 | break; |
| 2137 | } |
| 2138 | case Instruction::DIV_DOUBLE_2ADDR: { |
| 2139 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2140 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2141 | shadow_frame.SetVRegDouble(vregA, |
| 2142 | shadow_frame.GetVRegDouble(vregA) / |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2143 | shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2144 | inst = inst->Next_1xx(); |
| 2145 | break; |
| 2146 | } |
| 2147 | case Instruction::REM_DOUBLE_2ADDR: { |
| 2148 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2149 | uint4_t vregA = inst->VRegA_12x(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2150 | shadow_frame.SetVRegDouble(vregA, |
| 2151 | fmod(shadow_frame.GetVRegDouble(vregA), |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2152 | shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2153 | inst = inst->Next_1xx(); |
| 2154 | break; |
| 2155 | } |
| 2156 | case Instruction::ADD_INT_LIT16: |
| 2157 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2158 | shadow_frame.SetVReg(inst->VRegA_22s(inst_data), |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 2159 | SafeAdd(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), |
| 2160 | inst->VRegC_22s())); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2161 | inst = inst->Next_2xx(); |
| 2162 | break; |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 2163 | case Instruction::RSUB_INT_LIT16: |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2164 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2165 | shadow_frame.SetVReg(inst->VRegA_22s(inst_data), |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 2166 | SafeSub(inst->VRegC_22s(), |
| 2167 | shadow_frame.GetVReg(inst->VRegB_22s(inst_data)))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2168 | inst = inst->Next_2xx(); |
| 2169 | break; |
| 2170 | case Instruction::MUL_INT_LIT16: |
| 2171 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2172 | shadow_frame.SetVReg(inst->VRegA_22s(inst_data), |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 2173 | SafeMul(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), |
| 2174 | inst->VRegC_22s())); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2175 | inst = inst->Next_2xx(); |
| 2176 | break; |
| 2177 | case Instruction::DIV_INT_LIT16: { |
| 2178 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2179 | bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(inst_data), |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 2180 | shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), |
| 2181 | inst->VRegC_22s()); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2182 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 2183 | break; |
| 2184 | } |
| 2185 | case Instruction::REM_INT_LIT16: { |
| 2186 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2187 | bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(inst_data), |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 2188 | shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), |
| 2189 | inst->VRegC_22s()); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2190 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 2191 | break; |
| 2192 | } |
| 2193 | case Instruction::AND_INT_LIT16: |
| 2194 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2195 | shadow_frame.SetVReg(inst->VRegA_22s(inst_data), |
| 2196 | shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) & |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2197 | inst->VRegC_22s()); |
| 2198 | inst = inst->Next_2xx(); |
| 2199 | break; |
| 2200 | case Instruction::OR_INT_LIT16: |
| 2201 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2202 | shadow_frame.SetVReg(inst->VRegA_22s(inst_data), |
| 2203 | shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) | |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2204 | inst->VRegC_22s()); |
| 2205 | inst = inst->Next_2xx(); |
| 2206 | break; |
| 2207 | case Instruction::XOR_INT_LIT16: |
| 2208 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2209 | shadow_frame.SetVReg(inst->VRegA_22s(inst_data), |
| 2210 | shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^ |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2211 | inst->VRegC_22s()); |
| 2212 | inst = inst->Next_2xx(); |
| 2213 | break; |
| 2214 | case Instruction::ADD_INT_LIT8: |
| 2215 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2216 | shadow_frame.SetVReg(inst->VRegA_22b(inst_data), |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 2217 | SafeAdd(shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b())); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2218 | inst = inst->Next_2xx(); |
| 2219 | break; |
| 2220 | case Instruction::RSUB_INT_LIT8: |
| 2221 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2222 | shadow_frame.SetVReg(inst->VRegA_22b(inst_data), |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 2223 | SafeSub(inst->VRegC_22b(), shadow_frame.GetVReg(inst->VRegB_22b()))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2224 | inst = inst->Next_2xx(); |
| 2225 | break; |
| 2226 | case Instruction::MUL_INT_LIT8: |
| 2227 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2228 | shadow_frame.SetVReg(inst->VRegA_22b(inst_data), |
Ian Rogers | f72a11d | 2014-10-30 15:41:08 -0700 | [diff] [blame] | 2229 | SafeMul(shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b())); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2230 | inst = inst->Next_2xx(); |
| 2231 | break; |
| 2232 | case Instruction::DIV_INT_LIT8: { |
| 2233 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2234 | bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2235 | shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b()); |
| 2236 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 2237 | break; |
| 2238 | } |
| 2239 | case Instruction::REM_INT_LIT8: { |
| 2240 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2241 | bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2242 | shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b()); |
| 2243 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 2244 | break; |
| 2245 | } |
| 2246 | case Instruction::AND_INT_LIT8: |
| 2247 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2248 | shadow_frame.SetVReg(inst->VRegA_22b(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2249 | shadow_frame.GetVReg(inst->VRegB_22b()) & |
| 2250 | inst->VRegC_22b()); |
| 2251 | inst = inst->Next_2xx(); |
| 2252 | break; |
| 2253 | case Instruction::OR_INT_LIT8: |
| 2254 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2255 | shadow_frame.SetVReg(inst->VRegA_22b(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2256 | shadow_frame.GetVReg(inst->VRegB_22b()) | |
| 2257 | inst->VRegC_22b()); |
| 2258 | inst = inst->Next_2xx(); |
| 2259 | break; |
| 2260 | case Instruction::XOR_INT_LIT8: |
| 2261 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2262 | shadow_frame.SetVReg(inst->VRegA_22b(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2263 | shadow_frame.GetVReg(inst->VRegB_22b()) ^ |
| 2264 | inst->VRegC_22b()); |
| 2265 | inst = inst->Next_2xx(); |
| 2266 | break; |
| 2267 | case Instruction::SHL_INT_LIT8: |
| 2268 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2269 | shadow_frame.SetVReg(inst->VRegA_22b(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2270 | shadow_frame.GetVReg(inst->VRegB_22b()) << |
| 2271 | (inst->VRegC_22b() & 0x1f)); |
| 2272 | inst = inst->Next_2xx(); |
| 2273 | break; |
| 2274 | case Instruction::SHR_INT_LIT8: |
| 2275 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2276 | shadow_frame.SetVReg(inst->VRegA_22b(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2277 | shadow_frame.GetVReg(inst->VRegB_22b()) >> |
| 2278 | (inst->VRegC_22b() & 0x1f)); |
| 2279 | inst = inst->Next_2xx(); |
| 2280 | break; |
| 2281 | case Instruction::USHR_INT_LIT8: |
| 2282 | PREAMBLE(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 2283 | shadow_frame.SetVReg(inst->VRegA_22b(inst_data), |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2284 | static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >> |
| 2285 | (inst->VRegC_22b() & 0x1f)); |
| 2286 | inst = inst->Next_2xx(); |
| 2287 | break; |
Igor Murashkin | 158f35c | 2015-06-10 15:55:30 -0700 | [diff] [blame] | 2288 | case Instruction::INVOKE_LAMBDA: { |
| 2289 | if (!IsExperimentalInstructionEnabled(inst)) { |
| 2290 | UnexpectedOpcode(inst, shadow_frame); |
| 2291 | } |
| 2292 | |
| 2293 | PREAMBLE(); |
| 2294 | bool success = DoInvokeLambda<do_access_check>(self, shadow_frame, inst, inst_data, |
| 2295 | &result_register); |
| 2296 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 2297 | break; |
| 2298 | } |
Igor Murashkin | 6918bf1 | 2015-09-27 19:19:06 -0700 | [diff] [blame] | 2299 | case Instruction::CAPTURE_VARIABLE: { |
| 2300 | if (!IsExperimentalInstructionEnabled(inst)) { |
| 2301 | UnexpectedOpcode(inst, shadow_frame); |
| 2302 | } |
| 2303 | |
| 2304 | if (lambda_closure_builder == nullptr) { |
| 2305 | lambda_closure_builder = MakeUnique<lambda::ClosureBuilder>(); |
| 2306 | } |
| 2307 | |
| 2308 | PREAMBLE(); |
| 2309 | bool success = DoCaptureVariable<do_access_check>(self, |
| 2310 | inst, |
| 2311 | /*inout*/shadow_frame, |
| 2312 | /*inout*/lambda_closure_builder.get()); |
| 2313 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 2314 | break; |
| 2315 | } |
Igor Murashkin | 158f35c | 2015-06-10 15:55:30 -0700 | [diff] [blame] | 2316 | case Instruction::CREATE_LAMBDA: { |
| 2317 | if (!IsExperimentalInstructionEnabled(inst)) { |
| 2318 | UnexpectedOpcode(inst, shadow_frame); |
| 2319 | } |
| 2320 | |
| 2321 | PREAMBLE(); |
Igor Murashkin | 6918bf1 | 2015-09-27 19:19:06 -0700 | [diff] [blame] | 2322 | |
| 2323 | if (lambda_closure_builder == nullptr) { |
| 2324 | // DoCreateLambda always needs a ClosureBuilder, even if it has 0 captured variables. |
| 2325 | lambda_closure_builder = MakeUnique<lambda::ClosureBuilder>(); |
| 2326 | } |
| 2327 | |
| 2328 | // TODO: these allocations should not leak, and the lambda method should not be local. |
| 2329 | lambda::Closure* lambda_closure = |
| 2330 | reinterpret_cast<lambda::Closure*>(alloca(lambda_closure_builder->GetSize())); |
| 2331 | bool success = DoCreateLambda<do_access_check>(self, |
| 2332 | inst, |
| 2333 | /*inout*/shadow_frame, |
| 2334 | /*inout*/lambda_closure_builder.get(), |
| 2335 | /*inout*/lambda_closure); |
| 2336 | lambda_closure_builder.reset(nullptr); // reset state of variables captured |
Igor Murashkin | 158f35c | 2015-06-10 15:55:30 -0700 | [diff] [blame] | 2337 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 2338 | break; |
| 2339 | } |
Igor Murashkin | 6918bf1 | 2015-09-27 19:19:06 -0700 | [diff] [blame] | 2340 | case Instruction::LIBERATE_VARIABLE: { |
| 2341 | if (!IsExperimentalInstructionEnabled(inst)) { |
| 2342 | UnexpectedOpcode(inst, shadow_frame); |
| 2343 | } |
| 2344 | |
| 2345 | PREAMBLE(); |
| 2346 | bool success = DoLiberateVariable<do_access_check>(self, |
| 2347 | inst, |
| 2348 | lambda_captured_variable_index, |
| 2349 | /*inout*/shadow_frame); |
| 2350 | // Temporarily only allow sequences of 'liberate-variable, liberate-variable, ...' |
| 2351 | lambda_captured_variable_index++; |
| 2352 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 2353 | break; |
| 2354 | } |
| 2355 | case Instruction::UNUSED_F4: { |
Igor Murashkin | 158f35c | 2015-06-10 15:55:30 -0700 | [diff] [blame] | 2356 | if (!IsExperimentalInstructionEnabled(inst)) { |
| 2357 | UnexpectedOpcode(inst, shadow_frame); |
| 2358 | } |
| 2359 | |
| 2360 | CHECK(false); // TODO(iam): Implement opcodes for lambdas |
| 2361 | break; |
| 2362 | } |
Igor Murashkin | 2ee54e2 | 2015-06-18 10:05:11 -0700 | [diff] [blame] | 2363 | case Instruction::BOX_LAMBDA: { |
| 2364 | if (!IsExperimentalInstructionEnabled(inst)) { |
| 2365 | UnexpectedOpcode(inst, shadow_frame); |
| 2366 | } |
| 2367 | |
| 2368 | PREAMBLE(); |
| 2369 | bool success = DoBoxLambda<do_access_check>(self, shadow_frame, inst, inst_data); |
| 2370 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 2371 | break; |
| 2372 | } |
| 2373 | case Instruction::UNBOX_LAMBDA: { |
| 2374 | if (!IsExperimentalInstructionEnabled(inst)) { |
| 2375 | UnexpectedOpcode(inst, shadow_frame); |
| 2376 | } |
| 2377 | |
| 2378 | PREAMBLE(); |
| 2379 | bool success = DoUnboxLambda<do_access_check>(self, shadow_frame, inst, inst_data); |
| 2380 | POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); |
| 2381 | break; |
| 2382 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2383 | case Instruction::UNUSED_3E ... Instruction::UNUSED_43: |
Igor Murashkin | 158f35c | 2015-06-10 15:55:30 -0700 | [diff] [blame] | 2384 | case Instruction::UNUSED_FA ... Instruction::UNUSED_FF: |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2385 | case Instruction::UNUSED_79: |
| 2386 | case Instruction::UNUSED_7A: |
Ian Rogers | e94652f | 2014-12-02 11:13:19 -0800 | [diff] [blame] | 2387 | UnexpectedOpcode(inst, shadow_frame); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2388 | } |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 2389 | } while (!interpret_one_instruction); |
| 2390 | // Record where we stopped. |
| 2391 | shadow_frame.SetDexPC(inst->GetDexPc(insns)); |
buzbee | d6b48db | 2016-01-28 15:48:55 -0800 | [diff] [blame] | 2392 | return result_register; |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2393 | } // NOLINT(readability/fn_size) |
| 2394 | |
| 2395 | // Explicit definitions of ExecuteSwitchImpl. |
Mathieu Chartier | 9044347 | 2015-07-16 20:32:27 -0700 | [diff] [blame] | 2396 | template SHARED_REQUIRES(Locks::mutator_lock_) HOT_ATTR |
Ian Rogers | e94652f | 2014-12-02 11:13:19 -0800 | [diff] [blame] | 2397 | JValue ExecuteSwitchImpl<true, false>(Thread* self, const DexFile::CodeItem* code_item, |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 2398 | ShadowFrame& shadow_frame, JValue result_register, |
| 2399 | bool interpret_one_instruction); |
Mathieu Chartier | 9044347 | 2015-07-16 20:32:27 -0700 | [diff] [blame] | 2400 | template SHARED_REQUIRES(Locks::mutator_lock_) HOT_ATTR |
Ian Rogers | e94652f | 2014-12-02 11:13:19 -0800 | [diff] [blame] | 2401 | JValue ExecuteSwitchImpl<false, false>(Thread* self, const DexFile::CodeItem* code_item, |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 2402 | ShadowFrame& shadow_frame, JValue result_register, |
| 2403 | bool interpret_one_instruction); |
Mathieu Chartier | 9044347 | 2015-07-16 20:32:27 -0700 | [diff] [blame] | 2404 | template SHARED_REQUIRES(Locks::mutator_lock_) |
Ian Rogers | e94652f | 2014-12-02 11:13:19 -0800 | [diff] [blame] | 2405 | JValue ExecuteSwitchImpl<true, true>(Thread* self, const DexFile::CodeItem* code_item, |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 2406 | ShadowFrame& shadow_frame, JValue result_register, |
| 2407 | bool interpret_one_instruction); |
Mathieu Chartier | 9044347 | 2015-07-16 20:32:27 -0700 | [diff] [blame] | 2408 | template SHARED_REQUIRES(Locks::mutator_lock_) |
Ian Rogers | e94652f | 2014-12-02 11:13:19 -0800 | [diff] [blame] | 2409 | JValue ExecuteSwitchImpl<false, true>(Thread* self, const DexFile::CodeItem* code_item, |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 2410 | ShadowFrame& shadow_frame, JValue result_register, |
| 2411 | bool interpret_one_instruction); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 2412 | |
| 2413 | } // namespace interpreter |
| 2414 | } // namespace art |