summaryrefslogtreecommitdiffstats
path: root/runtime/gc_root.h
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-11-03 11:41:47 -0800
committerMathieu Chartier <mathieuc@google.com>2014-11-06 16:27:00 -0800
commitc2e20629c7dfdb0f679fa30c14b41fe68588697f (patch)
treeee428a17f93922e6f78e3482c348e6e7b81a8e4f /runtime/gc_root.h
parentf55996d6b4a672e09fbe3a3563646a7682719b4a (diff)
downloadart-c2e20629c7dfdb0f679fa30c14b41fe68588697f.tar.gz
art-c2e20629c7dfdb0f679fa30c14b41fe68588697f.tar.bz2
art-c2e20629c7dfdb0f679fa30c14b41fe68588697f.zip
Add hash set
More memory efficient than libcxx since we do not box the values. Change intern table to use new hash set. Clean up intern table by removing const casts and deleting unnecessary code. Changed the class linker to use a hash set, also added a pre-zygote class table. 5 samples of: adb shell stop && adb shell start && sleep 60 && adb shell dumpsys meminfo Before: 165929 kB: Native 175859 kB: Native 168434 kB: Native 166559 kB: Native 169958 kB: Native After: 160972 kB: Native 159439 kB: Native 157204 kB: Native 165093 kB: Native 163039 kB: Native TODO: Add HashTable which is implemented by using a HashSet. TODO: Use for DexFile::find_class_def_misses_. TODO: Investigate using mem maps instead of native heap. Bug: 17808975 Change-Id: I93e376cf6eb9628cf52f4aefdadb6157acfb799a (cherry picked from commit e05d1d5fd86867afc7513b1c546375dba11eee50)
Diffstat (limited to 'runtime/gc_root.h')
-rw-r--r--runtime/gc_root.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/gc_root.h b/runtime/gc_root.h
index a347622112..aee5586f3d 100644
--- a/runtime/gc_root.h
+++ b/runtime/gc_root.h
@@ -27,9 +27,9 @@ template<class MirrorType>
class PACKED(4) GcRoot {
public:
template<ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
- ALWAYS_INLINE MirrorType* Read() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ ALWAYS_INLINE MirrorType* Read() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void VisitRoot(RootCallback* callback, void* arg, uint32_t thread_id, RootType root_type) {
+ void VisitRoot(RootCallback* callback, void* arg, uint32_t thread_id, RootType root_type) const {
DCHECK(!IsNull());
callback(reinterpret_cast<mirror::Object**>(&root_), arg, thread_id, root_type);
DCHECK(!IsNull());
@@ -53,7 +53,7 @@ class PACKED(4) GcRoot {
}
private:
- MirrorType* root_;
+ mutable MirrorType* root_;
};
} // namespace art