diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/common_compiler_test.cc | 10 | ||||
| -rw-r--r-- | compiler/compiled_method-inl.h | 4 | ||||
| -rw-r--r-- | compiler/compiled_method.cc | 5 | ||||
| -rw-r--r-- | compiler/compiled_method.h | 6 | ||||
| -rw-r--r-- | compiler/dex/dex_to_dex_compiler.cc | 1 | ||||
| -rw-r--r-- | compiler/driver/compiled_method_storage.cc | 11 | ||||
| -rw-r--r-- | compiler/driver/compiled_method_storage.h | 5 | ||||
| -rw-r--r-- | compiler/driver/compiled_method_storage_test.cc | 28 | ||||
| -rw-r--r-- | compiler/exception_test.cc | 2 | ||||
| -rw-r--r-- | compiler/optimizing/code_generator.cc | 7 | ||||
| -rw-r--r-- | compiler/optimizing/code_generator.h | 3 | ||||
| -rw-r--r-- | compiler/optimizing/optimizing_compiler.cc | 32 | ||||
| -rw-r--r-- | compiler/optimizing/stack_map_stream.cc | 26 | ||||
| -rw-r--r-- | compiler/optimizing/stack_map_stream.h | 13 |
14 files changed, 25 insertions, 128 deletions
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc index 4824763288..87197becf9 100644 --- a/compiler/common_compiler_test.cc +++ b/compiler/common_compiler_test.cc @@ -65,23 +65,17 @@ void CommonCompilerTest::MakeExecutable(ArtMethod* method) { ArrayRef<const uint8_t> vmap_table = compiled_method->GetVmapTable(); const uint32_t vmap_table_offset = vmap_table.empty() ? 0u : sizeof(OatQuickMethodHeader) + vmap_table.size(); - // The method info is directly before the vmap table. - ArrayRef<const uint8_t> method_info = compiled_method->GetMethodInfo(); - const uint32_t method_info_offset = method_info.empty() ? 0u - : vmap_table_offset + method_info.size(); - - OatQuickMethodHeader method_header(vmap_table_offset, method_info_offset, code_size); + OatQuickMethodHeader method_header(vmap_table_offset, code_size); header_code_and_maps_chunks_.push_back(std::vector<uint8_t>()); std::vector<uint8_t>* chunk = &header_code_and_maps_chunks_.back(); const size_t max_padding = GetInstructionSetAlignment(compiled_method->GetInstructionSet()); - const size_t size = method_info.size() + vmap_table.size() + sizeof(method_header) + code_size; + const size_t size = vmap_table.size() + sizeof(method_header) + code_size; chunk->reserve(size + max_padding); chunk->resize(sizeof(method_header)); static_assert(std::is_trivially_copyable<OatQuickMethodHeader>::value, "Cannot use memcpy"); memcpy(&(*chunk)[0], &method_header, sizeof(method_header)); chunk->insert(chunk->begin(), vmap_table.begin(), vmap_table.end()); - chunk->insert(chunk->begin(), method_info.begin(), method_info.end()); chunk->insert(chunk->end(), code.begin(), code.end()); CHECK_EQ(chunk->size(), size); const void* unaligned_code_ptr = chunk->data() + (size - code_size); diff --git a/compiler/compiled_method-inl.h b/compiler/compiled_method-inl.h index c43274782e..e60b30fed2 100644 --- a/compiler/compiled_method-inl.h +++ b/compiler/compiled_method-inl.h @@ -38,10 +38,6 @@ inline ArrayRef<const T> CompiledCode::GetArray(const LengthPrefixedArray<T>* ar return ArrayRef<const T>(&array->At(0), array->size()); } -inline ArrayRef<const uint8_t> CompiledMethod::GetMethodInfo() const { - return GetArray(method_info_); -} - inline ArrayRef<const uint8_t> CompiledMethod::GetVmapTable() const { return GetArray(vmap_table_); } diff --git a/compiler/compiled_method.cc b/compiler/compiled_method.cc index 5b93316b87..29f004cf87 100644 --- a/compiler/compiled_method.cc +++ b/compiler/compiled_method.cc @@ -102,12 +102,10 @@ const void* CompiledCode::CodePointer(const void* code_pointer, InstructionSet i CompiledMethod::CompiledMethod(CompilerDriver* driver, InstructionSet instruction_set, const ArrayRef<const uint8_t>& quick_code, - const ArrayRef<const uint8_t>& method_info, const ArrayRef<const uint8_t>& vmap_table, const ArrayRef<const uint8_t>& cfi_info, const ArrayRef<const linker::LinkerPatch>& patches) : CompiledCode(driver, instruction_set, quick_code), - method_info_(driver->GetCompiledMethodStorage()->DeduplicateMethodInfo(method_info)), vmap_table_(driver->GetCompiledMethodStorage()->DeduplicateVMapTable(vmap_table)), cfi_info_(driver->GetCompiledMethodStorage()->DeduplicateCFIInfo(cfi_info)), patches_(driver->GetCompiledMethodStorage()->DeduplicateLinkerPatches(patches)) { @@ -117,7 +115,6 @@ CompiledMethod* CompiledMethod::SwapAllocCompiledMethod( CompilerDriver* driver, InstructionSet instruction_set, const ArrayRef<const uint8_t>& quick_code, - const ArrayRef<const uint8_t>& method_info, const ArrayRef<const uint8_t>& vmap_table, const ArrayRef<const uint8_t>& cfi_info, const ArrayRef<const linker::LinkerPatch>& patches) { @@ -127,7 +124,6 @@ CompiledMethod* CompiledMethod::SwapAllocCompiledMethod( driver, instruction_set, quick_code, - method_info, vmap_table, cfi_info, patches); return ret; @@ -144,7 +140,6 @@ CompiledMethod::~CompiledMethod() { storage->ReleaseLinkerPatches(patches_); storage->ReleaseCFIInfo(cfi_info_); storage->ReleaseVMapTable(vmap_table_); - storage->ReleaseMethodInfo(method_info_); } } // namespace art diff --git a/compiler/compiled_method.h b/compiler/compiled_method.h index aa6fd3e655..f88028034d 100644 --- a/compiler/compiled_method.h +++ b/compiler/compiled_method.h @@ -112,7 +112,6 @@ class CompiledMethod FINAL : public CompiledCode { CompiledMethod(CompilerDriver* driver, InstructionSet instruction_set, const ArrayRef<const uint8_t>& quick_code, - const ArrayRef<const uint8_t>& method_info, const ArrayRef<const uint8_t>& vmap_table, const ArrayRef<const uint8_t>& cfi_info, const ArrayRef<const linker::LinkerPatch>& patches); @@ -123,7 +122,6 @@ class CompiledMethod FINAL : public CompiledCode { CompilerDriver* driver, InstructionSet instruction_set, const ArrayRef<const uint8_t>& quick_code, - const ArrayRef<const uint8_t>& method_info, const ArrayRef<const uint8_t>& vmap_table, const ArrayRef<const uint8_t>& cfi_info, const ArrayRef<const linker::LinkerPatch>& patches); @@ -142,8 +140,6 @@ class CompiledMethod FINAL : public CompiledCode { SetPackedField<IsIntrinsicField>(/* value */ true); } - ArrayRef<const uint8_t> GetMethodInfo() const; - ArrayRef<const uint8_t> GetVmapTable() const; ArrayRef<const uint8_t> GetCFIInfo() const; @@ -159,8 +155,6 @@ class CompiledMethod FINAL : public CompiledCode { using IsIntrinsicField = BitField<bool, kIsIntrinsicLsb, kIsIntrinsicSize>; - // For quick code, method specific information that is not very dedupe friendly (method indices). - const LengthPrefixedArray<uint8_t>* const method_info_; // For quick code, holds code infos which contain stack maps, inline information, and etc. const LengthPrefixedArray<uint8_t>* const vmap_table_; // For quick code, a FDE entry for the debug_frame section. diff --git a/compiler/dex/dex_to_dex_compiler.cc b/compiler/dex/dex_to_dex_compiler.cc index 0800ab3d41..ad9a30f8d4 100644 --- a/compiler/dex/dex_to_dex_compiler.cc +++ b/compiler/dex/dex_to_dex_compiler.cc @@ -619,7 +619,6 @@ CompiledMethod* DexToDexCompiler::CompileMethod( driver_, instruction_set, ArrayRef<const uint8_t>(), // no code - ArrayRef<const uint8_t>(), // method_info ArrayRef<const uint8_t>(quicken_data), // vmap_table ArrayRef<const uint8_t>(), // cfi data ArrayRef<const linker::LinkerPatch>()); diff --git a/compiler/driver/compiled_method_storage.cc b/compiler/driver/compiled_method_storage.cc index d56b135aca..31062fb390 100644 --- a/compiler/driver/compiled_method_storage.cc +++ b/compiler/driver/compiled_method_storage.cc @@ -148,8 +148,6 @@ CompiledMethodStorage::CompiledMethodStorage(int swap_fd) : swap_space_(swap_fd == -1 ? nullptr : new SwapSpace(swap_fd, 10 * MB)), dedupe_enabled_(true), dedupe_code_("dedupe code", LengthPrefixedArrayAlloc<uint8_t>(swap_space_.get())), - dedupe_method_info_("dedupe method info", - LengthPrefixedArrayAlloc<uint8_t>(swap_space_.get())), dedupe_vmap_table_("dedupe vmap table", LengthPrefixedArrayAlloc<uint8_t>(swap_space_.get())), dedupe_cfi_info_("dedupe cfi info", LengthPrefixedArrayAlloc<uint8_t>(swap_space_.get())), @@ -185,15 +183,6 @@ void CompiledMethodStorage::ReleaseCode(const LengthPrefixedArray<uint8_t>* code ReleaseArrayIfNotDeduplicated(code); } -const LengthPrefixedArray<uint8_t>* CompiledMethodStorage::DeduplicateMethodInfo( - const ArrayRef<const uint8_t>& src_map) { - return AllocateOrDeduplicateArray(src_map, &dedupe_method_info_); -} - -void CompiledMethodStorage::ReleaseMethodInfo(const LengthPrefixedArray<uint8_t>* method_info) { - ReleaseArrayIfNotDeduplicated(method_info); -} - const LengthPrefixedArray<uint8_t>* CompiledMethodStorage::DeduplicateVMapTable( const ArrayRef<const uint8_t>& table) { return AllocateOrDeduplicateArray(table, &dedupe_vmap_table_); diff --git a/compiler/driver/compiled_method_storage.h b/compiler/driver/compiled_method_storage.h index 1634facb7c..a5a7691e12 100644 --- a/compiler/driver/compiled_method_storage.h +++ b/compiler/driver/compiled_method_storage.h @@ -54,10 +54,6 @@ class CompiledMethodStorage { const LengthPrefixedArray<uint8_t>* DeduplicateCode(const ArrayRef<const uint8_t>& code); void ReleaseCode(const LengthPrefixedArray<uint8_t>* code); - const LengthPrefixedArray<uint8_t>* DeduplicateMethodInfo( - const ArrayRef<const uint8_t>& method_info); - void ReleaseMethodInfo(const LengthPrefixedArray<uint8_t>* method_info); - const LengthPrefixedArray<uint8_t>* DeduplicateVMapTable(const ArrayRef<const uint8_t>& table); void ReleaseVMapTable(const LengthPrefixedArray<uint8_t>* table); @@ -120,7 +116,6 @@ class CompiledMethodStorage { bool dedupe_enabled_; ArrayDedupeSet<uint8_t> dedupe_code_; - ArrayDedupeSet<uint8_t> dedupe_method_info_; ArrayDedupeSet<uint8_t> dedupe_vmap_table_; ArrayDedupeSet<uint8_t> dedupe_cfi_info_; ArrayDedupeSet<linker::LinkerPatch> dedupe_linker_patches_; diff --git a/compiler/driver/compiled_method_storage_test.cc b/compiler/driver/compiled_method_storage_test.cc index 14d1e191ca..5e2f444a24 100644 --- a/compiler/driver/compiled_method_storage_test.cc +++ b/compiler/driver/compiled_method_storage_test.cc @@ -45,12 +45,6 @@ TEST(CompiledMethodStorage, Deduplicate) { ArrayRef<const uint8_t>(raw_code1), ArrayRef<const uint8_t>(raw_code2), }; - const uint8_t raw_method_info_map1[] = { 1u, 2u, 3u, 4u, 5u, 6u }; - const uint8_t raw_method_info_map2[] = { 8u, 7u, 6u, 5u, 4u, 3u, 2u, 1u }; - ArrayRef<const uint8_t> method_info[] = { - ArrayRef<const uint8_t>(raw_method_info_map1), - ArrayRef<const uint8_t>(raw_method_info_map2), - }; const uint8_t raw_vmap_table1[] = { 2, 4, 6 }; const uint8_t raw_vmap_table2[] = { 7, 5, 3, 1 }; ArrayRef<const uint8_t> vmap_table[] = { @@ -77,38 +71,32 @@ TEST(CompiledMethodStorage, Deduplicate) { }; std::vector<CompiledMethod*> compiled_methods; - compiled_methods.reserve(1u << 7); + compiled_methods.reserve(1u << 4); for (auto&& c : code) { - for (auto&& s : method_info) { - for (auto&& v : vmap_table) { - for (auto&& f : cfi_info) { - for (auto&& p : patches) { - compiled_methods.push_back(CompiledMethod::SwapAllocCompiledMethod( - &driver, InstructionSet::kNone, c, s, v, f, p)); - } + for (auto&& v : vmap_table) { + for (auto&& f : cfi_info) { + for (auto&& p : patches) { + compiled_methods.push_back(CompiledMethod::SwapAllocCompiledMethod( + &driver, InstructionSet::kNone, c, v, f, p)); } } } } - constexpr size_t code_bit = 1u << 4; - constexpr size_t src_map_bit = 1u << 3; + constexpr size_t code_bit = 1u << 3; constexpr size_t vmap_table_bit = 1u << 2; constexpr size_t cfi_info_bit = 1u << 1; constexpr size_t patches_bit = 1u << 0; - CHECK_EQ(compiled_methods.size(), 1u << 5); + CHECK_EQ(compiled_methods.size(), 1u << 4); for (size_t i = 0; i != compiled_methods.size(); ++i) { for (size_t j = 0; j != compiled_methods.size(); ++j) { CompiledMethod* lhs = compiled_methods[i]; CompiledMethod* rhs = compiled_methods[j]; bool same_code = ((i ^ j) & code_bit) == 0u; - bool same_src_map = ((i ^ j) & src_map_bit) == 0u; bool same_vmap_table = ((i ^ j) & vmap_table_bit) == 0u; bool same_cfi_info = ((i ^ j) & cfi_info_bit) == 0u; bool same_patches = ((i ^ j) & patches_bit) == 0u; ASSERT_EQ(same_code, lhs->GetQuickCode().data() == rhs->GetQuickCode().data()) << i << " " << j; - ASSERT_EQ(same_src_map, lhs->GetMethodInfo().data() == rhs->GetMethodInfo().data()) - << i << " " << j; ASSERT_EQ(same_vmap_table, lhs->GetVmapTable().data() == rhs->GetVmapTable().data()) << i << " " << j; ASSERT_EQ(same_cfi_info, lhs->GetCFIInfo().data() == rhs->GetCFIInfo().data()) diff --git a/compiler/exception_test.cc b/compiler/exception_test.cc index 6d952035c9..b0e03374a0 100644 --- a/compiler/exception_test.cc +++ b/compiler/exception_test.cc @@ -92,7 +92,7 @@ class ExceptionTest : public CommonRuntimeTest { MemoryRegion stack_maps_region(&fake_header_code_and_maps_[0], stack_maps_size); stack_maps.FillInCodeInfo(stack_maps_region); - OatQuickMethodHeader method_header(code_ptr - stack_maps_region.begin(), 0u, code_size); + OatQuickMethodHeader method_header(code_ptr - stack_maps_region.begin(), code_size); static_assert(std::is_trivially_copyable<OatQuickMethodHeader>::value, "Cannot use memcpy"); memcpy(code_ptr - header_size, &method_header, header_size); memcpy(code_ptr, fake_code_.data(), fake_code_.size()); diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index 0ebf4bec0a..b0a05da0b1 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -963,13 +963,10 @@ CodeGenerator::CodeGenerator(HGraph* graph, CodeGenerator::~CodeGenerator() {} -void CodeGenerator::ComputeStackMapAndMethodInfoSize(size_t* stack_map_size, - size_t* method_info_size) { +void CodeGenerator::ComputeStackMapSize(size_t* stack_map_size) { DCHECK(stack_map_size != nullptr); - DCHECK(method_info_size != nullptr); StackMapStream* stack_map_stream = GetStackMapStream(); *stack_map_size = stack_map_stream->PrepareForFillIn(); - *method_info_size = stack_map_stream->ComputeMethodInfoSize(); } size_t CodeGenerator::GetNumberOfJitRoots() const { @@ -1039,11 +1036,9 @@ static void CheckLoopEntriesCanBeUsedForOsr(const HGraph& graph, } void CodeGenerator::BuildStackMaps(MemoryRegion stack_map_region, - MemoryRegion method_info_region, const DexFile::CodeItem* code_item_for_osr_check) { StackMapStream* stack_map_stream = GetStackMapStream(); stack_map_stream->FillInCodeInfo(stack_map_region); - stack_map_stream->FillInMethodInfo(method_info_region); if (kIsDebugBuild && code_item_for_osr_check != nullptr) { CheckLoopEntriesCanBeUsedForOsr(*graph_, CodeInfo(stack_map_region), *code_item_for_osr_check); } diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index 59f858ea52..3d58d29648 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -351,9 +351,8 @@ class CodeGenerator : public DeletableArenaObject<kArenaAllocCodeGenerator> { void AddSlowPath(SlowPathCode* slow_path); void BuildStackMaps(MemoryRegion stack_map_region, - MemoryRegion method_info_region, const DexFile::CodeItem* code_item_for_osr_check); - void ComputeStackMapAndMethodInfoSize(size_t* stack_map_size, size_t* method_info_size); + void ComputeStackMapSize(size_t* stack_map_size); size_t GetNumberOfJitRoots() const; // Fills the `literals` array with literals collected during code generation. diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 939802626c..d96746fdd7 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -715,18 +715,16 @@ CompiledMethod* OptimizingCompiler::Emit(ArenaAllocator* allocator, ArenaVector<uint8_t> method_info(allocator->Adapter(kArenaAllocStackMaps)); size_t stack_map_size = 0; size_t method_info_size = 0; - codegen->ComputeStackMapAndMethodInfoSize(&stack_map_size, &method_info_size); + codegen->ComputeStackMapSize(&stack_map_size); stack_map.resize(stack_map_size); method_info.resize(method_info_size); codegen->BuildStackMaps(MemoryRegion(stack_map.data(), stack_map.size()), - MemoryRegion(method_info.data(), method_info.size()), code_item_for_osr_check); CompiledMethod* compiled_method = CompiledMethod::SwapAllocCompiledMethod( GetCompilerDriver(), codegen->GetInstructionSet(), code_allocator->GetMemory(), - ArrayRef<const uint8_t>(method_info), ArrayRef<const uint8_t>(stack_map), ArrayRef<const uint8_t>(*codegen->GetAssembler()->cfi().data()), ArrayRef<const linker::LinkerPatch>(linker_patches)); @@ -1101,8 +1099,7 @@ CompiledMethod* OptimizingCompiler::Compile(const DexFile::CodeItem* code_item, static void CreateJniStackMap(ArenaStack* arena_stack, const JniCompiledMethod& jni_compiled_method, - /* out */ ArenaVector<uint8_t>* stack_map, - /* out */ ArenaVector<uint8_t>* method_info) { + /* out */ ArenaVector<uint8_t>* stack_map) { ScopedArenaAllocator allocator(arena_stack); StackMapStream stack_map_stream(&allocator, jni_compiled_method.GetInstructionSet()); stack_map_stream.BeginMethod( @@ -1112,9 +1109,7 @@ static void CreateJniStackMap(ArenaStack* arena_stack, /* num_dex_registers */ 0); stack_map_stream.EndMethod(); stack_map->resize(stack_map_stream.PrepareForFillIn()); - method_info->resize(stack_map_stream.ComputeMethodInfoSize()); stack_map_stream.FillInCodeInfo(MemoryRegion(stack_map->data(), stack_map->size())); - stack_map_stream.FillInMethodInfo(MemoryRegion(method_info->data(), method_info->size())); } CompiledMethod* OptimizingCompiler::JniCompile(uint32_t access_flags, @@ -1169,13 +1164,11 @@ CompiledMethod* OptimizingCompiler::JniCompile(uint32_t access_flags, MaybeRecordStat(compilation_stats_.get(), MethodCompilationStat::kCompiledNativeStub); ArenaVector<uint8_t> stack_map(allocator.Adapter(kArenaAllocStackMaps)); - ArenaVector<uint8_t> method_info(allocator.Adapter(kArenaAllocStackMaps)); - CreateJniStackMap(&arena_stack, jni_compiled_method, &stack_map, &method_info); + CreateJniStackMap(&arena_stack, jni_compiled_method, &stack_map); return CompiledMethod::SwapAllocCompiledMethod( GetCompilerDriver(), jni_compiled_method.GetInstructionSet(), jni_compiled_method.GetCode(), - ArrayRef<const uint8_t>(method_info), ArrayRef<const uint8_t>(stack_map), jni_compiled_method.GetCfi(), /* patches */ ArrayRef<const linker::LinkerPatch>()); @@ -1237,34 +1230,28 @@ bool OptimizingCompiler::JitCompile(Thread* self, ArenaSet<ArtMethod*, std::less<ArtMethod*>> cha_single_implementation_list( allocator.Adapter(kArenaAllocCHA)); ArenaVector<uint8_t> stack_map(allocator.Adapter(kArenaAllocStackMaps)); - ArenaVector<uint8_t> method_info(allocator.Adapter(kArenaAllocStackMaps)); ArenaStack arena_stack(runtime->GetJitArenaPool()); // StackMapStream is large and it does not fit into this frame, so we need helper method. // TODO: Try to avoid the extra memory copy that results from this. - CreateJniStackMap(&arena_stack, jni_compiled_method, &stack_map, &method_info); + CreateJniStackMap(&arena_stack, jni_compiled_method, &stack_map); uint8_t* stack_map_data = nullptr; - uint8_t* method_info_data = nullptr; uint8_t* roots_data = nullptr; uint32_t data_size = code_cache->ReserveData(self, stack_map.size(), - method_info.size(), /* number_of_roots */ 0, method, &stack_map_data, - &method_info_data, &roots_data); if (stack_map_data == nullptr || roots_data == nullptr) { MaybeRecordStat(compilation_stats_.get(), MethodCompilationStat::kJitOutOfMemoryForCommit); return false; } memcpy(stack_map_data, stack_map.data(), stack_map.size()); - memcpy(method_info_data, method_info.data(), method_info.size()); const void* code = code_cache->CommitCode( self, method, stack_map_data, - method_info_data, roots_data, jni_compiled_method.GetCode().data(), jni_compiled_method.GetCode().size(), @@ -1340,8 +1327,7 @@ bool OptimizingCompiler::JitCompile(Thread* self, } size_t stack_map_size = 0; - size_t method_info_size = 0; - codegen->ComputeStackMapAndMethodInfoSize(&stack_map_size, &method_info_size); + codegen->ComputeStackMapSize(&stack_map_size); size_t number_of_roots = codegen->GetNumberOfJitRoots(); // We allocate an object array to ensure the JIT roots that we will collect in EmitJitRoots // will be visible by the GC between EmitLiterals and CommitCode. Once CommitCode is @@ -1357,30 +1343,24 @@ bool OptimizingCompiler::JitCompile(Thread* self, return false; } uint8_t* stack_map_data = nullptr; - uint8_t* method_info_data = nullptr; uint8_t* roots_data = nullptr; uint32_t data_size = code_cache->ReserveData(self, stack_map_size, - method_info_size, number_of_roots, method, &stack_map_data, - &method_info_data, &roots_data); if (stack_map_data == nullptr || roots_data == nullptr) { MaybeRecordStat(compilation_stats_.get(), MethodCompilationStat::kJitOutOfMemoryForCommit); return false; } - codegen->BuildStackMaps(MemoryRegion(stack_map_data, stack_map_size), - MemoryRegion(method_info_data, method_info_size), - code_item); + codegen->BuildStackMaps(MemoryRegion(stack_map_data, stack_map_size), code_item); codegen->EmitJitRoots(code_allocator.GetData(), roots, roots_data); const void* code = code_cache->CommitCode( self, method, stack_map_data, - method_info_data, roots_data, code_allocator.GetMemory().data(), code_allocator.GetMemory().size(), diff --git a/compiler/optimizing/stack_map_stream.cc b/compiler/optimizing/stack_map_stream.cc index e1b657554f..429054cec7 100644 --- a/compiler/optimizing/stack_map_stream.cc +++ b/compiler/optimizing/stack_map_stream.cc @@ -196,7 +196,7 @@ void StackMapStream::BeginInlineInfoEntry(ArtMethod* method, if (encode_art_method) { CHECK_EQ(inline_info.GetArtMethod(), method); } else { - CHECK_EQ(method_infos_[inline_info.GetMethodInfoIndex()][0], method->GetDexMethodIndex()); + CHECK_EQ(code_info.GetMethodIndexOf(inline_info), method->GetDexMethodIndex()); } }); } @@ -274,24 +274,6 @@ void StackMapStream::CreateDexRegisterMap() { } } -void StackMapStream::FillInMethodInfo(MemoryRegion region) { - { - MethodInfo info(region.begin(), method_infos_.size()); - for (size_t i = 0; i < method_infos_.size(); ++i) { - info.SetMethodIndex(i, method_infos_[i][0]); - } - } - if (kVerifyStackMaps) { - // Check the data matches. - MethodInfo info(region.begin()); - const size_t count = info.NumMethodIndices(); - DCHECK_EQ(count, method_infos_.size()); - for (size_t i = 0; i < count; ++i) { - DCHECK_EQ(info.GetMethodIndex(i), method_infos_[i][0]); - } - } -} - template<typename Writer, typename Builder> ALWAYS_INLINE static void EncodeTable(Writer& out, const Builder& bit_table) { out.WriteBit(false); // Is not deduped. @@ -317,6 +299,7 @@ size_t StackMapStream::PrepareForFillIn() { BitMemoryWriter<ScopedArenaVector<uint8_t>> out(&out_, out_.size() * kBitsPerByte); EncodeTable(out, stack_maps_); EncodeTable(out, inline_infos_); + EncodeTable(out, method_infos_); EncodeTable(out, register_masks_); EncodeTable(out, stack_masks_); EncodeTable(out, dex_register_masks_); @@ -347,9 +330,4 @@ void StackMapStream::FillInCodeInfo(MemoryRegion region) { } } -size_t StackMapStream::ComputeMethodInfoSize() const { - DCHECK_NE(0u, out_.size()) << "PrepareForFillIn not called before " << __FUNCTION__; - return MethodInfo::ComputeSize(method_infos_.size()); -} - } // namespace art diff --git a/compiler/optimizing/stack_map_stream.h b/compiler/optimizing/stack_map_stream.h index 203c2cdf84..de79f4921e 100644 --- a/compiler/optimizing/stack_map_stream.h +++ b/compiler/optimizing/stack_map_stream.h @@ -25,7 +25,6 @@ #include "base/scoped_arena_containers.h" #include "base/value_object.h" #include "dex_register_location.h" -#include "method_info.h" #include "nodes.h" #include "stack_map.h" @@ -40,14 +39,14 @@ class StackMapStream : public ValueObject { explicit StackMapStream(ScopedArenaAllocator* allocator, InstructionSet instruction_set) : instruction_set_(instruction_set), stack_maps_(allocator), + inline_infos_(allocator), + method_infos_(allocator), register_masks_(allocator), stack_masks_(allocator), - inline_infos_(allocator), dex_register_masks_(allocator), dex_register_maps_(allocator), dex_register_catalog_(allocator), out_(allocator->Adapter(kArenaAllocStackMapStream)), - method_infos_(allocator), lazy_stack_masks_(allocator->Adapter(kArenaAllocStackMapStream)), current_stack_map_(), current_inline_infos_(allocator->Adapter(kArenaAllocStackMapStream)), @@ -92,9 +91,6 @@ class StackMapStream : public ValueObject { // Returns the size (in bytes) needed to store this stream. size_t PrepareForFillIn(); void FillInCodeInfo(MemoryRegion region); - void FillInMethodInfo(MemoryRegion region); - - size_t ComputeMethodInfoSize() const; private: static constexpr uint32_t kNoValue = -1; @@ -107,16 +103,15 @@ class StackMapStream : public ValueObject { uint32_t fp_spill_mask_ = 0; uint32_t num_dex_registers_ = 0; BitTableBuilder<StackMap> stack_maps_; + BitTableBuilder<InlineInfo> inline_infos_; + BitTableBuilder<MethodInfo> method_infos_; BitTableBuilder<RegisterMask> register_masks_; BitmapTableBuilder stack_masks_; - BitTableBuilder<InlineInfo> inline_infos_; BitmapTableBuilder dex_register_masks_; BitTableBuilder<MaskInfo> dex_register_maps_; BitTableBuilder<DexRegisterInfo> dex_register_catalog_; ScopedArenaVector<uint8_t> out_; - BitTableBuilderBase<1> method_infos_; - ScopedArenaVector<BitVector*> lazy_stack_masks_; // Variables which track the current state between Begin/End calls; |