Fix image writer bitmap size calculation.
Wasn't properly dividing by 8 inside of the image header creation.
This resulted in a bitmap size which was larger than it should be
inside of the image.
Change-Id: I344d1f3c1794a7cff3c9e22afc7fdabedf74413c
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index c22f8d6..d2d7c0a 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -520,11 +520,13 @@
// Return to write header at start of image with future location of image_roots. At this point,
// image_end_ is the size of the image (excluding bitmaps).
+ const size_t heap_bytes_per_bitmap_byte = 8 * gc::accounting::SpaceBitmap::kAlignment;
+ const size_t bitmap_bytes = RoundUp(image_end_, heap_bytes_per_bitmap_byte) /
+ heap_bytes_per_bitmap_byte;
ImageHeader image_header(reinterpret_cast<uint32_t>(image_begin_),
static_cast<uint32_t>(image_end_),
RoundUp(image_end_, kPageSize),
- RoundUp(image_end_ / gc::accounting::SpaceBitmap::kAlignment,
- sizeof(size_t)),
+ RoundUp(bitmap_bytes, kPageSize),
reinterpret_cast<uint32_t>(GetImageAddress(image_roots.get())),
oat_file_->GetOatHeader().GetChecksum(),
reinterpret_cast<uint32_t>(oat_file_begin),