Add .bss support for inlining across dexfiles within Oat
We can safely reference other dexfiles within the same oat file for cross-dex inlining.
This CL makes the OptStat#NotInlinedBss drop to less than 1% of the not-inlining cases.
Test: ART tests
Change-Id: I676d48d973abf7a6f8412cf3b7bb73afd7747f31
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index e996512..8d0258d 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -1710,6 +1710,7 @@
// JIT can always encode methods in stack maps.
return true;
}
+
const DexFile* dex_file = callee->GetDexFile();
if (IsSameDexFile(outer_dex_file, *dex_file)) {
return true;
@@ -1718,15 +1719,16 @@
// Inline across dexfiles if the callee's DexFile is:
// 1) in the bootclasspath, or
if (callee->GetDeclaringClass()->GetClassLoader() == nullptr) {
+ // There are cases in which the BCP DexFiles are within the OatFile as far as the compiler
+ // options are concerned, but they have their own OatWriter (and therefore not in the same
+ // OatFile). Then, we request the BSS check for all BCP DexFiles.
+ // TODO(solanes): Add .bss support for BCP.
*out_needs_bss_check = true;
return true;
}
- // 2) is a non-BCP dexfile with an OatDexFile.
- const std::vector<const DexFile*>& dex_files =
- codegen->GetCompilerOptions().GetDexFilesForOatFile();
- if (std::find(dex_files.begin(), dex_files.end(), dex_file) != dex_files.end()) {
- *out_needs_bss_check = true;
+ // 2) is a non-BCP dexfile with the OatFile we are compiling.
+ if (codegen->GetCompilerOptions().WithinOatFile(dex_file)) {
return true;
}