From 5f4bd97519aad4f075346f8c5c0a84c6105951d8 Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Thu, 6 Jun 2013 22:27:40 -0700 Subject: Add logging of implicitly added image classes Change-Id: I52bc30b340032ba59e23f1ba0ef6f683c497db68 --- src/dex2oat.cc | 10 +++++----- src/image_writer.cc | 7 ++++++- src/image_writer.h | 5 +++-- 3 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/dex2oat.cc b/src/dex2oat.cc index 0567788d9e..6df381eebb 100644 --- a/src/dex2oat.cc +++ b/src/dex2oat.cc @@ -222,7 +222,7 @@ class Dex2Oat { // We walk the roots looking for classes so that we'll pick up the // above classes plus any classes them depend on such super // classes, interfaces, and the required ClassLinker roots. - UniquePtr > image_classes(new std::set()); + UniquePtr image_classes(new ImageWriter::DescriptorSet); class_linker->VisitClasses(RecordImageClassesVisitor, image_classes.get()); CHECK_NE(image_classes->size(), 0U); return image_classes.release(); @@ -236,7 +236,7 @@ class Dex2Oat { File* oat_file, const std::string& bitcode_filename, bool image, - const std::set* image_classes, + const ImageWriter::DescriptorSet* image_classes, bool dump_stats, bool dump_timings) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -313,7 +313,7 @@ class Dex2Oat { bool CreateImageFile(const std::string& image_filename, uintptr_t image_base, - std::set* image_classes, + ImageWriter::DescriptorSet* image_classes, const std::string& oat_filename, const std::string& oat_location, const CompilerDriver& compiler) @@ -431,7 +431,7 @@ class Dex2Oat { static bool RecordImageClassesVisitor(mirror::Class* klass, void* arg) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - std::set* image_classes = reinterpret_cast*>(arg); + ImageWriter::DescriptorSet* image_classes = reinterpret_cast(arg); if (klass->IsArrayClass() || klass->IsPrimitive()) { return true; } @@ -934,7 +934,7 @@ static int dex2oat(int argc, char** argv) { ScopedObjectAccess soa(Thread::Current()); // If --image-classes was specified, calculate the full list of classes to include in the image - UniquePtr > image_classes(NULL); + UniquePtr image_classes(NULL); if (image_classes_filename != NULL) { image_classes.reset(dex2oat->GetImageClassDescriptors(image_classes_filename)); if (image_classes.get() == NULL) { diff --git a/src/image_writer.cc b/src/image_writer.cc index fc9aabc21b..a989a4e0a3 100644 --- a/src/image_writer.cc +++ b/src/image_writer.cc @@ -283,7 +283,12 @@ void ImageWriter::FindClinitImageClassesCallback(Object* object, void* arg) { return; } while (!klass->IsObjectClass()) { - image_writer->image_classes_->insert(ClassHelper(klass).GetDescriptor()); + ClassHelper kh(klass); + const char* descriptor = kh.GetDescriptor(); + std::pair result = image_writer->image_classes_->insert(descriptor); + if (result.second) { + LOG(INFO) << "Adding " << descriptor << " to image classes"; + } klass = klass->GetSuperClass(); } } diff --git a/src/image_writer.h b/src/image_writer.h index 0cccf69a16..30a7f7f5da 100644 --- a/src/image_writer.h +++ b/src/image_writer.h @@ -37,7 +37,8 @@ namespace art { // Write a Space built during compilation for use during execution. class ImageWriter { public: - explicit ImageWriter(std::set* image_classes) + typedef std::set DescriptorSet; + explicit ImageWriter(DescriptorSet* image_classes) : oat_file_(NULL), image_end_(0), image_begin_(NULL), image_classes_(image_classes), oat_data_begin_(NULL) {} @@ -191,7 +192,7 @@ class ImageWriter { byte* image_begin_; // Set of classes to be include in the image, or NULL for all. - std::set* image_classes_; + DescriptorSet* image_classes_; // Beginning target oat address for the pointers from the output image to its oat file. const byte* oat_data_begin_; -- cgit v1.2.3-59-g8ed1b