Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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_SRC_OBJECT_UTILS_H_ |
| 18 | #define ART_SRC_OBJECT_UTILS_H_ |
| 19 | |
| 20 | #include "class_linker.h" |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 21 | #include "dex_file.h" |
Ian Rogers | 672f520 | 2012-01-12 18:06:40 -0800 | [diff] [blame] | 22 | #include "monitor.h" |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 23 | #include "mirror/abstract_method.h" |
| 24 | #include "mirror/class.h" |
| 25 | #include "mirror/dex_cache.h" |
| 26 | #include "mirror/field.h" |
| 27 | #include "mirror/iftable.h" |
| 28 | #include "mirror/string.h" |
| 29 | |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 30 | #include "runtime.h" |
Ian Rogers | 50b35e2 | 2012-10-04 10:09:15 -0700 | [diff] [blame] | 31 | #include "sirt_ref.h" |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 32 | |
| 33 | #include <string> |
| 34 | |
| 35 | namespace art { |
| 36 | |
Ian Rogers | 672f520 | 2012-01-12 18:06:40 -0800 | [diff] [blame] | 37 | class ObjectLock { |
| 38 | public: |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 39 | explicit ObjectLock(Thread* self, mirror::Object* object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) |
Ian Rogers | 1f53934 | 2012-10-03 21:09:42 -0700 | [diff] [blame] | 40 | : self_(self), obj_(object) { |
Ian Rogers | 672f520 | 2012-01-12 18:06:40 -0800 | [diff] [blame] | 41 | CHECK(object != NULL); |
| 42 | obj_->MonitorEnter(self_); |
| 43 | } |
| 44 | |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 45 | ~ObjectLock() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 672f520 | 2012-01-12 18:06:40 -0800 | [diff] [blame] | 46 | obj_->MonitorExit(self_); |
| 47 | } |
| 48 | |
Ian Rogers | 05f3057 | 2013-02-20 12:13:11 -0800 | [diff] [blame^] | 49 | void WaitIgnoringInterrupts() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
| 50 | Monitor::Wait(self_, obj_, 0, 0, false, kWaiting); |
Ian Rogers | 672f520 | 2012-01-12 18:06:40 -0800 | [diff] [blame] | 51 | } |
| 52 | |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 53 | void Notify() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 05f3057 | 2013-02-20 12:13:11 -0800 | [diff] [blame^] | 54 | obj_->Notify(self_); |
Ian Rogers | 672f520 | 2012-01-12 18:06:40 -0800 | [diff] [blame] | 55 | } |
| 56 | |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 57 | void NotifyAll() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 05f3057 | 2013-02-20 12:13:11 -0800 | [diff] [blame^] | 58 | obj_->NotifyAll(self_); |
Ian Rogers | 672f520 | 2012-01-12 18:06:40 -0800 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | private: |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 62 | Thread* const self_; |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 63 | mirror::Object* obj_; |
Ian Rogers | 672f520 | 2012-01-12 18:06:40 -0800 | [diff] [blame] | 64 | DISALLOW_COPY_AND_ASSIGN(ObjectLock); |
| 65 | }; |
| 66 | |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 67 | class ClassHelper { |
| 68 | public: |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 69 | ClassHelper(const mirror::Class* c = NULL, ClassLinker* l = NULL) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 70 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) |
Elliott Hughes | 91250e0 | 2011-12-13 22:30:35 -0800 | [diff] [blame] | 71 | : class_def_(NULL), |
| 72 | class_linker_(l), |
| 73 | dex_cache_(NULL), |
| 74 | dex_file_(NULL), |
| 75 | interface_type_list_(NULL), |
Brian Carlstrom | e77be40 | 2012-03-30 01:08:38 -0700 | [diff] [blame] | 76 | klass_(NULL) { |
| 77 | if (c != NULL) { |
| 78 | ChangeClass(c); |
| 79 | } |
Elliott Hughes | 91250e0 | 2011-12-13 22:30:35 -0800 | [diff] [blame] | 80 | } |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 81 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 82 | void ChangeClass(const mirror::Class* new_c) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 83 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Brian Carlstrom | 01e076e | 2012-03-30 11:54:16 -0700 | [diff] [blame] | 84 | CHECK(new_c != NULL) << "klass_=" << klass_; // Log what we were changing from if any |
| 85 | CHECK(new_c->IsClass()) << "new_c=" << new_c; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 86 | if (dex_cache_ != NULL) { |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 87 | mirror::DexCache* new_c_dex_cache = new_c->GetDexCache(); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 88 | if (new_c_dex_cache != dex_cache_) { |
| 89 | dex_cache_ = new_c_dex_cache; |
| 90 | dex_file_ = NULL; |
| 91 | } |
| 92 | } |
| 93 | klass_ = new_c; |
| 94 | interface_type_list_ = NULL; |
| 95 | class_def_ = NULL; |
| 96 | } |
| 97 | |
Elliott Hughes | 91250e0 | 2011-12-13 22:30:35 -0800 | [diff] [blame] | 98 | // The returned const char* is only guaranteed to be valid for the lifetime of the ClassHelper. |
| 99 | // If you need it longer, copy it into a std::string. |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 100 | const char* GetDescriptor() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Brian Carlstrom | 93235f7 | 2012-03-29 22:48:15 -0700 | [diff] [blame] | 101 | CHECK(klass_ != NULL); |
Ian Rogers | a68a1cb | 2012-01-10 10:34:36 -0800 | [diff] [blame] | 102 | if (UNLIKELY(klass_->IsArrayClass())) { |
| 103 | return GetArrayDescriptor(); |
| 104 | } else if (UNLIKELY(klass_->IsPrimitive())) { |
Elliott Hughes | 91250e0 | 2011-12-13 22:30:35 -0800 | [diff] [blame] | 105 | return Primitive::Descriptor(klass_->GetPrimitiveType()); |
Ian Rogers | a68a1cb | 2012-01-10 10:34:36 -0800 | [diff] [blame] | 106 | } else if (UNLIKELY(klass_->IsProxyClass())) { |
Elliott Hughes | 91250e0 | 2011-12-13 22:30:35 -0800 | [diff] [blame] | 107 | descriptor_ = GetClassLinker()->GetDescriptorForProxy(klass_); |
| 108 | return descriptor_.c_str(); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 109 | } else { |
| 110 | const DexFile& dex_file = GetDexFile(); |
| 111 | const DexFile::TypeId& type_id = dex_file.GetTypeId(klass_->GetDexTypeIndex()); |
| 112 | return dex_file.GetTypeDescriptor(type_id); |
| 113 | } |
| 114 | } |
Elliott Hughes | 91250e0 | 2011-12-13 22:30:35 -0800 | [diff] [blame] | 115 | |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 116 | const char* GetArrayDescriptor() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | a68a1cb | 2012-01-10 10:34:36 -0800 | [diff] [blame] | 117 | std::string result("["); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 118 | const mirror::Class* saved_klass = klass_; |
Brian Carlstrom | 93235f7 | 2012-03-29 22:48:15 -0700 | [diff] [blame] | 119 | CHECK(saved_klass != NULL); |
Ian Rogers | a68a1cb | 2012-01-10 10:34:36 -0800 | [diff] [blame] | 120 | ChangeClass(klass_->GetComponentType()); |
| 121 | result += GetDescriptor(); |
| 122 | ChangeClass(saved_klass); |
| 123 | descriptor_ = result; |
| 124 | return descriptor_.c_str(); |
| 125 | } |
| 126 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 127 | const DexFile::ClassDef* GetClassDef() |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 128 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 129 | const DexFile::ClassDef* result = class_def_; |
| 130 | if (result == NULL) { |
| 131 | result = GetDexFile().FindClassDef(GetDescriptor()); |
| 132 | class_def_ = result; |
| 133 | } |
| 134 | return result; |
| 135 | } |
Elliott Hughes | 91250e0 | 2011-12-13 22:30:35 -0800 | [diff] [blame] | 136 | |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 137 | uint32_t NumDirectInterfaces() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Brian Carlstrom | 93235f7 | 2012-03-29 22:48:15 -0700 | [diff] [blame] | 138 | DCHECK(klass_ != NULL); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 139 | if (klass_->IsPrimitive()) { |
| 140 | return 0; |
| 141 | } else if (klass_->IsArrayClass()) { |
| 142 | return 2; |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 143 | } else if (klass_->IsProxyClass()) { |
| 144 | return klass_->GetIfTable()->GetLength(); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 145 | } else { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 146 | const DexFile::TypeList* interfaces = GetInterfaceTypeList(); |
| 147 | if (interfaces == NULL) { |
| 148 | return 0; |
| 149 | } else { |
| 150 | return interfaces->Size(); |
| 151 | } |
| 152 | } |
| 153 | } |
Elliott Hughes | 91250e0 | 2011-12-13 22:30:35 -0800 | [diff] [blame] | 154 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 155 | uint16_t GetDirectInterfaceTypeIdx(uint32_t idx) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 156 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Brian Carlstrom | 93235f7 | 2012-03-29 22:48:15 -0700 | [diff] [blame] | 157 | DCHECK(klass_ != NULL); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 158 | DCHECK(!klass_->IsPrimitive()); |
| 159 | DCHECK(!klass_->IsArrayClass()); |
| 160 | return GetInterfaceTypeList()->GetTypeItem(idx).type_idx_; |
| 161 | } |
Elliott Hughes | 91250e0 | 2011-12-13 22:30:35 -0800 | [diff] [blame] | 162 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 163 | mirror::Class* GetDirectInterface(uint32_t idx) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 164 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Brian Carlstrom | 93235f7 | 2012-03-29 22:48:15 -0700 | [diff] [blame] | 165 | DCHECK(klass_ != NULL); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 166 | DCHECK(!klass_->IsPrimitive()); |
| 167 | if (klass_->IsArrayClass()) { |
| 168 | if (idx == 0) { |
| 169 | return GetClassLinker()->FindSystemClass("Ljava/lang/Cloneable;"); |
| 170 | } else { |
| 171 | DCHECK_EQ(1U, idx); |
| 172 | return GetClassLinker()->FindSystemClass("Ljava/io/Serializable;"); |
| 173 | } |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 174 | } else if (klass_->IsProxyClass()) { |
Ian Rogers | 9bc8191 | 2012-10-11 21:43:36 -0700 | [diff] [blame] | 175 | return klass_->GetIfTable()->GetInterface(idx); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 176 | } else { |
Ian Rogers | d24e264 | 2012-06-06 21:21:43 -0700 | [diff] [blame] | 177 | uint16_t type_idx = GetDirectInterfaceTypeIdx(idx); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 178 | mirror::Class* interface = GetDexCache()->GetResolvedType(type_idx); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 179 | if (interface == NULL) { |
| 180 | interface = GetClassLinker()->ResolveType(GetDexFile(), type_idx, klass_); |
| 181 | CHECK(interface != NULL || Thread::Current()->IsExceptionPending()); |
| 182 | } |
| 183 | return interface; |
| 184 | } |
| 185 | } |
Elliott Hughes | 91250e0 | 2011-12-13 22:30:35 -0800 | [diff] [blame] | 186 | |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 187 | const char* GetSourceFile() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Elliott Hughes | 9557241 | 2011-12-13 18:14:20 -0800 | [diff] [blame] | 188 | std::string descriptor(GetDescriptor()); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 189 | const DexFile& dex_file = GetDexFile(); |
| 190 | const DexFile::ClassDef* dex_class_def = dex_file.FindClassDef(descriptor); |
Elliott Hughes | 12c51e3 | 2012-01-17 20:25:05 -0800 | [diff] [blame] | 191 | CHECK(dex_class_def != NULL); |
| 192 | return dex_file.GetSourceFile(*dex_class_def); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 193 | } |
Elliott Hughes | 91250e0 | 2011-12-13 22:30:35 -0800 | [diff] [blame] | 194 | |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 195 | std::string GetLocation() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 196 | mirror::DexCache* dex_cache = GetDexCache(); |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 197 | if (dex_cache != NULL && !klass_->IsProxyClass()) { |
| 198 | return dex_cache->GetLocation()->ToModifiedUtf8(); |
| 199 | } else { |
| 200 | // Arrays and proxies are generated and have no corresponding dex file location. |
| 201 | return "generated class"; |
| 202 | } |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 203 | } |
| 204 | |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 205 | const DexFile& GetDexFile() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Mathieu Chartier | 66f1925 | 2012-09-18 08:57:04 -0700 | [diff] [blame] | 206 | if (dex_file_ == NULL) { |
| 207 | dex_file_ = GetDexCache()->GetDexFile(); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 208 | } |
Mathieu Chartier | 66f1925 | 2012-09-18 08:57:04 -0700 | [diff] [blame] | 209 | return *dex_file_; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 210 | } |
| 211 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 212 | mirror::DexCache* GetDexCache() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
| 213 | mirror::DexCache* result = dex_cache_; |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 214 | if (result == NULL) { |
| 215 | DCHECK(klass_ != NULL); |
| 216 | result = klass_->GetDexCache(); |
| 217 | dex_cache_ = result; |
| 218 | } |
| 219 | return result; |
| 220 | } |
| 221 | |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 222 | private: |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 223 | const DexFile::TypeList* GetInterfaceTypeList() |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 224 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 225 | const DexFile::TypeList* result = interface_type_list_; |
| 226 | if (result == NULL) { |
| 227 | const DexFile::ClassDef* class_def = GetClassDef(); |
| 228 | if (class_def != NULL) { |
| 229 | result = GetDexFile().GetInterfacesList(*class_def); |
| 230 | interface_type_list_ = result; |
| 231 | } |
| 232 | } |
| 233 | return result; |
| 234 | } |
Elliott Hughes | 91250e0 | 2011-12-13 22:30:35 -0800 | [diff] [blame] | 235 | |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 236 | ClassLinker* GetClassLinker() { |
| 237 | ClassLinker* result = class_linker_; |
| 238 | if (result == NULL) { |
| 239 | result = Runtime::Current()->GetClassLinker(); |
| 240 | class_linker_ = result; |
| 241 | } |
| 242 | return result; |
| 243 | } |
| 244 | |
| 245 | const DexFile::ClassDef* class_def_; |
| 246 | ClassLinker* class_linker_; |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 247 | mirror::DexCache* dex_cache_; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 248 | const DexFile* dex_file_; |
| 249 | const DexFile::TypeList* interface_type_list_; |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 250 | const mirror::Class* klass_; |
Elliott Hughes | 91250e0 | 2011-12-13 22:30:35 -0800 | [diff] [blame] | 251 | std::string descriptor_; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 252 | |
| 253 | DISALLOW_COPY_AND_ASSIGN(ClassHelper); |
| 254 | }; |
| 255 | |
| 256 | class FieldHelper { |
| 257 | public: |
| 258 | FieldHelper() : class_linker_(NULL), dex_cache_(NULL), dex_file_(NULL), field_(NULL) {} |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 259 | explicit FieldHelper(const mirror::Field* f) : class_linker_(NULL), dex_cache_(NULL), dex_file_(NULL), field_(f) {} |
| 260 | FieldHelper(const mirror::Field* f, ClassLinker* l) |
Ian Rogers | ca19066 | 2012-06-26 15:45:57 -0700 | [diff] [blame] | 261 | : class_linker_(l), dex_cache_(NULL), dex_file_(NULL), field_(f) {} |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 262 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 263 | void ChangeField(const mirror::Field* new_f) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 264 | DCHECK(new_f != NULL); |
| 265 | if (dex_cache_ != NULL) { |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 266 | mirror::DexCache* new_f_dex_cache = new_f->GetDeclaringClass()->GetDexCache(); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 267 | if (new_f_dex_cache != dex_cache_) { |
| 268 | dex_cache_ = new_f_dex_cache; |
| 269 | dex_file_ = NULL; |
| 270 | } |
| 271 | } |
| 272 | field_ = new_f; |
| 273 | } |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 274 | const char* GetName() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 275 | uint32_t field_index = field_->GetDexFieldIndex(); |
Elliott Hughes | 2ed52c4 | 2012-03-21 16:56:56 -0700 | [diff] [blame] | 276 | if (!field_->GetDeclaringClass()->IsProxyClass()) { |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 277 | const DexFile& dex_file = GetDexFile(); |
| 278 | return dex_file.GetFieldName(dex_file.GetFieldId(field_index)); |
| 279 | } else { |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 280 | DCHECK(field_->IsStatic()); |
Elliott Hughes | 2ed52c4 | 2012-03-21 16:56:56 -0700 | [diff] [blame] | 281 | DCHECK_LT(field_index, 2U); |
| 282 | return field_index == 0 ? "interfaces" : "throws"; |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 283 | } |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 284 | } |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 285 | mirror::Class* GetType() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 286 | uint32_t field_index = field_->GetDexFieldIndex(); |
Elliott Hughes | 2ed52c4 | 2012-03-21 16:56:56 -0700 | [diff] [blame] | 287 | if (!field_->GetDeclaringClass()->IsProxyClass()) { |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 288 | const DexFile& dex_file = GetDexFile(); |
| 289 | const DexFile::FieldId& field_id = dex_file.GetFieldId(field_index); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 290 | mirror::Class* type = GetDexCache()->GetResolvedType(field_id.type_idx_); |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 291 | if (type == NULL) { |
| 292 | type = GetClassLinker()->ResolveType(field_id.type_idx_, field_); |
| 293 | CHECK(type != NULL || Thread::Current()->IsExceptionPending()); |
| 294 | } |
| 295 | return type; |
| 296 | } else { |
Elliott Hughes | 2ed52c4 | 2012-03-21 16:56:56 -0700 | [diff] [blame] | 297 | return GetClassLinker()->FindSystemClass(GetTypeDescriptor()); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 298 | } |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 299 | } |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 300 | const char* GetTypeDescriptor() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 301 | uint32_t field_index = field_->GetDexFieldIndex(); |
Elliott Hughes | 2ed52c4 | 2012-03-21 16:56:56 -0700 | [diff] [blame] | 302 | if (!field_->GetDeclaringClass()->IsProxyClass()) { |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 303 | const DexFile& dex_file = GetDexFile(); |
| 304 | const DexFile::FieldId& field_id = dex_file.GetFieldId(field_index); |
| 305 | return dex_file.GetFieldTypeDescriptor(field_id); |
| 306 | } else { |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 307 | DCHECK(field_->IsStatic()); |
Elliott Hughes | 2ed52c4 | 2012-03-21 16:56:56 -0700 | [diff] [blame] | 308 | DCHECK_LT(field_index, 2U); |
| 309 | // 0 == Class[] interfaces; 1 == Class[][] throws; |
| 310 | return field_index == 0 ? "[Ljava/lang/Class;" : "[[Ljava/lang/Class;"; |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 311 | } |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 312 | } |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 313 | Primitive::Type GetTypeAsPrimitiveType() |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 314 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 315 | return Primitive::GetType(GetTypeDescriptor()[0]); |
| 316 | } |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 317 | bool IsPrimitiveType() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 318 | Primitive::Type type = GetTypeAsPrimitiveType(); |
| 319 | return type != Primitive::kPrimNot; |
| 320 | } |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 321 | size_t FieldSize() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 322 | Primitive::Type type = GetTypeAsPrimitiveType(); |
| 323 | return Primitive::FieldSize(type); |
| 324 | } |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 325 | |
| 326 | // The returned const char* is only guaranteed to be valid for the lifetime of the FieldHelper. |
| 327 | // If you need it longer, copy it into a std::string. |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 328 | const char* GetDeclaringClassDescriptor() |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 329 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 330 | uint16_t type_idx = field_->GetDeclaringClass()->GetDexTypeIndex(); |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 331 | if (type_idx != DexFile::kDexNoIndex16) { |
| 332 | const DexFile& dex_file = GetDexFile(); |
| 333 | return dex_file.GetTypeDescriptor(dex_file.GetTypeId(type_idx)); |
| 334 | } else { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 335 | // Most likely a proxy class. |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 336 | ClassHelper kh(field_->GetDeclaringClass()); |
| 337 | declaring_class_descriptor_ = kh.GetDescriptor(); |
| 338 | return declaring_class_descriptor_.c_str(); |
| 339 | } |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 340 | } |
| 341 | |
| 342 | private: |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 343 | mirror::DexCache* GetDexCache() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
| 344 | mirror::DexCache* result = dex_cache_; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 345 | if (result == NULL) { |
| 346 | result = field_->GetDeclaringClass()->GetDexCache(); |
| 347 | dex_cache_ = result; |
| 348 | } |
| 349 | return result; |
| 350 | } |
| 351 | ClassLinker* GetClassLinker() { |
| 352 | ClassLinker* result = class_linker_; |
| 353 | if (result == NULL) { |
| 354 | result = Runtime::Current()->GetClassLinker(); |
| 355 | class_linker_ = result; |
| 356 | } |
| 357 | return result; |
| 358 | } |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 359 | const DexFile& GetDexFile() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Mathieu Chartier | 66f1925 | 2012-09-18 08:57:04 -0700 | [diff] [blame] | 360 | if (dex_file_ == NULL) { |
| 361 | dex_file_ = GetDexCache()->GetDexFile(); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 362 | } |
Mathieu Chartier | 66f1925 | 2012-09-18 08:57:04 -0700 | [diff] [blame] | 363 | return *dex_file_; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 364 | } |
| 365 | |
| 366 | ClassLinker* class_linker_; |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 367 | mirror::DexCache* dex_cache_; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 368 | const DexFile* dex_file_; |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 369 | const mirror::Field* field_; |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 370 | std::string declaring_class_descriptor_; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 371 | |
| 372 | DISALLOW_COPY_AND_ASSIGN(FieldHelper); |
| 373 | }; |
| 374 | |
| 375 | class MethodHelper { |
| 376 | public: |
Ian Rogers | ca19066 | 2012-06-26 15:45:57 -0700 | [diff] [blame] | 377 | MethodHelper() |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 378 | : class_linker_(NULL), dex_cache_(NULL), dex_file_(NULL), method_(NULL), shorty_(NULL), |
| 379 | shorty_len_(0) {} |
Ian Rogers | ca19066 | 2012-06-26 15:45:57 -0700 | [diff] [blame] | 380 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 381 | explicit MethodHelper(const mirror::AbstractMethod* m) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 382 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) |
Ian Rogers | ca19066 | 2012-06-26 15:45:57 -0700 | [diff] [blame] | 383 | : class_linker_(NULL), dex_cache_(NULL), dex_file_(NULL), method_(NULL), shorty_(NULL), |
| 384 | shorty_len_(0) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 385 | SetMethod(m); |
| 386 | } |
Ian Rogers | ca19066 | 2012-06-26 15:45:57 -0700 | [diff] [blame] | 387 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 388 | MethodHelper(const mirror::AbstractMethod* m, ClassLinker* l) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 389 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) |
Ian Rogers | ca19066 | 2012-06-26 15:45:57 -0700 | [diff] [blame] | 390 | : class_linker_(l), dex_cache_(NULL), dex_file_(NULL), method_(NULL), shorty_(NULL), |
| 391 | shorty_len_(0) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 392 | SetMethod(m); |
| 393 | } |
| 394 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 395 | void ChangeMethod(mirror::AbstractMethod* new_m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 396 | DCHECK(new_m != NULL); |
| 397 | if (dex_cache_ != NULL) { |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 398 | mirror::Class* klass = new_m->GetDeclaringClass(); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 399 | if (klass->IsProxyClass()) { |
| 400 | dex_cache_ = NULL; |
| 401 | dex_file_ = NULL; |
| 402 | } else { |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 403 | mirror::DexCache* new_m_dex_cache = klass->GetDexCache(); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 404 | if (new_m_dex_cache != dex_cache_) { |
| 405 | dex_cache_ = new_m_dex_cache; |
| 406 | dex_file_ = NULL; |
| 407 | } |
| 408 | } |
| 409 | } |
| 410 | SetMethod(new_m); |
| 411 | shorty_ = NULL; |
| 412 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 413 | |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 414 | const char* GetName() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 415 | const DexFile& dex_file = GetDexFile(); |
Ian Rogers | 1984651 | 2012-02-24 11:42:47 -0800 | [diff] [blame] | 416 | uint32_t dex_method_idx = method_->GetDexMethodIndex(); |
| 417 | if (dex_method_idx != DexFile::kDexNoIndex16) { |
| 418 | return dex_file.GetMethodName(dex_file.GetMethodId(dex_method_idx)); |
| 419 | } else { |
| 420 | Runtime* runtime = Runtime::Current(); |
| 421 | if (method_ == runtime->GetResolutionMethod()) { |
Elliott Hughes | 81ff318 | 2012-03-23 20:35:56 -0700 | [diff] [blame] | 422 | return "<runtime internal resolution method>"; |
Ian Rogers | 1984651 | 2012-02-24 11:42:47 -0800 | [diff] [blame] | 423 | } else if (method_ == runtime->GetCalleeSaveMethod(Runtime::kSaveAll)) { |
Elliott Hughes | 81ff318 | 2012-03-23 20:35:56 -0700 | [diff] [blame] | 424 | return "<runtime internal callee-save all registers method>"; |
Ian Rogers | 1984651 | 2012-02-24 11:42:47 -0800 | [diff] [blame] | 425 | } else if (method_ == runtime->GetCalleeSaveMethod(Runtime::kRefsOnly)) { |
Elliott Hughes | 81ff318 | 2012-03-23 20:35:56 -0700 | [diff] [blame] | 426 | return "<runtime internal callee-save reference registers method>"; |
Ian Rogers | 1984651 | 2012-02-24 11:42:47 -0800 | [diff] [blame] | 427 | } else if (method_ == runtime->GetCalleeSaveMethod(Runtime::kRefsAndArgs)) { |
Elliott Hughes | 81ff318 | 2012-03-23 20:35:56 -0700 | [diff] [blame] | 428 | return "<runtime internal callee-save reference and argument registers method>"; |
Ian Rogers | 1984651 | 2012-02-24 11:42:47 -0800 | [diff] [blame] | 429 | } else { |
Elliott Hughes | 81ff318 | 2012-03-23 20:35:56 -0700 | [diff] [blame] | 430 | return "<unknown runtime internal method>"; |
Ian Rogers | 1984651 | 2012-02-24 11:42:47 -0800 | [diff] [blame] | 431 | } |
| 432 | } |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 433 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 434 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 435 | mirror::String* GetNameAsString() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 436 | const DexFile& dex_file = GetDexFile(); |
Ian Rogers | 1984651 | 2012-02-24 11:42:47 -0800 | [diff] [blame] | 437 | uint32_t dex_method_idx = method_->GetDexMethodIndex(); |
| 438 | const DexFile::MethodId& method_id = dex_file.GetMethodId(dex_method_idx); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 439 | return GetClassLinker()->ResolveString(dex_file, method_id.name_idx_, GetDexCache()); |
| 440 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 441 | |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 442 | const char* GetShorty() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) |
| 443 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 444 | const char* result = shorty_; |
| 445 | if (result == NULL) { |
| 446 | const DexFile& dex_file = GetDexFile(); |
| 447 | result = dex_file.GetMethodShorty(dex_file.GetMethodId(method_->GetDexMethodIndex()), |
| 448 | &shorty_len_); |
| 449 | shorty_ = result; |
| 450 | } |
| 451 | return result; |
| 452 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 453 | |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 454 | uint32_t GetShortyLength() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 455 | if (shorty_ == NULL) { |
| 456 | GetShorty(); |
| 457 | } |
| 458 | return shorty_len_; |
| 459 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 460 | |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 461 | const std::string GetSignature() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 462 | const DexFile& dex_file = GetDexFile(); |
Ian Rogers | 1984651 | 2012-02-24 11:42:47 -0800 | [diff] [blame] | 463 | uint32_t dex_method_idx = method_->GetDexMethodIndex(); |
| 464 | if (dex_method_idx != DexFile::kDexNoIndex16) { |
| 465 | return dex_file.GetMethodSignature(dex_file.GetMethodId(dex_method_idx)); |
| 466 | } else { |
| 467 | return "<no signature>"; |
| 468 | } |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 469 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 470 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 471 | const DexFile::ProtoId& GetPrototype() |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 472 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 473 | const DexFile& dex_file = GetDexFile(); |
| 474 | return dex_file.GetMethodPrototype(dex_file.GetMethodId(method_->GetDexMethodIndex())); |
| 475 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 476 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 477 | const DexFile::TypeList* GetParameterTypeList() |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 478 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 479 | const DexFile::ProtoId& proto = GetPrototype(); |
| 480 | return GetDexFile().GetProtoParameters(proto); |
| 481 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 482 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 483 | mirror::ObjectArray<mirror::Class>* GetParameterTypes(Thread* self) |
Ian Rogers | 50b35e2 | 2012-10-04 10:09:15 -0700 | [diff] [blame] | 484 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 485 | const DexFile::TypeList* params = GetParameterTypeList(); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 486 | uint32_t num_params = params == NULL ? 0 : params->Size(); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 487 | SirtRef<mirror::ObjectArray<mirror::Class> > |
| 488 | result(self, GetClassLinker()->AllocClassArray(self, num_params)); |
Ian Rogers | 50b35e2 | 2012-10-04 10:09:15 -0700 | [diff] [blame] | 489 | if (UNLIKELY(result.get() == NULL)) { |
| 490 | CHECK(self->IsExceptionPending()); |
| 491 | return NULL; |
| 492 | } |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 493 | for (uint32_t i = 0; i < num_params; i++) { |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 494 | mirror::Class* param_type = GetClassFromTypeIdx(params->GetTypeItem(i).type_idx_); |
jeffhao | 441d912 | 2012-03-21 17:29:10 -0700 | [diff] [blame] | 495 | if (param_type == NULL) { |
| 496 | DCHECK(Thread::Current()->IsExceptionPending()); |
| 497 | return NULL; |
| 498 | } |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 499 | result->Set(i, param_type); |
| 500 | } |
Ian Rogers | 50b35e2 | 2012-10-04 10:09:15 -0700 | [diff] [blame] | 501 | return result.get(); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 502 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 503 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 504 | mirror::Class* GetReturnType() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 505 | const DexFile& dex_file = GetDexFile(); |
| 506 | const DexFile::MethodId& method_id = dex_file.GetMethodId(method_->GetDexMethodIndex()); |
| 507 | const DexFile::ProtoId& proto_id = dex_file.GetMethodPrototype(method_id); |
| 508 | uint16_t return_type_idx = proto_id.return_type_idx_; |
| 509 | return GetClassFromTypeIdx(return_type_idx); |
| 510 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 511 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 512 | const char* GetReturnTypeDescriptor() |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 513 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 514 | const DexFile& dex_file = GetDexFile(); |
| 515 | const DexFile::MethodId& method_id = dex_file.GetMethodId(method_->GetDexMethodIndex()); |
| 516 | const DexFile::ProtoId& proto_id = dex_file.GetMethodPrototype(method_id); |
| 517 | uint16_t return_type_idx = proto_id.return_type_idx_; |
| 518 | return dex_file.GetTypeDescriptor(dex_file.GetTypeId(return_type_idx)); |
| 519 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 520 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 521 | int32_t GetLineNumFromDexPC(uint32_t dex_pc) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 522 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 0399dde | 2012-06-06 17:09:28 -0700 | [diff] [blame] | 523 | if (dex_pc == DexFile::kDexNoIndex) { |
| 524 | return method_->IsNative() ? -2 : -1; |
| 525 | } else { |
| 526 | const DexFile& dex_file = GetDexFile(); |
| 527 | return dex_file.GetLineNumFromPC(method_, dex_pc); |
| 528 | } |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 529 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 530 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 531 | const char* GetDeclaringClassDescriptor() |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 532 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 533 | mirror::Class* klass = method_->GetDeclaringClass(); |
Ian Rogers | c2b4447 | 2011-12-14 21:17:17 -0800 | [diff] [blame] | 534 | DCHECK(!klass->IsProxyClass()); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 535 | uint16_t type_idx = klass->GetDexTypeIndex(); |
| 536 | const DexFile& dex_file = GetDexFile(); |
| 537 | return dex_file.GetTypeDescriptor(dex_file.GetTypeId(type_idx)); |
| 538 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 539 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 540 | const char* GetDeclaringClassSourceFile() |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 541 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 542 | const char* descriptor = GetDeclaringClassDescriptor(); |
| 543 | const DexFile& dex_file = GetDexFile(); |
| 544 | const DexFile::ClassDef* dex_class_def = dex_file.FindClassDef(descriptor); |
Elliott Hughes | 12c51e3 | 2012-01-17 20:25:05 -0800 | [diff] [blame] | 545 | CHECK(dex_class_def != NULL); |
| 546 | return dex_file.GetSourceFile(*dex_class_def); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 547 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 548 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 549 | uint32_t GetClassDefIndex() |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 550 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 551 | const char* descriptor = GetDeclaringClassDescriptor(); |
| 552 | const DexFile& dex_file = GetDexFile(); |
| 553 | uint32_t index; |
| 554 | CHECK(dex_file.FindClassDefIndex(descriptor, index)); |
| 555 | return index; |
| 556 | } |
| 557 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 558 | mirror::ClassLoader* GetClassLoader() |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 559 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 560 | return method_->GetDeclaringClass()->GetClassLoader(); |
| 561 | } |
| 562 | |
Ian Rogers | af6e67a | 2013-01-16 08:38:37 -0800 | [diff] [blame] | 563 | bool IsStatic() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 564 | return method_->IsStatic(); |
| 565 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 566 | |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 567 | bool IsClassInitializer() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 568 | return IsStatic() && StringPiece(GetName()) == "<clinit>"; |
| 569 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 570 | |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 571 | size_t NumArgs() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 572 | // "1 +" because the first in Args is the receiver. |
| 573 | // "- 1" because we don't count the return type. |
| 574 | return (IsStatic() ? 0 : 1) + GetShortyLength() - 1; |
| 575 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 576 | |
Ian Rogers | af6e67a | 2013-01-16 08:38:37 -0800 | [diff] [blame] | 577 | // Get the primitive type associated with the given parameter. |
| 578 | Primitive::Type GetParamPrimitiveType(size_t param) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 579 | CHECK_LT(param, NumArgs()); |
| 580 | if (IsStatic()) { |
| 581 | param++; // 0th argument must skip return value at start of the shorty |
| 582 | } else if (param == 0) { |
Ian Rogers | af6e67a | 2013-01-16 08:38:37 -0800 | [diff] [blame] | 583 | return Primitive::kPrimNot; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 584 | } |
Ian Rogers | af6e67a | 2013-01-16 08:38:37 -0800 | [diff] [blame] | 585 | return Primitive::GetType(GetShorty()[param]); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 586 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 587 | |
Ian Rogers | af6e67a | 2013-01-16 08:38:37 -0800 | [diff] [blame] | 588 | // Is the specified parameter a long or double, where parameter 0 is 'this' for instance methods. |
| 589 | bool IsParamALongOrDouble(size_t param) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
| 590 | Primitive::Type type = GetParamPrimitiveType(param); |
| 591 | return type == Primitive::kPrimLong || type == Primitive::kPrimDouble; |
| 592 | } |
| 593 | |
| 594 | // Is the specified parameter a reference, where parameter 0 is 'this' for instance methods. |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 595 | bool IsParamAReference(size_t param) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | af6e67a | 2013-01-16 08:38:37 -0800 | [diff] [blame] | 596 | return GetParamPrimitiveType(param) == Primitive::kPrimNot; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 597 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 598 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 599 | bool HasSameNameAndSignature(MethodHelper* other) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 600 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 601 | if (GetDexCache() == other->GetDexCache()) { |
| 602 | const DexFile& dex_file = GetDexFile(); |
| 603 | const DexFile::MethodId& mid = dex_file.GetMethodId(method_->GetDexMethodIndex()); |
| 604 | const DexFile::MethodId& other_mid = |
| 605 | dex_file.GetMethodId(other->method_->GetDexMethodIndex()); |
Ian Rogers | 7b0c5b4 | 2012-02-16 15:29:07 -0800 | [diff] [blame] | 606 | return mid.name_idx_ == other_mid.name_idx_ && mid.proto_idx_ == other_mid.proto_idx_; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 607 | } |
Ian Rogers | 7b0c5b4 | 2012-02-16 15:29:07 -0800 | [diff] [blame] | 608 | StringPiece name(GetName()); |
| 609 | StringPiece other_name(other->GetName()); |
| 610 | return name == other_name && GetSignature() == other->GetSignature(); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 611 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 612 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 613 | const DexFile::CodeItem* GetCodeItem() |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 614 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 615 | return GetDexFile().GetCodeItem(method_->GetCodeItemOffset()); |
| 616 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 617 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 618 | bool IsResolvedTypeIdx(uint16_t type_idx) const |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 619 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6f1dfe4 | 2011-12-08 17:28:34 -0800 | [diff] [blame] | 620 | return method_->GetDexCacheResolvedTypes()->Get(type_idx) != NULL; |
| 621 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 622 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 623 | mirror::Class* GetClassFromTypeIdx(uint16_t type_idx) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 624 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 625 | mirror::Class* type = method_->GetDexCacheResolvedTypes()->Get(type_idx); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 626 | if (type == NULL) { |
| 627 | type = GetClassLinker()->ResolveType(type_idx, method_); |
| 628 | CHECK(type != NULL || Thread::Current()->IsExceptionPending()); |
| 629 | } |
| 630 | return type; |
| 631 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 632 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 633 | const char* GetTypeDescriptorFromTypeIdx(uint16_t type_idx) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 634 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 635 | const DexFile& dex_file = GetDexFile(); |
| 636 | return dex_file.GetTypeDescriptor(dex_file.GetTypeId(type_idx)); |
| 637 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 638 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 639 | mirror::Class* GetDexCacheResolvedType(uint16_t type_idx) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 640 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 2fa6b2e | 2012-10-17 00:10:17 -0700 | [diff] [blame] | 641 | return method_->GetDexCacheResolvedTypes()->Get(type_idx); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 642 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 643 | |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 644 | const DexFile& GetDexFile() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 645 | const DexFile* result = dex_file_; |
| 646 | if (result == NULL) { |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 647 | const mirror::DexCache* dex_cache = GetDexCache(); |
Ian Rogers | 4445a7e | 2012-10-05 17:19:13 -0700 | [diff] [blame] | 648 | result = dex_file_ = dex_cache->GetDexFile(); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 649 | } |
| 650 | return *result; |
| 651 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 652 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 653 | mirror::DexCache* GetDexCache() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
| 654 | mirror::DexCache* result = dex_cache_; |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 655 | if (result == NULL) { |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 656 | mirror::Class* klass = method_->GetDeclaringClass(); |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 657 | result = klass->GetDexCache(); |
| 658 | dex_cache_ = result; |
| 659 | } |
| 660 | return result; |
| 661 | } |
Elliott Hughes | a21039c | 2012-06-21 12:09:25 -0700 | [diff] [blame] | 662 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 663 | mirror::String* ResolveString(uint32_t string_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
| 664 | mirror::String* s = method_->GetDexCacheStrings()->Get(string_idx); |
Ian Rogers | 2fa6b2e | 2012-10-17 00:10:17 -0700 | [diff] [blame] | 665 | if (UNLIKELY(s == NULL)) { |
| 666 | s = GetClassLinker()->ResolveString(GetDexFile(), string_idx, GetDexCache()); |
| 667 | } |
| 668 | return s; |
| 669 | } |
| 670 | |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 671 | private: |
| 672 | // Set the method_ field, for proxy methods looking up the interface method via the resolved |
| 673 | // methods table. |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 674 | void SetMethod(const mirror::AbstractMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 675 | if (method != NULL) { |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 676 | mirror::Class* klass = method->GetDeclaringClass(); |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 677 | if (klass->IsProxyClass()) { |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 678 | mirror::AbstractMethod* interface_method = |
Ian Rogers | 1984651 | 2012-02-24 11:42:47 -0800 | [diff] [blame] | 679 | method->GetDexCacheResolvedMethods()->Get(method->GetDexMethodIndex()); |
| 680 | CHECK(interface_method != NULL); |
| 681 | CHECK(interface_method == GetClassLinker()->FindMethodForProxy(klass, method)); |
| 682 | method = interface_method; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 683 | } |
| 684 | } |
| 685 | method_ = method; |
| 686 | } |
Ian Rogers | ad0b3a3 | 2012-04-16 14:50:24 -0700 | [diff] [blame] | 687 | |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 688 | ClassLinker* GetClassLinker() { |
| 689 | ClassLinker* result = class_linker_; |
| 690 | if (result == NULL) { |
| 691 | result = Runtime::Current()->GetClassLinker(); |
| 692 | class_linker_ = result; |
| 693 | } |
| 694 | return result; |
| 695 | } |
| 696 | |
| 697 | ClassLinker* class_linker_; |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 698 | mirror::DexCache* dex_cache_; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 699 | const DexFile* dex_file_; |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 700 | const mirror::AbstractMethod* method_; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 701 | const char* shorty_; |
Elliott Hughes | 45651fd | 2012-02-21 15:48:20 -0800 | [diff] [blame] | 702 | uint32_t shorty_len_; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 703 | |
| 704 | DISALLOW_COPY_AND_ASSIGN(MethodHelper); |
| 705 | }; |
| 706 | |
| 707 | } // namespace art |
| 708 | |
| 709 | #endif // ART_SRC_OBJECT_UTILS_H_ |