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 | |
| 17 | #ifndef ART_RUNTIME_INTERPRETER_INTERPRETER_COMMON_H_ |
| 18 | #define ART_RUNTIME_INTERPRETER_INTERPRETER_COMMON_H_ |
| 19 | |
| 20 | #include "interpreter.h" |
| 21 | |
| 22 | #include <math.h> |
| 23 | |
| 24 | #include "base/logging.h" |
| 25 | #include "class_linker-inl.h" |
| 26 | #include "common_throws.h" |
| 27 | #include "dex_file-inl.h" |
| 28 | #include "dex_instruction-inl.h" |
| 29 | #include "dex_instruction.h" |
| 30 | #include "entrypoints/entrypoint_utils.h" |
| 31 | #include "gc/accounting/card_table-inl.h" |
Mathieu Chartier | 0cd8135 | 2014-05-22 16:48:55 -0700 | [diff] [blame] | 32 | #include "handle_scope-inl.h" |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 33 | #include "nth_caller_visitor.h" |
| 34 | #include "mirror/art_field-inl.h" |
| 35 | #include "mirror/art_method.h" |
| 36 | #include "mirror/art_method-inl.h" |
| 37 | #include "mirror/class.h" |
| 38 | #include "mirror/class-inl.h" |
| 39 | #include "mirror/object-inl.h" |
| 40 | #include "mirror/object_array-inl.h" |
| 41 | #include "object_utils.h" |
| 42 | #include "ScopedLocalRef.h" |
| 43 | #include "scoped_thread_state_change.h" |
| 44 | #include "thread.h" |
| 45 | #include "well_known_classes.h" |
| 46 | |
| 47 | using ::art::mirror::ArtField; |
| 48 | using ::art::mirror::ArtMethod; |
| 49 | using ::art::mirror::Array; |
| 50 | using ::art::mirror::BooleanArray; |
| 51 | using ::art::mirror::ByteArray; |
| 52 | using ::art::mirror::CharArray; |
| 53 | using ::art::mirror::Class; |
| 54 | using ::art::mirror::ClassLoader; |
| 55 | using ::art::mirror::IntArray; |
| 56 | using ::art::mirror::LongArray; |
| 57 | using ::art::mirror::Object; |
| 58 | using ::art::mirror::ObjectArray; |
| 59 | using ::art::mirror::ShortArray; |
| 60 | using ::art::mirror::String; |
| 61 | using ::art::mirror::Throwable; |
| 62 | |
Sebastien Hertz | 82aeddb | 2014-05-20 20:09:45 +0200 | [diff] [blame] | 63 | // b/14882674 Workaround stack overflow issue with clang |
| 64 | #if defined(__clang__) && defined(__aarch64__) |
| 65 | #define SOMETIMES_INLINE __attribute__((noinline)) |
| 66 | #define SOMETIMES_INLINE_KEYWORD |
| 67 | #else |
| 68 | #define SOMETIMES_INLINE ALWAYS_INLINE |
| 69 | #define SOMETIMES_INLINE_KEYWORD inline |
| 70 | #endif |
| 71 | |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 72 | namespace art { |
| 73 | namespace interpreter { |
| 74 | |
| 75 | // External references to both interpreter implementations. |
| 76 | |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 77 | template<bool do_access_check, bool transaction_active> |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 78 | extern JValue ExecuteSwitchImpl(Thread* self, MethodHelper& mh, |
| 79 | const DexFile::CodeItem* code_item, |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 80 | ShadowFrame& shadow_frame, JValue result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 81 | |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 82 | template<bool do_access_check, bool transaction_active> |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 83 | extern JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, |
| 84 | const DexFile::CodeItem* code_item, |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 85 | ShadowFrame& shadow_frame, JValue result_register); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 86 | |
Sebastien Hertz | da843e1 | 2014-05-28 19:28:31 +0200 | [diff] [blame^] | 87 | // Workaround for b/14882674 where clang allocates stack for each ThrowLocation created by calls to |
| 88 | // ShadowFrame::GetCurrentLocationForThrow(). Moving the call here prevents from doing such |
| 89 | // allocation in the interpreter itself. |
| 90 | static inline void ThrowNullPointerExceptionFromInterpreter(const ShadowFrame& shadow_frame) |
| 91 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) SOMETIMES_INLINE; |
| 92 | |
| 93 | static inline void ThrowNullPointerExceptionFromInterpreter( |
| 94 | const ShadowFrame& shadow_frame) { |
| 95 | ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow()); |
| 96 | } |
| 97 | |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 98 | static inline void DoMonitorEnter(Thread* self, Object* ref) NO_THREAD_SAFETY_ANALYSIS { |
| 99 | ref->MonitorEnter(self); |
| 100 | } |
| 101 | |
| 102 | static inline void DoMonitorExit(Thread* self, Object* ref) NO_THREAD_SAFETY_ANALYSIS { |
| 103 | ref->MonitorExit(self); |
| 104 | } |
| 105 | |
Mathieu Chartier | b2c7ead | 2014-04-29 11:13:16 -0700 | [diff] [blame] | 106 | void AbortTransaction(Thread* self, const char* fmt, ...) |
| 107 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
| 108 | |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 109 | void RecordArrayElementsInTransaction(mirror::Array* array, int32_t count) |
| 110 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
| 111 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 112 | // Invokes the given method. This is part of the invocation support and is used by DoInvoke and |
| 113 | // DoInvokeVirtualQuick functions. |
| 114 | // Returns true on success, otherwise throws an exception and returns false. |
Sebastien Hertz | c61124b | 2013-09-10 11:44:19 +0200 | [diff] [blame] | 115 | template<bool is_range, bool do_assignability_check> |
Sebastien Hertz | 9119c5f | 2013-12-16 11:31:45 +0100 | [diff] [blame] | 116 | bool DoCall(ArtMethod* method, Thread* self, ShadowFrame& shadow_frame, |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 117 | const Instruction* inst, uint16_t inst_data, JValue* result); |
Sebastien Hertz | c61124b | 2013-09-10 11:44:19 +0200 | [diff] [blame] | 118 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 119 | // Handles invoke-XXX/range instructions. |
| 120 | // Returns true on success, otherwise throws an exception and returns false. |
Sebastien Hertz | c61124b | 2013-09-10 11:44:19 +0200 | [diff] [blame] | 121 | template<InvokeType type, bool is_range, bool do_access_check> |
| 122 | static inline bool DoInvoke(Thread* self, ShadowFrame& shadow_frame, const Instruction* inst, |
| 123 | uint16_t inst_data, JValue* result) { |
| 124 | const uint32_t method_idx = (is_range) ? inst->VRegB_3rc() : inst->VRegB_35c(); |
| 125 | const uint32_t vregC = (is_range) ? inst->VRegC_3rc() : inst->VRegC_35c(); |
Mathieu Chartier | e861ebd | 2013-10-09 15:01:21 -0700 | [diff] [blame] | 126 | Object* receiver = (type == kStatic) ? nullptr : shadow_frame.GetVRegReference(vregC); |
Mathieu Chartier | 0cd8135 | 2014-05-22 16:48:55 -0700 | [diff] [blame] | 127 | mirror::ArtMethod* sf_method = shadow_frame.GetMethod(); |
| 128 | ArtMethod* const method = FindMethodFromCode<type, do_access_check>( |
| 129 | method_idx, &receiver, &sf_method, self); |
| 130 | // The shadow frame should already be pushed, so we don't need to update it. |
Sebastien Hertz | d4beb6b | 2013-10-02 17:07:20 +0200 | [diff] [blame] | 131 | if (UNLIKELY(method == nullptr)) { |
Sebastien Hertz | c61124b | 2013-09-10 11:44:19 +0200 | [diff] [blame] | 132 | CHECK(self->IsExceptionPending()); |
| 133 | result->SetJ(0); |
| 134 | return false; |
| 135 | } else if (UNLIKELY(method->IsAbstract())) { |
| 136 | ThrowAbstractMethodError(method); |
| 137 | result->SetJ(0); |
| 138 | return false; |
| 139 | } else { |
Sebastien Hertz | 9119c5f | 2013-12-16 11:31:45 +0100 | [diff] [blame] | 140 | return DoCall<is_range, do_access_check>(method, self, shadow_frame, inst, inst_data, result); |
Sebastien Hertz | c61124b | 2013-09-10 11:44:19 +0200 | [diff] [blame] | 141 | } |
| 142 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 143 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 144 | // Handles invoke-virtual-quick and invoke-virtual-quick-range instructions. |
| 145 | // Returns true on success, otherwise throws an exception and returns false. |
Sebastien Hertz | c61124b | 2013-09-10 11:44:19 +0200 | [diff] [blame] | 146 | template<bool is_range> |
| 147 | static inline bool DoInvokeVirtualQuick(Thread* self, ShadowFrame& shadow_frame, |
| 148 | const Instruction* inst, uint16_t inst_data, |
| 149 | JValue* result) { |
| 150 | const uint32_t vregC = (is_range) ? inst->VRegC_3rc() : inst->VRegC_35c(); |
| 151 | Object* const receiver = shadow_frame.GetVRegReference(vregC); |
Sebastien Hertz | d4beb6b | 2013-10-02 17:07:20 +0200 | [diff] [blame] | 152 | if (UNLIKELY(receiver == nullptr)) { |
Sebastien Hertz | c61124b | 2013-09-10 11:44:19 +0200 | [diff] [blame] | 153 | // We lost the reference to the method index so we cannot get a more |
| 154 | // precised exception message. |
| 155 | ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow()); |
| 156 | return false; |
| 157 | } |
| 158 | const uint32_t vtable_idx = (is_range) ? inst->VRegB_3rc() : inst->VRegB_35c(); |
| 159 | ArtMethod* const method = receiver->GetClass()->GetVTable()->GetWithoutChecks(vtable_idx); |
Sebastien Hertz | d4beb6b | 2013-10-02 17:07:20 +0200 | [diff] [blame] | 160 | if (UNLIKELY(method == nullptr)) { |
Sebastien Hertz | c61124b | 2013-09-10 11:44:19 +0200 | [diff] [blame] | 161 | CHECK(self->IsExceptionPending()); |
| 162 | result->SetJ(0); |
| 163 | return false; |
| 164 | } else if (UNLIKELY(method->IsAbstract())) { |
| 165 | ThrowAbstractMethodError(method); |
| 166 | result->SetJ(0); |
| 167 | return false; |
| 168 | } else { |
| 169 | // No need to check since we've been quickened. |
Sebastien Hertz | 9119c5f | 2013-12-16 11:31:45 +0100 | [diff] [blame] | 170 | return DoCall<is_range, false>(method, self, shadow_frame, inst, inst_data, result); |
Sebastien Hertz | c61124b | 2013-09-10 11:44:19 +0200 | [diff] [blame] | 171 | } |
| 172 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 173 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 174 | // Handles iget-XXX and sget-XXX instructions. |
| 175 | // Returns true on success, otherwise throws an exception and returns false. |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 176 | template<FindFieldType find_type, Primitive::Type field_type, bool do_access_check> |
Sebastien Hertz | 82aeddb | 2014-05-20 20:09:45 +0200 | [diff] [blame] | 177 | static SOMETIMES_INLINE_KEYWORD bool DoFieldGet(Thread* self, ShadowFrame& shadow_frame, |
| 178 | const Instruction* inst, uint16_t inst_data) { |
Sebastien Hertz | d4beb6b | 2013-10-02 17:07:20 +0200 | [diff] [blame] | 179 | const bool is_static = (find_type == StaticObjectRead) || (find_type == StaticPrimitiveRead); |
| 180 | const uint32_t field_idx = is_static ? inst->VRegB_21c() : inst->VRegC_22c(); |
| 181 | ArtField* f = FindFieldFromCode<find_type, do_access_check>(field_idx, shadow_frame.GetMethod(), self, |
| 182 | Primitive::FieldSize(field_type)); |
| 183 | if (UNLIKELY(f == nullptr)) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 184 | CHECK(self->IsExceptionPending()); |
| 185 | return false; |
| 186 | } |
| 187 | Object* obj; |
| 188 | if (is_static) { |
| 189 | obj = f->GetDeclaringClass(); |
| 190 | } else { |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 191 | obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data)); |
Sebastien Hertz | d4beb6b | 2013-10-02 17:07:20 +0200 | [diff] [blame] | 192 | if (UNLIKELY(obj == nullptr)) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 193 | ThrowNullPointerExceptionForFieldAccess(shadow_frame.GetCurrentLocationForThrow(), f, true); |
| 194 | return false; |
| 195 | } |
| 196 | } |
Sebastien Hertz | 479fc1e | 2014-04-04 17:51:34 +0200 | [diff] [blame] | 197 | // Report this field access to instrumentation if needed. |
| 198 | instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation(); |
| 199 | if (UNLIKELY(instrumentation->HasFieldReadListeners())) { |
| 200 | Object* this_object = f->IsStatic() ? nullptr : obj; |
| 201 | instrumentation->FieldReadEvent(self, this_object, shadow_frame.GetMethod(), |
| 202 | shadow_frame.GetDexPC(), f); |
| 203 | } |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 204 | uint32_t vregA = is_static ? inst->VRegA_21c(inst_data) : inst->VRegA_22c(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 205 | switch (field_type) { |
| 206 | case Primitive::kPrimBoolean: |
| 207 | shadow_frame.SetVReg(vregA, f->GetBoolean(obj)); |
| 208 | break; |
| 209 | case Primitive::kPrimByte: |
| 210 | shadow_frame.SetVReg(vregA, f->GetByte(obj)); |
| 211 | break; |
| 212 | case Primitive::kPrimChar: |
| 213 | shadow_frame.SetVReg(vregA, f->GetChar(obj)); |
| 214 | break; |
| 215 | case Primitive::kPrimShort: |
| 216 | shadow_frame.SetVReg(vregA, f->GetShort(obj)); |
| 217 | break; |
| 218 | case Primitive::kPrimInt: |
| 219 | shadow_frame.SetVReg(vregA, f->GetInt(obj)); |
| 220 | break; |
| 221 | case Primitive::kPrimLong: |
| 222 | shadow_frame.SetVRegLong(vregA, f->GetLong(obj)); |
| 223 | break; |
| 224 | case Primitive::kPrimNot: |
| 225 | shadow_frame.SetVRegReference(vregA, f->GetObject(obj)); |
| 226 | break; |
| 227 | default: |
| 228 | LOG(FATAL) << "Unreachable: " << field_type; |
| 229 | } |
| 230 | return true; |
| 231 | } |
| 232 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 233 | // Handles iget-quick, iget-wide-quick and iget-object-quick instructions. |
| 234 | // Returns true on success, otherwise throws an exception and returns false. |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 235 | template<Primitive::Type field_type> |
Sebastien Hertz | 82aeddb | 2014-05-20 20:09:45 +0200 | [diff] [blame] | 236 | static SOMETIMES_INLINE_KEYWORD bool DoIGetQuick(ShadowFrame& shadow_frame, const Instruction* inst, uint16_t inst_data) { |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 237 | Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data)); |
Sebastien Hertz | d4beb6b | 2013-10-02 17:07:20 +0200 | [diff] [blame] | 238 | if (UNLIKELY(obj == nullptr)) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 239 | // We lost the reference to the field index so we cannot get a more |
| 240 | // precised exception message. |
| 241 | ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow()); |
| 242 | return false; |
| 243 | } |
| 244 | MemberOffset field_offset(inst->VRegC_22c()); |
Sebastien Hertz | 479fc1e | 2014-04-04 17:51:34 +0200 | [diff] [blame] | 245 | // Report this field access to instrumentation if needed. Since we only have the offset of |
| 246 | // the field from the base of the object, we need to look for it first. |
| 247 | instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation(); |
| 248 | if (UNLIKELY(instrumentation->HasFieldReadListeners())) { |
| 249 | ArtField* f = ArtField::FindInstanceFieldWithOffset(obj->GetClass(), |
| 250 | field_offset.Uint32Value()); |
| 251 | DCHECK(f != nullptr); |
| 252 | DCHECK(!f->IsStatic()); |
| 253 | instrumentation->FieldReadEvent(Thread::Current(), obj, shadow_frame.GetMethod(), |
| 254 | shadow_frame.GetDexPC(), f); |
| 255 | } |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 256 | // Note: iget-x-quick instructions are only for non-volatile fields. |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 257 | const uint32_t vregA = inst->VRegA_22c(inst_data); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 258 | switch (field_type) { |
| 259 | case Primitive::kPrimInt: |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 260 | shadow_frame.SetVReg(vregA, static_cast<int32_t>(obj->GetField32(field_offset))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 261 | break; |
| 262 | case Primitive::kPrimLong: |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 263 | shadow_frame.SetVRegLong(vregA, static_cast<int64_t>(obj->GetField64(field_offset))); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 264 | break; |
| 265 | case Primitive::kPrimNot: |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 266 | shadow_frame.SetVRegReference(vregA, obj->GetFieldObject<mirror::Object>(field_offset)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 267 | break; |
| 268 | default: |
| 269 | LOG(FATAL) << "Unreachable: " << field_type; |
| 270 | } |
| 271 | return true; |
| 272 | } |
| 273 | |
Sebastien Hertz | 479fc1e | 2014-04-04 17:51:34 +0200 | [diff] [blame] | 274 | template<Primitive::Type field_type> |
| 275 | static inline JValue GetFieldValue(const ShadowFrame& shadow_frame, uint32_t vreg) |
| 276 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
| 277 | JValue field_value; |
| 278 | switch (field_type) { |
| 279 | case Primitive::kPrimBoolean: |
| 280 | field_value.SetZ(static_cast<uint8_t>(shadow_frame.GetVReg(vreg))); |
| 281 | break; |
| 282 | case Primitive::kPrimByte: |
| 283 | field_value.SetB(static_cast<int8_t>(shadow_frame.GetVReg(vreg))); |
| 284 | break; |
| 285 | case Primitive::kPrimChar: |
| 286 | field_value.SetC(static_cast<uint16_t>(shadow_frame.GetVReg(vreg))); |
| 287 | break; |
| 288 | case Primitive::kPrimShort: |
| 289 | field_value.SetS(static_cast<int16_t>(shadow_frame.GetVReg(vreg))); |
| 290 | break; |
| 291 | case Primitive::kPrimInt: |
| 292 | field_value.SetI(shadow_frame.GetVReg(vreg)); |
| 293 | break; |
| 294 | case Primitive::kPrimLong: |
| 295 | field_value.SetJ(shadow_frame.GetVRegLong(vreg)); |
| 296 | break; |
| 297 | case Primitive::kPrimNot: |
| 298 | field_value.SetL(shadow_frame.GetVRegReference(vreg)); |
| 299 | break; |
| 300 | default: |
| 301 | LOG(FATAL) << "Unreachable: " << field_type; |
| 302 | break; |
| 303 | } |
| 304 | return field_value; |
| 305 | } |
| 306 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 307 | // Handles iput-XXX and sput-XXX instructions. |
| 308 | // Returns true on success, otherwise throws an exception and returns false. |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 309 | template<FindFieldType find_type, Primitive::Type field_type, bool do_access_check, bool transaction_active> |
Sebastien Hertz | 82aeddb | 2014-05-20 20:09:45 +0200 | [diff] [blame] | 310 | static SOMETIMES_INLINE_KEYWORD bool DoFieldPut(Thread* self, const ShadowFrame& shadow_frame, |
| 311 | const Instruction* inst, uint16_t inst_data) { |
Jeff Hao | a3faaf4 | 2013-09-03 19:07:00 -0700 | [diff] [blame] | 312 | bool do_assignability_check = do_access_check; |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 313 | bool is_static = (find_type == StaticObjectWrite) || (find_type == StaticPrimitiveWrite); |
| 314 | uint32_t field_idx = is_static ? inst->VRegB_21c() : inst->VRegC_22c(); |
Sebastien Hertz | d4beb6b | 2013-10-02 17:07:20 +0200 | [diff] [blame] | 315 | ArtField* f = FindFieldFromCode<find_type, do_access_check>(field_idx, shadow_frame.GetMethod(), self, |
| 316 | Primitive::FieldSize(field_type)); |
| 317 | if (UNLIKELY(f == nullptr)) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 318 | CHECK(self->IsExceptionPending()); |
| 319 | return false; |
| 320 | } |
| 321 | Object* obj; |
| 322 | if (is_static) { |
| 323 | obj = f->GetDeclaringClass(); |
| 324 | } else { |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 325 | obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data)); |
Sebastien Hertz | d4beb6b | 2013-10-02 17:07:20 +0200 | [diff] [blame] | 326 | if (UNLIKELY(obj == nullptr)) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 327 | ThrowNullPointerExceptionForFieldAccess(shadow_frame.GetCurrentLocationForThrow(), |
| 328 | f, false); |
| 329 | return false; |
| 330 | } |
| 331 | } |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 332 | uint32_t vregA = is_static ? inst->VRegA_21c(inst_data) : inst->VRegA_22c(inst_data); |
Sebastien Hertz | 479fc1e | 2014-04-04 17:51:34 +0200 | [diff] [blame] | 333 | // Report this field access to instrumentation if needed. Since we only have the offset of |
| 334 | // the field from the base of the object, we need to look for it first. |
| 335 | instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation(); |
| 336 | if (UNLIKELY(instrumentation->HasFieldWriteListeners())) { |
| 337 | JValue field_value = GetFieldValue<field_type>(shadow_frame, vregA); |
| 338 | Object* this_object = f->IsStatic() ? nullptr : obj; |
| 339 | instrumentation->FieldWriteEvent(self, this_object, shadow_frame.GetMethod(), |
| 340 | shadow_frame.GetDexPC(), f, field_value); |
| 341 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 342 | switch (field_type) { |
| 343 | case Primitive::kPrimBoolean: |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 344 | f->SetBoolean<transaction_active>(obj, shadow_frame.GetVReg(vregA)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 345 | break; |
| 346 | case Primitive::kPrimByte: |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 347 | f->SetByte<transaction_active>(obj, shadow_frame.GetVReg(vregA)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 348 | break; |
| 349 | case Primitive::kPrimChar: |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 350 | f->SetChar<transaction_active>(obj, shadow_frame.GetVReg(vregA)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 351 | break; |
| 352 | case Primitive::kPrimShort: |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 353 | f->SetShort<transaction_active>(obj, shadow_frame.GetVReg(vregA)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 354 | break; |
| 355 | case Primitive::kPrimInt: |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 356 | f->SetInt<transaction_active>(obj, shadow_frame.GetVReg(vregA)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 357 | break; |
| 358 | case Primitive::kPrimLong: |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 359 | f->SetLong<transaction_active>(obj, shadow_frame.GetVRegLong(vregA)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 360 | break; |
Jeff Hao | a3faaf4 | 2013-09-03 19:07:00 -0700 | [diff] [blame] | 361 | case Primitive::kPrimNot: { |
| 362 | Object* reg = shadow_frame.GetVRegReference(vregA); |
Sebastien Hertz | d4beb6b | 2013-10-02 17:07:20 +0200 | [diff] [blame] | 363 | if (do_assignability_check && reg != nullptr) { |
Mathieu Chartier | 0cd8135 | 2014-05-22 16:48:55 -0700 | [diff] [blame] | 364 | // FieldHelper::GetType can resolve classes, use a handle wrapper which will restore the |
| 365 | // object in the destructor. |
| 366 | StackHandleScope<1> hs(self); |
| 367 | HandleWrapper<mirror::Object> wrapper(hs.NewHandleWrapper(&obj)); |
Jeff Hao | a3faaf4 | 2013-09-03 19:07:00 -0700 | [diff] [blame] | 368 | Class* field_class = FieldHelper(f).GetType(); |
| 369 | if (!reg->VerifierInstanceOf(field_class)) { |
| 370 | // This should never happen. |
| 371 | self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(), |
| 372 | "Ljava/lang/VirtualMachineError;", |
| 373 | "Put '%s' that is not instance of field '%s' in '%s'", |
Mathieu Chartier | f832284 | 2014-05-16 10:59:25 -0700 | [diff] [blame] | 374 | reg->GetClass()->GetDescriptor().c_str(), |
| 375 | field_class->GetDescriptor().c_str(), |
| 376 | f->GetDeclaringClass()->GetDescriptor().c_str()); |
Jeff Hao | a3faaf4 | 2013-09-03 19:07:00 -0700 | [diff] [blame] | 377 | return false; |
| 378 | } |
| 379 | } |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 380 | f->SetObj<transaction_active>(obj, reg); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 381 | break; |
Jeff Hao | a3faaf4 | 2013-09-03 19:07:00 -0700 | [diff] [blame] | 382 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 383 | default: |
| 384 | LOG(FATAL) << "Unreachable: " << field_type; |
| 385 | } |
| 386 | return true; |
| 387 | } |
| 388 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 389 | // Handles iput-quick, iput-wide-quick and iput-object-quick instructions. |
| 390 | // Returns true on success, otherwise throws an exception and returns false. |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 391 | template<Primitive::Type field_type, bool transaction_active> |
Mathieu Chartier | 0cd8135 | 2014-05-22 16:48:55 -0700 | [diff] [blame] | 392 | static SOMETIMES_INLINE_KEYWORD bool DoIPutQuick(const ShadowFrame& shadow_frame, |
| 393 | const Instruction* inst, uint16_t inst_data) { |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 394 | Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data)); |
Sebastien Hertz | d4beb6b | 2013-10-02 17:07:20 +0200 | [diff] [blame] | 395 | if (UNLIKELY(obj == nullptr)) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 396 | // We lost the reference to the field index so we cannot get a more |
| 397 | // precised exception message. |
| 398 | ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow()); |
| 399 | return false; |
| 400 | } |
| 401 | MemberOffset field_offset(inst->VRegC_22c()); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 402 | const uint32_t vregA = inst->VRegA_22c(inst_data); |
Sebastien Hertz | 479fc1e | 2014-04-04 17:51:34 +0200 | [diff] [blame] | 403 | // Report this field modification to instrumentation if needed. Since we only have the offset of |
| 404 | // the field from the base of the object, we need to look for it first. |
| 405 | instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation(); |
| 406 | if (UNLIKELY(instrumentation->HasFieldWriteListeners())) { |
| 407 | ArtField* f = ArtField::FindInstanceFieldWithOffset(obj->GetClass(), |
| 408 | field_offset.Uint32Value()); |
| 409 | DCHECK(f != nullptr); |
| 410 | DCHECK(!f->IsStatic()); |
| 411 | JValue field_value = GetFieldValue<field_type>(shadow_frame, vregA); |
| 412 | instrumentation->FieldWriteEvent(Thread::Current(), obj, shadow_frame.GetMethod(), |
| 413 | shadow_frame.GetDexPC(), f, field_value); |
| 414 | } |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 415 | // Note: iput-x-quick instructions are only for non-volatile fields. |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 416 | switch (field_type) { |
| 417 | case Primitive::kPrimInt: |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 418 | obj->SetField32<transaction_active>(field_offset, shadow_frame.GetVReg(vregA)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 419 | break; |
| 420 | case Primitive::kPrimLong: |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 421 | obj->SetField64<transaction_active>(field_offset, shadow_frame.GetVRegLong(vregA)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 422 | break; |
| 423 | case Primitive::kPrimNot: |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 424 | obj->SetFieldObject<transaction_active>(field_offset, shadow_frame.GetVRegReference(vregA)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 425 | break; |
| 426 | default: |
| 427 | LOG(FATAL) << "Unreachable: " << field_type; |
| 428 | } |
| 429 | return true; |
| 430 | } |
| 431 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 432 | // Handles string resolution for const-string and const-string-jumbo instructions. Also ensures the |
| 433 | // java.lang.String class is initialized. |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 434 | static inline String* ResolveString(Thread* self, MethodHelper& mh, uint32_t string_idx) |
| 435 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Mathieu Chartier | c528dba | 2013-11-26 12:00:11 -0800 | [diff] [blame] | 436 | CHECK(!kMovingMethods); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 437 | Class* java_lang_string_class = String::GetJavaLangString(); |
| 438 | if (UNLIKELY(!java_lang_string_class->IsInitialized())) { |
| 439 | ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); |
Mathieu Chartier | eb8167a | 2014-05-07 15:43:14 -0700 | [diff] [blame] | 440 | StackHandleScope<1> hs(self); |
| 441 | Handle<mirror::Class> h_class(hs.NewHandle(java_lang_string_class)); |
| 442 | if (UNLIKELY(!class_linker->EnsureInitialized(h_class, true, true))) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 443 | DCHECK(self->IsExceptionPending()); |
Mathieu Chartier | c528dba | 2013-11-26 12:00:11 -0800 | [diff] [blame] | 444 | return nullptr; |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 445 | } |
| 446 | } |
| 447 | return mh.ResolveString(string_idx); |
| 448 | } |
| 449 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 450 | // Handles div-int, div-int/2addr, div-int/li16 and div-int/lit8 instructions. |
| 451 | // Returns true on success, otherwise throws a java.lang.ArithmeticException and return false. |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 452 | static inline bool DoIntDivide(ShadowFrame& shadow_frame, size_t result_reg, |
| 453 | int32_t dividend, int32_t divisor) |
| 454 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 2e2deeb | 2013-09-23 11:58:57 -0700 | [diff] [blame] | 455 | const int32_t kMinInt = std::numeric_limits<int32_t>::min(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 456 | if (UNLIKELY(divisor == 0)) { |
| 457 | ThrowArithmeticExceptionDivideByZero(); |
| 458 | return false; |
| 459 | } |
| 460 | if (UNLIKELY(dividend == kMinInt && divisor == -1)) { |
| 461 | shadow_frame.SetVReg(result_reg, kMinInt); |
| 462 | } else { |
| 463 | shadow_frame.SetVReg(result_reg, dividend / divisor); |
| 464 | } |
| 465 | return true; |
| 466 | } |
| 467 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 468 | // Handles rem-int, rem-int/2addr, rem-int/li16 and rem-int/lit8 instructions. |
| 469 | // Returns true on success, otherwise throws a java.lang.ArithmeticException and return false. |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 470 | static inline bool DoIntRemainder(ShadowFrame& shadow_frame, size_t result_reg, |
| 471 | int32_t dividend, int32_t divisor) |
| 472 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 2e2deeb | 2013-09-23 11:58:57 -0700 | [diff] [blame] | 473 | const int32_t kMinInt = std::numeric_limits<int32_t>::min(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 474 | if (UNLIKELY(divisor == 0)) { |
| 475 | ThrowArithmeticExceptionDivideByZero(); |
| 476 | return false; |
| 477 | } |
| 478 | if (UNLIKELY(dividend == kMinInt && divisor == -1)) { |
| 479 | shadow_frame.SetVReg(result_reg, 0); |
| 480 | } else { |
| 481 | shadow_frame.SetVReg(result_reg, dividend % divisor); |
| 482 | } |
| 483 | return true; |
| 484 | } |
| 485 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 486 | // Handles div-long and div-long-2addr instructions. |
| 487 | // Returns true on success, otherwise throws a java.lang.ArithmeticException and return false. |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 488 | static inline bool DoLongDivide(ShadowFrame& shadow_frame, size_t result_reg, |
| 489 | int64_t dividend, int64_t divisor) |
| 490 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 2e2deeb | 2013-09-23 11:58:57 -0700 | [diff] [blame] | 491 | const int64_t kMinLong = std::numeric_limits<int64_t>::min(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 492 | if (UNLIKELY(divisor == 0)) { |
| 493 | ThrowArithmeticExceptionDivideByZero(); |
| 494 | return false; |
| 495 | } |
| 496 | if (UNLIKELY(dividend == kMinLong && divisor == -1)) { |
| 497 | shadow_frame.SetVRegLong(result_reg, kMinLong); |
| 498 | } else { |
| 499 | shadow_frame.SetVRegLong(result_reg, dividend / divisor); |
| 500 | } |
| 501 | return true; |
| 502 | } |
| 503 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 504 | // Handles rem-long and rem-long-2addr instructions. |
| 505 | // Returns true on success, otherwise throws a java.lang.ArithmeticException and return false. |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 506 | static inline bool DoLongRemainder(ShadowFrame& shadow_frame, size_t result_reg, |
| 507 | int64_t dividend, int64_t divisor) |
| 508 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 2e2deeb | 2013-09-23 11:58:57 -0700 | [diff] [blame] | 509 | const int64_t kMinLong = std::numeric_limits<int64_t>::min(); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 510 | if (UNLIKELY(divisor == 0)) { |
| 511 | ThrowArithmeticExceptionDivideByZero(); |
| 512 | return false; |
| 513 | } |
| 514 | if (UNLIKELY(dividend == kMinLong && divisor == -1)) { |
| 515 | shadow_frame.SetVRegLong(result_reg, 0); |
| 516 | } else { |
| 517 | shadow_frame.SetVRegLong(result_reg, dividend % divisor); |
| 518 | } |
| 519 | return true; |
| 520 | } |
| 521 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 522 | // Handles filled-new-array and filled-new-array-range instructions. |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 523 | // Returns true on success, otherwise throws an exception and returns false. |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 524 | template <bool is_range, bool do_access_check, bool transaction_active> |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 525 | bool DoFilledNewArray(const Instruction* inst, const ShadowFrame& shadow_frame, |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 526 | Thread* self, JValue* result); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 527 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 528 | // Handles packed-switch instruction. |
| 529 | // Returns the branch offset to the next instruction to execute. |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 530 | static inline int32_t DoPackedSwitch(const Instruction* inst, const ShadowFrame& shadow_frame, |
| 531 | uint16_t inst_data) |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 532 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
| 533 | DCHECK(inst->Opcode() == Instruction::PACKED_SWITCH); |
| 534 | const uint16_t* switch_data = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 535 | int32_t test_val = shadow_frame.GetVReg(inst->VRegA_31t(inst_data)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 536 | DCHECK_EQ(switch_data[0], static_cast<uint16_t>(Instruction::kPackedSwitchSignature)); |
| 537 | uint16_t size = switch_data[1]; |
| 538 | DCHECK_GT(size, 0); |
| 539 | const int32_t* keys = reinterpret_cast<const int32_t*>(&switch_data[2]); |
| 540 | DCHECK(IsAligned<4>(keys)); |
| 541 | int32_t first_key = keys[0]; |
| 542 | const int32_t* targets = reinterpret_cast<const int32_t*>(&switch_data[4]); |
| 543 | DCHECK(IsAligned<4>(targets)); |
| 544 | int32_t index = test_val - first_key; |
| 545 | if (index >= 0 && index < size) { |
| 546 | return targets[index]; |
| 547 | } else { |
| 548 | // No corresponding value: move forward by 3 (size of PACKED_SWITCH). |
| 549 | return 3; |
| 550 | } |
| 551 | } |
| 552 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 553 | // Handles sparse-switch instruction. |
| 554 | // Returns the branch offset to the next instruction to execute. |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 555 | static inline int32_t DoSparseSwitch(const Instruction* inst, const ShadowFrame& shadow_frame, |
| 556 | uint16_t inst_data) |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 557 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
| 558 | DCHECK(inst->Opcode() == Instruction::SPARSE_SWITCH); |
| 559 | const uint16_t* switch_data = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t(); |
Sebastien Hertz | 3b588e0 | 2013-09-11 14:33:18 +0200 | [diff] [blame] | 560 | int32_t test_val = shadow_frame.GetVReg(inst->VRegA_31t(inst_data)); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 561 | DCHECK_EQ(switch_data[0], static_cast<uint16_t>(Instruction::kSparseSwitchSignature)); |
| 562 | uint16_t size = switch_data[1]; |
| 563 | DCHECK_GT(size, 0); |
| 564 | const int32_t* keys = reinterpret_cast<const int32_t*>(&switch_data[2]); |
| 565 | DCHECK(IsAligned<4>(keys)); |
| 566 | const int32_t* entries = keys + size; |
| 567 | DCHECK(IsAligned<4>(entries)); |
| 568 | int lo = 0; |
| 569 | int hi = size - 1; |
| 570 | while (lo <= hi) { |
| 571 | int mid = (lo + hi) / 2; |
| 572 | int32_t foundVal = keys[mid]; |
| 573 | if (test_val < foundVal) { |
| 574 | hi = mid - 1; |
| 575 | } else if (test_val > foundVal) { |
| 576 | lo = mid + 1; |
| 577 | } else { |
| 578 | return entries[mid]; |
| 579 | } |
| 580 | } |
| 581 | // No corresponding value: move forward by 3 (size of SPARSE_SWITCH). |
| 582 | return 3; |
| 583 | } |
| 584 | |
| 585 | static inline uint32_t FindNextInstructionFollowingException(Thread* self, |
| 586 | ShadowFrame& shadow_frame, |
| 587 | uint32_t dex_pc, |
Sebastien Hertz | 947ff08 | 2013-09-17 14:10:13 +0200 | [diff] [blame] | 588 | mirror::Object* this_object, |
| 589 | const instrumentation::Instrumentation* instrumentation) |
Sebastien Hertz | 82aeddb | 2014-05-20 20:09:45 +0200 | [diff] [blame] | 590 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) SOMETIMES_INLINE; |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 591 | |
| 592 | static inline uint32_t FindNextInstructionFollowingException(Thread* self, |
| 593 | ShadowFrame& shadow_frame, |
| 594 | uint32_t dex_pc, |
Sebastien Hertz | 947ff08 | 2013-09-17 14:10:13 +0200 | [diff] [blame] | 595 | mirror::Object* this_object, |
Sebastien Hertz | 82aeddb | 2014-05-20 20:09:45 +0200 | [diff] [blame] | 596 | const instrumentation::Instrumentation* instrumentation) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 597 | self->VerifyStack(); |
| 598 | ThrowLocation throw_location; |
| 599 | mirror::Throwable* exception = self->GetException(&throw_location); |
Sebastien Hertz | 947ff08 | 2013-09-17 14:10:13 +0200 | [diff] [blame] | 600 | bool clear_exception = false; |
Andreas Gampe | 72b3e43 | 2014-05-13 21:42:05 -0700 | [diff] [blame] | 601 | bool new_exception = false; |
Mathieu Chartier | eb8167a | 2014-05-07 15:43:14 -0700 | [diff] [blame] | 602 | StackHandleScope<3> hs(self); |
| 603 | Handle<mirror::Class> exception_class(hs.NewHandle(exception->GetClass())); |
Jeff Hao | aa96191 | 2014-04-22 13:54:32 -0700 | [diff] [blame] | 604 | uint32_t found_dex_pc = shadow_frame.GetMethod()->FindCatchBlock(exception_class, dex_pc, |
Andreas Gampe | 72b3e43 | 2014-05-13 21:42:05 -0700 | [diff] [blame] | 605 | &clear_exception, |
| 606 | &new_exception); |
| 607 | if (UNLIKELY(new_exception)) { |
| 608 | // Update the exception. |
| 609 | exception = self->GetException(&throw_location); |
| 610 | } |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 611 | if (found_dex_pc == DexFile::kDexNoIndex) { |
Sebastien Hertz | 947ff08 | 2013-09-17 14:10:13 +0200 | [diff] [blame] | 612 | instrumentation->MethodUnwindEvent(self, this_object, |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 613 | shadow_frame.GetMethod(), dex_pc); |
| 614 | } else { |
| 615 | instrumentation->ExceptionCaughtEvent(self, throw_location, |
| 616 | shadow_frame.GetMethod(), |
| 617 | found_dex_pc, exception); |
| 618 | if (clear_exception) { |
| 619 | self->ClearException(); |
| 620 | } |
| 621 | } |
| 622 | return found_dex_pc; |
| 623 | } |
| 624 | |
Ian Rogers | b48b9eb | 2014-02-28 16:20:21 -0800 | [diff] [blame] | 625 | static inline void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh) |
| 626 | __attribute__((cold, noreturn)) |
| 627 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 628 | |
Ian Rogers | b48b9eb | 2014-02-28 16:20:21 -0800 | [diff] [blame] | 629 | static inline void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 630 | LOG(FATAL) << "Unexpected instruction: " << inst->DumpString(&mh.GetDexFile()); |
| 631 | exit(0); // Unreachable, keep GCC happy. |
| 632 | } |
| 633 | |
| 634 | static inline void TraceExecution(const ShadowFrame& shadow_frame, const Instruction* inst, |
Jeff Hao | a3faaf4 | 2013-09-03 19:07:00 -0700 | [diff] [blame] | 635 | const uint32_t dex_pc, MethodHelper& mh) |
| 636 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Mathieu Chartier | e861ebd | 2013-10-09 15:01:21 -0700 | [diff] [blame] | 637 | constexpr bool kTracing = false; |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 638 | if (kTracing) { |
| 639 | #define TRACE_LOG std::cerr |
Mathieu Chartier | e861ebd | 2013-10-09 15:01:21 -0700 | [diff] [blame] | 640 | std::ostringstream oss; |
| 641 | oss << PrettyMethod(shadow_frame.GetMethod()) |
| 642 | << StringPrintf("\n0x%x: ", dex_pc) |
| 643 | << inst->DumpString(&mh.GetDexFile()) << "\n"; |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 644 | for (uint32_t i = 0; i < shadow_frame.NumberOfVRegs(); ++i) { |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 645 | uint32_t raw_value = shadow_frame.GetVReg(i); |
| 646 | Object* ref_value = shadow_frame.GetVRegReference(i); |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 647 | oss << StringPrintf(" vreg%u=0x%08X", i, raw_value); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 648 | if (ref_value != NULL) { |
| 649 | if (ref_value->GetClass()->IsStringClass() && |
| 650 | ref_value->AsString()->GetCharArray() != NULL) { |
Mathieu Chartier | e861ebd | 2013-10-09 15:01:21 -0700 | [diff] [blame] | 651 | oss << "/java.lang.String \"" << ref_value->AsString()->ToModifiedUtf8() << "\""; |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 652 | } else { |
Mathieu Chartier | e861ebd | 2013-10-09 15:01:21 -0700 | [diff] [blame] | 653 | oss << "/" << PrettyTypeOf(ref_value); |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 654 | } |
| 655 | } |
| 656 | } |
Mathieu Chartier | e861ebd | 2013-10-09 15:01:21 -0700 | [diff] [blame] | 657 | TRACE_LOG << oss.str() << "\n"; |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 658 | #undef TRACE_LOG |
| 659 | } |
| 660 | } |
| 661 | |
Sebastien Hertz | 1eda226 | 2013-09-09 16:53:14 +0200 | [diff] [blame] | 662 | static inline bool IsBackwardBranch(int32_t branch_offset) { |
| 663 | return branch_offset <= 0; |
| 664 | } |
| 665 | |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 666 | // Explicitly instantiate all DoInvoke functions. |
Bernhard Rosenkränzer | 4605362 | 2013-12-12 02:15:52 +0100 | [diff] [blame] | 667 | #define EXPLICIT_DO_INVOKE_TEMPLATE_DECL(_type, _is_range, _do_check) \ |
Sebastien Hertz | 82aeddb | 2014-05-20 20:09:45 +0200 | [diff] [blame] | 668 | template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) SOMETIMES_INLINE \ |
Bernhard Rosenkränzer | 4605362 | 2013-12-12 02:15:52 +0100 | [diff] [blame] | 669 | bool DoInvoke<_type, _is_range, _do_check>(Thread* self, ShadowFrame& shadow_frame, \ |
| 670 | const Instruction* inst, uint16_t inst_data, \ |
| 671 | JValue* result) |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 672 | |
| 673 | #define EXPLICIT_DO_INVOKE_ALL_TEMPLATE_DECL(_type) \ |
| 674 | EXPLICIT_DO_INVOKE_TEMPLATE_DECL(_type, false, false); \ |
| 675 | EXPLICIT_DO_INVOKE_TEMPLATE_DECL(_type, false, true); \ |
| 676 | EXPLICIT_DO_INVOKE_TEMPLATE_DECL(_type, true, false); \ |
| 677 | EXPLICIT_DO_INVOKE_TEMPLATE_DECL(_type, true, true); |
| 678 | |
| 679 | EXPLICIT_DO_INVOKE_ALL_TEMPLATE_DECL(kStatic); // invoke-static/range. |
| 680 | EXPLICIT_DO_INVOKE_ALL_TEMPLATE_DECL(kDirect); // invoke-direct/range. |
| 681 | EXPLICIT_DO_INVOKE_ALL_TEMPLATE_DECL(kVirtual); // invoke-virtual/range. |
| 682 | EXPLICIT_DO_INVOKE_ALL_TEMPLATE_DECL(kSuper); // invoke-super/range. |
| 683 | EXPLICIT_DO_INVOKE_ALL_TEMPLATE_DECL(kInterface); // invoke-interface/range. |
| 684 | #undef EXPLICIT_DO_INVOKE_ALL_TEMPLATE_DECL |
| 685 | #undef EXPLICIT_DO_INVOKE_TEMPLATE_DECL |
| 686 | |
| 687 | // Explicitly instantiate all DoFieldGet functions. |
Bernhard Rosenkränzer | 4605362 | 2013-12-12 02:15:52 +0100 | [diff] [blame] | 688 | #define EXPLICIT_DO_FIELD_GET_TEMPLATE_DECL(_find_type, _field_type, _do_check) \ |
Sebastien Hertz | 82aeddb | 2014-05-20 20:09:45 +0200 | [diff] [blame] | 689 | template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) SOMETIMES_INLINE \ |
Bernhard Rosenkränzer | 4605362 | 2013-12-12 02:15:52 +0100 | [diff] [blame] | 690 | bool DoFieldGet<_find_type, _field_type, _do_check>(Thread* self, ShadowFrame& shadow_frame, \ |
| 691 | const Instruction* inst, uint16_t inst_data) |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 692 | |
| 693 | #define EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(_find_type, _field_type) \ |
| 694 | EXPLICIT_DO_FIELD_GET_TEMPLATE_DECL(_find_type, _field_type, false); \ |
| 695 | EXPLICIT_DO_FIELD_GET_TEMPLATE_DECL(_find_type, _field_type, true); |
| 696 | |
| 697 | // iget-XXX |
| 698 | EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(InstancePrimitiveRead, Primitive::kPrimBoolean); |
| 699 | EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(InstancePrimitiveRead, Primitive::kPrimByte); |
| 700 | EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(InstancePrimitiveRead, Primitive::kPrimChar); |
| 701 | EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(InstancePrimitiveRead, Primitive::kPrimShort); |
| 702 | EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(InstancePrimitiveRead, Primitive::kPrimInt); |
| 703 | EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(InstancePrimitiveRead, Primitive::kPrimLong); |
| 704 | EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(InstanceObjectRead, Primitive::kPrimNot); |
| 705 | |
| 706 | // sget-XXX |
| 707 | EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(StaticPrimitiveRead, Primitive::kPrimBoolean); |
| 708 | EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(StaticPrimitiveRead, Primitive::kPrimByte); |
| 709 | EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(StaticPrimitiveRead, Primitive::kPrimChar); |
| 710 | EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(StaticPrimitiveRead, Primitive::kPrimShort); |
| 711 | EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(StaticPrimitiveRead, Primitive::kPrimInt); |
| 712 | EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(StaticPrimitiveRead, Primitive::kPrimLong); |
| 713 | EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(StaticObjectRead, Primitive::kPrimNot); |
| 714 | |
| 715 | #undef EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL |
| 716 | #undef EXPLICIT_DO_FIELD_GET_TEMPLATE_DECL |
| 717 | |
| 718 | // Explicitly instantiate all DoFieldPut functions. |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 719 | #define EXPLICIT_DO_FIELD_PUT_TEMPLATE_DECL(_find_type, _field_type, _do_check, _transaction_active) \ |
Sebastien Hertz | 82aeddb | 2014-05-20 20:09:45 +0200 | [diff] [blame] | 720 | template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) SOMETIMES_INLINE \ |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 721 | bool DoFieldPut<_find_type, _field_type, _do_check, _transaction_active>(Thread* self, const ShadowFrame& shadow_frame, \ |
| 722 | const Instruction* inst, uint16_t inst_data) |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 723 | |
| 724 | #define EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(_find_type, _field_type) \ |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 725 | EXPLICIT_DO_FIELD_PUT_TEMPLATE_DECL(_find_type, _field_type, false, false); \ |
| 726 | EXPLICIT_DO_FIELD_PUT_TEMPLATE_DECL(_find_type, _field_type, true, false); \ |
| 727 | EXPLICIT_DO_FIELD_PUT_TEMPLATE_DECL(_find_type, _field_type, false, true); \ |
| 728 | EXPLICIT_DO_FIELD_PUT_TEMPLATE_DECL(_find_type, _field_type, true, true); |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 729 | |
| 730 | // iput-XXX |
| 731 | EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(InstancePrimitiveWrite, Primitive::kPrimBoolean); |
| 732 | EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(InstancePrimitiveWrite, Primitive::kPrimByte); |
| 733 | EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(InstancePrimitiveWrite, Primitive::kPrimChar); |
| 734 | EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(InstancePrimitiveWrite, Primitive::kPrimShort); |
| 735 | EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(InstancePrimitiveWrite, Primitive::kPrimInt); |
| 736 | EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(InstancePrimitiveWrite, Primitive::kPrimLong); |
| 737 | EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(InstanceObjectWrite, Primitive::kPrimNot); |
| 738 | |
| 739 | // sput-XXX |
| 740 | EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(StaticPrimitiveWrite, Primitive::kPrimBoolean); |
| 741 | EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(StaticPrimitiveWrite, Primitive::kPrimByte); |
| 742 | EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(StaticPrimitiveWrite, Primitive::kPrimChar); |
| 743 | EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(StaticPrimitiveWrite, Primitive::kPrimShort); |
| 744 | EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(StaticPrimitiveWrite, Primitive::kPrimInt); |
| 745 | EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(StaticPrimitiveWrite, Primitive::kPrimLong); |
| 746 | EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(StaticObjectWrite, Primitive::kPrimNot); |
| 747 | |
| 748 | #undef EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL |
| 749 | #undef EXPLICIT_DO_FIELD_PUT_TEMPLATE_DECL |
| 750 | |
| 751 | // Explicitly instantiate all DoInvokeVirtualQuick functions. |
Bernhard Rosenkränzer | 4605362 | 2013-12-12 02:15:52 +0100 | [diff] [blame] | 752 | #define EXPLICIT_DO_INVOKE_VIRTUAL_QUICK_TEMPLATE_DECL(_is_range) \ |
Sebastien Hertz | 82aeddb | 2014-05-20 20:09:45 +0200 | [diff] [blame] | 753 | template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) SOMETIMES_INLINE \ |
Bernhard Rosenkränzer | 4605362 | 2013-12-12 02:15:52 +0100 | [diff] [blame] | 754 | bool DoInvokeVirtualQuick<_is_range>(Thread* self, ShadowFrame& shadow_frame, \ |
| 755 | const Instruction* inst, uint16_t inst_data, \ |
| 756 | JValue* result) |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 757 | |
| 758 | EXPLICIT_DO_INVOKE_VIRTUAL_QUICK_TEMPLATE_DECL(false); // invoke-virtual-quick. |
| 759 | EXPLICIT_DO_INVOKE_VIRTUAL_QUICK_TEMPLATE_DECL(true); // invoke-virtual-quick-range. |
| 760 | #undef EXPLICIT_INSTANTIATION_DO_INVOKE_VIRTUAL_QUICK |
| 761 | |
| 762 | // Explicitly instantiate all DoIGetQuick functions. |
Bernhard Rosenkränzer | 4605362 | 2013-12-12 02:15:52 +0100 | [diff] [blame] | 763 | #define EXPLICIT_DO_IGET_QUICK_TEMPLATE_DECL(_field_type) \ |
Sebastien Hertz | 82aeddb | 2014-05-20 20:09:45 +0200 | [diff] [blame] | 764 | template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) SOMETIMES_INLINE \ |
Bernhard Rosenkränzer | 4605362 | 2013-12-12 02:15:52 +0100 | [diff] [blame] | 765 | bool DoIGetQuick<_field_type>(ShadowFrame& shadow_frame, const Instruction* inst, \ |
| 766 | uint16_t inst_data) |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 767 | |
| 768 | EXPLICIT_DO_IGET_QUICK_TEMPLATE_DECL(Primitive::kPrimInt); // iget-quick. |
| 769 | EXPLICIT_DO_IGET_QUICK_TEMPLATE_DECL(Primitive::kPrimLong); // iget-wide-quick. |
| 770 | EXPLICIT_DO_IGET_QUICK_TEMPLATE_DECL(Primitive::kPrimNot); // iget-object-quick. |
| 771 | #undef EXPLICIT_DO_IGET_QUICK_TEMPLATE_DECL |
| 772 | |
| 773 | // Explicitly instantiate all DoIPutQuick functions. |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 774 | #define EXPLICIT_DO_IPUT_QUICK_TEMPLATE_DECL(_field_type, _transaction_active) \ |
Sebastien Hertz | 82aeddb | 2014-05-20 20:09:45 +0200 | [diff] [blame] | 775 | template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) SOMETIMES_INLINE \ |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 776 | bool DoIPutQuick<_field_type, _transaction_active>(const ShadowFrame& shadow_frame, \ |
| 777 | const Instruction* inst, \ |
| 778 | uint16_t inst_data) |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 779 | |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 780 | #define EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL(_field_type) \ |
| 781 | EXPLICIT_DO_IPUT_QUICK_TEMPLATE_DECL(_field_type, false); \ |
| 782 | EXPLICIT_DO_IPUT_QUICK_TEMPLATE_DECL(_field_type, true); |
| 783 | |
| 784 | EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL(Primitive::kPrimInt); // iget-quick. |
| 785 | EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL(Primitive::kPrimLong); // iget-wide-quick. |
| 786 | EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL(Primitive::kPrimNot); // iget-object-quick. |
| 787 | #undef EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL |
Sebastien Hertz | c671485 | 2013-09-30 16:42:32 +0200 | [diff] [blame] | 788 | #undef EXPLICIT_DO_IPUT_QUICK_TEMPLATE_DECL |
| 789 | |
Sebastien Hertz | 8ece050 | 2013-08-07 11:26:41 +0200 | [diff] [blame] | 790 | } // namespace interpreter |
| 791 | } // namespace art |
| 792 | |
| 793 | #endif // ART_RUNTIME_INTERPRETER_INTERPRETER_COMMON_H_ |