Clean up some compact dex comments

Bug: 63756964
Test: test-art-host

Change-Id: If8748db7a9e68b6a82656fd9ec8fd8072e92af97
diff --git a/dexlayout/compact_dex_writer.cc b/dexlayout/compact_dex_writer.cc
index 092539f..08438c4 100644
--- a/dexlayout/compact_dex_writer.cc
+++ b/dexlayout/compact_dex_writer.cc
@@ -121,11 +121,14 @@
   const uint32_t deduped_offset = deduper_->Dedupe(start_offset_,
                                                    stream_->Tell(),
                                                    item_->GetOffset());
-  // In case we dedupe to something with wrong alignment, just say we didn't dedupe.
+  // If we deduped, only use the deduped offset if the alignment matches the required alignment.
+  // Otherwise, return without deduping.
   if (deduped_offset != Deduper::kDidNotDedupe && IsAlignedParam(deduped_offset, alignment_)) {
+    // Update the IR offset to the offset of the deduped item.
     item_->SetOffset(deduped_offset);
+    // Clear the written data for the item so that the stream write doesn't abort in the future.
     stream_->Clear(start_offset_, stream_->Tell() - start_offset_);
-    // Undo the offset for all that we wrote since we deduped.
+    // Since we deduped, restore the offset to the original position.
     stream_->Seek(start_offset_);
   }
 }
diff --git a/dexlayout/dex_ir_builder.h b/dexlayout/dex_ir_builder.h
index 43b5290..9f5377f 100644
--- a/dexlayout/dex_ir_builder.h
+++ b/dexlayout/dex_ir_builder.h
@@ -27,8 +27,8 @@
 
 namespace dex_ir {
 
-// Eagerly assign offsets assigns offsets based on the original offsets in the input dex file. If
-// this not done, dex_ir::Item::GetOffset will abort when reading uninitialized offsets.
+// Eagerly assign offsets based on the original offsets in the input dex file. If this is not done,
+// dex_ir::Item::GetOffset will abort when reading uninitialized offsets.
 dex_ir::Header* DexIrBuilder(const DexFile& dex_file,
                              bool eagerly_assign_offsets,
                              const Options& options);
diff --git a/dexlayout/dexlayout.h b/dexlayout/dexlayout.h
index e66710f..d2f9cb9 100644
--- a/dexlayout/dexlayout.h
+++ b/dexlayout/dexlayout.h
@@ -72,6 +72,8 @@
   const char* output_dex_directory_ = nullptr;
   const char* output_file_name_ = nullptr;
   const char* profile_file_name_ = nullptr;
+  // Filter that removes classes that don't have a matching descriptor (during IR creation).
+  // This speeds up cases when the output only requires a single class.
   std::set<std::string> class_filter_;
 };
 
diff --git a/dexlayout/dexlayout_test.cc b/dexlayout/dexlayout_test.cc
index e93ade1..be272fc 100644
--- a/dexlayout/dexlayout_test.cc
+++ b/dexlayout/dexlayout_test.cc
@@ -823,9 +823,9 @@
             &error_msg));
     ASSERT_TRUE(output_dex_file != nullptr);
 
-    ASSERT_EQ(output_dex_file->NumClassDefs(), 1u);
+    ASSERT_EQ(output_dex_file->NumClassDefs(), options.class_filter_.size());
     for (uint32_t i = 0; i < output_dex_file->NumClassDefs(); ++i) {
-      // Check that every class is in the filter.
+      // Check that every class in the output dex file is in the filter.
       const DexFile::ClassDef& class_def = output_dex_file->GetClassDef(i);
       ASSERT_TRUE(options.class_filter_.find(output_dex_file->GetClassDescriptor(class_def)) !=
           options.class_filter_.end());