From 1aa8ec2ccdd7bedb6d30d91c89f1e94ab23c4439 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Mon, 1 Feb 2016 10:34:47 -0800 Subject: Fix up dex cache strings stored in classes Previously we left the image pointer instead of fixing up the pointer to the one in the BSS. This only showed up because JIT does the same as boot image, bypassing null check. Fixed a bug where oat files without embedded dex cache arrays would get their dex cache arrays corrupted. Added a non virtual class visitor for performance. Bug: 26846419 Bug: 22858531 Change-Id: I8cd0d61e440f753b4628ddb8c932eb23a0a81027 --- runtime/class_table-inl.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'runtime/class_table-inl.h') diff --git a/runtime/class_table-inl.h b/runtime/class_table-inl.h index aef02b6d5d..e512906507 100644 --- a/runtime/class_table-inl.h +++ b/runtime/class_table-inl.h @@ -28,6 +28,9 @@ void ClassTable::VisitRoots(Visitor& visitor) { visitor.VisitRoot(root.AddressWithoutBarrier()); } } + for (GcRoot& root : dex_files_) { + visitor.VisitRoot(root.AddressWithoutBarrier()); + } } template @@ -42,6 +45,19 @@ void ClassTable::VisitRoots(const Visitor& visitor) { } } +template +bool ClassTable::Visit(Visitor& visitor) { + for (ClassSet& class_set : classes_) { + for (GcRoot& root : class_set) { + if (!visitor(root.Read())) { + return false; + } + } + } + return true; +} + + } // namespace art #endif // ART_RUNTIME_CLASS_TABLE_INL_H_ -- cgit v1.2.3-59-g8ed1b