Refactor java.lang.reflect implementation
Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1.
Move to ArtMethod/Field instead of AbstractMethod/Field and have
java.lang.reflect APIs delegate to ArtMethod/ArtField.
Bug: 10014286.
Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7
diff --git a/compiler/dex/quick/gen_common.cc b/compiler/dex/quick/gen_common.cc
index 298d389..e5c7fb1 100644
--- a/compiler/dex/quick/gen_common.cc
+++ b/compiler/dex/quick/gen_common.cc
@@ -347,7 +347,7 @@
RegLocation rl_method = LoadCurrMethod();
rBase = AllocTemp();
LoadWordDisp(rl_method.low_reg,
- mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), rBase);
+ mirror::ArtMethod::DeclaringClassOffset().Int32Value(), rBase);
if (IsTemp(rl_method.low_reg)) {
FreeTemp(rl_method.low_reg);
}
@@ -365,7 +365,7 @@
rBase = TargetReg(kArg0);
LockTemp(rBase);
LoadWordDisp(r_method,
- mirror::AbstractMethod::DexCacheInitializedStaticStorageOffset().Int32Value(),
+ mirror::ArtMethod::DexCacheInitializedStaticStorageOffset().Int32Value(),
rBase);
LoadWordDisp(rBase,
mirror::Array::DataOffset(sizeof(mirror::Object*)).Int32Value() +
@@ -433,7 +433,7 @@
RegLocation rl_method = LoadCurrMethod();
rBase = AllocTemp();
LoadWordDisp(rl_method.low_reg,
- mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), rBase);
+ mirror::ArtMethod::DeclaringClassOffset().Int32Value(), rBase);
} else {
// Medium path, static storage base in a different class which requires checks that the other
// class is initialized
@@ -448,7 +448,7 @@
rBase = TargetReg(kArg0);
LockTemp(rBase);
LoadWordDisp(r_method,
- mirror::AbstractMethod::DexCacheInitializedStaticStorageOffset().Int32Value(),
+ mirror::ArtMethod::DexCacheInitializedStaticStorageOffset().Int32Value(),
rBase);
LoadWordDisp(rBase, mirror::Array::DataOffset(sizeof(mirror::Object*)).Int32Value() +
sizeof(int32_t*) * ssb_index, rBase);
@@ -746,7 +746,7 @@
} else {
// We're don't need access checks, load type from dex cache
int32_t dex_cache_offset =
- mirror::AbstractMethod::DexCacheResolvedTypesOffset().Int32Value();
+ mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value();
LoadWordDisp(rl_method.low_reg, dex_cache_offset, res_reg);
int32_t offset_of_type =
mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() + (sizeof(mirror::Class*)
@@ -799,7 +799,7 @@
LockCallTemps(); // Using explicit registers
LoadCurrMethodDirect(TargetReg(kArg2));
LoadWordDisp(TargetReg(kArg2),
- mirror::AbstractMethod::DexCacheStringsOffset().Int32Value(), TargetReg(kArg0));
+ mirror::ArtMethod::DexCacheStringsOffset().Int32Value(), TargetReg(kArg0));
// Might call out to helper, which will return resolved string in kRet0
int r_tgt = CallHelperSetup(QUICK_ENTRYPOINT_OFFSET(pResolveString));
LoadWordDisp(TargetReg(kArg0), offset_of_string, TargetReg(kRet0));
@@ -835,7 +835,7 @@
int res_reg = AllocTemp();
RegLocation rl_result = EvalLoc(rl_dest, kCoreReg, true);
LoadWordDisp(rl_method.low_reg,
- mirror::AbstractMethod::DexCacheStringsOffset().Int32Value(), res_reg);
+ mirror::ArtMethod::DexCacheStringsOffset().Int32Value(), res_reg);
LoadWordDisp(res_reg, offset_of_string, rl_result.low_reg);
StoreValue(rl_dest, rl_result);
}
@@ -884,11 +884,11 @@
LoadCurrMethodDirect(check_class);
if (use_declaring_class) {
- LoadWordDisp(check_class, mirror::AbstractMethod::DeclaringClassOffset().Int32Value(),
+ LoadWordDisp(check_class, mirror::ArtMethod::DeclaringClassOffset().Int32Value(),
check_class);
LoadWordDisp(object.low_reg, mirror::Object::ClassOffset().Int32Value(), object_class);
} else {
- LoadWordDisp(check_class, mirror::AbstractMethod::DexCacheResolvedTypesOffset().Int32Value(),
+ LoadWordDisp(check_class, mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(),
check_class);
LoadWordDisp(object.low_reg, mirror::Object::ClassOffset().Int32Value(), object_class);
int32_t offset_of_type =
@@ -940,12 +940,12 @@
} else if (use_declaring_class) {
LoadValueDirectFixed(rl_src, TargetReg(kArg0)); // kArg0 <= ref
LoadWordDisp(TargetReg(kArg1),
- mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), class_reg);
+ mirror::ArtMethod::DeclaringClassOffset().Int32Value(), class_reg);
} else {
// Load dex cache entry into class_reg (kArg2)
LoadValueDirectFixed(rl_src, TargetReg(kArg0)); // kArg0 <= ref
LoadWordDisp(TargetReg(kArg1),
- mirror::AbstractMethod::DexCacheResolvedTypesOffset().Int32Value(), class_reg);
+ mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(), class_reg);
int32_t offset_of_type =
mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() + (sizeof(mirror::Class*)
* type_idx);
@@ -1078,11 +1078,11 @@
OpRegCopy(class_reg, TargetReg(kRet0)); // Align usage with fast path
} else if (use_declaring_class) {
LoadWordDisp(TargetReg(kArg1),
- mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), class_reg);
+ mirror::ArtMethod::DeclaringClassOffset().Int32Value(), class_reg);
} else {
// Load dex cache entry into class_reg (kArg2)
LoadWordDisp(TargetReg(kArg1),
- mirror::AbstractMethod::DexCacheResolvedTypesOffset().Int32Value(), class_reg);
+ mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(), class_reg);
int32_t offset_of_type =
mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() +
(sizeof(mirror::Class*) * type_idx);