Fix the computation of the size of the stack maps region.
In art::StackMapStream::ComputeStackMapSize, compute the
size of a CodeInfo's stack maps region using the stack
mask size, not the maximum element of the stack mask.
Also, rename this method as
art::StackMapStream::ComputeStackMapsSize to make it clear
it that it covers all the stack maps of the CodeInfo item,
not just one stack map.
Change-Id: Icad21946dbca6e1ade2b82c9c2c535fdfed110a9
diff --git a/runtime/stack_map.h b/runtime/stack_map.h
index e88820f..3856da3 100644
--- a/runtime/stack_map.h
+++ b/runtime/stack_map.h
@@ -606,10 +606,17 @@
region_.Store<uint32_t>(kNumberOfStackMapsOffset, number_of_stack_maps);
}
+ // Get the size of one stack map of this CodeInfo object, in bytes.
+ // All stack maps of a CodeInfo have the same size.
size_t StackMapSize() const {
return StackMap::ComputeAlignedStackMapSize(GetStackMaskSize());
}
+ // Get the size all the stack maps of this CodeInfo object, in bytes.
+ size_t StackMapsSize() const {
+ return StackMapSize() * GetNumberOfStackMaps();
+ }
+
uint32_t GetStackMapsOffset() const {
return kFixedSize;
}
@@ -663,7 +670,7 @@
MemoryRegion GetStackMaps() const {
return region_.size() == 0
? MemoryRegion()
- : region_.Subregion(kFixedSize, StackMapSize() * GetNumberOfStackMaps());
+ : region_.Subregion(kFixedSize, StackMapsSize());
}
// Compute the size of a Dex register map starting at offset `origin` in