verifier: Clean up `RegisterLine::SetRegisterType*()`.
In `RegisterLine::SetRegisterTypeWide()`, replace the pair
check with a DCHECK() as all callers pass valid pairs.
In `RegisterLine::SetRegisterType()`, the non-pair check was
needed only by a single caller (the only one that checked
the return value), so move the check to that caller and use
a DCHECK() instead.
Remove the now unnecessary `verifier` argument from these two
functions and change return type to `void`.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 28313047
Change-Id: Iabeb6fdb61d3bf2713bf7c5a72288fff54a35754
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 102d30d..66b2137 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -1664,15 +1664,14 @@
if (declaring_class.IsJavaLangObject()) {
// "this" is implicitly initialized.
reg_line->SetThisInitialized();
- reg_line->SetRegisterType<LockOp::kClear>(this, arg_start + cur_arg, declaring_class);
+ reg_line->SetRegisterType<LockOp::kClear>(arg_start + cur_arg, declaring_class);
} else {
reg_line->SetRegisterType<LockOp::kClear>(
- this,
arg_start + cur_arg,
reg_types_.UninitializedThisArgument(declaring_class));
}
} else {
- reg_line->SetRegisterType<LockOp::kClear>(this, arg_start + cur_arg, declaring_class);
+ reg_line->SetRegisterType<LockOp::kClear>(arg_start + cur_arg, declaring_class);
}
cur_arg++;
}
@@ -1706,26 +1705,26 @@
DCHECK(HasFailures());
return false;
}
- reg_line->SetRegisterType<LockOp::kClear>(this, arg_start + cur_arg, reg_type);
+ reg_line->SetRegisterType<LockOp::kClear>(arg_start + cur_arg, reg_type);
}
break;
case 'Z':
- reg_line->SetRegisterType<LockOp::kClear>(this, arg_start + cur_arg, reg_types_.Boolean());
+ reg_line->SetRegisterType<LockOp::kClear>(arg_start + cur_arg, reg_types_.Boolean());
break;
case 'C':
- reg_line->SetRegisterType<LockOp::kClear>(this, arg_start + cur_arg, reg_types_.Char());
+ reg_line->SetRegisterType<LockOp::kClear>(arg_start + cur_arg, reg_types_.Char());
break;
case 'B':
- reg_line->SetRegisterType<LockOp::kClear>(this, arg_start + cur_arg, reg_types_.Byte());
+ reg_line->SetRegisterType<LockOp::kClear>(arg_start + cur_arg, reg_types_.Byte());
break;
case 'I':
- reg_line->SetRegisterType<LockOp::kClear>(this, arg_start + cur_arg, reg_types_.Integer());
+ reg_line->SetRegisterType<LockOp::kClear>(arg_start + cur_arg, reg_types_.Integer());
break;
case 'S':
- reg_line->SetRegisterType<LockOp::kClear>(this, arg_start + cur_arg, reg_types_.Short());
+ reg_line->SetRegisterType<LockOp::kClear>(arg_start + cur_arg, reg_types_.Short());
break;
case 'F':
- reg_line->SetRegisterType<LockOp::kClear>(this, arg_start + cur_arg, reg_types_.Float());
+ reg_line->SetRegisterType<LockOp::kClear>(arg_start + cur_arg, reg_types_.Float());
break;
case 'J':
case 'D': {
@@ -1744,7 +1743,7 @@
lo_half = ®_types_.DoubleLo();
hi_half = ®_types_.DoubleHi();
}
- reg_line->SetRegisterTypeWide(this, arg_start + cur_arg, *lo_half, *hi_half);
+ reg_line->SetRegisterTypeWide(arg_start + cur_arg, *lo_half, *hi_half);
cur_arg++;
break;
}
@@ -2188,26 +2187,22 @@
/* could be boolean, int, float, or a null reference */
case Instruction::CONST_4: {
int32_t val = static_cast<int32_t>(inst->VRegB_11n() << 28) >> 28;
- work_line_->SetRegisterType<LockOp::kClear>(
- this, inst->VRegA_11n(), DetermineCat1Constant(val));
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_11n(), DetermineCat1Constant(val));
break;
}
case Instruction::CONST_16: {
int16_t val = static_cast<int16_t>(inst->VRegB_21s());
- work_line_->SetRegisterType<LockOp::kClear>(
- this, inst->VRegA_21s(), DetermineCat1Constant(val));
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_21s(), DetermineCat1Constant(val));
break;
}
case Instruction::CONST: {
int32_t val = inst->VRegB_31i();
- work_line_->SetRegisterType<LockOp::kClear>(
- this, inst->VRegA_31i(), DetermineCat1Constant(val));
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_31i(), DetermineCat1Constant(val));
break;
}
case Instruction::CONST_HIGH16: {
int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
- work_line_->SetRegisterType<LockOp::kClear>(
- this, inst->VRegA_21h(), DetermineCat1Constant(val));
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_21h(), DetermineCat1Constant(val));
break;
}
/* could be long or double; resolved upon use */
@@ -2215,37 +2210,35 @@
int64_t val = static_cast<int16_t>(inst->VRegB_21s());
const RegType& lo = reg_types_.FromCat2ConstLo(static_cast<int32_t>(val), true);
const RegType& hi = reg_types_.FromCat2ConstHi(static_cast<int32_t>(val >> 32), true);
- work_line_->SetRegisterTypeWide(this, inst->VRegA_21s(), lo, hi);
+ work_line_->SetRegisterTypeWide(inst->VRegA_21s(), lo, hi);
break;
}
case Instruction::CONST_WIDE_32: {
int64_t val = static_cast<int32_t>(inst->VRegB_31i());
const RegType& lo = reg_types_.FromCat2ConstLo(static_cast<int32_t>(val), true);
const RegType& hi = reg_types_.FromCat2ConstHi(static_cast<int32_t>(val >> 32), true);
- work_line_->SetRegisterTypeWide(this, inst->VRegA_31i(), lo, hi);
+ work_line_->SetRegisterTypeWide(inst->VRegA_31i(), lo, hi);
break;
}
case Instruction::CONST_WIDE: {
int64_t val = inst->VRegB_51l();
const RegType& lo = reg_types_.FromCat2ConstLo(static_cast<int32_t>(val), true);
const RegType& hi = reg_types_.FromCat2ConstHi(static_cast<int32_t>(val >> 32), true);
- work_line_->SetRegisterTypeWide(this, inst->VRegA_51l(), lo, hi);
+ work_line_->SetRegisterTypeWide(inst->VRegA_51l(), lo, hi);
break;
}
case Instruction::CONST_WIDE_HIGH16: {
int64_t val = static_cast<uint64_t>(inst->VRegB_21h()) << 48;
const RegType& lo = reg_types_.FromCat2ConstLo(static_cast<int32_t>(val), true);
const RegType& hi = reg_types_.FromCat2ConstHi(static_cast<int32_t>(val >> 32), true);
- work_line_->SetRegisterTypeWide(this, inst->VRegA_21h(), lo, hi);
+ work_line_->SetRegisterTypeWide(inst->VRegA_21h(), lo, hi);
break;
}
case Instruction::CONST_STRING:
- work_line_->SetRegisterType<LockOp::kClear>(
- this, inst->VRegA_21c(), reg_types_.JavaLangString());
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_21c(), reg_types_.JavaLangString());
break;
case Instruction::CONST_STRING_JUMBO:
- work_line_->SetRegisterType<LockOp::kClear>(
- this, inst->VRegA_31c(), reg_types_.JavaLangString());
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_31c(), reg_types_.JavaLangString());
break;
case Instruction::CONST_CLASS: {
// Get type from instruction if unresolved then we need an access check
@@ -2253,17 +2246,17 @@
const RegType& res_type = ResolveClass<CheckAccess::kYes>(dex::TypeIndex(inst->VRegB_21c()));
// Register holds class, ie its type is class, on error it will hold Conflict.
work_line_->SetRegisterType<LockOp::kClear>(
- this, inst->VRegA_21c(), res_type.IsConflict() ? res_type
- : reg_types_.JavaLangClass());
+ inst->VRegA_21c(),
+ res_type.IsConflict() ? res_type : reg_types_.JavaLangClass());
break;
}
case Instruction::CONST_METHOD_HANDLE:
work_line_->SetRegisterType<LockOp::kClear>(
- this, inst->VRegA_21c(), reg_types_.JavaLangInvokeMethodHandle());
+ inst->VRegA_21c(), reg_types_.JavaLangInvokeMethodHandle());
break;
case Instruction::CONST_METHOD_TYPE:
work_line_->SetRegisterType<LockOp::kClear>(
- this, inst->VRegA_21c(), reg_types_.JavaLangInvokeMethodType());
+ inst->VRegA_21c(), reg_types_.JavaLangInvokeMethodType());
break;
case Instruction::MONITOR_ENTER:
work_line_->PushMonitor(this, inst->VRegA_11x(), work_insn_idx_);
@@ -2382,9 +2375,7 @@
DCHECK_NE(failures_.size(), 0U);
if (!is_checkcast) {
- work_line_->SetRegisterType<LockOp::kClear>(this,
- inst->VRegA_22c(),
- reg_types_.Boolean());
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_22c(), reg_types_.Boolean());
}
break; // bad class
}
@@ -2413,11 +2404,9 @@
}
} else {
if (is_checkcast) {
- work_line_->SetRegisterType<LockOp::kKeep>(this, inst->VRegA_21c(), res_type);
+ work_line_->SetRegisterType<LockOp::kKeep>(inst->VRegA_21c(), res_type);
} else {
- work_line_->SetRegisterType<LockOp::kClear>(this,
- inst->VRegA_22c(),
- reg_types_.Boolean());
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_22c(), reg_types_.Boolean());
}
}
break;
@@ -2429,9 +2418,7 @@
// ie not an array or null
Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "array-length on non-array " << res_type;
} else {
- work_line_->SetRegisterType<LockOp::kClear>(this,
- inst->VRegA_12x(),
- reg_types_.Integer());
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_12x(), reg_types_.Integer());
}
} else {
Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "array-length on non-array " << res_type;
@@ -2456,7 +2443,7 @@
// initialized must be marked invalid.
work_line_->MarkUninitRefsAsInvalid(this, uninit_type);
// add the new uninitialized reference to the register state
- work_line_->SetRegisterType<LockOp::kClear>(this, inst->VRegA_21c(), uninit_type);
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_21c(), uninit_type);
break;
}
case Instruction::NEW_ARRAY:
@@ -2478,7 +2465,7 @@
if (!work_line_->VerifyRegisterType(this, inst->VRegC_23x(), reg_types_.Float())) {
break;
}
- work_line_->SetRegisterType<LockOp::kClear>(this, inst->VRegA_23x(), reg_types_.Integer());
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_23x(), reg_types_.Integer());
break;
case Instruction::CMPL_DOUBLE:
case Instruction::CMPG_DOUBLE:
@@ -2490,7 +2477,7 @@
reg_types_.DoubleHi())) {
break;
}
- work_line_->SetRegisterType<LockOp::kClear>(this, inst->VRegA_23x(), reg_types_.Integer());
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_23x(), reg_types_.Integer());
break;
case Instruction::CMP_LONG:
if (!work_line_->VerifyRegisterTypeWide(this, inst->VRegB_23x(), reg_types_.LongLo(),
@@ -2501,7 +2488,7 @@
reg_types_.LongHi())) {
break;
}
- work_line_->SetRegisterType<LockOp::kClear>(this, inst->VRegA_23x(), reg_types_.Integer());
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_23x(), reg_types_.Integer());
break;
case Instruction::THROW: {
const RegType& res_type = work_line_->GetRegisterType(this, inst->VRegA_11x());
@@ -2670,9 +2657,7 @@
branch_line.reset(update_line);
}
update_line->CopyFromLine(work_line_.get());
- update_line->SetRegisterType<LockOp::kKeep>(this,
- instance_of_inst.VRegB_22c(),
- cast_type);
+ update_line->SetRegisterType<LockOp::kKeep>(instance_of_inst.VRegB_22c(), cast_type);
if (!GetInstructionFlags(instance_of_idx).IsBranchTarget() && 0 != instance_of_idx) {
// See if instance-of was preceded by a move-object operation, common due to the small
// register encoding space of instance-of, and propagate type information to the source
@@ -2683,13 +2668,13 @@
move_idx--;
}
DCHECK(GetInstructionFlags(move_idx).IsOpcode());
- auto maybe_update_fn = [&instance_of_inst, update_line, this, &cast_type](
+ auto maybe_update_fn = [&instance_of_inst, update_line, &cast_type](
uint16_t move_src,
uint16_t move_trg)
REQUIRES_SHARED(Locks::mutator_lock_) {
if (move_trg == instance_of_inst.VRegB_22c() &&
move_src != instance_of_inst.VRegA_22c()) {
- update_line->SetRegisterType<LockOp::kKeep>(this, move_src, cast_type);
+ update_line->SetRegisterType<LockOp::kKeep>(move_src, cast_type);
}
};
const Instruction& move_inst = code_item_accessor_.InstructionAt(move_idx);
@@ -3739,7 +3724,7 @@
return std::make_pair(true, common_super);
};
auto result = caught_exc_type_fn();
- work_line_->SetRegisterType<LockOp::kClear>(this, inst->VRegA_11x(), *result.second);
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_11x(), *result.second);
return result.first;
}
@@ -4310,7 +4295,7 @@
work_line_->VerifyRegisterType(this, inst->VRegB_22c(), reg_types_.Integer());
/* set register type to array class */
const RegType& precise_type = reg_types_.FromUninitialized(res_type);
- work_line_->SetRegisterType<LockOp::kClear>(this, inst->VRegA_22c(), precise_type);
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_22c(), precise_type);
} else {
DCHECK(!res_type.IsUnresolvedMergedReference());
// Verify each register. If "arg_count" is bad, VerifyRegisterType() will run off the end of
@@ -4348,19 +4333,18 @@
// Null array class; this code path will fail at runtime. Infer a merge-able type from the
// instruction type.
if (!is_primitive) {
- work_line_->SetRegisterType<LockOp::kClear>(this, inst->VRegA_23x(), reg_types_.Null());
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_23x(), reg_types_.Null());
} else if (insn_type.IsInteger()) {
// Pick a non-zero constant (to distinguish with null) that can fit in any primitive.
// We cannot use 'insn_type' as it could be a float array or an int array.
- work_line_->SetRegisterType<LockOp::kClear>(
- this, inst->VRegA_23x(), DetermineCat1Constant(1));
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_23x(), DetermineCat1Constant(1));
} else if (insn_type.IsCategory1Types()) {
// Category 1
// The 'insn_type' is exactly the type we need.
- work_line_->SetRegisterType<LockOp::kClear>(this, inst->VRegA_23x(), insn_type);
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_23x(), insn_type);
} else {
// Category 2
- work_line_->SetRegisterTypeWide(this, inst->VRegA_23x(),
+ work_line_->SetRegisterTypeWide(inst->VRegA_23x(),
reg_types_.FromCat2ConstLo(0, false),
reg_types_.FromCat2ConstHi(0, false));
}
@@ -4375,8 +4359,7 @@
Fail(VERIFY_ERROR_NO_CLASS) << "cannot verify aget for " << array_type
<< " because of missing class";
// Approximate with java.lang.Object[].
- work_line_->SetRegisterType<LockOp::kClear>(this,
- inst->VRegA_23x(),
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_23x(),
reg_types_.JavaLangObject(false));
}
} else {
@@ -4398,9 +4381,9 @@
// instruction, which can't differentiate object types and ints from floats, longs from
// doubles.
if (!component_type.IsLowHalf()) {
- work_line_->SetRegisterType<LockOp::kClear>(this, inst->VRegA_23x(), component_type);
+ work_line_->SetRegisterType<LockOp::kClear>(inst->VRegA_23x(), component_type);
} else {
- work_line_->SetRegisterTypeWide(this, inst->VRegA_23x(), component_type,
+ work_line_->SetRegisterTypeWide(inst->VRegA_23x(), component_type,
component_type.HighHalf(®_types_));
}
}
@@ -4815,15 +4798,15 @@
<< "' but found type '" << *field_type
<< "' in get-object";
if (error != VERIFY_ERROR_BAD_CLASS_HARD) {
- work_line_->SetRegisterType<LockOp::kClear>(this, vregA, reg_types_.Conflict());
+ work_line_->SetRegisterType<LockOp::kClear>(vregA, reg_types_.Conflict());
}
return;
}
}
if (!field_type->IsLowHalf()) {
- work_line_->SetRegisterType<LockOp::kClear>(this, vregA, *field_type);
+ work_line_->SetRegisterType<LockOp::kClear>(vregA, *field_type);
} else {
- work_line_->SetRegisterTypeWide(this, vregA, *field_type, field_type->HighHalf(®_types_));
+ work_line_->SetRegisterTypeWide(vregA, *field_type, field_type->HighHalf(®_types_));
}
} else {
LOG(FATAL) << "Unexpected case.";
diff --git a/runtime/verifier/register_line-inl.h b/runtime/verifier/register_line-inl.h
index cacd2fd..6b53687 100644
--- a/runtime/verifier/register_line-inl.h
+++ b/runtime/verifier/register_line-inl.h
@@ -38,18 +38,13 @@
}
template <LockOp kLockOp>
-inline bool RegisterLine::SetRegisterType(MethodVerifier* verifier, uint32_t vdst,
- const RegType& new_type) {
+inline void RegisterLine::SetRegisterType(uint32_t vdst, const RegType& new_type) {
DCHECK_LT(vdst, num_regs_);
- if (new_type.IsLowHalf() || new_type.IsHighHalf()) {
- verifier->Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Expected category1 register type not '"
- << new_type << "'";
- return false;
- } else {
- // Note: previously we failed when asked to set a conflict. However, conflicts are OK as long
- // as they are not accessed, and our backends can handle this nowadays.
- line_[vdst] = new_type.GetId();
- }
+ DCHECK(!new_type.IsLowHalf());
+ DCHECK(!new_type.IsHighHalf());
+ // Note: previously we failed when asked to set a conflict. However, conflicts are OK as long
+ // as they are not accessed, and our backends can handle this nowadays.
+ line_[vdst] = new_type.GetId();
switch (kLockOp) {
case LockOp::kClear:
// Clear the monitor entry bits for this register.
@@ -60,25 +55,18 @@
DCHECK(new_type.IsReferenceTypes());
break;
}
- return true;
}
-inline bool RegisterLine::SetRegisterTypeWide(MethodVerifier* verifier, uint32_t vdst,
+inline void RegisterLine::SetRegisterTypeWide(uint32_t vdst,
const RegType& new_type1,
const RegType& new_type2) {
DCHECK_LT(vdst + 1, num_regs_);
- if (!new_type1.CheckWidePair(new_type2)) {
- verifier->Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Invalid wide pair '"
- << new_type1 << "' '" << new_type2 << "'";
- return false;
- } else {
- line_[vdst] = new_type1.GetId();
- line_[vdst + 1] = new_type2.GetId();
- }
+ DCHECK(new_type1.CheckWidePair(new_type2));
+ line_[vdst] = new_type1.GetId();
+ line_[vdst + 1] = new_type2.GetId();
// Clear the monitor entry bits for this register.
ClearAllRegToLockDepths(vdst);
ClearAllRegToLockDepths(vdst + 1);
- return true;
}
inline void RegisterLine::SetResultTypeToUnknown(RegTypeCache* reg_types) {
@@ -104,9 +92,12 @@
TypeCategory cat) {
DCHECK(cat == kTypeCategory1nr || cat == kTypeCategoryRef);
const RegType& type = GetRegisterType(verifier, vsrc);
- if (!SetRegisterType<LockOp::kClear>(verifier, vdst, type)) {
+ if (type.IsLowHalf() || type.IsHighHalf()) {
+ verifier->Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Expected category1 register type not '"
+ << type << "'";
return;
}
+ SetRegisterType<LockOp::kClear>(vdst, type);
if (!type.IsConflict() && // Allow conflicts to be copied around.
((cat == kTypeCategory1nr && !type.IsCategory1Types()) ||
(cat == kTypeCategoryRef && !type.IsReferenceTypes()))) {
@@ -125,7 +116,7 @@
verifier->Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "copy2 v" << vdst << "<-v" << vsrc
<< " type=" << type_l << "/" << type_h;
} else {
- SetRegisterTypeWide(verifier, vdst, type_l, type_h);
+ SetRegisterTypeWide(vdst, type_l, type_h);
}
}
diff --git a/runtime/verifier/register_line.cc b/runtime/verifier/register_line.cc
index b69267c..0e9e0d4 100644
--- a/runtime/verifier/register_line.cc
+++ b/runtime/verifier/register_line.cc
@@ -172,7 +172,7 @@
<< "copyRes1 v" << vdst << "<- result0" << " type=" << type;
} else {
DCHECK(verifier->GetRegTypeCache()->GetFromId(result_[1]).IsUndefined());
- SetRegisterType<LockOp::kClear>(verifier, vdst, type);
+ SetRegisterType<LockOp::kClear>(vdst, type);
result_[0] = verifier->GetRegTypeCache()->Undefined().GetId();
}
}
@@ -189,7 +189,7 @@
<< "copyRes2 v" << vdst << "<- result0" << " type=" << type_l;
} else {
DCHECK(type_l.CheckWidePair(type_h)); // Set should never allow this case
- SetRegisterTypeWide(verifier, vdst, type_l, type_h); // also sets the high
+ SetRegisterTypeWide(vdst, type_l, type_h); // also sets the high
result_[0] = verifier->GetRegTypeCache()->Undefined().GetId();
result_[1] = verifier->GetRegTypeCache()->Undefined().GetId();
}
@@ -198,7 +198,7 @@
void RegisterLine::CheckUnaryOp(MethodVerifier* verifier, const Instruction* inst,
const RegType& dst_type, const RegType& src_type) {
if (VerifyRegisterType(verifier, inst->VRegB_12x(), src_type)) {
- SetRegisterType<LockOp::kClear>(verifier, inst->VRegA_12x(), dst_type);
+ SetRegisterType<LockOp::kClear>(inst->VRegA_12x(), dst_type);
}
}
@@ -206,7 +206,7 @@
const RegType& dst_type1, const RegType& dst_type2,
const RegType& src_type1, const RegType& src_type2) {
if (VerifyRegisterTypeWide(verifier, inst->VRegB_12x(), src_type1, src_type2)) {
- SetRegisterTypeWide(verifier, inst->VRegA_12x(), dst_type1, dst_type2);
+ SetRegisterTypeWide(inst->VRegA_12x(), dst_type1, dst_type2);
}
}
@@ -214,7 +214,7 @@
const RegType& dst_type1, const RegType& dst_type2,
const RegType& src_type) {
if (VerifyRegisterType(verifier, inst->VRegB_12x(), src_type)) {
- SetRegisterTypeWide(verifier, inst->VRegA_12x(), dst_type1, dst_type2);
+ SetRegisterTypeWide(inst->VRegA_12x(), dst_type1, dst_type2);
}
}
@@ -222,7 +222,7 @@
const RegType& dst_type,
const RegType& src_type1, const RegType& src_type2) {
if (VerifyRegisterTypeWide(verifier, inst->VRegB_12x(), src_type1, src_type2)) {
- SetRegisterType<LockOp::kClear>(verifier, inst->VRegA_12x(), dst_type);
+ SetRegisterType<LockOp::kClear>(inst->VRegA_12x(), dst_type);
}
}
@@ -238,13 +238,11 @@
DCHECK(dst_type.IsInteger());
if (GetRegisterType(verifier, vregB).IsBooleanTypes() &&
GetRegisterType(verifier, vregC).IsBooleanTypes()) {
- SetRegisterType<LockOp::kClear>(verifier,
- inst->VRegA_23x(),
- verifier->GetRegTypeCache()->Boolean());
+ SetRegisterType<LockOp::kClear>(inst->VRegA_23x(), verifier->GetRegTypeCache()->Boolean());
return;
}
}
- SetRegisterType<LockOp::kClear>(verifier, inst->VRegA_23x(), dst_type);
+ SetRegisterType<LockOp::kClear>(inst->VRegA_23x(), dst_type);
}
}
@@ -254,7 +252,7 @@
const RegType& src_type2_1, const RegType& src_type2_2) {
if (VerifyRegisterTypeWide(verifier, inst->VRegB_23x(), src_type1_1, src_type1_2) &&
VerifyRegisterTypeWide(verifier, inst->VRegC_23x(), src_type2_1, src_type2_2)) {
- SetRegisterTypeWide(verifier, inst->VRegA_23x(), dst_type1, dst_type2);
+ SetRegisterTypeWide(inst->VRegA_23x(), dst_type1, dst_type2);
}
}
@@ -263,7 +261,7 @@
const RegType& int_type) {
if (VerifyRegisterTypeWide(verifier, inst->VRegB_23x(), long_lo_type, long_hi_type) &&
VerifyRegisterType(verifier, inst->VRegC_23x(), int_type)) {
- SetRegisterTypeWide(verifier, inst->VRegA_23x(), long_lo_type, long_hi_type);
+ SetRegisterTypeWide(inst->VRegA_23x(), long_lo_type, long_hi_type);
}
}
@@ -278,13 +276,11 @@
DCHECK(dst_type.IsInteger());
if (GetRegisterType(verifier, vregA).IsBooleanTypes() &&
GetRegisterType(verifier, vregB).IsBooleanTypes()) {
- SetRegisterType<LockOp::kClear>(verifier,
- vregA,
- verifier->GetRegTypeCache()->Boolean());
+ SetRegisterType<LockOp::kClear>(vregA, verifier->GetRegTypeCache()->Boolean());
return;
}
}
- SetRegisterType<LockOp::kClear>(verifier, vregA, dst_type);
+ SetRegisterType<LockOp::kClear>(vregA, dst_type);
}
}
@@ -296,7 +292,7 @@
const uint32_t vregB = inst->VRegB_12x();
if (VerifyRegisterTypeWide(verifier, vregA, src_type1_1, src_type1_2) &&
VerifyRegisterTypeWide(verifier, vregB, src_type2_1, src_type2_2)) {
- SetRegisterTypeWide(verifier, vregA, dst_type1, dst_type2);
+ SetRegisterTypeWide(vregA, dst_type1, dst_type2);
}
}
@@ -307,7 +303,7 @@
const uint32_t vregB = inst->VRegB_12x();
if (VerifyRegisterTypeWide(verifier, vregA, long_lo_type, long_hi_type) &&
VerifyRegisterType(verifier, vregB, int_type)) {
- SetRegisterTypeWide(verifier, vregA, long_lo_type, long_hi_type);
+ SetRegisterTypeWide(vregA, long_lo_type, long_hi_type);
}
}
@@ -322,13 +318,11 @@
/* check vB with the call, then check the constant manually */
const uint32_t val = is_lit16 ? inst->VRegC_22s() : inst->VRegC_22b();
if (GetRegisterType(verifier, vregB).IsBooleanTypes() && (val == 0 || val == 1)) {
- SetRegisterType<LockOp::kClear>(verifier,
- vregA,
- verifier->GetRegTypeCache()->Boolean());
+ SetRegisterType<LockOp::kClear>(vregA, verifier->GetRegTypeCache()->Boolean());
return;
}
}
- SetRegisterType<LockOp::kClear>(verifier, vregA, dst_type);
+ SetRegisterType<LockOp::kClear>(vregA, dst_type);
}
}
diff --git a/runtime/verifier/register_line.h b/runtime/verifier/register_line.h
index fd8edec..3db1efb 100644
--- a/runtime/verifier/register_line.h
+++ b/runtime/verifier/register_line.h
@@ -112,13 +112,10 @@
// available now. An example is sharpening types after a check-cast. Note that when given kKeep,
// the new_type is dchecked to be a reference type.
template <LockOp kLockOp>
- ALWAYS_INLINE bool SetRegisterType(MethodVerifier* verifier,
- uint32_t vdst,
- const RegType& new_type)
+ ALWAYS_INLINE void SetRegisterType(uint32_t vdst, const RegType& new_type)
REQUIRES_SHARED(Locks::mutator_lock_);
- bool SetRegisterTypeWide(MethodVerifier* verifier,
- uint32_t vdst,
+ void SetRegisterTypeWide(uint32_t vdst,
const RegType& new_type1,
const RegType& new_type2)
REQUIRES_SHARED(Locks::mutator_lock_);