summaryrefslogtreecommitdiff
path: root/compiler/optimizing/instruction_builder.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2022-03-08 16:24:23 +0000
committer Vladimir Marko <vmarko@google.com> 2022-03-09 09:16:09 +0000
commit961dbc4a173eb424f79ddca1ac9a90214addcc19 (patch)
treeaf929410be66cc697f46765872f6901c0b153953 /compiler/optimizing/instruction_builder.cc
parent4478abee749d56755578cd4309c9510e180be430 (diff)
Optimizing: Do not resolve field type for `get` opcodes.
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 161898207 Change-Id: Ia4b9cd5d03dfc9d1eb32b59840279171f2d42a56
Diffstat (limited to 'compiler/optimizing/instruction_builder.cc')
-rw-r--r--compiler/optimizing/instruction_builder.cc32
1 files changed, 18 insertions, 14 deletions
diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc
index 2454125589..e0bdd0963c 100644
--- a/compiler/optimizing/instruction_builder.cc
+++ b/compiler/optimizing/instruction_builder.cc
@@ -2225,22 +2225,26 @@ ArtField* HInstructionBuilder::ResolveField(uint16_t field_idx, bool is_static,
return nullptr;
}
- if (is_put &&
- resolved_field->IsFinal() &&
- (compiling_class.Get() != resolved_field->GetDeclaringClass())) {
- // Final fields can only be updated within their own class.
- // TODO: Only allow it in constructors. b/34966607.
- return nullptr;
- }
+ if (is_put) {
+ if (resolved_field->IsFinal() &&
+ (compiling_class.Get() != resolved_field->GetDeclaringClass())) {
+ // Final fields can only be updated within their own class.
+ // TODO: Only allow it in constructors. b/34966607.
+ return nullptr;
+ }
- StackArtFieldHandleScope<1> rhs(soa.Self());
- ReflectiveHandle<ArtField> resolved_field_handle(rhs.NewHandle(resolved_field));
- if (resolved_field->ResolveType().IsNull()) {
- // ArtField::ResolveType() may fail as evidenced with a dexing bug (b/78788577).
- soa.Self()->ClearException();
- return nullptr; // Failure
+ // Note: We do not need to resolve the field type for `get` opcodes.
+ StackArtFieldHandleScope<1> rhs(soa.Self());
+ ReflectiveHandle<ArtField> resolved_field_handle(rhs.NewHandle(resolved_field));
+ if (resolved_field->ResolveType().IsNull()) {
+ // ArtField::ResolveType() may fail as evidenced with a dexing bug (b/78788577).
+ soa.Self()->ClearException();
+ return nullptr; // Failure
+ }
+ resolved_field = resolved_field_handle.Get();
}
- return resolved_field_handle.Get();
+
+ return resolved_field;
}
void HInstructionBuilder::BuildStaticFieldAccess(const Instruction& instruction,