diff options
Diffstat (limited to 'runtime/class_linker.h')
-rw-r--r-- | runtime/class_linker.h | 328 |
1 files changed, 110 insertions, 218 deletions
diff --git a/runtime/class_linker.h b/runtime/class_linker.h index 54f1f3dac8..c53ff616e5 100644 --- a/runtime/class_linker.h +++ b/runtime/class_linker.h @@ -25,7 +25,6 @@ #include "base/hash_set.h" #include "base/macros.h" #include "base/mutex.h" -#include "base/out_fwd.h" #include "class_table.h" #include "dex_file.h" #include "gc_root.h" @@ -109,19 +108,16 @@ class ClassLinker { // Initialize class linker by bootstraping from dex files. void InitWithoutImage(std::vector<std::unique_ptr<const DexFile>> boot_class_path) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); // Initialize class linker from one or more images. void InitFromImage() SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); // Finds a class by its descriptor, loading it if necessary. // If class_loader is null, searches boot_class_path_. - mirror::Class* FindClass(Thread* self, - const char* descriptor, + mirror::Class* FindClass(Thread* self, const char* descriptor, Handle<mirror::ClassLoader> class_loader) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); // Finds a class in the path class loader, loading it if necessary without using JNI. Hash // function is supposed to be ComputeModifiedUtf8Hash(descriptor). Returns true if the @@ -129,24 +125,19 @@ class ClassLinker { // was encountered while walking the parent chain (currently only BootClassLoader and // PathClassLoader are supported). bool FindClassInPathClassLoader(ScopedObjectAccessAlreadyRunnable& soa, - Thread* self, - const char* descriptor, - size_t hash, + Thread* self, const char* descriptor, size_t hash, Handle<mirror::ClassLoader> class_loader, - out<mirror::Class*> result) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); + mirror::Class** result) + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); // Finds a class by its descriptor using the "system" class loader, ie by searching the // boot_class_path_. mirror::Class* FindSystemClass(Thread* self, const char* descriptor) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); // Finds the array class given for the element class. - mirror::Class* FindArrayClass(Thread* self, /* in parameter */ mirror::Class** element_class) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); + mirror::Class* FindArrayClass(Thread* self, mirror::Class** element_class) + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); // Returns true if the class linker is initialized. bool IsInitialized() const { @@ -154,27 +145,20 @@ class ClassLinker { } // Define a new a class based on a ClassDef from a DexFile - mirror::Class* DefineClass(Thread* self, - const char* descriptor, - size_t hash, + mirror::Class* DefineClass(Thread* self, const char* descriptor, size_t hash, Handle<mirror::ClassLoader> class_loader, - const DexFile& dex_file, - const DexFile::ClassDef& dex_class_def) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); + const DexFile& dex_file, const DexFile::ClassDef& dex_class_def) + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); // Finds a class by its descriptor, returning null if it isn't wasn't loaded // by the given 'class_loader'. - mirror::Class* LookupClass(Thread* self, - const char* descriptor, - size_t hash, - mirror::ClassLoader* - class_loader) + mirror::Class* LookupClass(Thread* self, const char* descriptor, size_t hash, + mirror::ClassLoader* class_loader) REQUIRES(!Locks::classlinker_classes_lock_) SHARED_REQUIRES(Locks::mutator_lock_); // Finds all the classes with the given descriptor, regardless of ClassLoader. - void LookupClasses(const char* descriptor, out<std::vector<mirror::Class*>> classes) + void LookupClasses(const char* descriptor, std::vector<mirror::Class*>& classes) REQUIRES(!Locks::classlinker_classes_lock_) SHARED_REQUIRES(Locks::mutator_lock_); @@ -182,21 +166,17 @@ class ClassLinker { // General class unloading is not supported, this is used to prune // unwanted classes during image writing. - bool RemoveClass(const char* descriptor, - mirror::ClassLoader* class_loader) - REQUIRES(!Locks::classlinker_classes_lock_) - SHARED_REQUIRES(Locks::mutator_lock_); + bool RemoveClass(const char* descriptor, mirror::ClassLoader* class_loader) + REQUIRES(!Locks::classlinker_classes_lock_) SHARED_REQUIRES(Locks::mutator_lock_); void DumpAllClasses(int flags) - REQUIRES(!Locks::classlinker_classes_lock_) - SHARED_REQUIRES(Locks::mutator_lock_); + REQUIRES(!Locks::classlinker_classes_lock_) SHARED_REQUIRES(Locks::mutator_lock_); void DumpForSigQuit(std::ostream& os) REQUIRES(!Locks::classlinker_classes_lock_); size_t NumLoadedClasses() - REQUIRES(!Locks::classlinker_classes_lock_) - SHARED_REQUIRES(Locks::mutator_lock_); + REQUIRES(!Locks::classlinker_classes_lock_) SHARED_REQUIRES(Locks::mutator_lock_); // Resolve a String with the given index from the DexFile, storing the // result in the DexCache. The referrer is used to identify the @@ -206,95 +186,75 @@ class ClassLinker { // Resolve a String with the given index from the DexFile, storing the // result in the DexCache. - mirror::String* ResolveString(const DexFile& dex_file, - uint32_t string_idx, + mirror::String* ResolveString(const DexFile& dex_file, uint32_t string_idx, Handle<mirror::DexCache> dex_cache) SHARED_REQUIRES(Locks::mutator_lock_); // Resolve a Type with the given index from the DexFile, storing the // result in the DexCache. The referrer is used to identity the // target DexCache and ClassLoader to use for resolution. - mirror::Class* ResolveType(const DexFile& dex_file, - uint16_t type_idx, - mirror::Class* referrer) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_, !Roles::uninterruptible_); + mirror::Class* ResolveType(const DexFile& dex_file, uint16_t type_idx, mirror::Class* referrer) + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_, !Roles::uninterruptible_); // Resolve a Type with the given index from the DexFile, storing the // result in the DexCache. The referrer is used to identify the // target DexCache and ClassLoader to use for resolution. - mirror::Class* ResolveType(uint16_t type_idx, - ArtMethod* referrer) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_, !Roles::uninterruptible_); + mirror::Class* ResolveType(uint16_t type_idx, ArtMethod* referrer) + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_, !Roles::uninterruptible_); - mirror::Class* ResolveType(uint16_t type_idx, - ArtField* referrer) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_, !Roles::uninterruptible_); + mirror::Class* ResolveType(uint16_t type_idx, ArtField* referrer) + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_, !Roles::uninterruptible_); // Resolve a type with the given ID from the DexFile, storing the // result in DexCache. The ClassLoader is used to search for the // type, since it may be referenced from but not contained within // the given DexFile. - mirror::Class* ResolveType(const DexFile& dex_file, - uint16_t type_idx, + mirror::Class* ResolveType(const DexFile& dex_file, uint16_t type_idx, Handle<mirror::DexCache> dex_cache, Handle<mirror::ClassLoader> class_loader) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_, !Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_, !Roles::uninterruptible_); // Resolve a method with a given ID from the DexFile, storing the // result in DexCache. The ClassLinker and ClassLoader are used as // in ResolveType. What is unique is the method type argument which // is used to determine if this method is a direct, static, or // virtual method. - ArtMethod* ResolveMethod(const DexFile& dex_file, - uint32_t method_idx, + ArtMethod* ResolveMethod(const DexFile& dex_file, uint32_t method_idx, Handle<mirror::DexCache> dex_cache, - Handle<mirror::ClassLoader> class_loader, - ArtMethod* referrer, + Handle<mirror::ClassLoader> class_loader, ArtMethod* referrer, InvokeType type) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_, !Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_, !Roles::uninterruptible_); ArtMethod* GetResolvedMethod(uint32_t method_idx, ArtMethod* referrer) SHARED_REQUIRES(Locks::mutator_lock_); ArtMethod* ResolveMethod(Thread* self, uint32_t method_idx, ArtMethod* referrer, InvokeType type) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_, !Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_, !Roles::uninterruptible_); ArtField* GetResolvedField(uint32_t field_idx, mirror::Class* field_declaring_class) SHARED_REQUIRES(Locks::mutator_lock_); ArtField* GetResolvedField(uint32_t field_idx, mirror::DexCache* dex_cache) SHARED_REQUIRES(Locks::mutator_lock_); ArtField* ResolveField(uint32_t field_idx, ArtMethod* referrer, bool is_static) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_, !Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_, !Roles::uninterruptible_); // Resolve a field with a given ID from the DexFile, storing the // result in DexCache. The ClassLinker and ClassLoader are used as // in ResolveType. What is unique is the is_static argument which is // used to determine if we are resolving a static or non-static // field. - ArtField* ResolveField(const DexFile& dex_file, - uint32_t field_idx, + ArtField* ResolveField(const DexFile& dex_file, uint32_t field_idx, Handle<mirror::DexCache> dex_cache, - Handle<mirror::ClassLoader> class_loader, - bool is_static) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_, !Roles::uninterruptible_); + Handle<mirror::ClassLoader> class_loader, bool is_static) + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_, !Roles::uninterruptible_); // Resolve a field with a given ID from the DexFile, storing the // result in DexCache. The ClassLinker and ClassLoader are used as // in ResolveType. No is_static argument is provided so that Java // field resolution semantics are followed. - ArtField* ResolveFieldJLS(const DexFile& dex_file, - uint32_t field_idx, + ArtField* ResolveFieldJLS(const DexFile& dex_file, uint32_t field_idx, Handle<mirror::DexCache> dex_cache, Handle<mirror::ClassLoader> class_loader) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_, !Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_, !Roles::uninterruptible_); // Get shorty from method index without resolution. Used to do handlerization. const char* MethodShorty(uint32_t method_idx, ArtMethod* referrer, uint32_t* length) @@ -303,12 +263,9 @@ class ClassLinker { // Returns true on success, false if there's an exception pending. // can_run_clinit=false allows the compiler to attempt to init a class, // given the restriction that no <clinit> execution is possible. - bool EnsureInitialized(Thread* self, - Handle<mirror::Class> c, - bool can_init_fields, + bool EnsureInitialized(Thread* self, Handle<mirror::Class> c, bool can_init_fields, bool can_init_parents) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_, !Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_, !Roles::uninterruptible_); // Initializes classes that have instances in the image but that have // <clinit> methods so they could not be initialized by the compiler. @@ -332,33 +289,26 @@ class ClassLinker { REQUIRES(!dex_lock_); void VisitClasses(ClassVisitor* visitor) - REQUIRES(!Locks::classlinker_classes_lock_) - SHARED_REQUIRES(Locks::mutator_lock_); + REQUIRES(!Locks::classlinker_classes_lock_) SHARED_REQUIRES(Locks::mutator_lock_); // Less efficient variant of VisitClasses that copies the class_table_ into secondary storage // so that it can visit individual classes without holding the doesn't hold the // Locks::classlinker_classes_lock_. As the Locks::classlinker_classes_lock_ isn't held this code // can race with insertion and deletion of classes while the visitor is being called. void VisitClassesWithoutClassesLock(ClassVisitor* visitor) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); void VisitClassRoots(RootVisitor* visitor, VisitRootFlags flags) - REQUIRES(!Locks::classlinker_classes_lock_) - SHARED_REQUIRES(Locks::mutator_lock_); + REQUIRES(!Locks::classlinker_classes_lock_) SHARED_REQUIRES(Locks::mutator_lock_); void VisitRoots(RootVisitor* visitor, VisitRootFlags flags) - REQUIRES(!dex_lock_) - SHARED_REQUIRES(Locks::mutator_lock_); + REQUIRES(!dex_lock_) SHARED_REQUIRES(Locks::mutator_lock_); mirror::DexCache* FindDexCache(const DexFile& dex_file) - REQUIRES(!dex_lock_) - SHARED_REQUIRES(Locks::mutator_lock_); + REQUIRES(!dex_lock_) SHARED_REQUIRES(Locks::mutator_lock_); bool IsDexFileRegistered(const DexFile& dex_file) - REQUIRES(!dex_lock_) - SHARED_REQUIRES(Locks::mutator_lock_); + REQUIRES(!dex_lock_) SHARED_REQUIRES(Locks::mutator_lock_); void FixupDexCaches(ArtMethod* resolution_method) - REQUIRES(!dex_lock_) - SHARED_REQUIRES(Locks::mutator_lock_); + REQUIRES(!dex_lock_) SHARED_REQUIRES(Locks::mutator_lock_); // Finds or creates the oat file holding dex_location. Then loads and returns // all corresponding dex files (there may be more than one dex file loaded @@ -374,75 +324,58 @@ class ClassLinker { // This method should not be called with the mutator_lock_ held, because it // could end up starving GC if we need to generate or relocate any oat // files. - std::vector<std::unique_ptr<const DexFile>> OpenDexFilesFromOat(const char* dex_location, - const char* oat_location, - out<std::vector<std::string>> - error_msgs) + std::vector<std::unique_ptr<const DexFile>> OpenDexFilesFromOat( + const char* dex_location, const char* oat_location, + std::vector<std::string>* error_msgs) REQUIRES(!dex_lock_, !Locks::mutator_lock_); // Allocate an instance of a java.lang.Object. - mirror::Object* AllocObject(Thread* self) - SHARED_REQUIRES(Locks::mutator_lock_) + mirror::Object* AllocObject(Thread* self) SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_); // TODO: replace this with multiple methods that allocate the correct managed type. template <class T> mirror::ObjectArray<T>* AllocObjectArray(Thread* self, size_t length) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_); mirror::ObjectArray<mirror::Class>* AllocClassArray(Thread* self, size_t length) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_); mirror::ObjectArray<mirror::String>* AllocStringArray(Thread* self, size_t length) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_); ArtField* AllocArtFieldArray(Thread* self, size_t length); ArtMethod* AllocArtMethodArray(Thread* self, size_t length); mirror::PointerArray* AllocPointerArray(Thread* self, size_t length) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_); mirror::IfTable* AllocIfTable(Thread* self, size_t ifcount) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_); - mirror::ObjectArray<mirror::StackTraceElement>* AllocStackTraceElementArray(Thread* self, - size_t length) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!Roles::uninterruptible_); + mirror::ObjectArray<mirror::StackTraceElement>* AllocStackTraceElementArray( + Thread* self, size_t length) SHARED_REQUIRES(Locks::mutator_lock_) + REQUIRES(!Roles::uninterruptible_); void VerifyClass(Thread* self, Handle<mirror::Class> klass) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); - bool VerifyClassUsingOatFile(const DexFile& dex_file, - mirror::Class* klass, + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); + bool VerifyClassUsingOatFile(const DexFile& dex_file, mirror::Class* klass, mirror::Class::Status& oat_file_class_status) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); void ResolveClassExceptionHandlerTypes(const DexFile& dex_file, Handle<mirror::Class> klass) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); void ResolveMethodExceptionHandlerTypes(const DexFile& dex_file, ArtMethod* klass) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); - mirror::Class* CreateProxyClass(ScopedObjectAccessAlreadyRunnable& soa, - jstring name, - jobjectArray interfaces, - jobject loader, - jobjectArray methods, + mirror::Class* CreateProxyClass(ScopedObjectAccessAlreadyRunnable& soa, jstring name, + jobjectArray interfaces, jobject loader, jobjectArray methods, jobjectArray throws) SHARED_REQUIRES(Locks::mutator_lock_); std::string GetDescriptorForProxy(mirror::Class* proxy_class) SHARED_REQUIRES(Locks::mutator_lock_); - ArtMethod* FindMethodForProxy(mirror::Class* proxy_class, - ArtMethod* proxy_method) + ArtMethod* FindMethodForProxy(mirror::Class* proxy_class, ArtMethod* proxy_method) REQUIRES(!dex_lock_) SHARED_REQUIRES(Locks::mutator_lock_); @@ -451,8 +384,7 @@ class ClassLinker { SHARED_REQUIRES(Locks::mutator_lock_); // Get the oat code for a method from a method index. - const void* GetQuickOatCodeFor(const DexFile& dex_file, - uint16_t class_def_idx, + const void* GetQuickOatCodeFor(const DexFile& dex_file, uint16_t class_def_idx, uint32_t method_idx) SHARED_REQUIRES(Locks::mutator_lock_); @@ -462,7 +394,7 @@ class ClassLinker { const void* GetOatMethodQuickCodeFor(ArtMethod* method) SHARED_REQUIRES(Locks::mutator_lock_); - const OatFile::OatMethod FindOatMethodFor(ArtMethod* method, out<bool> found) + const OatFile::OatMethod FindOatMethodFor(ArtMethod* method, bool* found) SHARED_REQUIRES(Locks::mutator_lock_); pid_t GetClassesLockOwner(); // For SignalCatcher. @@ -519,14 +451,12 @@ class ClassLinker { // Returns true if the method can be called with its direct code pointer, false otherwise. bool MayBeCalledWithDirectCodePointer(ArtMethod* m) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); // Creates a GlobalRef PathClassLoader that can be used to load classes from the given dex files. // Note: the objects are not completely set up. Do not use this outside of tests and the compiler. - jobject CreatePathClassLoader(Thread* self, const std::vector<const DexFile*>& dex_files) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); + jobject CreatePathClassLoader(Thread* self, std::vector<const DexFile*>& dex_files) + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); size_t GetImagePointerSize() const { DCHECK(ValidPointerSize(image_pointer_size_)) << image_pointer_size_; @@ -573,39 +503,29 @@ class ClassLinker { // For early bootstrapping by Init mirror::Class* AllocClass(Thread* self, mirror::Class* java_lang_Class, uint32_t class_size) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_); // Alloc* convenience functions to avoid needing to pass in mirror::Class* // values that are known to the ClassLinker such as // kObjectArrayClass and kJavaLangString etc. mirror::Class* AllocClass(Thread* self, uint32_t class_size) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_); mirror::DexCache* AllocDexCache(Thread* self, const DexFile& dex_file) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_); mirror::Class* CreatePrimitiveClass(Thread* self, Primitive::Type type) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_); mirror::Class* InitializePrimitiveClass(mirror::Class* primitive_class, Primitive::Type type) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_); - mirror::Class* CreateArrayClass(Thread* self, - const char* descriptor, - size_t hash, + mirror::Class* CreateArrayClass(Thread* self, const char* descriptor, size_t hash, Handle<mirror::ClassLoader> class_loader) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_, !Roles::uninterruptible_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_, !Roles::uninterruptible_); void AppendToBootClassPath(Thread* self, const DexFile& dex_file) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); void AppendToBootClassPath(const DexFile& dex_file, Handle<mirror::DexCache> dex_cache) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); // Precomputes size needed for Class, in the case of a non-temporary class this size must be // sufficient to hold all static fields. @@ -614,41 +534,30 @@ class ClassLinker { // Setup the classloader, class def index, type idx so that we can insert this class in the class // table. - void SetupClass(const DexFile& dex_file, - const DexFile::ClassDef& dex_class_def, - Handle<mirror::Class> klass, - mirror::ClassLoader* class_loader) + void SetupClass(const DexFile& dex_file, const DexFile::ClassDef& dex_class_def, + Handle<mirror::Class> klass, mirror::ClassLoader* class_loader) SHARED_REQUIRES(Locks::mutator_lock_); - void LoadClass(Thread* self, - const DexFile& dex_file, - const DexFile::ClassDef& dex_class_def, + void LoadClass(Thread* self, const DexFile& dex_file, const DexFile::ClassDef& dex_class_def, Handle<mirror::Class> klass) SHARED_REQUIRES(Locks::mutator_lock_); - void LoadClassMembers(Thread* self, - const DexFile& dex_file, - const uint8_t* class_data, - Handle<mirror::Class> klass, - const OatFile::OatClass* oat_class) + void LoadClassMembers(Thread* self, const DexFile& dex_file, const uint8_t* class_data, + Handle<mirror::Class> klass, const OatFile::OatClass* oat_class) SHARED_REQUIRES(Locks::mutator_lock_); - void LoadField(const ClassDataItemIterator& it, - Handle<mirror::Class> klass, + void LoadField(const ClassDataItemIterator& it, Handle<mirror::Class> klass, ArtField* dst) SHARED_REQUIRES(Locks::mutator_lock_); - void LoadMethod(Thread* self, - const DexFile& dex_file, - const ClassDataItemIterator& it, - Handle<mirror::Class> klass, - ArtMethod* dst) + void LoadMethod(Thread* self, const DexFile& dex_file, const ClassDataItemIterator& it, + Handle<mirror::Class> klass, ArtMethod* dst) SHARED_REQUIRES(Locks::mutator_lock_); void FixupStaticTrampolines(mirror::Class* klass) SHARED_REQUIRES(Locks::mutator_lock_); // Finds the associated oat class for a dex_file and descriptor. Returns an invalid OatClass on // error and sets found to false. - OatFile::OatClass FindOatClass(const DexFile& dex_file, uint16_t class_def_idx, out<bool> found) + OatFile::OatClass FindOatClass(const DexFile& dex_file, uint16_t class_def_idx, bool* found) SHARED_REQUIRES(Locks::mutator_lock_); void RegisterDexFileLocked(const DexFile& dex_file, Handle<mirror::DexCache> dex_cache) @@ -656,70 +565,55 @@ class ClassLinker { bool IsDexFileRegisteredLocked(const DexFile& dex_file) SHARED_REQUIRES(dex_lock_, Locks::mutator_lock_); - bool InitializeClass(Thread* self, - Handle<mirror::Class> klass, - bool can_run_clinit, + bool InitializeClass(Thread* self, Handle<mirror::Class> klass, bool can_run_clinit, bool can_init_parents) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); - bool WaitForInitializeClass(Handle<mirror::Class> klass, - Thread* self, - ObjectLock<mirror::Class>* lock); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); + bool WaitForInitializeClass(Handle<mirror::Class> klass, Thread* self, + ObjectLock<mirror::Class>& lock); bool ValidateSuperClassDescriptors(Handle<mirror::Class> klass) SHARED_REQUIRES(Locks::mutator_lock_); - bool IsSameDescriptorInDifferentClassContexts(Thread* self, - const char* descriptor, + bool IsSameDescriptorInDifferentClassContexts(Thread* self, const char* descriptor, Handle<mirror::ClassLoader> class_loader1, Handle<mirror::ClassLoader> class_loader2) SHARED_REQUIRES(Locks::mutator_lock_); - bool IsSameMethodSignatureInDifferentClassContexts(Thread* self, - ArtMethod* method, - mirror::Class* klass1, - mirror::Class* klass2) + bool IsSameMethodSignatureInDifferentClassContexts(Thread* self, ArtMethod* method, + mirror::Class* klass1, mirror::Class* klass2) SHARED_REQUIRES(Locks::mutator_lock_); - bool LinkClass(Thread* self, - const char* descriptor, - Handle<mirror::Class> klass, + bool LinkClass(Thread* self, const char* descriptor, Handle<mirror::Class> klass, Handle<mirror::ObjectArray<mirror::Class>> interfaces, - out<MutableHandle<mirror::Class>> h_new_class_out) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!Locks::classlinker_classes_lock_); + MutableHandle<mirror::Class>* h_new_class_out) + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!Locks::classlinker_classes_lock_); bool LinkSuperClass(Handle<mirror::Class> klass) SHARED_REQUIRES(Locks::mutator_lock_); bool LoadSuperAndInterfaces(Handle<mirror::Class> klass, const DexFile& dex_file) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!dex_lock_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); bool LinkMethods(Thread* self, Handle<mirror::Class> klass, Handle<mirror::ObjectArray<mirror::Class>> interfaces, - out<ArtMethod* [mirror::Class::kImtSize]> out_imt) + ArtMethod** out_imt) SHARED_REQUIRES(Locks::mutator_lock_); bool LinkVirtualMethods(Thread* self, Handle<mirror::Class> klass) SHARED_REQUIRES(Locks::mutator_lock_); - bool LinkInterfaceMethods(Thread* self, - Handle<mirror::Class> klass, + bool LinkInterfaceMethods(Thread* self, Handle<mirror::Class> klass, Handle<mirror::ObjectArray<mirror::Class>> interfaces, - out<ArtMethod* [mirror::Class::kImtSize]> out_imt) + ArtMethod** out_imt) SHARED_REQUIRES(Locks::mutator_lock_); - bool LinkStaticFields(Thread* self, - Handle<mirror::Class> klass, - out<size_t> class_size) + bool LinkStaticFields(Thread* self, Handle<mirror::Class> klass, size_t* class_size) SHARED_REQUIRES(Locks::mutator_lock_); bool LinkInstanceFields(Thread* self, Handle<mirror::Class> klass) SHARED_REQUIRES(Locks::mutator_lock_); - bool LinkFields(Thread* self, Handle<mirror::Class> klass, bool is_static, out<size_t> class_size) + bool LinkFields(Thread* self, Handle<mirror::Class> klass, bool is_static, size_t* class_size) SHARED_REQUIRES(Locks::mutator_lock_); - void LinkCode(ArtMethod* method, - const OatFile::OatClass* oat_class, + void LinkCode(ArtMethod* method, const OatFile::OatClass* oat_class, uint32_t class_def_method_index) SHARED_REQUIRES(Locks::mutator_lock_); void CreateReferenceInstanceOffsets(Handle<mirror::Class> klass) @@ -792,7 +686,7 @@ class ClassLinker { REQUIRES(!dex_lock_); // Check for duplicate class definitions of the given oat file against all open oat files. - bool HasCollisions(const OatFile* oat_file, out<std::string> error_msg) REQUIRES(!dex_lock_); + bool HasCollisions(const OatFile* oat_file, std::string* error_msg) REQUIRES(!dex_lock_); bool HasInitWithString(Thread* self, const char* descriptor) SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_); @@ -800,11 +694,9 @@ class ClassLinker { bool CanWeInitializeClass(mirror::Class* klass, bool can_init_statics, bool can_init_parents) SHARED_REQUIRES(Locks::mutator_lock_); - void UpdateClassVirtualMethods(mirror::Class* klass, - ArtMethod* new_methods, + void UpdateClassVirtualMethods(mirror::Class* klass, ArtMethod* new_methods, size_t new_num_methods) - SHARED_REQUIRES(Locks::mutator_lock_) - REQUIRES(!Locks::classlinker_classes_lock_); + SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!Locks::classlinker_classes_lock_); std::vector<const DexFile*> boot_class_path_; std::vector<std::unique_ptr<const DexFile>> opened_dex_files_; |