diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-01-14 14:31:25 -0800 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-01-14 15:25:45 -0800 |
commit | eae2fb27c91aa7972dffcb32d5e405567badd6aa (patch) | |
tree | 07b53346da7531093d9720fb8a5ee218b4a20c6f /runtime/verifier | |
parent | 4289116517f765df84820bf753fbf891986f40ca (diff) | |
download | art-eae2fb27c91aa7972dffcb32d5e405567badd6aa.tar.gz art-eae2fb27c91aa7972dffcb32d5e405567badd6aa.tar.bz2 art-eae2fb27c91aa7972dffcb32d5e405567badd6aa.zip |
Don't resolve types in verifier when we can't load classes.
Added a boolean parameter to GetReturnType which tells us whether or
not we can resolve types. We pass in can_load_classes_.
Bug: 11689500
Change-Id: Ib3d35f441e08c2409ce14ac269854012dc978ddd
Diffstat (limited to 'runtime/verifier')
-rw-r--r-- | runtime/verifier/method_verifier.cc | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index 9a2de47296..d2681dff47 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -2129,13 +2129,13 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) { const RegType* return_type = nullptr; if (called_method != nullptr) { MethodHelper mh(called_method); - mirror::Class* return_type_class = mh.GetReturnType(); + mirror::Class* return_type_class = mh.GetReturnType(can_load_classes_); if (return_type_class != nullptr) { return_type = ®_types_.FromClass(mh.GetReturnTypeDescriptor(), return_type_class, return_type_class->CannotBeAssignedFromOtherTypes()); } else { Thread* self = Thread::Current(); - DCHECK(self->IsExceptionPending()); + DCHECK(!can_load_classes_ || self->IsExceptionPending()); self->ClearException(); } } @@ -3518,10 +3518,14 @@ void MethodVerifier::VerifyISGet(const Instruction* inst, const RegType& insn_ty const RegType* field_type = nullptr; if (field != NULL) { FieldHelper fh(field); - mirror::Class* field_type_class = fh.GetType(false); + mirror::Class* field_type_class = fh.GetType(can_load_classes_); if (field_type_class != nullptr) { field_type = ®_types_.FromClass(fh.GetTypeDescriptor(), field_type_class, field_type_class->CannotBeAssignedFromOtherTypes()); + } else { + Thread* self = Thread::Current(); + DCHECK(!can_load_classes_ || self->IsExceptionPending()); + self->ClearException(); } } if (field_type == nullptr) { @@ -3580,10 +3584,14 @@ void MethodVerifier::VerifyISPut(const Instruction* inst, const RegType& insn_ty return; } FieldHelper fh(field); - mirror::Class* field_type_class = fh.GetType(false); + mirror::Class* field_type_class = fh.GetType(can_load_classes_); if (field_type_class != nullptr) { field_type = ®_types_.FromClass(fh.GetTypeDescriptor(), field_type_class, field_type_class->CannotBeAssignedFromOtherTypes()); + } else { + Thread* self = Thread::Current(); + DCHECK(!can_load_classes_ || self->IsExceptionPending()); + self->ClearException(); } } if (field_type == nullptr) { @@ -3673,12 +3681,15 @@ void MethodVerifier::VerifyIGetQuick(const Instruction* inst, const RegType& ins return; } FieldHelper fh(field); - mirror::Class* field_type_class = fh.GetType(false); + mirror::Class* field_type_class = fh.GetType(can_load_classes_); const RegType* field_type; if (field_type_class != nullptr) { field_type = ®_types_.FromClass(fh.GetTypeDescriptor(), field_type_class, field_type_class->CannotBeAssignedFromOtherTypes()); } else { + Thread* self = Thread::Current(); + DCHECK(!can_load_classes_ || self->IsExceptionPending()); + self->ClearException(); field_type = ®_types_.FromDescriptor(field->GetDeclaringClass()->GetClassLoader(), fh.GetTypeDescriptor(), false); } @@ -3856,13 +3867,13 @@ const RegType& MethodVerifier::GetMethodReturnType() { if (return_type_ == nullptr) { if (mirror_method_ != NULL) { MethodHelper mh(mirror_method_); - mirror::Class* return_type_class = mh.GetReturnType(); + mirror::Class* return_type_class = mh.GetReturnType(can_load_classes_); if (return_type_class != nullptr) { return_type_ = ®_types_.FromClass(mh.GetReturnTypeDescriptor(), return_type_class, return_type_class->CannotBeAssignedFromOtherTypes()); } else { Thread* self = Thread::Current(); - DCHECK(self->IsExceptionPending()); + DCHECK(!can_load_classes_ || self->IsExceptionPending()); self->ClearException(); } } |