Revert "Expand sharpening's ComputeLoadClassKind to cover cross-dex cases"
This reverts commit 32b8c8f33ad68982357c1fa3d0f132d06b070ab5.
Bug: 154012332
Bug: 214850438
Reason for revert: b/214850438
Change-Id: I479c0910ce5da593e170bc5e4f6fa10dfe5d67b2
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index 326e833..a31be3f 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -26,7 +26,6 @@
#include "base/globals.h"
#include "base/hash_set.h"
#include "base/macros.h"
-#include "base/stl_util.h"
#include "base/utils.h"
#include "optimizing/register_allocator.h"
@@ -375,7 +374,8 @@
}
bool WithinOatFile(const DexFile* dex_file) const {
- return ContainsElement(GetDexFilesForOatFile(), dex_file);
+ return std::find(GetDexFilesForOatFile().begin(), GetDexFilesForOatFile().end(), dex_file) !=
+ GetDexFilesForOatFile().end();
}
private:
diff --git a/compiler/optimizing/sharpening.cc b/compiler/optimizing/sharpening.cc
index cb9edc0..1fd76f7 100644
--- a/compiler/optimizing/sharpening.cc
+++ b/compiler/optimizing/sharpening.cc
@@ -275,18 +275,15 @@
}
HLoadClass::LoadKind load_kind = codegen->GetSupportedLoadClassKind(desired_load_kind);
- // If we cannot reference this class due to .bss requirements, we're forced to bail.
if (!IsSameDexFile(load_class->GetDexFile(), *dex_compilation_unit.GetDexFile())) {
- if (load_kind == HLoadClass::LoadKind::kRuntimeCall) {
- return HLoadClass::LoadKind::kInvalid;
- }
-
- if (load_kind == HLoadClass::LoadKind::kBssEntry ||
+ if (load_kind == HLoadClass::LoadKind::kRuntimeCall ||
+ load_kind == HLoadClass::LoadKind::kBssEntry ||
load_kind == HLoadClass::LoadKind::kBssEntryPublic ||
load_kind == HLoadClass::LoadKind::kBssEntryPackage) {
- if (!codegen->GetCompilerOptions().WithinOatFile(&load_class->GetDexFile())) {
- return HLoadClass::LoadKind::kInvalid;
- }
+ // We actually cannot reference this class, we're forced to bail.
+ // We cannot reference this class with Bss, as the entrypoint will lookup the class
+ // in the caller's dex file, but that dex file does not reference the class.
+ return HLoadClass::LoadKind::kInvalid;
}
}
return load_kind;