blob: 9e86aa2655a5ee68bcf3df3253e44ad64b1fe471 [file] [log] [blame]
Elliott Hughes418d20f2011-09-22 14:00:39 -07001/*
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 */
Carl Shapiro0e5d75d2011-07-06 18:28:37 -070016
Brian Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_RUNTIME_CLASS_LINKER_H_
18#define ART_RUNTIME_CLASS_LINKER_H_
Carl Shapiro0e5d75d2011-07-06 18:28:37 -070019
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080020#include <string>
Carl Shapiro0e5d75d2011-07-06 18:28:37 -070021#include <utility>
22#include <vector>
23
Mathieu Chartier5369c402014-08-25 13:08:22 -070024#include "base/allocator.h"
Elliott Hughes76160052012-12-12 16:31:20 -080025#include "base/macros.h"
Elliott Hughes76b61672012-12-12 17:47:30 -080026#include "base/mutex.h"
Brian Carlstrom7e49dca2011-07-22 18:07:34 -070027#include "dex_file.h"
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -070028#include "gc_root.h"
Elliott Hughese5448b52012-01-18 16:44:06 -080029#include "gtest/gtest.h"
Mathieu Chartier590fee92013-09-13 13:46:47 -070030#include "jni.h"
Brian Carlstrom58ae9412011-10-04 00:56:06 -070031#include "oat_file.h"
Mathieu Chartier83c8ee02014-01-28 14:50:23 -080032#include "object_callbacks.h"
Carl Shapiro0e5d75d2011-07-06 18:28:37 -070033
34namespace art {
Mingyao Yang98d1cc82014-05-15 17:02:16 -070035
Ian Rogers1d54e732013-05-02 21:10:01 -070036namespace gc {
37namespace space {
38 class ImageSpace;
39} // namespace space
40} // namespace gc
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080041namespace mirror {
Ian Rogers33e95662013-05-20 20:29:14 -070042 class ClassLoader;
43 class DexCache;
44 class DexCacheTest_Open_Test;
45 class IfTable;
46 template<class T> class ObjectArray;
47 class StackTraceElement;
48} // namespace mirror
Ian Rogers1d54e732013-05-02 21:10:01 -070049
Elliott Hughescf4c6c42011-09-01 15:16:42 -070050class InternTable;
Mathieu Chartierc528dba2013-11-26 12:00:11 -080051template<class T> class ObjectLock;
Andreas Gamped7392fa2014-10-23 11:37:40 -070052class Runtime;
Mathieu Chartier2b7c4d12014-05-19 10:52:16 -070053class ScopedObjectAccessAlreadyRunnable;
Mathieu Chartier1fb463e2014-10-23 16:48:06 -070054template<size_t kNumReferences> class PACKED(4) StackHandleScope;
Elliott Hughescf4c6c42011-09-01 15:16:42 -070055
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080056typedef bool (ClassVisitor)(mirror::Class* c, void* arg);
Elliott Hughesa2155262011-11-16 16:26:58 -080057
Mathieu Chartier893263b2014-03-04 11:07:42 -080058enum VisitRootFlags : uint8_t;
59
Carl Shapiro0e5d75d2011-07-06 18:28:37 -070060class ClassLinker {
61 public:
Mathieu Chartier590fee92013-09-13 13:46:47 -070062 explicit ClassLinker(InternTable* intern_table);
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -070063 ~ClassLinker();
Carl Shapiro565f5072011-07-10 13:39:43 -070064
Alex Light507e6182014-08-19 14:23:13 -070065 // Initialize class linker by bootstraping from dex files.
66 void InitWithoutImage(const std::vector<const DexFile*>& boot_class_path)
Mathieu Chartier590fee92013-09-13 13:46:47 -070067 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
68
69 // Initialize class linker from one or more images.
70 void InitFromImage() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
71
Elliott Hughes64bf5a32011-09-20 14:43:12 -070072 // Finds a class by its descriptor, loading it if necessary.
Brian Carlstrom74eb46a2011-08-02 20:10:14 -070073 // If class_loader is null, searches boot_class_path_.
Ian Rogers98379392014-02-24 16:53:16 -080074 mirror::Class* FindClass(Thread* self, const char* descriptor,
Mathieu Chartier0cd81352014-05-22 16:48:55 -070075 Handle<mirror::ClassLoader> class_loader)
Ian Rogersb726dcb2012-09-05 08:57:23 -070076 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstromaded5f72011-10-07 17:15:04 -070077
Mathieu Chartier194116c2014-09-11 14:21:41 -070078 // Find a class in the path class loader, loading it if necessary.
79 mirror::Class* FindClassInPathClassLoader(ScopedObjectAccessAlreadyRunnable& soa,
80 Thread* self, const char* descriptor,
81 Handle<mirror::ClassLoader> class_loader)
82 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
83
Ian Rogers98379392014-02-24 16:53:16 -080084 // Finds a class by its descriptor using the "system" class loader, ie by searching the
85 // boot_class_path_.
86 mirror::Class* FindSystemClass(Thread* self, const char* descriptor)
87 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
88
89 // Finds the array class given for the element class.
Mathieu Chartierb74cd292014-05-29 14:31:33 -070090 mirror::Class* FindArrayClass(Thread* self, mirror::Class** element_class)
Ian Rogersb726dcb2012-09-05 08:57:23 -070091 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstromaded5f72011-10-07 17:15:04 -070092
Ian Rogers79cfc0e2014-06-04 16:57:15 -070093 // Returns true if the class linker is initialized.
Mathieu Chartier590fee92013-09-13 13:46:47 -070094 bool IsInitialized() const;
95
Brian Carlstromaded5f72011-10-07 17:15:04 -070096 // Define a new a class based on a ClassDef from a DexFile
Mathieu Chartierc528dba2013-11-26 12:00:11 -080097 mirror::Class* DefineClass(const char* descriptor,
Mathieu Chartier0cd81352014-05-22 16:48:55 -070098 Handle<mirror::ClassLoader> class_loader,
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080099 const DexFile& dex_file, const DexFile::ClassDef& dex_class_def)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700100 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Elliott Hughes64bf5a32011-09-20 14:43:12 -0700101
102 // Finds a class by its descriptor, returning NULL if it isn't wasn't loaded
103 // by the given 'class_loader'.
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800104 mirror::Class* LookupClass(const char* descriptor, const mirror::ClassLoader* class_loader)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700105 LOCKS_EXCLUDED(Locks::classlinker_classes_lock_)
106 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Carl Shapiro0e5d75d2011-07-06 18:28:37 -0700107
Elliott Hughes6fa602d2011-12-02 17:54:25 -0800108 // Finds all the classes with the given descriptor, regardless of ClassLoader.
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800109 void LookupClasses(const char* descriptor, std::vector<mirror::Class*>& classes)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700110 LOCKS_EXCLUDED(Locks::classlinker_classes_lock_)
111 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Elliott Hughes6fa602d2011-12-02 17:54:25 -0800112
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800113 mirror::Class* FindPrimitiveClass(char type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Elliott Hughesd8ddfd52011-08-15 14:32:53 -0700114
Brian Carlstromae826982011-11-09 01:33:42 -0800115 // General class unloading is not supported, this is used to prune
116 // unwanted classes during image writing.
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800117 bool RemoveClass(const char* descriptor, const mirror::ClassLoader* class_loader)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700118 LOCKS_EXCLUDED(Locks::classlinker_classes_lock_)
119 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstromae826982011-11-09 01:33:42 -0800120
Ian Rogers7dfb28c2013-08-22 08:18:36 -0700121 void DumpAllClasses(int flags)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700122 LOCKS_EXCLUDED(Locks::classlinker_classes_lock_)
123 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700124
Ian Rogers7dfb28c2013-08-22 08:18:36 -0700125 void DumpForSigQuit(std::ostream& os)
126 LOCKS_EXCLUDED(Locks::classlinker_classes_lock_)
127 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Elliott Hughescac6cc72011-11-03 20:31:21 -0700128
Ian Rogers7dfb28c2013-08-22 08:18:36 -0700129 size_t NumLoadedClasses()
130 LOCKS_EXCLUDED(Locks::classlinker_classes_lock_)
131 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Elliott Hughese27955c2011-08-26 15:21:24 -0700132
Brian Carlstromb63ec392011-08-27 17:38:27 -0700133 // Resolve a String with the given index from the DexFile, storing the
Brian Carlstromaded5f72011-10-07 17:15:04 -0700134 // result in the DexCache. The referrer is used to identify the
135 // target DexCache and ClassLoader to use for resolution.
Ian Rogersef7d42f2014-01-06 12:55:46 -0800136 mirror::String* ResolveString(uint32_t string_idx, mirror::ArtMethod* referrer)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800137 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstromaded5f72011-10-07 17:15:04 -0700138
139 // Resolve a String with the given index from the DexFile, storing the
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700140 // result in the DexCache.
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800141 mirror::String* ResolveString(const DexFile& dex_file, uint32_t string_idx,
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700142 Handle<mirror::DexCache> dex_cache)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700143 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700144
Brian Carlstromb63ec392011-08-27 17:38:27 -0700145 // Resolve a Type with the given index from the DexFile, storing the
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700146 // result in the DexCache. The referrer is used to identity the
147 // target DexCache and ClassLoader to use for resolution.
Ian Rogersef7d42f2014-01-06 12:55:46 -0800148 mirror::Class* ResolveType(const DexFile& dex_file, uint16_t type_idx, mirror::Class* referrer)
Mathieu Chartier590fee92013-09-13 13:46:47 -0700149 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700150
Brian Carlstromb63ec392011-08-27 17:38:27 -0700151 // Resolve a Type with the given index from the DexFile, storing the
Ian Rogers0cfe1fb2011-08-26 03:29:44 -0700152 // result in the DexCache. The referrer is used to identify the
Brian Carlstromb63ec392011-08-27 17:38:27 -0700153 // target DexCache and ClassLoader to use for resolution.
Ian Rogersef7d42f2014-01-06 12:55:46 -0800154 mirror::Class* ResolveType(uint16_t type_idx, mirror::ArtMethod* referrer)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800155 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers0cfe1fb2011-08-26 03:29:44 -0700156
Ian Rogersef7d42f2014-01-06 12:55:46 -0800157 mirror::Class* ResolveType(uint16_t type_idx, mirror::ArtField* referrer)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800158 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstromb63ec392011-08-27 17:38:27 -0700159
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700160 // Resolve a type with the given ID from the DexFile, storing the
161 // result in DexCache. The ClassLoader is used to search for the
162 // type, since it may be referenced from but not contained within
163 // the given DexFile.
Mathieu Chartier590fee92013-09-13 13:46:47 -0700164 mirror::Class* ResolveType(const DexFile& dex_file, uint16_t type_idx,
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700165 Handle<mirror::DexCache> dex_cache,
166 Handle<mirror::ClassLoader> class_loader)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700167 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700168
169 // Resolve a method with a given ID from the DexFile, storing the
170 // result in DexCache. The ClassLinker and ClassLoader are used as
171 // in ResolveType. What is unique is the method type argument which
172 // is used to determine if this method is a direct, static, or
173 // virtual method.
Brian Carlstromea46f952013-07-30 01:26:50 -0700174 mirror::ArtMethod* ResolveMethod(const DexFile& dex_file,
175 uint32_t method_idx,
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700176 Handle<mirror::DexCache> dex_cache,
177 Handle<mirror::ClassLoader> class_loader,
178 Handle<mirror::ArtMethod> referrer,
Brian Carlstromea46f952013-07-30 01:26:50 -0700179 InvokeType type)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700180 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700181
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700182 mirror::ArtMethod* GetResolvedMethod(uint32_t method_idx, mirror::ArtMethod* referrer,
183 InvokeType type)
184 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
185 mirror::ArtMethod* ResolveMethod(Thread* self, uint32_t method_idx, mirror::ArtMethod** referrer,
Brian Carlstromea46f952013-07-30 01:26:50 -0700186 InvokeType type)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800187 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom16192862011-09-12 17:50:06 -0700188
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700189 mirror::ArtField* GetResolvedField(uint32_t field_idx, mirror::Class* field_declaring_class)
190 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogersef7d42f2014-01-06 12:55:46 -0800191 mirror::ArtField* ResolveField(uint32_t field_idx, mirror::ArtMethod* referrer,
Brian Carlstromea46f952013-07-30 01:26:50 -0700192 bool is_static)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800193 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstromb9edb842011-08-28 16:31:06 -0700194
Brian Carlstrom16192862011-09-12 17:50:06 -0700195 // Resolve a field with a given ID from the DexFile, storing the
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700196 // result in DexCache. The ClassLinker and ClassLoader are used as
197 // in ResolveType. What is unique is the is_static argument which is
198 // used to determine if we are resolving a static or non-static
199 // field.
Brian Carlstromea46f952013-07-30 01:26:50 -0700200 mirror::ArtField* ResolveField(const DexFile& dex_file,
201 uint32_t field_idx,
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700202 Handle<mirror::DexCache> dex_cache,
203 Handle<mirror::ClassLoader> class_loader,
Brian Carlstromea46f952013-07-30 01:26:50 -0700204 bool is_static)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700205 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700206
Ian Rogersb067ac22011-12-13 18:05:09 -0800207 // Resolve a field with a given ID from the DexFile, storing the
208 // result in DexCache. The ClassLinker and ClassLoader are used as
209 // in ResolveType. No is_static argument is provided so that Java
210 // field resolution semantics are followed.
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700211 mirror::ArtField* ResolveFieldJLS(const DexFile& dex_file, uint32_t field_idx,
212 Handle<mirror::DexCache> dex_cache,
213 Handle<mirror::ClassLoader> class_loader)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700214 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogersb067ac22011-12-13 18:05:09 -0800215
Ian Rogersad25ac52011-10-04 19:13:33 -0700216 // Get shorty from method index without resolution. Used to do handlerization.
Brian Carlstromea46f952013-07-30 01:26:50 -0700217 const char* MethodShorty(uint32_t method_idx, mirror::ArtMethod* referrer, uint32_t* length)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700218 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogersad25ac52011-10-04 19:13:33 -0700219
Elliott Hughesf4c21c92011-08-19 17:31:31 -0700220 // Returns true on success, false if there's an exception pending.
Brian Carlstrom25c33252011-09-18 15:58:35 -0700221 // can_run_clinit=false allows the compiler to attempt to init a class,
222 // given the restriction that no <clinit> execution is possible.
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700223 bool EnsureInitialized(Handle<mirror::Class> c, bool can_init_fields, bool can_init_parents)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700224 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Carl Shapiro0e5d75d2011-07-06 18:28:37 -0700225
Elliott Hughes2a20cfd2011-09-23 19:30:41 -0700226 // Initializes classes that have instances in the image but that have
227 // <clinit> methods so they could not be initialized by the compiler.
Ian Rogersb726dcb2012-09-05 08:57:23 -0700228 void RunRootClinits() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Elliott Hughes2a20cfd2011-09-23 19:30:41 -0700229
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700230 void RegisterDexFile(const DexFile& dex_file)
231 LOCKS_EXCLUDED(dex_lock_)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700232 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700233 void RegisterDexFile(const DexFile& dex_file, Handle<mirror::DexCache> dex_cache)
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700234 LOCKS_EXCLUDED(dex_lock_)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700235 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Carl Shapiro0e5d75d2011-07-06 18:28:37 -0700236
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700237 const OatFile* RegisterOatFile(const OatFile* oat_file)
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700238 LOCKS_EXCLUDED(dex_lock_);
Brian Carlstrom866c8622012-01-06 16:35:13 -0800239
Brian Carlstrom8a487412011-08-29 20:08:52 -0700240 const std::vector<const DexFile*>& GetBootClassPath() {
241 return boot_class_path_;
242 }
243
Ian Rogers7dfb28c2013-08-22 08:18:36 -0700244 void VisitClasses(ClassVisitor* visitor, void* arg)
Ian Rogersca0c8d32014-08-29 15:40:08 -0700245 LOCKS_EXCLUDED(Locks::classlinker_classes_lock_)
Ian Rogers7dfb28c2013-08-22 08:18:36 -0700246 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogersca0c8d32014-08-29 15:40:08 -0700247
248 // Less efficient variant of VisitClasses that copies the class_table_ into secondary storage
249 // so that it can visit individual classes without holding the doesn't hold the
250 // Locks::classlinker_classes_lock_. As the Locks::classlinker_classes_lock_ isn't held this code
251 // can race with insertion and deletion of classes while the visitor is being called.
Ian Rogers7dfb28c2013-08-22 08:18:36 -0700252 void VisitClassesWithoutClassesLock(ClassVisitor* visitor, void* arg)
Ian Rogers7dfb28c2013-08-22 08:18:36 -0700253 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Elliott Hughesa2155262011-11-16 16:26:58 -0800254
Mathieu Chartier52e4b432014-06-10 11:22:31 -0700255 void VisitClassRoots(RootCallback* callback, void* arg, VisitRootFlags flags)
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -0700256 LOCKS_EXCLUDED(Locks::classlinker_classes_lock_)
257 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mathieu Chartier893263b2014-03-04 11:07:42 -0800258 void VisitRoots(RootCallback* callback, void* arg, VisitRootFlags flags)
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -0700259 LOCKS_EXCLUDED(dex_lock_)
260 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom75cb3b42011-07-28 02:13:36 -0700261
Hiroshi Yamauchie9e3e692014-06-24 14:31:37 -0700262 mirror::DexCache* FindDexCache(const DexFile& dex_file)
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700263 LOCKS_EXCLUDED(dex_lock_)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700264 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Hiroshi Yamauchie9e3e692014-06-24 14:31:37 -0700265 bool IsDexFileRegistered(const DexFile& dex_file)
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700266 LOCKS_EXCLUDED(dex_lock_) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Hiroshi Yamauchie9e3e692014-06-24 14:31:37 -0700267 void FixupDexCaches(mirror::ArtMethod* resolution_method)
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700268 LOCKS_EXCLUDED(dex_lock_)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700269 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom1d9f52b2011-10-13 10:50:45 -0700270
jeffhao262bf462011-10-20 18:36:32 -0700271 // Generate an oat file from a dex file
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700272 bool GenerateOatFile(const char* dex_filename,
Brian Carlstromd601af82012-01-06 10:15:19 -0800273 int oat_fd,
Vladimir Marko60836d52014-01-16 15:53:38 +0000274 const char* oat_cache_filename,
Ian Rogers719d1a32014-03-06 12:13:39 -0800275 std::string* error_msg)
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700276 LOCKS_EXCLUDED(Locks::mutator_lock_);
jeffhao262bf462011-10-20 18:36:32 -0700277
Andreas Gampe833a4852014-05-21 18:46:59 -0700278 // Find or create the oat file holding dex_location. Then load all corresponding dex files
279 // (if multidex) into the given vector.
280 bool OpenDexFilesFromOat(const char* dex_location, const char* oat_location,
281 std::vector<std::string>* error_msgs,
282 std::vector<const DexFile*>* dex_files)
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700283 LOCKS_EXCLUDED(dex_lock_, Locks::mutator_lock_);
jeffhaof6174e82012-01-31 16:14:17 -0800284
Alex Light345c4b12014-07-18 14:57:04 -0700285 // Returns true if the given oat file has the same image checksum as the image it is paired with.
286 static bool VerifyOatImageChecksum(const OatFile* oat_file, const InstructionSet instruction_set);
287 // Returns true if the oat file checksums match with the image and the offsets are such that it
288 // could be loaded with it.
289 static bool VerifyOatChecksums(const OatFile* oat_file, const InstructionSet instruction_set,
290 std::string* error_msg);
Brian Carlstrom28db0122012-10-18 16:20:41 -0700291 // Returns true if oat file contains the dex file with the given location and checksum.
Alex Light345c4b12014-07-18 14:57:04 -0700292 static bool VerifyOatAndDexFileChecksums(const OatFile* oat_file,
293 const char* dex_location,
294 uint32_t dex_location_checksum,
295 InstructionSet instruction_set,
296 std::string* error_msg);
Brian Carlstromafe25512012-06-27 17:02:58 -0700297
Elliott Hughes418d20f2011-09-22 14:00:39 -0700298 // TODO: replace this with multiple methods that allocate the correct managed type.
Shih-wei Liao44175362011-08-28 16:59:17 -0700299 template <class T>
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800300 mirror::ObjectArray<T>* AllocObjectArray(Thread* self, size_t length)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700301 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Shih-wei Liao55df06b2011-08-26 14:39:27 -0700302
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800303 mirror::ObjectArray<mirror::Class>* AllocClassArray(Thread* self, size_t length)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700304 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
jeffhao98eacac2011-09-14 16:11:53 -0700305
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800306 mirror::ObjectArray<mirror::String>* AllocStringArray(Thread* self, size_t length)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700307 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800308
Brian Carlstromea46f952013-07-30 01:26:50 -0700309 mirror::ObjectArray<mirror::ArtMethod>* AllocArtMethodArray(Thread* self, size_t length)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800310 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
311
312 mirror::IfTable* AllocIfTable(Thread* self, size_t ifcount)
313 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
314
Brian Carlstromea46f952013-07-30 01:26:50 -0700315 mirror::ObjectArray<mirror::ArtField>* AllocArtFieldArray(Thread* self, size_t length)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800316 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
317
318 mirror::ObjectArray<mirror::StackTraceElement>* AllocStackTraceElementArray(Thread* self,
319 size_t length)
320 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
321
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700322 void VerifyClass(Handle<mirror::Class> klass) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800323 bool VerifyClassUsingOatFile(const DexFile& dex_file, mirror::Class* klass,
324 mirror::Class::Status& oat_file_class_status)
325 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mathieu Chartierc528dba2013-11-26 12:00:11 -0800326 void ResolveClassExceptionHandlerTypes(const DexFile& dex_file,
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700327 Handle<mirror::Class> klass)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800328 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstromea46f952013-07-30 01:26:50 -0700329 void ResolveMethodExceptionHandlerTypes(const DexFile& dex_file, mirror::ArtMethod* klass)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800330 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
331
Mathieu Chartier2b7c4d12014-05-19 10:52:16 -0700332 mirror::Class* CreateProxyClass(ScopedObjectAccessAlreadyRunnable& soa, jstring name,
333 jobjectArray interfaces, jobject loader, jobjectArray methods,
334 jobjectArray throws)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800335 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogersef7d42f2014-01-06 12:55:46 -0800336 std::string GetDescriptorForProxy(mirror::Class* proxy_class)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800337 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogersef7d42f2014-01-06 12:55:46 -0800338 mirror::ArtMethod* FindMethodForProxy(mirror::Class* proxy_class,
339 mirror::ArtMethod* proxy_method)
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700340 LOCKS_EXCLUDED(dex_lock_)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700341 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Jesse Wilson95caa792011-10-12 18:14:17 -0400342
Ian Rogers19846512012-02-24 11:42:47 -0800343 // Get the oat code for a method when its class isn't yet initialized
Ian Rogersef7d42f2014-01-06 12:55:46 -0800344 const void* GetQuickOatCodeFor(mirror::ArtMethod* method)
345 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers63bc11e2014-09-18 08:56:45 -0700346#if defined(ART_USE_PORTABLE_COMPILER)
Ian Rogersef7d42f2014-01-06 12:55:46 -0800347 const void* GetPortableOatCodeFor(mirror::ArtMethod* method, bool* have_portable_code)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700348 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers63bc11e2014-09-18 08:56:45 -0700349#endif
Ian Rogers19846512012-02-24 11:42:47 -0800350
Mathieu Chartiere35517a2012-10-30 18:49:55 -0700351 // Get the oat code for a method from a method index.
Ian Rogersef7d42f2014-01-06 12:55:46 -0800352 const void* GetQuickOatCodeFor(const DexFile& dex_file, uint16_t class_def_idx, uint32_t method_idx)
353 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers63bc11e2014-09-18 08:56:45 -0700354#if defined(ART_USE_PORTABLE_COMPILER)
Ian Rogersef7d42f2014-01-06 12:55:46 -0800355 const void* GetPortableOatCodeFor(const DexFile& dex_file, uint16_t class_def_idx, uint32_t method_idx)
Ian Rogers33e95662013-05-20 20:29:14 -0700356 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers63bc11e2014-09-18 08:56:45 -0700357#endif
Mathieu Chartiere35517a2012-10-30 18:49:55 -0700358
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700359 pid_t GetClassesLockOwner(); // For SignalCatcher.
360 pid_t GetDexLockOwner(); // For SignalCatcher.
Brian Carlstrom24a3c2e2011-10-17 18:07:52 -0700361
Jeff Hao0aba0ba2013-06-03 14:49:28 -0700362 const void* GetPortableResolutionTrampoline() const {
363 return portable_resolution_trampoline_;
364 }
365
Andreas Gampe2da88232014-02-27 12:26:20 -0800366 const void* GetQuickGenericJniTrampoline() const {
Dmitry Petrochenkof0972a42014-05-16 17:43:39 +0700367 return quick_generic_jni_trampoline_;
368 }
Andreas Gampe2da88232014-02-27 12:26:20 -0800369
Jeff Hao0aba0ba2013-06-03 14:49:28 -0700370 const void* GetQuickResolutionTrampoline() const {
371 return quick_resolution_trampoline_;
372 }
373
Jeff Hao88474b42013-10-23 16:24:40 -0700374 const void* GetPortableImtConflictTrampoline() const {
375 return portable_imt_conflict_trampoline_;
376 }
377
378 const void* GetQuickImtConflictTrampoline() const {
379 return quick_imt_conflict_trampoline_;
380 }
381
Vladimir Marko8a630572014-04-09 18:45:35 +0100382 const void* GetQuickToInterpreterBridgeTrampoline() const {
383 return quick_to_interpreter_bridge_trampoline_;
384 }
385
Jeff Hao88474b42013-10-23 16:24:40 -0700386 InternTable* GetInternTable() const {
387 return intern_table_;
388 }
389
Ian Rogers848871b2013-08-05 10:56:33 -0700390 // Attempts to insert a class into a class table. Returns NULL if
391 // the class was inserted, otherwise returns an existing class with
392 // the same descriptor and ClassLoader.
Ian Rogers7dfb28c2013-08-22 08:18:36 -0700393 mirror::Class* InsertClass(const char* descriptor, mirror::Class* klass, size_t hash)
Ian Rogers848871b2013-08-05 10:56:33 -0700394 LOCKS_EXCLUDED(Locks::classlinker_classes_lock_)
395 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
396
Mathieu Chartier590fee92013-09-13 13:46:47 -0700397 // Special code to allocate an art method, use this instead of class->AllocObject.
398 mirror::ArtMethod* AllocArtMethod(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Carl Shapiro61e019d2011-07-14 16:53:09 -0700399
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700400 mirror::ObjectArray<mirror::Class>* GetClassRoots() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -0700401 mirror::ObjectArray<mirror::Class>* class_roots = class_roots_.Read();
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700402 DCHECK(class_roots != NULL);
403 return class_roots;
404 }
405
Mathieu Chartier590fee92013-09-13 13:46:47 -0700406 private:
Nicolas Geoffray9c290012014-07-22 10:48:00 +0100407 bool FindOatMethodFor(mirror::ArtMethod* method, OatFile::OatMethod* oat_method)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700408 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
TDYa12785321912012-04-01 15:24:56 -0700409
Brian Carlstrom56d947f2013-07-15 13:14:23 -0700410 OatFile& GetImageOatFile(gc::space::ImageSpace* space)
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700411 LOCKS_EXCLUDED(dex_lock_)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700412 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstroma663ea52011-08-19 23:33:41 -0700413
Ian Rogers98379392014-02-24 16:53:16 -0800414 void FinishInit(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstroma663ea52011-08-19 23:33:41 -0700415
Brian Carlstrom75cb3b42011-07-28 02:13:36 -0700416 // For early bootstrapping by Init
Ian Rogers6fac4472014-02-25 17:01:10 -0800417 mirror::Class* AllocClass(Thread* self, mirror::Class* java_lang_Class, uint32_t class_size)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700418 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom75cb3b42011-07-28 02:13:36 -0700419
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800420 // Alloc* convenience functions to avoid needing to pass in mirror::Class*
Brian Carlstrom75cb3b42011-07-28 02:13:36 -0700421 // values that are known to the ClassLinker such as
422 // kObjectArrayClass and kJavaLangString etc.
Ian Rogers6fac4472014-02-25 17:01:10 -0800423 mirror::Class* AllocClass(Thread* self, uint32_t class_size)
Mathieu Chartierc528dba2013-11-26 12:00:11 -0800424 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800425 mirror::DexCache* AllocDexCache(Thread* self, const DexFile& dex_file)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700426 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstromea46f952013-07-30 01:26:50 -0700427 mirror::ArtField* AllocArtField(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogersbdb03912011-09-14 00:55:44 -0700428
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800429 mirror::Class* CreatePrimitiveClass(Thread* self, Primitive::Type type)
430 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
431 mirror::Class* InitializePrimitiveClass(mirror::Class* primitive_class, Primitive::Type type)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700432 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom5b8e4c82011-09-18 01:38:59 -0700433
Brian Carlstroma331b3c2011-07-18 17:47:56 -0700434
Ian Rogers98379392014-02-24 16:53:16 -0800435 mirror::Class* CreateArrayClass(Thread* self, const char* descriptor,
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700436 Handle<mirror::ClassLoader> class_loader)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700437 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstroma331b3c2011-07-18 17:47:56 -0700438
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700439 void AppendToBootClassPath(const DexFile& dex_file)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700440 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700441 void AppendToBootClassPath(const DexFile& dex_file, Handle<mirror::DexCache> dex_cache)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700442 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom578bbdc2011-07-21 14:07:47 -0700443
Elliott Hughes5fe594f2011-09-08 12:33:17 -0700444 void ConstructFieldMap(const DexFile& dex_file, const DexFile::ClassDef& dex_class_def,
Brian Carlstromea46f952013-07-30 01:26:50 -0700445 mirror::Class* c, SafeMap<uint32_t, mirror::ArtField*>& field_map)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700446 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Elliott Hughes5fe594f2011-09-08 12:33:17 -0700447
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700448 // Precomputes size needed for Class, in the case of a non-temporary class this size must be
449 // sufficient to hold all static fields.
450 uint32_t SizeOfClassWithoutEmbeddedTables(const DexFile& dex_file,
451 const DexFile::ClassDef& dex_class_def);
Brian Carlstrom4873d462011-08-21 15:23:39 -0700452
Brian Carlstromf615a612011-07-23 12:50:34 -0700453 void LoadClass(const DexFile& dex_file,
454 const DexFile::ClassDef& dex_class_def,
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700455 Handle<mirror::Class> klass,
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800456 mirror::ClassLoader* class_loader)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700457 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Vladimir Markod3c5beb2014-04-11 16:32:51 +0100458 void LoadClassMembers(const DexFile& dex_file,
459 const byte* class_data,
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700460 Handle<mirror::Class> klass,
Vladimir Markod3c5beb2014-04-11 16:32:51 +0100461 mirror::ClassLoader* class_loader,
462 const OatFile::OatClass* oat_class)
463 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom578bbdc2011-07-21 14:07:47 -0700464
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800465 void LoadField(const DexFile& dex_file, const ClassDataItemIterator& it,
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700466 Handle<mirror::Class> klass, Handle<mirror::ArtField> dst)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800467 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom578bbdc2011-07-21 14:07:47 -0700468
Brian Carlstromea46f952013-07-30 01:26:50 -0700469 mirror::ArtMethod* LoadMethod(Thread* self, const DexFile& dex_file,
470 const ClassDataItemIterator& dex_method,
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700471 Handle<mirror::Class> klass)
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800472 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom934486c2011-07-12 23:42:50 -0700473
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800474 void FixupStaticTrampolines(mirror::Class* klass) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers19846512012-02-24 11:42:47 -0800475
Nicolas Geoffray9c290012014-07-22 10:48:00 +0100476 // Finds the associated oat class for a dex_file and descriptor. Returns whether the class
477 // was found, and sets the data in oat_class.
478 bool FindOatClass(const DexFile& dex_file, uint16_t class_def_idx, OatFile::OatClass* oat_class)
Ian Rogers33e95662013-05-20 20:29:14 -0700479 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers19846512012-02-24 11:42:47 -0800480
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700481 void RegisterDexFileLocked(const DexFile& dex_file, Handle<mirror::DexCache> dex_cache)
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700482 EXCLUSIVE_LOCKS_REQUIRED(dex_lock_)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700483 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Hiroshi Yamauchie9e3e692014-06-24 14:31:37 -0700484 bool IsDexFileRegisteredLocked(const DexFile& dex_file)
Ian Rogersb0fa5dc2014-04-28 16:47:08 -0700485 SHARED_LOCKS_REQUIRED(dex_lock_, Locks::mutator_lock_);
Brian Carlstromaded5f72011-10-07 17:15:04 -0700486
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700487 bool InitializeClass(Handle<mirror::Class> klass, bool can_run_clinit,
Mathieu Chartierc528dba2013-11-26 12:00:11 -0800488 bool can_init_parents)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700489 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700490 bool WaitForInitializeClass(Handle<mirror::Class> klass, Thread* self,
Mathieu Chartierc528dba2013-11-26 12:00:11 -0800491 ObjectLock<mirror::Class>& lock);
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700492 bool ValidateSuperClassDescriptors(Handle<mirror::Class> klass)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700493 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Carl Shapiro0e5d75d2011-07-06 18:28:37 -0700494
Ian Rogers98379392014-02-24 16:53:16 -0800495 bool IsSameDescriptorInDifferentClassContexts(Thread* self, const char* descriptor,
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700496 Handle<mirror::ClassLoader> class_loader1,
497 Handle<mirror::ClassLoader> class_loader2)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700498 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Carl Shapiro0e5d75d2011-07-06 18:28:37 -0700499
Ian Rogers98379392014-02-24 16:53:16 -0800500 bool IsSameMethodSignatureInDifferentClassContexts(Thread* self, mirror::ArtMethod* method,
Ian Rogersef7d42f2014-01-06 12:55:46 -0800501 mirror::Class* klass1,
502 mirror::Class* klass2)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700503 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Carl Shapiro0e5d75d2011-07-06 18:28:37 -0700504
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700505 bool LinkClass(Thread* self, const char* descriptor, Handle<mirror::Class> klass,
506 Handle<mirror::ObjectArray<mirror::Class>> interfaces,
507 mirror::Class** new_class)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700508 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Carl Shapiro0e5d75d2011-07-06 18:28:37 -0700509
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700510 bool LinkSuperClass(Handle<mirror::Class> klass)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700511 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Carl Shapiro0e5d75d2011-07-06 18:28:37 -0700512
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700513 bool LoadSuperAndInterfaces(Handle<mirror::Class> klass, const DexFile& dex_file)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700514 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Carl Shapiro0e5d75d2011-07-06 18:28:37 -0700515
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700516 bool LinkMethods(Thread* self, Handle<mirror::Class> klass,
Mathieu Chartier1fb463e2014-10-23 16:48:06 -0700517 Handle<mirror::ObjectArray<mirror::Class>> interfaces,
518 StackHandleScope<mirror::Class::kImtSize>* out_imt)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700519 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Carl Shapiro0e5d75d2011-07-06 18:28:37 -0700520
Mathieu Chartierbfd9a432014-05-21 17:43:44 -0700521 bool LinkVirtualMethods(Thread* self, Handle<mirror::Class> klass)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700522 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Carl Shapiro0e5d75d2011-07-06 18:28:37 -0700523
Mathieu Chartier1fb463e2014-10-23 16:48:06 -0700524 bool LinkInterfaceMethods(Thread* const self, Handle<mirror::Class> klass,
525 Handle<mirror::ObjectArray<mirror::Class>> interfaces,
526 StackHandleScope<mirror::Class::kImtSize>* out_imt)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700527 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Carl Shapiro0e5d75d2011-07-06 18:28:37 -0700528
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700529 bool LinkStaticFields(Handle<mirror::Class> klass, size_t* class_size)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700530 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700531 bool LinkInstanceFields(Handle<mirror::Class> klass)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700532 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700533 bool LinkFields(Handle<mirror::Class> klass, bool is_static, size_t* class_size)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700534 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700535 void LinkCode(Handle<mirror::ArtMethod> method, const OatFile::OatClass* oat_class,
Dmitry Petrochenkof0972a42014-05-16 17:43:39 +0700536 const DexFile& dex_file, uint32_t dex_method_index, uint32_t method_index)
537 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers0cfe1fb2011-08-26 03:29:44 -0700538
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700539 void CreateReferenceInstanceOffsets(Handle<mirror::Class> klass)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700540 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700541 void CreateReferenceStaticOffsets(Handle<mirror::Class> klass)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700542 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700543 void CreateReferenceOffsets(Handle<mirror::Class> klass, bool is_static,
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700544 uint32_t reference_offsets)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700545 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Carl Shapiro0e5d75d2011-07-06 18:28:37 -0700546
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700547 // For use by ImageWriter to find DexCaches for its roots
Hiroshi Yamauchie9e3e692014-06-24 14:31:37 -0700548 ReaderWriterMutex* DexLock()
549 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) LOCK_RETURNED(dex_lock_) {
550 return &dex_lock_;
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700551 }
Hiroshi Yamauchie9e3e692014-06-24 14:31:37 -0700552 size_t GetDexCacheCount() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_, dex_lock_) {
553 return dex_caches_.size();
554 }
555 mirror::DexCache* GetDexCache(size_t idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_, dex_lock_);
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700556
Vladimir Markobe4e6432014-09-05 14:01:17 +0100557 const OatFile::OatDexFile* FindOpenedOatDexFileForDexFile(const DexFile& dex_file)
Ian Rogers33e95662013-05-20 20:29:14 -0700558 LOCKS_EXCLUDED(dex_lock_)
559 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Andreas Gampe833a4852014-05-21 18:46:59 -0700560
Vladimir Markobe4e6432014-09-05 14:01:17 +0100561 // Find an opened oat dex file that contains dex_location. If oat_location is not nullptr,
562 // the file must have that location, else any oat location is accepted.
563 const OatFile::OatDexFile* FindOpenedOatDexFile(const char* oat_location,
564 const char* dex_location,
565 const uint32_t* dex_location_checksum)
Ian Rogers719d1a32014-03-06 12:13:39 -0800566 LOCKS_EXCLUDED(dex_lock_);
Alex Lighta59dd802014-07-02 16:28:08 -0700567
568 // Will open the oat file directly without relocating, even if we could/should do relocation.
569 const OatFile* FindOatFileFromOatLocation(const std::string& oat_location,
570 std::string* error_msg)
571 LOCKS_EXCLUDED(dex_lock_);
572
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700573 const OatFile* FindOpenedOatFileFromOatLocation(const std::string& oat_location)
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700574 LOCKS_EXCLUDED(dex_lock_);
Andreas Gampe833a4852014-05-21 18:46:59 -0700575
Alex Lighta59dd802014-07-02 16:28:08 -0700576 const OatFile* OpenOatFileFromDexLocation(const std::string& dex_location,
577 InstructionSet isa,
578 bool* already_opened,
579 bool* obsolete_file_cleanup_failed,
580 std::vector<std::string>* error_msg)
581 LOCKS_EXCLUDED(dex_lock_, Locks::mutator_lock_);
582
Alex Light0a112bb2014-08-14 14:16:26 -0700583 const OatFile* GetInterpretedOnlyOat(const std::string& oat_path,
584 InstructionSet isa,
585 std::string* error_msg);
586
Alex Lighta59dd802014-07-02 16:28:08 -0700587 const OatFile* PatchAndRetrieveOat(const std::string& input, const std::string& output,
588 const std::string& image_location, InstructionSet isa,
589 std::string* error_msg)
590 LOCKS_EXCLUDED(Locks::mutator_lock_);
591
Andreas Gamped7392fa2014-10-23 11:37:40 -0700592 bool CheckOatFile(const Runtime* runtime, const OatFile* oat_file, InstructionSet isa,
Alex Lighta59dd802014-07-02 16:28:08 -0700593 bool* checksum_verified, std::string* error_msg);
Alex Lighta59dd802014-07-02 16:28:08 -0700594
Andreas Gampe833a4852014-05-21 18:46:59 -0700595 // Note: will not register the oat file.
596 const OatFile* FindOatFileInOatLocationForDexFile(const char* dex_location,
597 uint32_t dex_location_checksum,
598 const char* oat_location,
599 std::string* error_msg)
Ian Rogers8d31bbd2013-10-13 10:44:14 -0700600 LOCKS_EXCLUDED(dex_lock_);
Ian Rogerse3359f72013-06-11 15:14:11 -0700601
Andreas Gampe833a4852014-05-21 18:46:59 -0700602 // Creates the oat file from the dex_location to the oat_location. Needs a file descriptor for
603 // the file to be written, which is assumed to be under a lock.
604 const OatFile* CreateOatFileForDexLocation(const char* dex_location,
605 int fd, const char* oat_location,
606 std::vector<std::string>* error_msgs)
607 LOCKS_EXCLUDED(dex_lock_, Locks::mutator_lock_);
608
609 // Finds an OatFile that contains a DexFile for the given a DexFile location.
610 //
611 // Note 1: this will not check open oat files, which are assumed to be stale when this is run.
612 // Note 2: Does not register the oat file. It is the caller's job to register if the file is to
613 // be kept.
Vladimir Markobe4e6432014-09-05 14:01:17 +0100614 const OatFile* FindOatFileContainingDexFileFromDexLocation(const char* dex_location,
615 const uint32_t* dex_location_checksum,
Andreas Gampe833a4852014-05-21 18:46:59 -0700616 InstructionSet isa,
Calin Juravlec54aea72014-07-16 14:45:03 +0100617 std::vector<std::string>* error_msgs,
618 bool* obsolete_file_cleanup_failed)
Andreas Gampe833a4852014-05-21 18:46:59 -0700619 LOCKS_EXCLUDED(dex_lock_, Locks::mutator_lock_);
620
Calin Juravleca345932014-09-02 15:53:55 +0100621 // Verifies:
622 // - that the oat file contains the dex file (with a matching checksum, which may be null if the
623 // file was pre-opted)
624 // - the checksums of the oat file (against the image space)
625 // - the checksum of the dex file against dex_location_checksum
626 // - that the dex file can be opened
627 // Returns true iff all verification succeed.
628 //
629 // The dex_location is the dex location as stored in the oat file header.
630 // (see DexFile::GetDexCanonicalLocation for a description of location conventions)
Alex Lighta59dd802014-07-02 16:28:08 -0700631 bool VerifyOatWithDexFile(const OatFile* oat_file, const char* dex_location,
Calin Juravleca345932014-09-02 15:53:55 +0100632 const uint32_t* dex_location_checksum,
Alex Lighta59dd802014-07-02 16:28:08 -0700633 std::string* error_msg);
Brian Carlstromfad71432011-10-16 20:25:10 -0700634
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700635 mirror::ArtMethod* CreateProxyConstructor(Thread* self, Handle<mirror::Class> klass,
Brian Carlstromea46f952013-07-30 01:26:50 -0700636 mirror::Class* proxy_class)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700637 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Mathieu Chartier0cd81352014-05-22 16:48:55 -0700638 mirror::ArtMethod* CreateProxyMethod(Thread* self, Handle<mirror::Class> klass,
639 Handle<mirror::ArtMethod> prototype)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700640 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Jesse Wilson95caa792011-10-12 18:14:17 -0400641
Andreas Gampedf1532b2014-09-10 19:48:05 -0700642 // Ensures that methods have the kAccPreverified bit set. We use the kAccPreverfied bit on the
643 // class access flags to determine whether this has been done before.
644 void EnsurePreverifiedMethods(Handle<mirror::Class> c)
645 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
646
Ian Rogersca0c8d32014-08-29 15:40:08 -0700647 mirror::Class* LookupClassFromTableLocked(const char* descriptor,
648 const mirror::ClassLoader* class_loader,
649 size_t hash)
650 SHARED_LOCKS_REQUIRED(Locks::classlinker_classes_lock_, Locks::mutator_lock_);
651
652 mirror::Class* UpdateClass(const char* descriptor, mirror::Class* klass, size_t hash)
653 LOCKS_EXCLUDED(Locks::classlinker_classes_lock_)
654 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
655
656 void MoveImageClassesToClassTable() LOCKS_EXCLUDED(Locks::classlinker_classes_lock_)
657 LOCKS_EXCLUDED(Locks::classlinker_classes_lock_)
658 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
659 mirror::Class* LookupClassFromImage(const char* descriptor)
660 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
661
662 // EnsureResolved is called to make sure that a class in the class_table_ has been resolved
663 // before returning it to the caller. Its the responsibility of the thread that placed the class
664 // in the table to make it resolved. The thread doing resolution must notify on the class' lock
665 // when resolution has occurred. This happens in mirror::Class::SetStatus. As resolution may
666 // retire a class, the version of the class in the table is returned and this may differ from
667 // the class passed in.
668 mirror::Class* EnsureResolved(Thread* self, const char* descriptor, mirror::Class* klass)
669 WARN_UNUSED SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
670
671 void FixupTemporaryDeclaringClass(mirror::Class* temp_class, mirror::Class* new_class)
672 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
673
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700674 std::vector<const DexFile*> boot_class_path_;
Brian Carlstrom578bbdc2011-07-21 14:07:47 -0700675
Ian Rogers1bf8d4d2013-05-30 00:18:49 -0700676 mutable ReaderWriterMutex dex_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
Mathieu Chartier893263b2014-03-04 11:07:42 -0800677 std::vector<size_t> new_dex_cache_roots_ GUARDED_BY(dex_lock_);;
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -0700678 std::vector<GcRoot<mirror::DexCache>> dex_caches_ GUARDED_BY(dex_lock_);
Elliott Hughesf8349362012-06-18 15:00:06 -0700679 std::vector<const OatFile*> oat_files_ GUARDED_BY(dex_lock_);
Brian Carlstrom47d237a2011-10-18 15:08:33 -0700680
Carl Shapiro0e5d75d2011-07-06 18:28:37 -0700681
Brian Carlstromaded5f72011-10-07 17:15:04 -0700682 // multimap from a string hash code of a class descriptor to
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800683 // mirror::Class* instances. Results should be compared for a matching
Brian Carlstrom9cff8e12011-08-18 16:47:29 -0700684 // Class::descriptor_ and Class::class_loader_.
Mathieu Chartier5369c402014-08-25 13:08:22 -0700685 typedef AllocationTrackingMultiMap<size_t, GcRoot<mirror::Class>, kAllocatorTagClassTable> Table;
Hiroshi Yamauchia91a4bc2014-06-13 16:44:55 -0700686 // This contains strong roots. To enable concurrent root scanning of
687 // the class table, be careful to use a read barrier when accessing this.
Ian Rogers7dfb28c2013-08-22 08:18:36 -0700688 Table class_table_ GUARDED_BY(Locks::classlinker_classes_lock_);
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -0700689 std::vector<std::pair<size_t, GcRoot<mirror::Class>>> new_class_roots_;
Elliott Hughesf8349362012-06-18 15:00:06 -0700690
Ian Rogers7dfb28c2013-08-22 08:18:36 -0700691 // Do we need to search dex caches to find image classes?
692 bool dex_cache_image_class_lookup_required_;
693 // Number of times we've searched dex caches for a class. After a certain number of misses we move
694 // the classes into the class_table_ to avoid dex cache based searches.
Ian Rogerscc2f2392014-08-29 20:19:11 -0700695 Atomic<uint32_t> failed_dex_cache_class_lookups_;
Ian Rogers7dfb28c2013-08-22 08:18:36 -0700696
Brian Carlstroma663ea52011-08-19 23:33:41 -0700697 // indexes into class_roots_.
698 // needs to be kept in sync with class_roots_descriptors_.
Brian Carlstrom74eb46a2011-08-02 20:10:14 -0700699 enum ClassRoot {
Brian Carlstrom75cb3b42011-07-28 02:13:36 -0700700 kJavaLangClass,
701 kJavaLangObject,
Elliott Hughes418d20f2011-09-22 14:00:39 -0700702 kClassArrayClass,
Brian Carlstrom74eb46a2011-08-02 20:10:14 -0700703 kObjectArrayClass,
704 kJavaLangString,
Mathieu Chartier66f19252012-09-18 08:57:04 -0700705 kJavaLangDexCache,
Elliott Hughesbf61ba32011-10-11 10:53:09 -0700706 kJavaLangRefReference,
Brian Carlstromea46f952013-07-30 01:26:50 -0700707 kJavaLangReflectArtField,
708 kJavaLangReflectArtMethod,
Ian Rogers466bb252011-10-14 03:29:56 -0700709 kJavaLangReflectProxy,
Mathieu Chartier66f19252012-09-18 08:57:04 -0700710 kJavaLangStringArrayClass,
Brian Carlstromea46f952013-07-30 01:26:50 -0700711 kJavaLangReflectArtFieldArrayClass,
712 kJavaLangReflectArtMethodArrayClass,
Brian Carlstrom74eb46a2011-08-02 20:10:14 -0700713 kJavaLangClassLoader,
Ian Rogers5167c972012-02-03 10:41:20 -0800714 kJavaLangThrowable,
jeffhao8cd6dda2012-02-22 10:15:34 -0800715 kJavaLangClassNotFoundException,
Shih-wei Liao55df06b2011-08-26 14:39:27 -0700716 kJavaLangStackTraceElement,
Brian Carlstrom75cb3b42011-07-28 02:13:36 -0700717 kPrimitiveBoolean,
Brian Carlstrom75cb3b42011-07-28 02:13:36 -0700718 kPrimitiveByte,
Elliott Hughesd8ddfd52011-08-15 14:32:53 -0700719 kPrimitiveChar,
720 kPrimitiveDouble,
721 kPrimitiveFloat,
Brian Carlstrom75cb3b42011-07-28 02:13:36 -0700722 kPrimitiveInt,
723 kPrimitiveLong,
Elliott Hughesd8ddfd52011-08-15 14:32:53 -0700724 kPrimitiveShort,
Brian Carlstrom75cb3b42011-07-28 02:13:36 -0700725 kPrimitiveVoid,
Elliott Hughesd8ddfd52011-08-15 14:32:53 -0700726 kBooleanArrayClass,
727 kByteArrayClass,
728 kCharArrayClass,
729 kDoubleArrayClass,
730 kFloatArrayClass,
731 kIntArrayClass,
732 kLongArrayClass,
733 kShortArrayClass,
Shih-wei Liao55df06b2011-08-26 14:39:27 -0700734 kJavaLangStackTraceElementArrayClass,
Brian Carlstrom75cb3b42011-07-28 02:13:36 -0700735 kClassRootsMax,
736 };
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -0700737 GcRoot<mirror::ObjectArray<mirror::Class>> class_roots_;
Brian Carlstrom913af1b2011-07-23 21:41:13 -0700738
Mathieu Chartier1fb463e2014-10-23 16:48:06 -0700739 ALWAYS_INLINE mirror::Class* GetClassRoot(ClassRoot class_root)
740 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstrom74eb46a2011-08-02 20:10:14 -0700741
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800742 void SetClassRoot(ClassRoot class_root, mirror::Class* klass)
Ian Rogersb726dcb2012-09-05 08:57:23 -0700743 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Brian Carlstroma663ea52011-08-19 23:33:41 -0700744
Elliott Hughes418d20f2011-09-22 14:00:39 -0700745 static const char* class_roots_descriptors_[];
Brian Carlstroma663ea52011-08-19 23:33:41 -0700746
747 const char* GetClassRootDescriptor(ClassRoot class_root) {
748 const char* descriptor = class_roots_descriptors_[class_root];
749 CHECK(descriptor != NULL);
750 return descriptor;
751 }
752
Ian Rogers98379392014-02-24 16:53:16 -0800753 // The interface table used by all arrays.
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -0700754 GcRoot<mirror::IfTable> array_iftable_;
Carl Shapiro565f5072011-07-10 13:39:43 -0700755
Ian Rogers98379392014-02-24 16:53:16 -0800756 // A cache of the last FindArrayClass results. The cache serves to avoid creating array class
757 // descriptors for the sake of performing FindClass.
758 static constexpr size_t kFindArrayCacheSize = 16;
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -0700759 GcRoot<mirror::Class> find_array_class_cache_[kFindArrayCacheSize];
Ian Rogers98379392014-02-24 16:53:16 -0800760 size_t find_array_class_cache_next_victim_;
761
Brian Carlstrom75cb3b42011-07-28 02:13:36 -0700762 bool init_done_;
Mathieu Chartier893263b2014-03-04 11:07:42 -0800763 bool log_new_dex_caches_roots_ GUARDED_BY(dex_lock_);
764 bool log_new_class_table_roots_ GUARDED_BY(Locks::classlinker_classes_lock_);
Brian Carlstrom75cb3b42011-07-28 02:13:36 -0700765
Elliott Hughescf4c6c42011-09-01 15:16:42 -0700766 InternTable* intern_table_;
767
Mingyao Yang98d1cc82014-05-15 17:02:16 -0700768 // Trampolines within the image the bounce to runtime entrypoints. Done so that there is a single
769 // patch point within the image. TODO: make these proper relocations.
Jeff Hao0aba0ba2013-06-03 14:49:28 -0700770 const void* portable_resolution_trampoline_;
771 const void* quick_resolution_trampoline_;
Jeff Hao88474b42013-10-23 16:24:40 -0700772 const void* portable_imt_conflict_trampoline_;
773 const void* quick_imt_conflict_trampoline_;
Andreas Gampe2da88232014-02-27 12:26:20 -0800774 const void* quick_generic_jni_trampoline_;
Vladimir Marko8a630572014-04-09 18:45:35 +0100775 const void* quick_to_interpreter_bridge_trampoline_;
Jeff Hao0aba0ba2013-06-03 14:49:28 -0700776
Brian Carlstrom34f426c2011-10-04 12:58:02 -0700777 friend class ImageWriter; // for GetClassRoots
Alex Lighta59dd802014-07-02 16:28:08 -0700778 friend class ImageDumper; // for FindOpenedOatFileFromOatLocation
779 friend class ElfPatcher; // for FindOpenedOatFileForDexFile & FindOpenedOatFileFromOatLocation
Nicolas Geoffray9c290012014-07-22 10:48:00 +0100780 friend class NoDex2OatTest; // for FindOpenedOatFileForDexFile
Alex Light0a112bb2014-08-14 14:16:26 -0700781 friend class NoPatchoatTest; // for FindOpenedOatFileForDexFile
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800782 FRIEND_TEST(ClassLinkerTest, ClassRootDescriptors);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800783 FRIEND_TEST(mirror::DexCacheTest, Open);
Brian Carlstromae826982011-11-09 01:33:42 -0800784 FRIEND_TEST(ExceptionTest, FindExceptionHandler);
785 FRIEND_TEST(ObjectTest, AllocObjectArray);
Carl Shapiro0e5d75d2011-07-06 18:28:37 -0700786 DISALLOW_COPY_AND_ASSIGN(ClassLinker);
787};
788
789} // namespace art
790
Brian Carlstromfc0e3212013-07-17 14:40:12 -0700791#endif // ART_RUNTIME_CLASS_LINKER_H_