summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2013-07-26 10:37:43 -0700
committerBrian Carlstrom <bdc@google.com>2013-07-26 10:37:43 -0700
commit93c3396f8b33539489763ebdfafcedb4127009d9 (patch)
treeee31a41dc2365cd1bca83ee8b435bc5c6f1ca909
parent7a40f059c9d118c0d94716358297bd61bc6d1bf3 (diff)
downloadandroid_art-93c3396f8b33539489763ebdfafcedb4127009d9.tar.gz
android_art-93c3396f8b33539489763ebdfafcedb4127009d9.tar.bz2
android_art-93c3396f8b33539489763ebdfafcedb4127009d9.zip
Fix style issues in MethodVerifier
Change-Id: I3aa5929311863e40840acebc5efafecb949fdea5
-rw-r--r--runtime/verifier/method_verifier.cc207
1 files changed, 146 insertions, 61 deletions
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 3549945a4c..9948e00acc 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -102,7 +102,11 @@ MethodVerifier::FailureKind MethodVerifier::VerifyClass(const mirror::Class* kla
error += dex_file.GetLocation();
return kHardFailure;
}
- return VerifyClass(&dex_file, kh.GetDexCache(), klass->GetClassLoader(), class_def_idx, error, allow_soft_failures);
+ return VerifyClass(&dex_file,
+ kh.GetDexCache(),
+ klass->GetClassLoader(),
+ class_def_idx, error,
+ allow_soft_failures);
}
MethodVerifier::FailureKind MethodVerifier::VerifyClass(const DexFile* dex_file,
@@ -142,8 +146,15 @@ MethodVerifier::FailureKind MethodVerifier::VerifyClass(const DexFile* dex_file,
// We couldn't resolve the method, but continue regardless.
Thread::Current()->ClearException();
}
- MethodVerifier::FailureKind result = VerifyMethod(method_idx, dex_file, dex_cache, class_loader,
- class_def_idx, it.GetMethodCodeItem(), method, it.GetMemberAccessFlags(), allow_soft_failures);
+ MethodVerifier::FailureKind result = VerifyMethod(method_idx,
+ dex_file,
+ dex_cache,
+ class_loader,
+ class_def_idx,
+ it.GetMethodCodeItem(),
+ method,
+ it.GetMemberAccessFlags(),
+ allow_soft_failures);
if (result != kNoFailure) {
if (result == kHardFailure) {
hard_fail = true;
@@ -177,8 +188,15 @@ MethodVerifier::FailureKind MethodVerifier::VerifyClass(const DexFile* dex_file,
// We couldn't resolve the method, but continue regardless.
Thread::Current()->ClearException();
}
- MethodVerifier::FailureKind result = VerifyMethod(method_idx, dex_file, dex_cache, class_loader,
- class_def_idx, it.GetMethodCodeItem(), method, it.GetMemberAccessFlags(), allow_soft_failures);
+ MethodVerifier::FailureKind result = VerifyMethod(method_idx,
+ dex_file,
+ dex_cache,
+ class_loader,
+ class_def_idx,
+ it.GetMethodCodeItem(),
+ method,
+ it.GetMemberAccessFlags(),
+ allow_soft_failures);
if (result != kNoFailure) {
if (result == kHardFailure) {
hard_fail = true;
@@ -515,7 +533,8 @@ bool MethodVerifier::ScanTryCatchBlocks() {
return false;
}
if (!insn_flags_[start].IsOpcode()) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "'try' block starts inside an instruction (" << start << ")";
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD)
+ << "'try' block starts inside an instruction (" << start << ")";
return false;
}
for (uint32_t dex_pc = start; dex_pc < end;
@@ -532,7 +551,8 @@ bool MethodVerifier::ScanTryCatchBlocks() {
for (; iterator.HasNext(); iterator.Next()) {
uint32_t dex_pc= iterator.GetHandlerAddress();
if (!insn_flags_[dex_pc].IsOpcode()) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "exception handler starts at bad address (" << dex_pc << ")";
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD)
+ << "exception handler starts at bad address (" << dex_pc << ")";
return false;
}
const Instruction* inst = Instruction::At(code_item_->insns_ + dex_pc);
@@ -744,11 +764,13 @@ bool MethodVerifier::CheckNewArray(uint32_t idx) {
}
if (bracket_count == 0) {
/* The given class must be an array type. */
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "can't new-array class '" << descriptor << "' (not an array)";
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD)
+ << "can't new-array class '" << descriptor << "' (not an array)";
return false;
} else if (bracket_count > 255) {
/* It is illegal to create an array of more than 255 dimensions. */
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "can't new-array class '" << descriptor << "' (exceeds limit)";
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD)
+ << "can't new-array class '" << descriptor << "' (exceeds limit)";
return false;
}
return true;
@@ -766,7 +788,8 @@ bool MethodVerifier::CheckArrayData(uint32_t cur_offset) {
if ((int32_t) cur_offset + array_data_offset < 0 ||
cur_offset + array_data_offset + 2 >= insn_count) {
Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invalid array data start: at " << cur_offset
- << ", data offset " << array_data_offset << ", count " << insn_count;
+ << ", data offset " << array_data_offset
+ << ", count " << insn_count;
return false;
}
/* offset to array data table is a relative branch-style offset */
@@ -798,18 +821,22 @@ bool MethodVerifier::CheckBranchTarget(uint32_t cur_offset) {
return false;
}
if (!selfOkay && offset == 0) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "branch offset of zero not allowed at" << reinterpret_cast<void*>(cur_offset);
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "branch offset of zero not allowed at"
+ << reinterpret_cast<void*>(cur_offset);
return false;
}
// Check for 32-bit overflow. This isn't strictly necessary if we can depend on the runtime
// to have identical "wrap-around" behavior, but it's unwise to depend on that.
if (((int64_t) cur_offset + (int64_t) offset) != (int64_t) (cur_offset + offset)) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "branch target overflow " << reinterpret_cast<void*>(cur_offset) << " +" << offset;
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "branch target overflow "
+ << reinterpret_cast<void*>(cur_offset) << " +" << offset;
return false;
}
const uint32_t insn_count = code_item_->insns_size_in_code_units_;
int32_t abs_offset = cur_offset + offset;
- if (abs_offset < 0 || (uint32_t) abs_offset >= insn_count || !insn_flags_[abs_offset].IsOpcode()) {
+ if (abs_offset < 0 ||
+ (uint32_t) abs_offset >= insn_count ||
+ !insn_flags_[abs_offset].IsOpcode()) {
Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invalid branch target " << offset << " (-> "
<< reinterpret_cast<void*>(abs_offset) << ") at "
<< reinterpret_cast<void*>(cur_offset);
@@ -865,7 +892,8 @@ bool MethodVerifier::CheckSwitchTargets(uint32_t cur_offset) {
int32_t switch_offset = insns[1] | ((int32_t) insns[2]) << 16;
if ((int32_t) cur_offset + switch_offset < 0 || cur_offset + switch_offset + 2 >= insn_count) {
Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invalid switch start: at " << cur_offset
- << ", switch offset " << switch_offset << ", count " << insn_count;
+ << ", switch offset " << switch_offset
+ << ", count " << insn_count;
return false;
}
/* offset to switch table is a relative branch-style offset */
@@ -892,15 +920,16 @@ bool MethodVerifier::CheckSwitchTargets(uint32_t cur_offset) {
}
uint32_t table_size = targets_offset + switch_count * 2;
if (switch_insns[0] != expected_signature) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << StringPrintf("wrong signature for switch table (%x, wanted %x)",
- switch_insns[0], expected_signature);
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD)
+ << StringPrintf("wrong signature for switch table (%x, wanted %x)",
+ switch_insns[0], expected_signature);
return false;
}
/* make sure the end of the switch is in range */
if (cur_offset + switch_offset + table_size > (uint32_t) insn_count) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invalid switch end: at " << cur_offset << ", switch offset "
- << switch_offset << ", end "
- << (cur_offset + switch_offset + table_size)
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invalid switch end: at " << cur_offset
+ << ", switch offset " << switch_offset
+ << ", end " << (cur_offset + switch_offset + table_size)
<< ", count " << insn_count;
return false;
}
@@ -923,10 +952,13 @@ bool MethodVerifier::CheckSwitchTargets(uint32_t cur_offset) {
int32_t offset = (int32_t) switch_insns[targets_offset + targ * 2] |
(int32_t) (switch_insns[targets_offset + targ * 2 + 1] << 16);
int32_t abs_offset = cur_offset + offset;
- if (abs_offset < 0 || abs_offset >= (int32_t) insn_count || !insn_flags_[abs_offset].IsOpcode()) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invalid switch target " << offset << " (-> "
- << reinterpret_cast<void*>(abs_offset) << ") at "
- << reinterpret_cast<void*>(cur_offset) << "[" << targ << "]";
+ if (abs_offset < 0 ||
+ abs_offset >= (int32_t) insn_count ||
+ !insn_flags_[abs_offset].IsOpcode()) {
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invalid switch target " << offset
+ << " (-> " << reinterpret_cast<void*>(abs_offset) << ") at "
+ << reinterpret_cast<void*>(cur_offset)
+ << "[" << targ << "]";
return false;
}
insn_flags_[abs_offset].SetBranchTarget();
@@ -956,14 +988,15 @@ bool MethodVerifier::CheckVarArgRangeRegs(uint32_t vA, uint32_t vC) {
// vA/vC are unsigned 8-bit/16-bit quantities for /range instructions, so there's no risk of
// integer overflow when adding them here.
if (vA + vC > registers_size) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invalid reg index " << vA << "+" << vC << " in range invoke (> "
- << registers_size << ")";
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invalid reg index " << vA << "+" << vC
+ << " in range invoke (> " << registers_size << ")";
return false;
}
return true;
}
-static const std::vector<uint8_t>* CreateLengthPrefixedDexGcMap(const std::vector<uint8_t>& gc_map) {
+static const std::vector<uint8_t>* CreateLengthPrefixedDexGcMap(
+ const std::vector<uint8_t>& gc_map) {
std::vector<uint8_t>* length_prefixed_gc_map = new std::vector<uint8_t>;
length_prefixed_gc_map->reserve(gc_map.size() + 4);
length_prefixed_gc_map->push_back((gc_map.size() & 0xff000000) >> 24);
@@ -991,7 +1024,11 @@ bool MethodVerifier::VerifyCodeFlow() {
<< " insns_size=" << insns_size << ")";
}
/* Create and initialize table holding register status */
- reg_table_.Init(kTrackCompilerInterestPoints, insn_flags_.get(), insns_size, registers_size, this);
+ reg_table_.Init(kTrackCompilerInterestPoints,
+ insn_flags_.get(),
+ insns_size,
+ registers_size,
+ this);
work_line_.reset(new RegisterLine(registers_size, this));
@@ -1031,14 +1068,14 @@ bool MethodVerifier::VerifyCodeFlow() {
if (has_check_casts_) {
MethodVerifier::MethodSafeCastSet* method_to_safe_casts = GenerateSafeCastSet();
- if(method_to_safe_casts != NULL ) {
+ if (method_to_safe_casts != NULL) {
SetSafeCastMap(ref, method_to_safe_casts);
}
}
if (has_virtual_or_interface_invokes_) {
MethodVerifier::PcToConcreteMethodMap* pc_to_concrete_method = GenerateDevirtMap();
- if(pc_to_concrete_method != NULL ) {
+ if (pc_to_concrete_method != NULL) {
SetDevirtMap(ref, pc_to_concrete_method);
}
}
@@ -1181,13 +1218,15 @@ bool MethodVerifier::SetTypesFromSignature() {
break;
}
default:
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "unexpected signature type char '" << descriptor << "'";
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "unexpected signature type char '"
+ << descriptor << "'";
return false;
}
cur_arg++;
}
if (cur_arg != expected_args) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "expected " << expected_args << " arguments, found " << cur_arg;
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "expected " << expected_args
+ << " arguments, found " << cur_arg;
return false;
}
const char* descriptor = dex_file_->GetReturnTypeDescriptor(proto_id);
@@ -1321,12 +1360,14 @@ bool MethodVerifier::CodeFlowVerifyMethod() {
if (dead_start < 0)
dead_start = insn_idx;
} else if (dead_start >= 0) {
- LogVerifyInfo() << "dead code " << reinterpret_cast<void*>(dead_start) << "-" << reinterpret_cast<void*>(insn_idx - 1);
+ LogVerifyInfo() << "dead code " << reinterpret_cast<void*>(dead_start)
+ << "-" << reinterpret_cast<void*>(insn_idx - 1);
dead_start = -1;
}
}
if (dead_start >= 0) {
- LogVerifyInfo() << "dead code " << reinterpret_cast<void*>(dead_start) << "-" << reinterpret_cast<void*>(insn_idx - 1);
+ LogVerifyInfo() << "dead code " << reinterpret_cast<void*>(dead_start)
+ << "-" << reinterpret_cast<void*>(insn_idx - 1);
}
// To dump the state of the verify after a method, do something like:
// if (PrettyMethod(dex_method_idx_, *dex_file_) ==
@@ -1483,7 +1524,8 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) {
/* check the method signature */
const RegType& return_type = GetMethodReturnType();
if (!return_type.IsCategory1Types()) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "unexpected non-category 1 return type " << return_type;
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "unexpected non-category 1 return type "
+ << return_type;
} else {
// Compilers may generate synthetic functions that write byte values into boolean fields.
// Also, it may use integer values for boolean, byte, short, and character return types.
@@ -1532,10 +1574,14 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) {
// Disallow returning uninitialized values and verify that the reference in vAA is an
// instance of the "return_type"
if (reg_type.IsUninitializedTypes()) {
- Fail(VERIFY_ERROR_BAD_CLASS_SOFT) << "returning uninitialized object '" << reg_type << "'";
+ Fail(VERIFY_ERROR_BAD_CLASS_SOFT) << "returning uninitialized object '"
+ << reg_type << "'";
} else if (!return_type.IsAssignableFrom(reg_type)) {
- Fail(reg_type.IsUnresolvedTypes() ? VERIFY_ERROR_BAD_CLASS_SOFT : VERIFY_ERROR_BAD_CLASS_HARD)
- << "returning '" << reg_type << "', but expected from declaration '" << return_type << "'";
+ Fail(reg_type.IsUnresolvedTypes() ?
+ VERIFY_ERROR_BAD_CLASS_SOFT :
+ VERIFY_ERROR_BAD_CLASS_HARD)
+ << "returning '" << reg_type << "', but expected from declaration '"
+ << return_type << "'";
}
}
}
@@ -1755,7 +1801,8 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) {
case Instruction::THROW: {
const RegType& res_type = work_line_->GetRegisterType(inst->VRegA_11x());
if (!reg_types_.JavaLangThrowable(false).IsAssignableFrom(res_type)) {
- Fail(VERIFY_ERROR_BAD_CLASS_SOFT) << "thrown class " << res_type << " not instanceof Throwable";
+ Fail(VERIFY_ERROR_BAD_CLASS_SOFT) << "thrown class " << res_type
+ << " not instanceof Throwable";
}
break;
}
@@ -1777,7 +1824,8 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) {
/* array_type can be null if the reg type is Zero */
if (!array_type.IsZero()) {
if (!array_type.IsArrayTypes()) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invalid fill-array-data with array type " << array_type;
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invalid fill-array-data with array type "
+ << array_type;
} else {
const RegType& component_type = reg_types_.GetComponentType(array_type, class_loader_);
DCHECK(!component_type.IsConflict());
@@ -1817,8 +1865,8 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) {
mismatch = !reg_type1.IsIntegralTypes() || !reg_type2.IsIntegralTypes();
}
if (mismatch) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "args to if-eq/if-ne (" << reg_type1 << "," << reg_type2
- << ") must both be references or integral";
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "args to if-eq/if-ne (" << reg_type1 << ","
+ << reg_type2 << ") must both be references or integral";
}
break;
}
@@ -1838,7 +1886,8 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) {
case Instruction::IF_NEZ: {
const RegType& reg_type = work_line_->GetRegisterType(inst->VRegA_21t());
if (!reg_type.IsReferenceTypes() && !reg_type.IsIntegralTypes()) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "type " << reg_type << " unexpected as arg to if-eqz/if-nez";
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "type " << reg_type
+ << " unexpected as arg to if-eqz/if-nez";
}
// Find previous instruction - its existence is a precondition to peephole optimization.
@@ -2160,7 +2209,10 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) {
case Instruction::INVOKE_STATIC:
case Instruction::INVOKE_STATIC_RANGE: {
bool is_range = (inst->Opcode() == Instruction::INVOKE_STATIC_RANGE);
- mirror::AbstractMethod* called_method = VerifyInvocationArgs(inst, METHOD_STATIC, is_range, false);
+ mirror::AbstractMethod* called_method = VerifyInvocationArgs(inst,
+ METHOD_STATIC,
+ is_range,
+ false);
const char* descriptor;
if (called_method == NULL) {
uint32_t method_idx = (is_range) ? inst->VRegB_3rc() : inst->VRegB_35c();
@@ -2182,7 +2234,10 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) {
case Instruction::INVOKE_INTERFACE:
case Instruction::INVOKE_INTERFACE_RANGE: {
bool is_range = (inst->Opcode() == Instruction::INVOKE_INTERFACE_RANGE);
- mirror::AbstractMethod* abs_method = VerifyInvocationArgs(inst, METHOD_INTERFACE, is_range, false);
+ mirror::AbstractMethod* abs_method = VerifyInvocationArgs(inst,
+ METHOD_INTERFACE,
+ is_range,
+ false);
if (abs_method != NULL) {
mirror::Class* called_interface = abs_method->GetDeclaringClass();
if (!called_interface->IsInterface() && !called_interface->IsObjectClass()) {
@@ -2346,7 +2401,11 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) {
case Instruction::MUL_FLOAT:
case Instruction::DIV_FLOAT:
case Instruction::REM_FLOAT:
- work_line_->CheckBinaryOp(inst, reg_types_.Float(), reg_types_.Float(), reg_types_.Float(), false);
+ work_line_->CheckBinaryOp(inst,
+ reg_types_.Float(),
+ reg_types_.Float(),
+ reg_types_.Float(),
+ false);
break;
case Instruction::ADD_DOUBLE:
case Instruction::SUB_DOUBLE:
@@ -2364,15 +2423,27 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) {
case Instruction::SHL_INT_2ADDR:
case Instruction::SHR_INT_2ADDR:
case Instruction::USHR_INT_2ADDR:
- work_line_->CheckBinaryOp2addr(inst, reg_types_.Integer(), reg_types_.Integer(), reg_types_.Integer(), false);
+ work_line_->CheckBinaryOp2addr(inst,
+ reg_types_.Integer(),
+ reg_types_.Integer(),
+ reg_types_.Integer(),
+ false);
break;
case Instruction::AND_INT_2ADDR:
case Instruction::OR_INT_2ADDR:
case Instruction::XOR_INT_2ADDR:
- work_line_->CheckBinaryOp2addr(inst, reg_types_.Integer(), reg_types_.Integer(), reg_types_.Integer(), true);
+ work_line_->CheckBinaryOp2addr(inst,
+ reg_types_.Integer(),
+ reg_types_.Integer(),
+ reg_types_.Integer(),
+ true);
break;
case Instruction::DIV_INT_2ADDR:
- work_line_->CheckBinaryOp2addr(inst, reg_types_.Integer(), reg_types_.Integer(), reg_types_.Integer(), false);
+ work_line_->CheckBinaryOp2addr(inst,
+ reg_types_.Integer(),
+ reg_types_.Integer(),
+ reg_types_.Integer(),
+ false);
break;
case Instruction::ADD_LONG_2ADDR:
case Instruction::SUB_LONG_2ADDR:
@@ -2397,7 +2468,11 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) {
case Instruction::MUL_FLOAT_2ADDR:
case Instruction::DIV_FLOAT_2ADDR:
case Instruction::REM_FLOAT_2ADDR:
- work_line_->CheckBinaryOp2addr(inst, reg_types_.Float(), reg_types_.Float(), reg_types_.Float(), false);
+ work_line_->CheckBinaryOp2addr(inst,
+ reg_types_.Float(),
+ reg_types_.Float(),
+ reg_types_.Float(),
+ false);
break;
case Instruction::ADD_DOUBLE_2ADDR:
case Instruction::SUB_DOUBLE_2ADDR:
@@ -3103,8 +3178,9 @@ mirror::AbstractMethod* MethodVerifier::VerifyInvokeVirtualQuickArgs(const Instr
for (size_t param_index = 0; param_index < params_size; param_index++) {
if (actual_args >= expected_args) {
Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Rejecting invalid call to '" << PrettyMethod(res_method)
- << "'. Expected " << expected_args << " arguments, processing argument " << actual_args
- << " (where longs/doubles count twice).";
+ << "'. Expected " << expected_args
+ << " arguments, processing argument " << actual_args
+ << " (where longs/doubles count twice).";
return NULL;
}
const char* descriptor =
@@ -3257,7 +3333,8 @@ void MethodVerifier::VerifyAPut(const Instruction* inst,
// The instruction agrees with the type of array, confirm the value to be stored does too
// Note: we use the instruction type (rather than the component type) for aput-object as
// incompatible classes will be caught at runtime as an array store exception
- work_line_->VerifyRegisterType(inst->VRegA_23x(), is_primitive ? component_type : insn_type);
+ work_line_->VerifyRegisterType(inst->VRegA_23x(),
+ is_primitive ? component_type : insn_type);
}
}
}
@@ -3276,8 +3353,10 @@ mirror::Field* MethodVerifier::GetStaticField(int field_idx) {
if (klass_type.IsUnresolvedTypes()) {
return NULL; // Can't resolve Class so no more to do here, will do checking at runtime.
}
- mirror::Field* field = Runtime::Current()->GetClassLinker()->ResolveFieldJLS(*dex_file_, field_idx,
- dex_cache_, class_loader_);
+ mirror::Field* field = Runtime::Current()->GetClassLinker()->ResolveFieldJLS(*dex_file_,
+ field_idx,
+ dex_cache_,
+ class_loader_);
if (field == NULL) {
LOG(INFO) << "Unable to resolve static field " << field_idx << " ("
<< dex_file_->GetFieldName(field_id) << ") in "
@@ -3311,8 +3390,10 @@ mirror::Field* MethodVerifier::GetInstanceField(const RegType& obj_type, int fie
if (klass_type.IsUnresolvedTypes()) {
return NULL; // Can't resolve Class so no more to do here
}
- mirror::Field* field = Runtime::Current()->GetClassLinker()->ResolveFieldJLS(*dex_file_, field_idx,
- dex_cache_, class_loader_);
+ mirror::Field* field = Runtime::Current()->GetClassLinker()->ResolveFieldJLS(*dex_file_,
+ field_idx,
+ dex_cache_,
+ class_loader_);
if (field == NULL) {
LOG(INFO) << "Unable to resolve instance field " << field_idx << " ("
<< dex_file_->GetFieldName(field_id) << ") in "
@@ -3343,8 +3424,8 @@ mirror::Field* MethodVerifier::GetInstanceField(const RegType& obj_type, int fie
// Field accesses through uninitialized references are only allowable for constructors where
// the field is declared in this class
Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "cannot access instance field " << PrettyField(field)
- << " of a not fully initialized object within the context of "
- << PrettyMethod(dex_method_idx_, *dex_file_);
+ << " of a not fully initialized object within the context"
+ << " of " << PrettyMethod(dex_method_idx_, *dex_file_);
return NULL;
} else if (!field_klass.IsAssignableFrom(obj_type)) {
// Trying to access C1.field1 using reference of type C2, which is neither C1 or a sub-class
@@ -3697,7 +3778,9 @@ bool MethodVerifier::UpdateRegisters(uint32_t next_insn, const RegisterLine* mer
}
}
} else {
- UniquePtr<RegisterLine> copy(gDebugVerify ? new RegisterLine(target_line->NumRegs(), this) : NULL);
+ UniquePtr<RegisterLine> copy(gDebugVerify ?
+ new RegisterLine(target_line->NumRegs(), this) :
+ NULL);
if (gDebugVerify) {
copy->CopyFromLine(target_line);
}
@@ -3734,7 +3817,8 @@ const RegType& MethodVerifier::GetMethodReturnType() {
const RegType& MethodVerifier::GetDeclaringClass() {
if (declaring_class_ == NULL) {
const DexFile::MethodId& method_id = dex_file_->GetMethodId(dex_method_idx_);
- const char* descriptor = dex_file_->GetTypeDescriptor(dex_file_->GetTypeId(method_id.class_idx_));
+ const char* descriptor
+ = dex_file_->GetTypeDescriptor(dex_file_->GetTypeId(method_id.class_idx_));
if (mirror_method_ != NULL) {
mirror::Class* klass = mirror_method_->GetDeclaringClass();
declaring_class_ = &reg_types_.FromClass(descriptor, klass,
@@ -4043,7 +4127,8 @@ const MethodReference* MethodVerifier::GetDevirtMap(const MethodReference& ref,
}
// Look up the PC in the map, get the concrete method to execute and return its reference.
- MethodVerifier::PcToConcreteMethodMap::const_iterator pc_to_concrete_method = it->second->find(dex_pc);
+ MethodVerifier::PcToConcreteMethodMap::const_iterator pc_to_concrete_method
+ = it->second->find(dex_pc);
if (pc_to_concrete_method != it->second->end()) {
return &(pc_to_concrete_method->second);
} else {