Revert "ART: Extracts an utility function of the duplicated code"
This reverts commit 973cc95da6fb617bab133bd7a693c1cb7eafd393.
Change-Id: I3883c74ba06116e89d89d9cf085f20cff5d15f77
diff --git a/compiler/dex/quick/gen_common.cc b/compiler/dex/quick/gen_common.cc
index bd662b7..aa9b2a4 100644
--- a/compiler/dex/quick/gen_common.cc
+++ b/compiler/dex/quick/gen_common.cc
@@ -519,7 +519,8 @@
r_base = TargetReg(kArg0);
LockTemp(r_base);
LoadRefDisp(r_method, mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(), r_base);
- LoadRefDisp(r_base, mirror::Array::DataOffsetOfType<mirror::Object>(field_info.StorageIndex()), r_base);
+ LoadRefDisp(r_base, mirror::Array::DataOffset(sizeof(mirror::Object*)).Int32Value() +
+ sizeof(int32_t*) * field_info.StorageIndex(), r_base);
// r_base now points at static storage (Class*) or NULL if the type is not yet resolved.
if (!field_info.IsInitialized() &&
(mir->optimization_flags & MIR_IGNORE_CLINIT_CHECK) == 0) {
@@ -607,7 +608,8 @@
r_base = TargetReg(kArg0);
LockTemp(r_base);
LoadRefDisp(r_method, mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(), r_base);
- LoadRefDisp(r_base, mirror::Array::DataOffsetOfType<mirror::Object>(field_info.StorageIndex()), r_base);
+ LoadRefDisp(r_base, mirror::Array::DataOffset(sizeof(mirror::Object*)).Int32Value() +
+ sizeof(int32_t*) * field_info.StorageIndex(), r_base);
// r_base now points at static storage (Class*) or NULL if the type is not yet resolved.
if (!field_info.IsInitialized() &&
(mir->optimization_flags & MIR_IGNORE_CLINIT_CHECK) == 0) {
@@ -863,7 +865,9 @@
int32_t dex_cache_offset =
mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value();
Load32Disp(rl_method.reg, dex_cache_offset, res_reg);
- int32_t offset_of_type = mirror::Array::DataOffsetOfType<mirror::Class>(type_idx);
+ int32_t offset_of_type =
+ mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() + (sizeof(mirror::Class*)
+ * type_idx);
Load32Disp(res_reg, offset_of_type, rl_result.reg);
if (!cu_->compiler_driver->CanAssumeTypeIsPresentInDexCache(*cu_->dex_file,
type_idx) || SLOW_TYPE_PATH) {
@@ -910,7 +914,8 @@
void Mir2Lir::GenConstString(uint32_t string_idx, RegLocation rl_dest) {
/* NOTE: Most strings should be available at compile time */
- int32_t offset_of_string = mirror::Array::DataOffsetOfType<mirror::String>(string_idx);
+ int32_t offset_of_string = mirror::Array::DataOffset(sizeof(mirror::String*)).Int32Value() +
+ (sizeof(mirror::String*) * string_idx);
if (!cu_->compiler_driver->CanAssumeStringIsPresentInDexCache(
*cu_->dex_file, string_idx) || SLOW_STRING_PATH) {
// slow path, resolve string if not in dex cache
@@ -1074,7 +1079,9 @@
LoadRefDisp(check_class, mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(),
check_class);
LoadRefDisp(object.reg, mirror::Object::ClassOffset().Int32Value(), object_class);
- int32_t offset_of_type = mirror::Array::DataOffsetOfType<mirror::Class>(type_idx);
+ int32_t offset_of_type =
+ mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() +
+ (sizeof(mirror::Class*) * type_idx);
LoadRefDisp(check_class, offset_of_type, check_class);
}
@@ -1132,7 +1139,9 @@
LoadValueDirectFixed(rl_src, TargetReg(kArg0)); // kArg0 <= ref
LoadRefDisp(TargetReg(kArg1), mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(),
class_reg);
- int32_t offset_of_type = mirror::Array::DataOffsetOfType<mirror::Class>(type_idx);
+ int32_t offset_of_type =
+ mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() + (sizeof(mirror::Class*)
+ * type_idx);
LoadRefDisp(class_reg, offset_of_type, class_reg);
if (!can_assume_type_is_in_dex_cache) {
// Need to test presence of type in dex cache at runtime
@@ -1266,7 +1275,9 @@
// Load dex cache entry into class_reg (kArg2)
LoadRefDisp(TargetReg(kArg1), mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(),
class_reg);
- int32_t offset_of_type = mirror::Array::DataOffsetOfType<mirror::Class>(type_idx);
+ int32_t offset_of_type =
+ mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() +
+ (sizeof(mirror::Class*) * type_idx);
LoadRefDisp(class_reg, offset_of_type, class_reg);
if (!cu_->compiler_driver->CanAssumeTypeIsPresentInDexCache(*cu_->dex_file, type_idx)) {
// Need to test presence of type in dex cache at runtime
diff --git a/runtime/mirror/array.h b/runtime/mirror/array.h
index a9dcfe6..772d303 100644
--- a/runtime/mirror/array.h
+++ b/runtime/mirror/array.h
@@ -68,12 +68,6 @@
}
}
- template<class MirrorType>
- static int32_t DataOffsetOfType(uint32_t index) {
- return DataOffset(sizeof(HeapReference<MirrorType>)).Int32Value() +
- (sizeof(HeapReference<MirrorType>) * index);
- }
-
void* GetRawData(size_t component_size, int32_t index)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
intptr_t data = reinterpret_cast<intptr_t>(this) + DataOffset(component_size).Int32Value() +