Lines Matching refs:verifier
27 namespace verifier { namespace
31 bool RegisterLine::CheckConstructorReturn(MethodVerifier* verifier) const { in CheckConstructorReturn()
35 const RegType& type = GetRegisterType(verifier, i); in CheckConstructorReturn()
39 << verifier->GetMethodReference().PrettyMethod(); in CheckConstructorReturn()
43 verifier->Fail(VERIFY_ERROR_BAD_CLASS_HARD) in CheckConstructorReturn()
49 const RegType& RegisterLine::GetInvocationThis(MethodVerifier* verifier, const Instruction* inst, in GetInvocationThis() argument
55 verifier->Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invoke lacks 'this'"; in GetInvocationThis()
57 return verifier->GetRegTypeCache()->Conflict(); in GetInvocationThis()
61 const RegType& this_type = GetRegisterType(verifier, this_reg); in GetInvocationThis()
64 verifier->Fail(VERIFY_ERROR_BAD_CLASS_HARD) in GetInvocationThis()
68 return verifier->GetRegTypeCache()->Conflict(); in GetInvocationThis()
73 bool RegisterLine::VerifyRegisterTypeWide(MethodVerifier* verifier, uint32_t vsrc, in VerifyRegisterTypeWide() argument
78 const RegType& src_type = GetRegisterType(verifier, vsrc); in VerifyRegisterTypeWide()
79 if (!check_type1.IsAssignableFrom(src_type, verifier)) { in VerifyRegisterTypeWide()
80 verifier->Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "register v" << vsrc << " has type " << src_type in VerifyRegisterTypeWide()
84 const RegType& src_type_h = GetRegisterType(verifier, vsrc + 1); in VerifyRegisterTypeWide()
86 verifier->Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "wide register v" << vsrc << " has type " in VerifyRegisterTypeWide()
97 void RegisterLine::MarkRefsAsInitialized(MethodVerifier* verifier, const RegType& uninit_type) { in MarkRefsAsInitialized() argument
99 const RegType& init_type = verifier->GetRegTypeCache()->FromUninitialized(uninit_type); in MarkRefsAsInitialized()
102 if (GetRegisterType(verifier, i).Equals(uninit_type)) { in MarkRefsAsInitialized()
115 void RegisterLine::MarkAllRegistersAsConflicts(MethodVerifier* verifier) { in MarkAllRegistersAsConflicts() argument
116 uint16_t conflict_type_id = verifier->GetRegTypeCache()->Conflict().GetId(); in MarkAllRegistersAsConflicts()
122 void RegisterLine::MarkAllRegistersAsConflictsExcept(MethodVerifier* verifier, uint32_t vsrc) { in MarkAllRegistersAsConflictsExcept() argument
123 uint16_t conflict_type_id = verifier->GetRegTypeCache()->Conflict().GetId(); in MarkAllRegistersAsConflictsExcept()
131 void RegisterLine::MarkAllRegistersAsConflictsExceptWide(MethodVerifier* verifier, uint32_t vsrc) { in MarkAllRegistersAsConflictsExceptWide() argument
132 uint16_t conflict_type_id = verifier->GetRegTypeCache()->Conflict().GetId(); in MarkAllRegistersAsConflictsExceptWide()
140 std::string RegisterLine::Dump(MethodVerifier* verifier) const { in Dump()
144 result += GetRegisterType(verifier, i).Dump(); in Dump()
158 void RegisterLine::MarkUninitRefsAsInvalid(MethodVerifier* verifier, const RegType& uninit_type) { in MarkUninitRefsAsInvalid() argument
160 if (GetRegisterType(verifier, i).Equals(uninit_type)) { in MarkUninitRefsAsInvalid()
161 line_[i] = verifier->GetRegTypeCache()->Conflict().GetId(); in MarkUninitRefsAsInvalid()
167 void RegisterLine::CopyResultRegister1(MethodVerifier* verifier, uint32_t vdst, bool is_reference) { in CopyResultRegister1() argument
168 const RegType& type = verifier->GetRegTypeCache()->GetFromId(result_[0]); in CopyResultRegister1()
171 verifier->Fail(VERIFY_ERROR_BAD_CLASS_HARD) in CopyResultRegister1()
174 DCHECK(verifier->GetRegTypeCache()->GetFromId(result_[1]).IsUndefined()); in CopyResultRegister1()
175 SetRegisterType<LockOp::kClear>(verifier, vdst, type); in CopyResultRegister1()
176 result_[0] = verifier->GetRegTypeCache()->Undefined().GetId(); in CopyResultRegister1()
184 void RegisterLine::CopyResultRegister2(MethodVerifier* verifier, uint32_t vdst) { in CopyResultRegister2() argument
185 const RegType& type_l = verifier->GetRegTypeCache()->GetFromId(result_[0]); in CopyResultRegister2()
186 const RegType& type_h = verifier->GetRegTypeCache()->GetFromId(result_[1]); in CopyResultRegister2()
188 verifier->Fail(VERIFY_ERROR_BAD_CLASS_HARD) in CopyResultRegister2()
192 SetRegisterTypeWide(verifier, vdst, type_l, type_h); // also sets the high in CopyResultRegister2()
193 result_[0] = verifier->GetRegTypeCache()->Undefined().GetId(); in CopyResultRegister2()
194 result_[1] = verifier->GetRegTypeCache()->Undefined().GetId(); in CopyResultRegister2()
198 void RegisterLine::CheckUnaryOp(MethodVerifier* verifier, const Instruction* inst, in CheckUnaryOp() argument
200 if (VerifyRegisterType(verifier, inst->VRegB_12x(), src_type)) { in CheckUnaryOp()
201 SetRegisterType<LockOp::kClear>(verifier, inst->VRegA_12x(), dst_type); in CheckUnaryOp()
205 void RegisterLine::CheckUnaryOpWide(MethodVerifier* verifier, const Instruction* inst, in CheckUnaryOpWide() argument
208 if (VerifyRegisterTypeWide(verifier, inst->VRegB_12x(), src_type1, src_type2)) { in CheckUnaryOpWide()
209 SetRegisterTypeWide(verifier, inst->VRegA_12x(), dst_type1, dst_type2); in CheckUnaryOpWide()
213 void RegisterLine::CheckUnaryOpToWide(MethodVerifier* verifier, const Instruction* inst, in CheckUnaryOpToWide() argument
216 if (VerifyRegisterType(verifier, inst->VRegB_12x(), src_type)) { in CheckUnaryOpToWide()
217 SetRegisterTypeWide(verifier, inst->VRegA_12x(), dst_type1, dst_type2); in CheckUnaryOpToWide()
221 void RegisterLine::CheckUnaryOpFromWide(MethodVerifier* verifier, const Instruction* inst, in CheckUnaryOpFromWide() argument
224 if (VerifyRegisterTypeWide(verifier, inst->VRegB_12x(), src_type1, src_type2)) { in CheckUnaryOpFromWide()
225 SetRegisterType<LockOp::kClear>(verifier, inst->VRegA_12x(), dst_type); in CheckUnaryOpFromWide()
229 void RegisterLine::CheckBinaryOp(MethodVerifier* verifier, const Instruction* inst, in CheckBinaryOp() argument
235 if (VerifyRegisterType(verifier, vregB, src_type1) && in CheckBinaryOp()
236 VerifyRegisterType(verifier, vregC, src_type2)) { in CheckBinaryOp()
239 if (GetRegisterType(verifier, vregB).IsBooleanTypes() && in CheckBinaryOp()
240 GetRegisterType(verifier, vregC).IsBooleanTypes()) { in CheckBinaryOp()
241 SetRegisterType<LockOp::kClear>(verifier, in CheckBinaryOp()
243 verifier->GetRegTypeCache()->Boolean()); in CheckBinaryOp()
247 SetRegisterType<LockOp::kClear>(verifier, inst->VRegA_23x(), dst_type); in CheckBinaryOp()
251 void RegisterLine::CheckBinaryOpWide(MethodVerifier* verifier, const Instruction* inst, in CheckBinaryOpWide() argument
255 if (VerifyRegisterTypeWide(verifier, inst->VRegB_23x(), src_type1_1, src_type1_2) && in CheckBinaryOpWide()
256 VerifyRegisterTypeWide(verifier, inst->VRegC_23x(), src_type2_1, src_type2_2)) { in CheckBinaryOpWide()
257 SetRegisterTypeWide(verifier, inst->VRegA_23x(), dst_type1, dst_type2); in CheckBinaryOpWide()
261 void RegisterLine::CheckBinaryOpWideShift(MethodVerifier* verifier, const Instruction* inst, in CheckBinaryOpWideShift() argument
264 if (VerifyRegisterTypeWide(verifier, inst->VRegB_23x(), long_lo_type, long_hi_type) && in CheckBinaryOpWideShift()
265 VerifyRegisterType(verifier, inst->VRegC_23x(), int_type)) { in CheckBinaryOpWideShift()
266 SetRegisterTypeWide(verifier, inst->VRegA_23x(), long_lo_type, long_hi_type); in CheckBinaryOpWideShift()
270 void RegisterLine::CheckBinaryOp2addr(MethodVerifier* verifier, const Instruction* inst, in CheckBinaryOp2addr() argument
275 if (VerifyRegisterType(verifier, vregA, src_type1) && in CheckBinaryOp2addr()
276 VerifyRegisterType(verifier, vregB, src_type2)) { in CheckBinaryOp2addr()
279 if (GetRegisterType(verifier, vregA).IsBooleanTypes() && in CheckBinaryOp2addr()
280 GetRegisterType(verifier, vregB).IsBooleanTypes()) { in CheckBinaryOp2addr()
281 SetRegisterType<LockOp::kClear>(verifier, in CheckBinaryOp2addr()
283 verifier->GetRegTypeCache()->Boolean()); in CheckBinaryOp2addr()
287 SetRegisterType<LockOp::kClear>(verifier, vregA, dst_type); in CheckBinaryOp2addr()
291 void RegisterLine::CheckBinaryOp2addrWide(MethodVerifier* verifier, const Instruction* inst, in CheckBinaryOp2addrWide() argument
297 if (VerifyRegisterTypeWide(verifier, vregA, src_type1_1, src_type1_2) && in CheckBinaryOp2addrWide()
298 VerifyRegisterTypeWide(verifier, vregB, src_type2_1, src_type2_2)) { in CheckBinaryOp2addrWide()
299 SetRegisterTypeWide(verifier, vregA, dst_type1, dst_type2); in CheckBinaryOp2addrWide()
303 void RegisterLine::CheckBinaryOp2addrWideShift(MethodVerifier* verifier, const Instruction* inst, in CheckBinaryOp2addrWideShift() argument
308 if (VerifyRegisterTypeWide(verifier, vregA, long_lo_type, long_hi_type) && in CheckBinaryOp2addrWideShift()
309 VerifyRegisterType(verifier, vregB, int_type)) { in CheckBinaryOp2addrWideShift()
310 SetRegisterTypeWide(verifier, vregA, long_lo_type, long_hi_type); in CheckBinaryOp2addrWideShift()
314 void RegisterLine::CheckLiteralOp(MethodVerifier* verifier, const Instruction* inst, in CheckLiteralOp() argument
319 if (VerifyRegisterType(verifier, vregB, src_type)) { in CheckLiteralOp()
324 if (GetRegisterType(verifier, vregB).IsBooleanTypes() && (val == 0 || val == 1)) { in CheckLiteralOp()
325 SetRegisterType<LockOp::kClear>(verifier, in CheckLiteralOp()
327 verifier->GetRegTypeCache()->Boolean()); in CheckLiteralOp()
331 SetRegisterType<LockOp::kClear>(verifier, vregA, dst_type); in CheckLiteralOp()
337 void RegisterLine::PushMonitor(MethodVerifier* verifier, uint32_t reg_idx, int32_t insn_idx) { in PushMonitor() argument
338 const RegType& reg_type = GetRegisterType(verifier, reg_idx); in PushMonitor()
340 verifier->Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "monitor-enter on non-object (" in PushMonitor()
343 verifier->Fail(VERIFY_ERROR_LOCKING); in PushMonitor()
345 VLOG(verifier) << "monitor-enter stack overflow while verifying " in PushMonitor()
346 << verifier->GetMethodReference().PrettyMethod(); in PushMonitor()
358 verifier->Fail(VERIFY_ERROR_LOCKING); in PushMonitor()
360 VLOG(verifier) << "unexpected monitor-enter on register v" << reg_idx << " in " in PushMonitor()
361 << verifier->GetMethodReference().PrettyMethod(); in PushMonitor()
367 void RegisterLine::PopMonitor(MethodVerifier* verifier, uint32_t reg_idx) { in PopMonitor() argument
368 const RegType& reg_type = GetRegisterType(verifier, reg_idx); in PopMonitor()
370 … verifier->Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "monitor-exit on non-object (" << reg_type << ")"; in PopMonitor()
372 verifier->Fail(VERIFY_ERROR_LOCKING); in PopMonitor()
374 VLOG(verifier) << "monitor-exit stack underflow while verifying " in PopMonitor()
375 << verifier->GetMethodReference().PrettyMethod(); in PopMonitor()
392 verifier->Fail(VERIFY_ERROR_LOCKING); in PopMonitor()
394 VLOG(verifier) << "monitor-exit not unlocking the top of the monitor stack while verifying " in PopMonitor()
395 << verifier->GetMethodReference().PrettyMethod(); in PopMonitor()
430 bool RegisterLine::MergeRegisters(MethodVerifier* verifier, const RegisterLine* incoming_line) { in MergeRegisters() argument
435 const RegType& incoming_reg_type = incoming_line->GetRegisterType(verifier, idx); in MergeRegisters()
436 const RegType& cur_type = GetRegisterType(verifier, idx); in MergeRegisters()
438 incoming_reg_type, verifier->GetRegTypeCache(), verifier); in MergeRegisters()
445 verifier->Fail(VERIFY_ERROR_LOCKING, /*pending_exc=*/ false); in MergeRegisters()
447 VLOG(verifier) << "mismatched stack depths (depth=" << MonitorStackDepth() in MergeRegisters()
449 << verifier->GetMethodReference().PrettyMethod(); in MergeRegisters()
479 verifier->Fail(VERIFY_ERROR_LOCKING, /*pending_exc=*/ false); in MergeRegisters()
481 VLOG(verifier) << "mismatched stack depths for register v" << idx in MergeRegisters()
483 << verifier->GetMethodReference().PrettyMethod(); in MergeRegisters()
520 verifier->Fail(VERIFY_ERROR_LOCKING, /*pending_exc=*/ false); in MergeRegisters()
522 VLOG(verifier) << "mismatched lock levels for register v" << idx << ": " in MergeRegisters()
525 << verifier->GetMethodReference().PrettyMethod(); in MergeRegisters()