summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Brian Carlstrom <bdc@google.com> 2013-06-07 15:53:42 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2013-06-07 15:53:42 -0700
commit6cda291b40cd02a079ec2c4e42da555f28c9246a (patch)
tree67d7111c0a76731b33e58d0561a485c5b06ae7aa
parent78ffecc0ad1f47b1551ee575811c610b62e08d98 (diff)
parent5f4bd97519aad4f075346f8c5c0a84c6105951d8 (diff)
am 5f4bd975: Add logging of implicitly added image classes
* commit '5f4bd97519aad4f075346f8c5c0a84c6105951d8': Add logging of implicitly added image classes
-rw-r--r--src/dex2oat.cc10
-rw-r--r--src/image_writer.cc7
-rw-r--r--src/image_writer.h5
3 files changed, 14 insertions, 8 deletions
diff --git a/src/dex2oat.cc b/src/dex2oat.cc
index 2f3edc443b..33c1ad445f 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<std::set<std::string> > image_classes(new std::set<std::string>());
+ UniquePtr<ImageWriter::DescriptorSet> 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<std::string>* image_classes,
+ const ImageWriter::DescriptorSet* image_classes,
bool dump_stats,
bool dump_timings)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
@@ -320,7 +320,7 @@ class Dex2Oat {
bool CreateImageFile(const std::string& image_filename,
uintptr_t image_base,
- std::set<std::string>* image_classes,
+ ImageWriter::DescriptorSet* image_classes,
const std::string& oat_filename,
const std::string& oat_location,
const CompilerDriver& compiler)
@@ -438,7 +438,7 @@ class Dex2Oat {
static bool RecordImageClassesVisitor(mirror::Class* klass, void* arg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- std::set<std::string>* image_classes = reinterpret_cast<std::set<std::string>*>(arg);
+ ImageWriter::DescriptorSet* image_classes = reinterpret_cast<ImageWriter::DescriptorSet*>(arg);
if (klass->IsArrayClass() || klass->IsPrimitive()) {
return true;
}
@@ -941,7 +941,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<std::set<std::string> > image_classes(NULL);
+ UniquePtr<ImageWriter::DescriptorSet> 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 4eea1cab29..4ba99fe3d0 100644
--- a/src/image_writer.cc
+++ b/src/image_writer.cc
@@ -287,7 +287,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<DescriptorSet::iterator, bool> 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 1de31491dd..4628e5a05f 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<std::string>* image_classes)
+ typedef std::set<std::string> DescriptorSet;
+ explicit ImageWriter(DescriptorSet* image_classes)
: oat_file_(NULL), image_end_(0), image_begin_(NULL), image_classes_(image_classes),
oat_data_begin_(NULL), interpreter_to_interpreter_entry_offset_(0),
interpreter_to_quick_entry_offset_(0), portable_resolution_trampoline_offset_(0),
@@ -193,7 +194,7 @@ class ImageWriter {
byte* image_begin_;
// Set of classes to be include in the image, or NULL for all.
- std::set<std::string>* 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_;