diff options
| author | 2022-03-23 08:25:33 +0000 | |
|---|---|---|
| committer | 2022-04-06 15:09:46 +0000 | |
| commit | f4bd5debf74ee5473756b4cbd71fadb3506e653b (patch) | |
| tree | 115bb605fbd66a90d0c3ff12cc196fd4ebdca528 /compiler/optimizing | |
| parent | 6a1d9b9106183d829fd17e81cce345d1ef81f034 (diff) | |
Touch up changes related to cross-dex compiling
* Added exaplanatory comments
* Used IsBootStrapClassLoaded to avoid a read barrier
* Use the new multi-image from CompilerOptions
Bug: 154012332
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b
Change-Id: I10a4ed0f9d5b2e796102846564a54dc90f297068
Diffstat (limited to 'compiler/optimizing')
| -rw-r--r-- | compiler/optimizing/inliner.cc | 21 | ||||
| -rw-r--r-- | compiler/optimizing/stack_map_stream.cc | 4 |
2 files changed, 12 insertions, 13 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index 741e6dffc1..8b41205c53 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -1744,13 +1744,11 @@ static bool CanEncodeInlinedMethodInStackMap(const DexFile& outer_dex_file, // Inline across dexfiles if the callee's DexFile is: // 1) in the bootclasspath, or - if (callee->GetDeclaringClass()->GetClassLoader() == nullptr) { + if (callee->GetDeclaringClass()->IsBootStrapClassLoaded()) { // In multi-image, each BCP DexFile has their own OatWriter. Since they don't cooperate with // each other, we request the BSS check for them. - // TODO(solanes): Add .bss support for BCP multi-image. - const bool is_multi_image = codegen->GetCompilerOptions().IsBootImage() || - codegen->GetCompilerOptions().IsBootImageExtension(); - *out_needs_bss_check = is_multi_image; + // TODO(solanes, 154012332): Add .bss support for BCP multi-image. + *out_needs_bss_check = codegen->GetCompilerOptions().IsMultiImage(); return true; } @@ -1939,13 +1937,14 @@ bool HInliner::CanInlineBody(const HGraph* callee_graph, return false; } - // We currently don't have support for inlining across dex files if the inlined method needs a - // .bss entry. This only happens when we are: + // We currently don't have support for inlining across dex files if we are: // 1) In AoT, - // 2) cross-dex inlining, and - // 3) have an instruction that needs a bss entry, which will always be - // 3)b) an instruction that needs an environment. - // TODO(solanes, 154012332): Add this support. + // 2) cross-dex inlining, + // 3) the callee is a BCP DexFile, + // 4) we are compiling multi image, and + // 5) have an instruction that needs a bss entry, which will always be + // 5)b) an instruction that needs an environment. + // 1) - 4) are encoded in `needs_bss_check` (see CanEncodeInlinedMethodInStackMap). if (needs_bss_check && current->NeedsBss()) { DCHECK(current->NeedsEnvironment()); LOG_FAIL(stats_, MethodCompilationStat::kNotInlinedBss) diff --git a/compiler/optimizing/stack_map_stream.cc b/compiler/optimizing/stack_map_stream.cc index 7317bdfc8f..f55bbee1c8 100644 --- a/compiler/optimizing/stack_map_stream.cc +++ b/compiler/optimizing/stack_map_stream.cc @@ -224,7 +224,7 @@ void StackMapStream::BeginInlineInfoEntry(ArtMethod* method, ScopedObjectAccess soa(Thread::Current()); const DexFile* dex_file = method->GetDexFile(); if (!IsSameDexFile(*outer_dex_file, *dex_file)) { - if (method->GetDeclaringClass()->GetClassLoader() == nullptr) { + if (method->GetDeclaringClass()->IsBootStrapClassLoaded()) { ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); const std::vector<const DexFile*>& boot_class_path = class_linker->GetBootClassPath(); auto it = std::find_if( @@ -269,7 +269,7 @@ void StackMapStream::BeginInlineInfoEntry(ArtMethod* method, ScopedObjectAccess soa(Thread::Current()); if (inline_info.GetDexPc() != static_cast<uint32_t>(-1) && !IsSameDexFile(*outer_dex_file, *method->GetDexFile())) { - if (method->GetDeclaringClass()->GetClassLoader() == nullptr) { + if (method->GetDeclaringClass()->IsBootStrapClassLoaded()) { CHECK_EQ(method_info.GetDexFileIndexKind(), MethodInfo::kKindBCP); ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); const std::vector<const DexFile*>& boot_class_path = class_linker->GetBootClassPath(); |