Use class def index from java.lang.Class.
Bug: 10244719
This removes the computation of the dex file index, when necessary this is
computed by searching the dex file. Its only necessary in
dalvik.system.DexFile.defineClassNative and DexFile::FindInClassPath, the
latter not showing up significantly in profiling with this change.
(cherry-picked from 8b2c0b9abc3f520495f4387ea040132ba85cae69)
Change-Id: I20c73a3b17d86286428ab0fd21bc13f51f36c85c
diff --git a/compiler/sea_ir/frontend.cc b/compiler/sea_ir/frontend.cc
index 93f6f25..3512911 100644
--- a/compiler/sea_ir/frontend.cc
+++ b/compiler/sea_ir/frontend.cc
@@ -41,7 +41,7 @@
const CompilerBackend compiler_backend,
const DexFile::CodeItem* code_item,
uint32_t method_access_flags, InvokeType invoke_type,
- uint32_t class_def_idx, uint32_t method_idx,
+ uint16_t class_def_idx, uint32_t method_idx,
jobject class_loader, const DexFile& dex_file
#if defined(ART_USE_PORTABLE_COMPILER)
, llvm::LlvmCompilationUnit* llvm_compilation_unit
@@ -69,7 +69,7 @@
const DexFile::CodeItem* code_item,
uint32_t method_access_flags,
InvokeType invoke_type,
- uint32_t class_def_idx,
+ uint16_t class_def_idx,
uint32_t method_idx,
jobject class_loader,
const DexFile& dex_file,
@@ -86,7 +86,7 @@
SeaIrCompileMethod(art::CompilerDriver& compiler,
const art::DexFile::CodeItem* code_item,
uint32_t method_access_flags, art::InvokeType invoke_type,
- uint32_t class_def_idx, uint32_t method_idx, jobject class_loader,
+ uint16_t class_def_idx, uint32_t method_idx, jobject class_loader,
const art::DexFile& dex_file) {
// TODO: Check method fingerprint here to determine appropriate backend type.
// Until then, use build default
diff --git a/compiler/sea_ir/ir/sea.cc b/compiler/sea_ir/ir/sea.cc
index 5ccaba6..0734b21 100644
--- a/compiler/sea_ir/ir/sea.cc
+++ b/compiler/sea_ir/ir/sea.cc
@@ -191,7 +191,7 @@
}
void SeaGraph::BuildMethodSeaGraph(const art::DexFile::CodeItem* code_item,
- const art::DexFile& dex_file, uint32_t class_def_idx,
+ const art::DexFile& dex_file, uint16_t class_def_idx,
uint32_t method_idx, uint32_t method_access_flags) {
code_item_ = code_item;
class_def_idx_ = class_def_idx;
@@ -409,7 +409,7 @@
CodeGenData* SeaGraph::CompileMethod(
const std::string& function_name,
- const art::DexFile::CodeItem* code_item, uint32_t class_def_idx,
+ const art::DexFile::CodeItem* code_item, uint16_t class_def_idx,
uint32_t method_idx, uint32_t method_access_flags, const art::DexFile& dex_file) {
// Two passes: Builds the intermediate structure (non-SSA) of the sea-ir for the function.
BuildMethodSeaGraph(code_item, dex_file, class_def_idx, method_idx, method_access_flags);
diff --git a/compiler/sea_ir/ir/sea.h b/compiler/sea_ir/ir/sea.h
index 92c2043..26b16be 100644
--- a/compiler/sea_ir/ir/sea.h
+++ b/compiler/sea_ir/ir/sea.h
@@ -262,7 +262,7 @@
static SeaGraph* GetGraph(const art::DexFile&);
CodeGenData* CompileMethod(const std::string& function_name,
- const art::DexFile::CodeItem* code_item, uint32_t class_def_idx,
+ const art::DexFile::CodeItem* code_item, uint16_t class_def_idx,
uint32_t method_idx, uint32_t method_access_flags, const art::DexFile& dex_file);
// Returns all regions corresponding to this SeaGraph.
std::vector<Region*>* GetRegions() {
@@ -288,7 +288,7 @@
}
TypeInference* ti_;
- uint32_t class_def_idx_;
+ uint16_t class_def_idx_;
uint32_t method_idx_;
uint32_t method_access_flags_;
@@ -311,7 +311,7 @@
// Builds the non-SSA sea-ir representation of the function @code_item from @dex_file
// with class id @class_def_idx and method id @method_idx.
void BuildMethodSeaGraph(const art::DexFile::CodeItem* code_item,
- const art::DexFile& dex_file, uint32_t class_def_idx,
+ const art::DexFile& dex_file, uint16_t class_def_idx,
uint32_t method_idx, uint32_t method_access_flags);
// Computes immediate dominators for each region.
// Precondition: ComputeMethodSeaGraph()