summaryrefslogtreecommitdiff
path: root/compiler/optimizing/instruction_builder.cc
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2020-06-16 12:02:45 +0100
committerNicolas Geoffray <ngeoffray@google.com>2020-06-18 15:07:22 +0000
commit396198b6bd6635fff52091131ca5be94cfab1d74 (patch)
tree5f49cc86258bbde5913420c1cb0cc009a8eb456a /compiler/optimizing/instruction_builder.cc
parent0d60a2b1eaa2cd2ec3481e49578b77405353efa1 (diff)
Handle unresolved field type in compiler.
Make behavior consistent with interpreter, by only resolving field types when the stored value is not null. Note that this differs from RI behavior which throws a NoClassDefFoundError when loading the BadField class. Bug: 79751666 Test: 173-missing-field-type Change-Id: I1e584f3129fd651bee1c9635c90bc30e13190a90
Diffstat (limited to 'compiler/optimizing/instruction_builder.cc')
-rw-r--r--compiler/optimizing/instruction_builder.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc
index df236c17c1..cd68b2a7c9 100644
--- a/compiler/optimizing/instruction_builder.cc
+++ b/compiler/optimizing/instruction_builder.cc
@@ -34,6 +34,7 @@
#include "oat_file.h"
#include "optimizing_compiler_stats.h"
#include "quicken_info.h"
+#include "reflective_handle_scope-inl.h"
#include "scoped_thread_state_change-inl.h"
#include "sharpening.h"
#include "ssa_builder.h"
@@ -1934,7 +1935,14 @@ ArtField* HInstructionBuilder::ResolveField(uint16_t field_idx, bool is_static,
return nullptr;
}
- return resolved_field;
+ 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
+ }
+ return resolved_field_handle.Get();
}
void HInstructionBuilder::BuildStaticFieldAccess(const Instruction& instruction,