diff options
author | Ian Rogers <irogers@google.com> | 2013-07-23 22:18:37 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-07-23 22:18:37 +0000 |
commit | 7041676162cbe0645bcba468e6788769513dc864 (patch) | |
tree | 43ecbaddcc6d3a19325c5a77221797c155ecfb7b /runtime | |
parent | 8a7bc17da633d3577eda040ac490cbd8351dc6b9 (diff) | |
parent | 6d376aec61fc57b4caa840c1ae309e4f4f589792 (diff) | |
download | art-7041676162cbe0645bcba468e6788769513dc864.zip art-7041676162cbe0645bcba468e6788769513dc864.tar.gz art-7041676162cbe0645bcba468e6788769513dc864.tar.bz2 |
Merge "Tidy ws and document verifier instruction flags." into dalvik-dev
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/verifier/instruction_flags.h | 17 | ||||
-rw-r--r-- | runtime/verifier/method_verifier.cc | 56 |
2 files changed, 39 insertions, 34 deletions
diff --git a/runtime/verifier/instruction_flags.h b/runtime/verifier/instruction_flags.h index df89bee..9b2e595 100644 --- a/runtime/verifier/instruction_flags.h +++ b/runtime/verifier/instruction_flags.h @@ -97,12 +97,17 @@ class InstructionFlags { private: enum { - kInTry, - kBranchTarget, - kCompileTimeInfoPoint, // Location of interest to the compiler for GC maps and - // verifier based method sharpening. - kVisited, - kChanged, + // The instruction has been visited and unless IsChanged() verified. + kVisited = 0, + // Register type information flowing into the instruction changed and so the instruction must be + // reprocessed. + kChanged = 1, + // Instruction is contained within a try region. + kInTry = 2, + // Instruction is the target of a branch (ie the start of a basic block). + kBranchTarget = 3, + // Location of interest to the compiler for GC maps and verifier based method sharpening. + kCompileTimeInfoPoint = 4, }; // Size of instruction in code units. diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index ca4dce4..2bf78d8 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -2641,36 +2641,36 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) { * because it changes work_line_ when performing peephole optimization * and this change should not be used in those cases. */ - if ((opcode_flags & Instruction::kContinue) != 0) { - uint32_t next_insn_idx = work_insn_idx_ + CurrentInsnFlags()->GetLengthInCodeUnits(); - if (next_insn_idx >= code_item_->insns_size_in_code_units_) { - Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Execution can walk off end of code area"; - return false; - } - // The only way to get to a move-exception instruction is to get thrown there. Make sure the - // next instruction isn't one. - if (!CheckNotMoveException(code_item_->insns_, next_insn_idx)) { + if ((opcode_flags & Instruction::kContinue) != 0) { + uint32_t next_insn_idx = work_insn_idx_ + CurrentInsnFlags()->GetLengthInCodeUnits(); + if (next_insn_idx >= code_item_->insns_size_in_code_units_) { + Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Execution can walk off end of code area"; + return false; + } + // The only way to get to a move-exception instruction is to get thrown there. Make sure the + // next instruction isn't one. + if (!CheckNotMoveException(code_item_->insns_, next_insn_idx)) { + return false; + } + if (NULL != fallthrough_line.get()) { + // Make workline consistent with fallthrough computed from peephole optimization. + work_line_->CopyFromLine(fallthrough_line.get()); + } + RegisterLine* next_line = reg_table_.GetLine(next_insn_idx); + if (next_line != NULL) { + // Merge registers into what we have for the next instruction, + // and set the "changed" flag if needed. + if (!UpdateRegisters(next_insn_idx, work_line_.get())) { return false; } - if (NULL != fallthrough_line.get()) { - // Make workline consistent with fallthrough computed from peephole optimization. - work_line_->CopyFromLine(fallthrough_line.get()); - } - RegisterLine* next_line = reg_table_.GetLine(next_insn_idx); - if (next_line != NULL) { - // Merge registers into what we have for the next instruction, - // and set the "changed" flag if needed. - if (!UpdateRegisters(next_insn_idx, work_line_.get())) { - return false; - } - } else { - /* - * We're not recording register data for the next instruction, so we don't know what the - * prior state was. We have to assume that something has changed and re-evaluate it. - */ - insn_flags_[next_insn_idx].SetChanged(); - } + } else { + /* + * We're not recording register data for the next instruction, so we don't know what the + * prior state was. We have to assume that something has changed and re-evaluate it. + */ + insn_flags_[next_insn_idx].SetChanged(); } + } /* If we're returning from the method, make sure monitor stack is empty. */ if ((opcode_flags & Instruction::kReturn) != 0) { @@ -3695,7 +3695,7 @@ const RegType& MethodVerifier::GetDeclaringClass() { } void MethodVerifier::ComputeGcMapSizes(size_t* gc_points, size_t* ref_bitmap_bits, - size_t* log2_max_gc_pc) { + size_t* log2_max_gc_pc) { size_t local_gc_points = 0; size_t max_insn = 0; size_t max_ref_reg = -1; |