diff options
-rw-r--r-- | runtime/verifier/method_verifier.cc | 15 | ||||
-rw-r--r-- | runtime/verifier/reg_type_test.cc | 6 |
2 files changed, 12 insertions, 9 deletions
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index fb2d29f..21e3e44 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -3377,7 +3377,7 @@ void MethodVerifier::VerifyPrimitivePut(const RegType& target_type, const RegTyp } void MethodVerifier::VerifyAPut(const Instruction* inst, - const RegType& insn_type, bool is_primitive) { + const RegType& insn_type, bool is_primitive) { const RegType& index_type = work_line_->GetRegisterType(inst->VRegC_23x()); if (!index_type.IsArrayIndexTypes()) { Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Invalid reg type for array index (" << index_type << ")"; @@ -3533,6 +3533,7 @@ void MethodVerifier::VerifyISGet(const Instruction* inst, const RegType& insn_ty const char* descriptor = dex_file_->GetFieldTypeDescriptor(field_id); field_type = ®_types_.FromDescriptor(class_loader_->get(), descriptor, false); } + DCHECK(field_type != nullptr); const uint32_t vregA = (is_static) ? inst->VRegA_21c() : inst->VRegA_22c(); if (is_primitive) { if (field_type->Equals(insn_type) || @@ -3546,14 +3547,14 @@ void MethodVerifier::VerifyISGet(const Instruction* inst, const RegType& insn_ty // compile time Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "expected field " << PrettyField(field) << " to be of type '" << insn_type - << "' but found type '" << field_type << "' in get"; + << "' but found type '" << *field_type << "' in get"; return; } } else { if (!insn_type.IsAssignableFrom(*field_type)) { Fail(VERIFY_ERROR_BAD_CLASS_SOFT) << "expected field " << PrettyField(field) << " to be compatible with type '" << insn_type - << "' but found type '" << field_type + << "' but found type '" << *field_type << "' in get-object"; work_line_->SetRegisterType(vregA, reg_types_.Conflict()); return; @@ -3599,6 +3600,7 @@ void MethodVerifier::VerifyISPut(const Instruction* inst, const RegType& insn_ty const char* descriptor = dex_file_->GetFieldTypeDescriptor(field_id); field_type = ®_types_.FromDescriptor(class_loader_->get(), descriptor, false); } + DCHECK(field_type != nullptr); const uint32_t vregA = (is_static) ? inst->VRegA_21c() : inst->VRegA_22c(); if (is_primitive) { VerifyPrimitivePut(*field_type, insn_type, vregA); @@ -3606,7 +3608,7 @@ void MethodVerifier::VerifyISPut(const Instruction* inst, const RegType& insn_ty if (!insn_type.IsAssignableFrom(*field_type)) { Fail(VERIFY_ERROR_BAD_CLASS_SOFT) << "expected field " << PrettyField(field) << " to be compatible with type '" << insn_type - << "' but found type '" << field_type + << "' but found type '" << *field_type << "' in put-object"; return; } @@ -3692,6 +3694,7 @@ void MethodVerifier::VerifyIGetQuick(const Instruction* inst, const RegType& ins field_type = ®_types_.FromDescriptor(field->GetDeclaringClass()->GetClassLoader(), fh.GetTypeDescriptor(), false); } + DCHECK(field_type != nullptr); const uint32_t vregA = inst->VRegA_22c(); if (is_primitive) { if (field_type->Equals(insn_type) || @@ -3705,14 +3708,14 @@ void MethodVerifier::VerifyIGetQuick(const Instruction* inst, const RegType& ins // compile time Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "expected field " << PrettyField(field) << " to be of type '" << insn_type - << "' but found type '" << field_type << "' in get"; + << "' but found type '" << *field_type << "' in get"; return; } } else { if (!insn_type.IsAssignableFrom(*field_type)) { Fail(VERIFY_ERROR_BAD_CLASS_SOFT) << "expected field " << PrettyField(field) << " to be compatible with type '" << insn_type - << "' but found type '" << field_type + << "' but found type '" << *field_type << "' in get-object"; work_line_->SetRegisterType(vregA, reg_types_.Conflict()); return; diff --git a/runtime/verifier/reg_type_test.cc b/runtime/verifier/reg_type_test.cc index 1695fc5..1935a5b 100644 --- a/runtime/verifier/reg_type_test.cc +++ b/runtime/verifier/reg_type_test.cc @@ -471,7 +471,7 @@ TEST_F(RegTypeReferenceTest, Merging) { EXPECT_EQ(ref_type_1.GetId(), *((++merged_ids.begin()))); } -TEST_F(RegTypeReferenceTest, MergingFloat) { +TEST_F(RegTypeTest, MergingFloat) { // Testing merging logic with float and float constants. ScopedObjectAccess soa(Thread::Current()); RegTypeCache cache_new(true); @@ -502,7 +502,7 @@ TEST_F(RegTypeReferenceTest, MergingFloat) { } } -TEST_F(RegTypeReferenceTest, MergingLong) { +TEST_F(RegTypeTest, MergingLong) { // Testing merging logic with long and long constants. ScopedObjectAccess soa(Thread::Current()); RegTypeCache cache_new(true); @@ -556,7 +556,7 @@ TEST_F(RegTypeReferenceTest, MergingLong) { } } -TEST_F(RegTypeReferenceTest, MergingDouble) { +TEST_F(RegTypeTest, MergingDouble) { // Testing merging logic with double and double constants. ScopedObjectAccess soa(Thread::Current()); RegTypeCache cache_new(true); |