Remove CodeItem accessor functions
These are replaced by the accessor helpers.
Bug: 63756964
Test: test-art-host
Test: test/testrunner/testrunner.py --host -j30
Change-Id: Ic93d60b68b684eeb5f69be286b4e15b8f8f97542
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 68f963e..5d4ed46 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -702,6 +702,7 @@
// stable order.
static void ResolveConstStrings(Handle<mirror::DexCache> dex_cache,
+ const DexFile* dex_file,
const DexFile::CodeItem* code_item)
REQUIRES_SHARED(Locks::mutator_lock_) {
if (code_item == nullptr) {
@@ -710,7 +711,7 @@
}
ClassLinker* const class_linker = Runtime::Current()->GetClassLinker();
- for (const DexInstructionPcPair& inst : code_item->Instructions()) {
+ for (const DexInstructionPcPair& inst : CodeItemInstructionAccessor(dex_file, code_item)) {
switch (inst->Opcode()) {
case Instruction::CONST_STRING:
case Instruction::CONST_STRING_JUMBO: {
@@ -772,7 +773,7 @@
continue;
}
previous_method_idx = method_idx;
- ResolveConstStrings(dex_cache, it.GetMethodCodeItem());
+ ResolveConstStrings(dex_cache, dex_file, it.GetMethodCodeItem());
it.Next();
}
DCHECK(!it.HasNext());
@@ -2352,9 +2353,7 @@
// Intern strings seen in <clinit>.
ArtMethod* clinit = klass->FindClassInitializer(class_linker->GetImagePointerSize());
if (clinit != nullptr) {
- const DexFile::CodeItem* code_item = clinit->GetCodeItem();
- DCHECK(code_item != nullptr);
- for (const DexInstructionPcPair& inst : code_item->Instructions()) {
+ for (const DexInstructionPcPair& inst : clinit->DexInstructions()) {
if (inst->Opcode() == Instruction::CONST_STRING) {
ObjPtr<mirror::String> s = class_linker->ResolveString(
dex::StringIndex(inst->VRegB_21c()), dex_cache);
diff --git a/compiler/driver/dex_compilation_unit.cc b/compiler/driver/dex_compilation_unit.cc
index 7e8e812..76e1299 100644
--- a/compiler/driver/dex_compilation_unit.cc
+++ b/compiler/driver/dex_compilation_unit.cc
@@ -16,6 +16,7 @@
#include "dex_compilation_unit.h"
+#include "code_item_accessors-inl.h"
#include "mirror/dex_cache.h"
#include "utils.h"
@@ -38,7 +39,8 @@
dex_method_idx_(method_idx),
access_flags_(access_flags),
verified_method_(verified_method),
- dex_cache_(dex_cache) {
+ dex_cache_(dex_cache),
+ code_item_accessor_(&dex_file, code_item) {
}
const std::string& DexCompilationUnit::GetSymbol() {
diff --git a/compiler/driver/dex_compilation_unit.h b/compiler/driver/dex_compilation_unit.h
index 24a9a5b..cdc505f 100644
--- a/compiler/driver/dex_compilation_unit.h
+++ b/compiler/driver/dex_compilation_unit.h
@@ -20,6 +20,7 @@
#include <stdint.h>
#include "base/arena_object.h"
+#include "code_item_accessors.h"
#include "dex_file.h"
#include "handle.h"
#include "jni.h"
@@ -112,6 +113,10 @@
return dex_cache_;
}
+ const CodeItemDataAccessor& GetCodeItemAccessor() const {
+ return code_item_accessor_;
+ }
+
private:
const Handle<mirror::ClassLoader> class_loader_;
@@ -127,6 +132,8 @@
const Handle<mirror::DexCache> dex_cache_;
+ const CodeItemDataAccessor code_item_accessor_;
+
std::string symbol_;
};