diff options
author | 2015-09-21 23:29:32 +0000 | |
---|---|---|
committer | 2015-09-21 23:29:32 +0000 | |
commit | a28cae4d38020ea5c42c203414eaa667743ffd1e (patch) | |
tree | e76a781160bb2b70337c630b463761679ee00b57 /runtime/mirror/class_loader.h | |
parent | beb5d85bec2f2e001fa89a79c0dfccbc9290986c (diff) | |
parent | 356412e2b7ba3fde164bc08a44fee0ddc19c54e1 (diff) |
Merge "Add one LinearAlloc per ClassLoader"
Diffstat (limited to 'runtime/mirror/class_loader.h')
-rw-r--r-- | runtime/mirror/class_loader.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/runtime/mirror/class_loader.h b/runtime/mirror/class_loader.h index f27b6155ce..c2a65d62e2 100644 --- a/runtime/mirror/class_loader.h +++ b/runtime/mirror/class_loader.h @@ -35,18 +35,31 @@ class MANAGED ClassLoader : public Object { static constexpr uint32_t InstanceSize() { return sizeof(ClassLoader); } + ClassLoader* GetParent() SHARED_REQUIRES(Locks::mutator_lock_) { return GetFieldObject<ClassLoader>(OFFSET_OF_OBJECT_MEMBER(ClassLoader, parent_)); } + ClassTable* GetClassTable() SHARED_REQUIRES(Locks::mutator_lock_) { return reinterpret_cast<ClassTable*>( GetField64(OFFSET_OF_OBJECT_MEMBER(ClassLoader, class_table_))); } + void SetClassTable(ClassTable* class_table) SHARED_REQUIRES(Locks::mutator_lock_) { SetField64<false>(OFFSET_OF_OBJECT_MEMBER(ClassLoader, class_table_), reinterpret_cast<uint64_t>(class_table)); } + LinearAlloc* GetAllocator() SHARED_REQUIRES(Locks::mutator_lock_) { + return reinterpret_cast<LinearAlloc*>( + GetField64(OFFSET_OF_OBJECT_MEMBER(ClassLoader, allocator_))); + } + + void SetAllocator(LinearAlloc* allocator) SHARED_REQUIRES(Locks::mutator_lock_) { + SetField64<false>(OFFSET_OF_OBJECT_MEMBER(ClassLoader, allocator_), + reinterpret_cast<uint64_t>(allocator)); + } + private: // Visit instance fields of the class loader as well as its associated classes. // Null class loader is handled by ClassLinker::VisitClassRoots. @@ -61,6 +74,7 @@ class MANAGED ClassLoader : public Object { HeapReference<Object> proxyCache_; // Native pointer to class table, need to zero this out when image writing. uint32_t padding_ ATTRIBUTE_UNUSED; + uint64_t allocator_; uint64_t class_table_; friend struct art::ClassLoaderOffsets; // for verifying offset information |