summaryrefslogtreecommitdiffstats
path: root/runtime/runtime.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r--runtime/runtime.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 23a7db6..b5d2e15 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -62,7 +62,7 @@
#include "gc/accounting/card_table-inl.h"
#include "gc/heap.h"
#include "gc/space/image_space.h"
-#include "gc/space/space.h"
+#include "gc/space/space-inl.h"
#include "handle_scope-inl.h"
#include "image.h"
#include "instrumentation.h"
@@ -1355,6 +1355,23 @@ void Runtime::VisitRoots(RootCallback* callback, void* arg, VisitRootFlags flags
VisitConcurrentRoots(callback, arg, flags);
}
+void Runtime::VisitImageRoots(RootCallback* callback, void* arg) {
+ for (auto* space : GetHeap()->GetContinuousSpaces()) {
+ if (space->IsImageSpace()) {
+ auto* image_space = space->AsImageSpace();
+ const auto& image_header = image_space->GetImageHeader();
+ for (size_t i = 0; i < ImageHeader::kImageRootsMax; ++i) {
+ auto* obj = image_header.GetImageRoot(static_cast<ImageHeader::ImageRoot>(i));
+ if (obj != nullptr) {
+ auto* after_obj = obj;
+ callback(&after_obj, arg, RootInfo(kRootStickyClass));
+ CHECK_EQ(after_obj, obj);
+ }
+ }
+ }
+ }
+}
+
mirror::ObjectArray<mirror::ArtMethod>* Runtime::CreateDefaultImt(ClassLinker* cl) {
Thread* self = Thread::Current();
StackHandleScope<1> hs(self);