Move the catalog after the stack maps.
Fetching a stack map should be cheap, and therefore we should
not compute the size of the catalog.
Change-Id: Iff6accb7832bdfa6d209a0928d6088b8b57c1aa4
diff --git a/compiler/optimizing/stack_map_stream.cc b/compiler/optimizing/stack_map_stream.cc
index b446815..5663e39 100644
--- a/compiler/optimizing/stack_map_stream.cc
+++ b/compiler/optimizing/stack_map_stream.cc
@@ -144,14 +144,17 @@
// Note: use RoundUp to word-size here if you want CodeInfo objects to be word aligned.
needed_size_ = CodeInfo::kFixedSize
- + dex_register_location_catalog_size_
+ stack_maps_size_
+ + dex_register_location_catalog_size_
+ dex_register_maps_size_
+ inline_info_size_;
- dex_register_location_catalog_start_ = CodeInfo::kFixedSize;
- stack_maps_start_ = dex_register_location_catalog_start_ + dex_register_location_catalog_size_;
- dex_register_maps_start_ = stack_maps_start_ + stack_maps_size_;
+ stack_maps_start_ = CodeInfo::kFixedSize;
+ // TODO: Move the catalog at the end. It is currently too expensive at runtime
+ // to compute its size (note that we do not encode that size in the CodeInfo).
+ dex_register_location_catalog_start_ = stack_maps_start_ + stack_maps_size_;
+ dex_register_maps_start_ =
+ dex_register_location_catalog_start_ + dex_register_location_catalog_size_;
inline_infos_start_ = dex_register_maps_start_ + dex_register_maps_size_;
return needed_size_;