summaryrefslogtreecommitdiff
path: root/compiler/optimizing/instruction_builder.cc
diff options
context:
space:
mode:
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,