diff options
author | Hiroshi Yamauchi <yamauchi@google.com> | 2014-07-30 14:26:22 -0700 |
---|---|---|
committer | Hiroshi Yamauchi <yamauchi@google.com> | 2014-07-31 10:45:47 -0700 |
commit | 7da9586b559290e1c16207c6513ffe485de61655 (patch) | |
tree | 4fb44066c831224dad49430f69aa4edf29aad3da /compiler/dex/verified_method.cc | |
parent | 1175aec5f686b9e3d429282d7d4022c39436f71f (diff) | |
download | art-7da9586b559290e1c16207c6513ffe485de61655.zip art-7da9586b559290e1c16207c6513ffe485de61655.tar.gz art-7da9586b559290e1c16207c6513ffe485de61655.tar.bz2 |
Add read barriers for the roots in the verifier.
Note: Because the roots (the class references in RegType objects) can
be updated by the read barriers, a lot of uses of type "const RegType"
were replaced with "RegType".
Bug: 12687968
Change-Id: I6cf37a87f352938d43fb51560a8d927ada104f50
Diffstat (limited to 'compiler/dex/verified_method.cc')
-rw-r--r-- | compiler/dex/verified_method.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/dex/verified_method.cc b/compiler/dex/verified_method.cc index 01c8f80..1b3f2a1 100644 --- a/compiler/dex/verified_method.cc +++ b/compiler/dex/verified_method.cc @@ -216,7 +216,7 @@ void VerifiedMethod::GenerateDevirtMap(verifier::MethodVerifier* method_verifier verifier::RegisterLine* line = method_verifier->GetRegLine(dex_pc); bool is_range = (inst->Opcode() == Instruction::INVOKE_VIRTUAL_RANGE) || (inst->Opcode() == Instruction::INVOKE_INTERFACE_RANGE); - const verifier::RegType& + verifier::RegType& reg_type(line->GetRegisterType(is_range ? inst->VRegC_3rc() : inst->VRegC_35c())); if (!reg_type.HasClass()) { @@ -284,18 +284,18 @@ void VerifiedMethod::GenerateSafeCastSet(verifier::MethodVerifier* method_verifi const verifier::RegisterLine* line = method_verifier->GetRegLine(dex_pc); bool is_safe_cast = false; if (code == Instruction::CHECK_CAST) { - const verifier::RegType& reg_type(line->GetRegisterType(inst->VRegA_21c())); - const verifier::RegType& cast_type = + verifier::RegType& reg_type(line->GetRegisterType(inst->VRegA_21c())); + verifier::RegType& cast_type = method_verifier->ResolveCheckedClass(inst->VRegB_21c()); is_safe_cast = cast_type.IsStrictlyAssignableFrom(reg_type); } else { - const verifier::RegType& array_type(line->GetRegisterType(inst->VRegB_23x())); + verifier::RegType& array_type(line->GetRegisterType(inst->VRegB_23x())); // We only know its safe to assign to an array if the array type is precise. For example, // an Object[] can have any type of object stored in it, but it may also be assigned a // String[] in which case the stores need to be of Strings. if (array_type.IsPreciseReference()) { - const verifier::RegType& value_type(line->GetRegisterType(inst->VRegA_23x())); - const verifier::RegType& component_type = method_verifier->GetRegTypeCache() + verifier::RegType& value_type(line->GetRegisterType(inst->VRegA_23x())); + verifier::RegType& component_type = method_verifier->GetRegTypeCache() ->GetComponentType(array_type, method_verifier->GetClassLoader()); is_safe_cast = component_type.IsStrictlyAssignableFrom(value_type); } |