blob: ebd5bd581b1e652d1f3e97204f0bcb9a10a10a36 [file] [log] [blame]
Ian Rogers2dd0e2c2013-01-24 12:42:14 -08001/*
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
Brian Carlstromea46f952013-07-30 01:26:50 -070017#ifndef ART_RUNTIME_MIRROR_ART_METHOD_H_
18#define ART_RUNTIME_MIRROR_ART_METHOD_H_
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080019
Jeff Hao790ad902013-05-22 15:02:08 -070020#include "dex_file.h"
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -070021#include "gc_root.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080022#include "invoke_type.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080023#include "modifiers.h"
24#include "object.h"
Mathieu Chartier83c8ee02014-01-28 14:50:23 -080025#include "object_callbacks.h"
Vladimir Marko7624d252014-05-02 14:40:15 +010026#include "quick/quick_method_frame_info.h"
Mingyao Yang98d1cc82014-05-15 17:02:16 -070027#include "read_barrier_option.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080028
29namespace art {
30
Brian Carlstromea46f952013-07-30 01:26:50 -070031struct ArtMethodOffsets;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080032struct ConstructorMethodOffsets;
33union JValue;
Jeff Hao790ad902013-05-22 15:02:08 -070034class MethodHelper;
Mathieu Chartier2b7c4d12014-05-19 10:52:16 -070035class ScopedObjectAccessAlreadyRunnable;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080036class StringPiece;
Jeff Hao16743632013-05-08 10:59:04 -070037class ShadowFrame;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080038
39namespace mirror {
40
Jeff Hao790ad902013-05-22 15:02:08 -070041typedef void (EntryPointFromInterpreter)(Thread* self, MethodHelper& mh,
42 const DexFile::CodeItem* code_item, ShadowFrame* shadow_frame, JValue* result);
Jeff Hao16743632013-05-08 10:59:04 -070043
Mingyao Yang98d1cc82014-05-15 17:02:16 -070044// C++ mirror of java.lang.reflect.ArtMethod.
45class MANAGED ArtMethod FINAL : public Object {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080046 public:
Mingyao Yang98d1cc82014-05-15 17:02:16 -070047 // Size of java.lang.reflect.ArtMethod.class.
48 static uint32_t ClassSize();
49
50 // Size of an instance of java.lang.reflect.ArtMethod not including its value array.
51 static constexpr uint32_t InstanceSize() {
52 return sizeof(ArtMethod);
53 }
54
Mathieu Chartier2b7c4d12014-05-19 10:52:16 -070055 static ArtMethod* FromReflectedMethod(const ScopedObjectAccessAlreadyRunnable& soa,
56 jobject jlr_method)
Ian Rogers62f05122014-03-21 11:21:29 -070057 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
58
Ian Rogersb0fa5dc2014-04-28 16:47:08 -070059 Class* GetDeclaringClass() ALWAYS_INLINE SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080060
61 void SetDeclaringClass(Class *new_declaring_class) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
62
63 static MemberOffset DeclaringClassOffset() {
Brian Carlstromea46f952013-07-30 01:26:50 -070064 return MemberOffset(OFFSETOF_MEMBER(ArtMethod, declaring_class_));
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080065 }
66
Ian Rogersef7d42f2014-01-06 12:55:46 -080067 uint32_t GetAccessFlags() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Jeff Hao5d917302013-02-27 17:57:33 -080068
Ian Rogersef7d42f2014-01-06 12:55:46 -080069 void SetAccessFlags(uint32_t new_access_flags) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +010070 // Not called within a transaction.
Ian Rogersb0fa5dc2014-04-28 16:47:08 -070071 SetField32<false>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, access_flags_), new_access_flags);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080072 }
73
74 // Approximate what kind of method call would be used for this method.
Ian Rogersef7d42f2014-01-06 12:55:46 -080075 InvokeType GetInvokeType() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080076
77 // Returns true if the method is declared public.
Ian Rogersef7d42f2014-01-06 12:55:46 -080078 bool IsPublic() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080079 return (GetAccessFlags() & kAccPublic) != 0;
80 }
81
82 // Returns true if the method is declared private.
Ian Rogersef7d42f2014-01-06 12:55:46 -080083 bool IsPrivate() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080084 return (GetAccessFlags() & kAccPrivate) != 0;
85 }
86
87 // Returns true if the method is declared static.
Ian Rogersef7d42f2014-01-06 12:55:46 -080088 bool IsStatic() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080089 return (GetAccessFlags() & kAccStatic) != 0;
90 }
91
92 // Returns true if the method is a constructor.
Ian Rogersef7d42f2014-01-06 12:55:46 -080093 bool IsConstructor() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080094 return (GetAccessFlags() & kAccConstructor) != 0;
95 }
96
Mathieu Chartierbfd9a432014-05-21 17:43:44 -070097 // Returns true if the method is a class initializer.
98 bool IsClassInitializer() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
99 return IsConstructor() && IsStatic();
100 }
101
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800102 // Returns true if the method is static, private, or a constructor.
Ian Rogersef7d42f2014-01-06 12:55:46 -0800103 bool IsDirect() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800104 return IsDirect(GetAccessFlags());
105 }
106
107 static bool IsDirect(uint32_t access_flags) {
108 return (access_flags & (kAccStatic | kAccPrivate | kAccConstructor)) != 0;
109 }
110
111 // Returns true if the method is declared synchronized.
Ian Rogersef7d42f2014-01-06 12:55:46 -0800112 bool IsSynchronized() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800113 uint32_t synchonized = kAccSynchronized | kAccDeclaredSynchronized;
114 return (GetAccessFlags() & synchonized) != 0;
115 }
116
Ian Rogersef7d42f2014-01-06 12:55:46 -0800117 bool IsFinal() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800118 return (GetAccessFlags() & kAccFinal) != 0;
119 }
120
Ian Rogersef7d42f2014-01-06 12:55:46 -0800121 bool IsMiranda() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800122 return (GetAccessFlags() & kAccMiranda) != 0;
123 }
124
Ian Rogersef7d42f2014-01-06 12:55:46 -0800125 bool IsNative() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800126 return (GetAccessFlags() & kAccNative) != 0;
127 }
128
Ian Rogersef7d42f2014-01-06 12:55:46 -0800129 bool IsFastNative() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers16ce0922014-01-10 14:59:36 -0800130 uint32_t mask = kAccFastNative | kAccNative;
131 return (GetAccessFlags() & mask) == mask;
Ian Rogers1eb512d2013-10-18 15:42:20 -0700132 }
133
Ian Rogersef7d42f2014-01-06 12:55:46 -0800134 bool IsAbstract() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800135 return (GetAccessFlags() & kAccAbstract) != 0;
136 }
137
Ian Rogersef7d42f2014-01-06 12:55:46 -0800138 bool IsSynthetic() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800139 return (GetAccessFlags() & kAccSynthetic) != 0;
140 }
141
Ian Rogersef7d42f2014-01-06 12:55:46 -0800142 bool IsProxyMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800143
Ian Rogersef7d42f2014-01-06 12:55:46 -0800144 bool IsPreverified() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Sebastien Hertz233ea8e2013-06-06 11:57:09 +0200145 return (GetAccessFlags() & kAccPreverified) != 0;
146 }
147
Ian Rogersef7d42f2014-01-06 12:55:46 -0800148 void SetPreverified() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
149 DCHECK(!IsPreverified());
Sebastien Hertz233ea8e2013-06-06 11:57:09 +0200150 SetAccessFlags(GetAccessFlags() | kAccPreverified);
151 }
152
Ian Rogersef7d42f2014-01-06 12:55:46 -0800153 bool IsPortableCompiled() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
154 return (GetAccessFlags() & kAccPortableCompiled) != 0;
155 }
156
157 void SetIsPortableCompiled() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
158 DCHECK(!IsPortableCompiled());
159 SetAccessFlags(GetAccessFlags() | kAccPortableCompiled);
160 }
161
162 void ClearIsPortableCompiled() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
163 DCHECK(IsPortableCompiled());
164 SetAccessFlags(GetAccessFlags() & ~kAccPortableCompiled);
165 }
166
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800167 bool CheckIncompatibleClassChange(InvokeType type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
168
Ian Rogersef7d42f2014-01-06 12:55:46 -0800169 uint16_t GetMethodIndex() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800170
Ian Rogersef7d42f2014-01-06 12:55:46 -0800171 size_t GetVtableIndex() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800172 return GetMethodIndex();
173 }
174
Ian Rogersef7d42f2014-01-06 12:55:46 -0800175 void SetMethodIndex(uint16_t new_method_index) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100176 // Not called within a transaction.
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700177 SetField32<false>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_index_), new_method_index);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800178 }
179
180 static MemberOffset MethodIndexOffset() {
Brian Carlstromea46f952013-07-30 01:26:50 -0700181 return OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_index_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800182 }
183
Ian Rogersef7d42f2014-01-06 12:55:46 -0800184 uint32_t GetCodeItemOffset() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700185 return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_code_item_offset_));
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800186 }
187
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700188 void SetCodeItemOffset(uint32_t new_code_off) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100189 // Not called within a transaction.
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700190 SetField32<false>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_code_item_offset_), new_code_off);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800191 }
192
193 // Number of 32bit registers that would be required to hold all the arguments
194 static size_t NumArgRegisters(const StringPiece& shorty);
195
Ian Rogersef7d42f2014-01-06 12:55:46 -0800196 uint32_t GetDexMethodIndex() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800197
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700198 void SetDexMethodIndex(uint32_t new_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Sebastien Hertzd2fe10a2014-01-15 10:20:56 +0100199 // Not called within a transaction.
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700200 SetField32<false>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_method_index_), new_idx);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800201 }
202
Ian Rogersef7d42f2014-01-06 12:55:46 -0800203 ObjectArray<String>* GetDexCacheStrings() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800204 void SetDexCacheStrings(ObjectArray<String>* new_dex_cache_strings)
205 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
206
207 static MemberOffset DexCacheStringsOffset() {
Brian Carlstromea46f952013-07-30 01:26:50 -0700208 return OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_strings_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800209 }
210
211 static MemberOffset DexCacheResolvedMethodsOffset() {
Brian Carlstromea46f952013-07-30 01:26:50 -0700212 return OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_methods_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800213 }
214
215 static MemberOffset DexCacheResolvedTypesOffset() {
Brian Carlstromea46f952013-07-30 01:26:50 -0700216 return OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_types_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800217 }
218
Andreas Gampe58a5af82014-07-31 16:23:49 -0700219 ArtMethod* GetDexCacheResolvedMethod(uint16_t method_idx)
220 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
221 void SetDexCacheResolvedMethod(uint16_t method_idx, ArtMethod* new_method)
222 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstromea46f952013-07-30 01:26:50 -0700223 void SetDexCacheResolvedMethods(ObjectArray<ArtMethod>* new_dex_cache_methods)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800224 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Andreas Gampe58a5af82014-07-31 16:23:49 -0700225 bool HasDexCacheResolvedMethods() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
226 bool HasSameDexCacheResolvedMethods(ArtMethod* other) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
227 bool HasSameDexCacheResolvedMethods(ObjectArray<ArtMethod>* other_cache)
228 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800229
Andreas Gampe58a5af82014-07-31 16:23:49 -0700230 template <bool kWithCheck = true>
231 Class* GetDexCacheResolvedType(uint32_t type_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800232 void SetDexCacheResolvedTypes(ObjectArray<Class>* new_dex_cache_types)
233 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Andreas Gampe58a5af82014-07-31 16:23:49 -0700234 bool HasDexCacheResolvedTypes() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
235 bool HasSameDexCacheResolvedTypes(ArtMethod* other) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
236 bool HasSameDexCacheResolvedTypes(ObjectArray<Class>* other_cache)
237 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800238
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800239 // Find the method that this method overrides
Ian Rogersef7d42f2014-01-06 12:55:46 -0800240 ArtMethod* FindOverriddenMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800241
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700242 void Invoke(Thread* self, uint32_t* args, uint32_t args_size, JValue* result, const char* shorty)
243 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800244
Mathieu Chartier4e305412014-02-19 10:54:44 -0800245 template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700246 EntryPointFromInterpreter* GetEntryPointFromInterpreter()
247 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Mathieu Chartier4e305412014-02-19 10:54:44 -0800248 return GetFieldPtr<EntryPointFromInterpreter*, kVerifyFlags>(
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700249 OFFSET_OF_OBJECT_MEMBER(ArtMethod, entry_point_from_interpreter_));
Jeff Hao16743632013-05-08 10:59:04 -0700250 }
251
Mathieu Chartier4e305412014-02-19 10:54:44 -0800252 template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700253 void SetEntryPointFromInterpreter(EntryPointFromInterpreter* entry_point_from_interpreter)
254 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Mathieu Chartier4e305412014-02-19 10:54:44 -0800255 SetFieldPtr<false, true, kVerifyFlags>(
256 OFFSET_OF_OBJECT_MEMBER(ArtMethod, entry_point_from_interpreter_),
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700257 entry_point_from_interpreter);
Jeff Hao16743632013-05-08 10:59:04 -0700258 }
259
Ian Rogersef7d42f2014-01-06 12:55:46 -0800260 static MemberOffset EntryPointFromPortableCompiledCodeOffset() {
261 return MemberOffset(OFFSETOF_MEMBER(ArtMethod, entry_point_from_portable_compiled_code_));
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800262 }
263
Mathieu Chartier4e305412014-02-19 10:54:44 -0800264 template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700265 const void* GetEntryPointFromPortableCompiledCode() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Mathieu Chartier4e305412014-02-19 10:54:44 -0800266 return GetFieldPtr<const void*, kVerifyFlags>(
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700267 EntryPointFromPortableCompiledCodeOffset());
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800268 }
269
Mathieu Chartier4e305412014-02-19 10:54:44 -0800270 template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700271 void SetEntryPointFromPortableCompiledCode(const void* entry_point_from_portable_compiled_code)
272 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Mathieu Chartier4e305412014-02-19 10:54:44 -0800273 SetFieldPtr<false, true, kVerifyFlags>(
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700274 EntryPointFromPortableCompiledCodeOffset(), entry_point_from_portable_compiled_code);
Ian Rogersef7d42f2014-01-06 12:55:46 -0800275 }
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800276
Ian Rogersef7d42f2014-01-06 12:55:46 -0800277 static MemberOffset EntryPointFromQuickCompiledCodeOffset() {
278 return MemberOffset(OFFSETOF_MEMBER(ArtMethod, entry_point_from_quick_compiled_code_));
279 }
280
Mathieu Chartier4e305412014-02-19 10:54:44 -0800281 template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700282 const void* GetEntryPointFromQuickCompiledCode() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
283 return GetFieldPtr<const void*, kVerifyFlags>(EntryPointFromQuickCompiledCodeOffset());
Ian Rogersef7d42f2014-01-06 12:55:46 -0800284 }
285
Mathieu Chartier4e305412014-02-19 10:54:44 -0800286 template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700287 void SetEntryPointFromQuickCompiledCode(const void* entry_point_from_quick_compiled_code)
288 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Mathieu Chartier4e305412014-02-19 10:54:44 -0800289 SetFieldPtr<false, true, kVerifyFlags>(
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700290 EntryPointFromQuickCompiledCodeOffset(), entry_point_from_quick_compiled_code);
Ian Rogersef7d42f2014-01-06 12:55:46 -0800291 }
292
Ian Rogersef7d42f2014-01-06 12:55:46 -0800293 uint32_t GetCodeSize() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
294
295 bool IsWithinQuickCode(uintptr_t pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
296 uintptr_t code = reinterpret_cast<uintptr_t>(GetEntryPointFromQuickCompiledCode());
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800297 if (code == 0) {
298 return pc == 0;
299 }
300 /*
Vladimir Marko96c6ab92014-04-08 14:00:50 +0100301 * During a stack walk, a return PC may point past-the-end of the code
302 * in the case that the last instruction is a call that isn't expected to
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800303 * return. Thus, we check <= code + GetCodeSize().
Vladimir Marko96c6ab92014-04-08 14:00:50 +0100304 *
305 * NOTE: For Thumb both pc and code are offset by 1 indicating the Thumb state.
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800306 */
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700307 return code <= pc && pc <= code + GetCodeSize();
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800308 }
309
Ian Rogersef7d42f2014-01-06 12:55:46 -0800310 void AssertPcIsWithinQuickCode(uintptr_t pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800311
Hiroshi Yamauchi9bdec882014-08-15 17:11:12 -0700312 // Returns true if the entrypoint points to the interpreter, as
313 // opposed to the compiled code, that is, this method will be
314 // interpretered on invocation.
315 bool IsEntrypointInterpreter() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
316
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700317 uint32_t GetQuickOatCodeOffset() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
318 uint32_t GetPortableOatCodeOffset() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
319 void SetQuickOatCodeOffset(uint32_t code_offset) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
320 void SetPortableOatCodeOffset(uint32_t code_offset) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800321
Vladimir Marko8a630572014-04-09 18:45:35 +0100322 static const void* EntryPointToCodePointer(const void* entry_point) ALWAYS_INLINE {
323 uintptr_t code = reinterpret_cast<uintptr_t>(entry_point);
324 code &= ~0x1; // TODO: Make this Thumb2 specific.
325 return reinterpret_cast<const void*>(code);
326 }
327
Vladimir Marko4c1c5102014-05-14 16:51:16 +0100328 // Actual entry point pointer to compiled oat code or nullptr.
329 const void* GetQuickOatEntryPoint() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Vladimir Marko8a630572014-04-09 18:45:35 +0100330 // Actual pointer to compiled oat code or nullptr.
Vladimir Marko4c1c5102014-05-14 16:51:16 +0100331 const void* GetQuickOatCodePointer() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Vladimir Marko8a630572014-04-09 18:45:35 +0100332
Ian Rogers1809a722013-08-09 22:05:32 -0700333 // Callers should wrap the uint8_t* in a MappingTable instance for convenient access.
Vladimir Marko8a630572014-04-09 18:45:35 +0100334 const uint8_t* GetMappingTable() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Vladimir Marko4c1c5102014-05-14 16:51:16 +0100335 const uint8_t* GetMappingTable(const void* code_pointer)
336 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800337
Ian Rogers1809a722013-08-09 22:05:32 -0700338 // Callers should wrap the uint8_t* in a VmapTable instance for convenient access.
Vladimir Marko8a630572014-04-09 18:45:35 +0100339 const uint8_t* GetVmapTable() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Vladimir Marko4c1c5102014-05-14 16:51:16 +0100340 const uint8_t* GetVmapTable(const void* code_pointer)
341 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800342
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700343 const uint8_t* GetNativeGcMap() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
344 return GetFieldPtr<uint8_t*>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, gc_map_));
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800345 }
Mathieu Chartier4e305412014-02-19 10:54:44 -0800346 template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700347 void SetNativeGcMap(const uint8_t* data) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
348 SetFieldPtr<false, true, kVerifyFlags>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, gc_map_), data);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800349 }
350
351 // When building the oat need a convenient place to stuff the offset of the native GC map.
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700352 void SetOatNativeGcMapOffset(uint32_t gc_map_offset) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
353 uint32_t GetOatNativeGcMapOffset() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800354
Andreas Gampe90546832014-03-12 18:07:19 -0700355 template <bool kCheckFrameSize = true>
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700356 uint32_t GetFrameSizeInBytes() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Vladimir Marko7624d252014-05-02 14:40:15 +0100357 uint32_t result = GetQuickFrameInfo().FrameSizeInBytes();
Andreas Gampe90546832014-03-12 18:07:19 -0700358 if (kCheckFrameSize) {
359 DCHECK_LE(static_cast<size_t>(kStackAlignment), result);
360 }
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800361 return result;
362 }
363
Vladimir Marko7624d252014-05-02 14:40:15 +0100364 QuickMethodFrameInfo GetQuickFrameInfo() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Vladimir Marko4c1c5102014-05-14 16:51:16 +0100365 QuickMethodFrameInfo GetQuickFrameInfo(const void* code_pointer)
366 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800367
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700368 size_t GetReturnPcOffsetInBytes() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Vladimir Marko4c1c5102014-05-14 16:51:16 +0100369 return GetReturnPcOffsetInBytes(GetFrameSizeInBytes());
370 }
371
372 size_t GetReturnPcOffsetInBytes(uint32_t frame_size_in_bytes)
373 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
374 DCHECK_EQ(frame_size_in_bytes, GetFrameSizeInBytes());
375 return frame_size_in_bytes - kPointerSize;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800376 }
377
Mathieu Chartiereb8167a2014-05-07 15:43:14 -0700378 size_t GetHandleScopeOffsetInBytes() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers62d6c772013-02-27 08:32:07 -0800379 return kPointerSize;
380 }
381
Ian Rogers1eb512d2013-10-18 15:42:20 -0700382 void RegisterNative(Thread* self, const void* native_method, bool is_fast)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800383 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
384
385 void UnregisterNative(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
386
387 static MemberOffset NativeMethodOffset() {
Ian Rogersef7d42f2014-01-06 12:55:46 -0800388 return OFFSET_OF_OBJECT_MEMBER(ArtMethod, entry_point_from_jni_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800389 }
390
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700391 const void* GetNativeMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
392 return GetFieldPtr<const void*>(NativeMethodOffset());
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800393 }
394
Mathieu Chartier4e305412014-02-19 10:54:44 -0800395 template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700396 void SetNativeMethod(const void*) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800397
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800398 static MemberOffset GetMethodIndexOffset() {
Brian Carlstromea46f952013-07-30 01:26:50 -0700399 return OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_index_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800400 }
401
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800402 // Is this a CalleSaveMethod or ResolutionMethod and therefore doesn't adhere to normal
403 // conventions for a method of managed code. Returns false for Proxy methods.
Ian Rogersef7d42f2014-01-06 12:55:46 -0800404 bool IsRuntimeMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800405
406 // Is this a hand crafted method used for something like describing callee saves?
Ian Rogersef7d42f2014-01-06 12:55:46 -0800407 bool IsCalleeSaveMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800408
Ian Rogersef7d42f2014-01-06 12:55:46 -0800409 bool IsResolutionMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800410
Ian Rogersef7d42f2014-01-06 12:55:46 -0800411 bool IsImtConflictMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Jeff Hao88474b42013-10-23 16:24:40 -0700412
Ian Rogersef7d42f2014-01-06 12:55:46 -0800413 uintptr_t NativePcOffset(const uintptr_t pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Vladimir Marko4c1c5102014-05-14 16:51:16 +0100414 uintptr_t NativePcOffset(const uintptr_t pc, const void* quick_entry_point)
415 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800416
417 // Converts a native PC to a dex PC.
Dave Allisonb373e092014-02-20 16:06:36 -0800418 uint32_t ToDexPc(const uintptr_t pc, bool abort_on_failure = true)
419 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800420
421 // Converts a dex PC to a native PC.
Ian Rogersef7d42f2014-01-06 12:55:46 -0800422 uintptr_t ToNativePc(const uint32_t dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800423
Ian Rogersc449aa82013-07-29 14:35:46 -0700424 // Find the catch block for the given exception type and dex_pc. When a catch block is found,
425 // indicates whether the found catch block is responsible for clearing the exception or whether
426 // a move-exception instruction is present.
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700427 static uint32_t FindCatchBlock(Handle<ArtMethod> h_this, Handle<Class> exception_type,
428 uint32_t dex_pc, bool* has_no_move_exception)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800429 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
430
Brian Carlstromea46f952013-07-30 01:26:50 -0700431 static void SetClass(Class* java_lang_reflect_ArtMethod);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800432
Hiroshi Yamauchi4f1ebc22014-06-25 14:30:41 -0700433 template<ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700434 static Class* GetJavaLangReflectArtMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800435
Brian Carlstromea46f952013-07-30 01:26:50 -0700436 static void ResetClass();
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800437
Mathieu Chartier83c8ee02014-01-28 14:50:23 -0800438 static void VisitRoots(RootCallback* callback, void* arg)
Mathieu Chartierc528dba2013-11-26 12:00:11 -0800439 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
440
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700441 const DexFile* GetDexFile() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700442
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700443 const char* GetDeclaringClassDescriptor() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700444
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700445 const char* GetShorty() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
446 uint32_t unused_length;
447 return GetShorty(&unused_length);
448 }
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700449
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700450 const char* GetShorty(uint32_t* out_length) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700451
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700452 const Signature GetSignature() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700453
Ian Rogers1ff3c982014-08-12 02:30:58 -0700454 ALWAYS_INLINE const char* GetName() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700455
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700456 const DexFile::CodeItem* GetCodeItem() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700457
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700458 bool IsResolvedTypeIdx(uint16_t type_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700459
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700460 int32_t GetLineNumFromDexPC(uint32_t dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700461
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700462 const DexFile::ProtoId& GetPrototype() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700463
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700464 const DexFile::TypeList* GetParameterTypeList() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700465
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700466 const char* GetDeclaringClassSourceFile() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700467
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700468 uint16_t GetClassDefIndex() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700469
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700470 const DexFile::ClassDef& GetClassDef() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700471
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700472 const char* GetReturnTypeDescriptor() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700473
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700474 const char* GetTypeDescriptorFromTypeIdx(uint16_t type_idx)
475 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700476
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700477 mirror::ClassLoader* GetClassLoader() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700478
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700479 mirror::DexCache* GetDexCache() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700480
Ian Rogers1ff3c982014-08-12 02:30:58 -0700481 ALWAYS_INLINE ArtMethod* GetInterfaceMethodIfProxy() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700482
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800483 protected:
484 // Field order required by test "ValidateFieldOrderOfJavaCppUnionClasses".
Ian Rogersef7d42f2014-01-06 12:55:46 -0800485 // The class we are a part of.
486 HeapReference<Class> declaring_class_;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800487
Ian Rogersef7d42f2014-01-06 12:55:46 -0800488 // Short cuts to declaring_class_->dex_cache_ member for fast compiled code access.
Ian Rogers700a4022014-05-19 16:49:03 -0700489 HeapReference<ObjectArray<ArtMethod>> dex_cache_resolved_methods_;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800490
Ian Rogersef7d42f2014-01-06 12:55:46 -0800491 // Short cuts to declaring_class_->dex_cache_ member for fast compiled code access.
Ian Rogers700a4022014-05-19 16:49:03 -0700492 HeapReference<ObjectArray<Class>> dex_cache_resolved_types_;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800493
Ian Rogersef7d42f2014-01-06 12:55:46 -0800494 // Short cuts to declaring_class_->dex_cache_ member for fast compiled code access.
Ian Rogers700a4022014-05-19 16:49:03 -0700495 HeapReference<ObjectArray<String>> dex_cache_strings_;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800496
Ian Rogersef7d42f2014-01-06 12:55:46 -0800497 // Method dispatch from the interpreter invokes this pointer which may cause a bridge into
498 // compiled code.
499 uint64_t entry_point_from_interpreter_;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800500
Ian Rogersef7d42f2014-01-06 12:55:46 -0800501 // Pointer to JNI function registered to this method, or a function to resolve the JNI function.
502 uint64_t entry_point_from_jni_;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800503
Ian Rogersef7d42f2014-01-06 12:55:46 -0800504 // Method dispatch from portable compiled code invokes this pointer which may cause bridging into
505 // quick compiled code or the interpreter.
506 uint64_t entry_point_from_portable_compiled_code_;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800507
Ian Rogersef7d42f2014-01-06 12:55:46 -0800508 // Method dispatch from quick compiled code invokes this pointer which may cause bridging into
509 // portable compiled code or the interpreter.
510 uint64_t entry_point_from_quick_compiled_code_;
Jeff Haoaa4a7932013-05-13 11:28:27 -0700511
Ian Rogersef7d42f2014-01-06 12:55:46 -0800512 // Pointer to a data structure created by the compiler and used by the garbage collector to
513 // determine which registers hold live references to objects within the heap. Keyed by native PC
514 // offsets for the quick compiler and dex PCs for the portable.
515 uint64_t gc_map_;
Jeff Hao16743632013-05-08 10:59:04 -0700516
Ian Rogersef7d42f2014-01-06 12:55:46 -0800517 // Access flags; low 16 bits are defined by spec.
518 uint32_t access_flags_;
519
520 /* Dex file fields. The defining dex file is available via declaring_class_->dex_cache_ */
521
522 // Offset to the CodeItem.
523 uint32_t dex_code_item_offset_;
524
525 // Index into method_ids of the dex file associated with this method.
526 uint32_t dex_method_index_;
527
528 /* End of dex file fields. */
529
530 // Entry within a dispatch table for this method. For static/direct methods the index is into
531 // the declaringClass.directMethods, for virtual methods the vtable and for interface methods the
532 // ifTable.
533 uint32_t method_index_;
534
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -0700535 static GcRoot<Class> java_lang_reflect_ArtMethod_;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800536
Mathieu Chartier02e25112013-08-14 16:14:24 -0700537 private:
Andreas Gampe58a5af82014-07-31 16:23:49 -0700538 ObjectArray<ArtMethod>* GetDexCacheResolvedMethods() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
539
540 ObjectArray<Class>* GetDexCacheResolvedTypes() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
541
Brian Carlstromea46f952013-07-30 01:26:50 -0700542 friend struct art::ArtMethodOffsets; // for verifying offset information
543 DISALLOW_IMPLICIT_CONSTRUCTORS(ArtMethod);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800544};
545
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800546} // namespace mirror
547} // namespace art
548
Brian Carlstromea46f952013-07-30 01:26:50 -0700549#endif // ART_RUNTIME_MIRROR_ART_METHOD_H_