From 6530baf76ef7a62f2d76a6735ad461d7d59cf0e4 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Tue, 26 May 2015 15:22:58 +0100 Subject: 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 --- compiler/optimizing/stack_map_stream.cc | 11 +++++++---- runtime/stack_map.h | 12 ++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/compiler/optimizing/stack_map_stream.cc b/compiler/optimizing/stack_map_stream.cc index b446815770..5663e3973d 100644 --- a/compiler/optimizing/stack_map_stream.cc +++ b/compiler/optimizing/stack_map_stream.cc @@ -144,14 +144,17 @@ size_t StackMapStream::PrepareForFillIn() { // 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_; diff --git a/runtime/stack_map.h b/runtime/stack_map.h index f710460d0f..b425a465b4 100644 --- a/runtime/stack_map.h +++ b/runtime/stack_map.h @@ -923,10 +923,6 @@ class CodeInfo { + (NumberOfBytesForDexRegisterMap() * sizeof(uint8_t)); } - uint32_t GetDexRegisterLocationCatalogOffset() const { - return kFixedSize; - } - DexRegisterLocationCatalog GetDexRegisterLocationCatalog() const { return DexRegisterLocationCatalog(region_.Subregion( GetDexRegisterLocationCatalogOffset(), @@ -991,14 +987,18 @@ class CodeInfo { return StackMapSize() * GetNumberOfStackMaps(); } - size_t GetDexRegisterMapsOffset() const { + uint32_t GetDexRegisterLocationCatalogOffset() const { return GetStackMapsOffset() + GetStackMapsSize(); } - uint32_t GetStackMapsOffset() const { + size_t GetDexRegisterMapsOffset() const { return GetDexRegisterLocationCatalogOffset() + GetDexRegisterLocationCatalogSize(); } + uint32_t GetStackMapsOffset() const { + return kFixedSize; + } + DexRegisterMap GetDexRegisterMapOf(StackMap stack_map, uint32_t number_of_dex_registers) const { DCHECK(stack_map.HasDexRegisterMap(*this)); uint32_t offset = GetDexRegisterMapsOffset() + stack_map.GetDexRegisterMapOffset(*this); -- cgit v1.2.3-59-g8ed1b