From a169e1d8d968800380245cda450505d969ebff76 Mon Sep 17 00:00:00 2001 From: buzbee Date: Wed, 5 Dec 2012 14:26:44 -0800 Subject: Quick compiler: refactored listing & const fix This CL started off as a simple fix to Issue 4959751, which identified a case in which compiler debugging listings could read uninitialized data. The fix ended up pulling a few strings - we had two distinct dex printing routines (one was focused on SSA names and was used by the .dot graph dumper), while the other was used with verbose codegen listing. Ended up combining the two routines and significantly enhancing the value of the verbose debug output. We now always use ssa register names, and also show the constant values of ssa names which are known to be const following constant propagation. Along the way, deleted a bit of useless code that remapped all registers in a phi set to have the same name, and also got rid of some duplicate listing helper LIR pseudo ops. Somee examples of the new listing: -------- dalvik offset: 0x2 @ const/4 v0_1#0x1, #1 the format of the vreg is: v_[#hex value of immediate] In this example, we don't add any new info (the listing already had #1), but we also show this form in uses: invoke-virtual v0_2, v1_3#0x40 Also improved is the listing output of potentially throwing instructions which are broken into two parts: the check portion and the work portion. Both halves now show the full disassembly. For example: -------- dalvik offset: 0x13 @ Check1: invoke-virtual v0_2, v1_3#0x40 ....code here ....code here -------- dalvik offset: 0x13 @ Check2: invoke-virtual v0_2, v1_3#0x40 Dalvik instructions which are optimized away prior to code generation are displayed in sqare brackets. For example: -------- dalvik offset: 0x16 @ [move-result-object v0_3]--optimized away Finally, Phi nodes show which incoming block an operand came through. In the following example: -------- dalvik offset: 0x5 @ Phi v1_2 = (v1_1#0x0:4, v1_2:12, v1_3#0x1:14) Sreg v1_2 is a merge of a constant 0x0 from incoming block 4, a non-const value from block 12 and a const 0x1 from block 14. Change-Id: Ib6c19c19ab8a48509d43d8b0e5ed3e8e7ce9fc82 --- src/compiler/codegen/gen_invoke.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/compiler/codegen/gen_invoke.cc') diff --git a/src/compiler/codegen/gen_invoke.cc b/src/compiler/codegen/gen_invoke.cc index afaa053f95..ebc1a986ca 100644 --- a/src/compiler/codegen/gen_invoke.cc +++ b/src/compiler/codegen/gen_invoke.cc @@ -1337,7 +1337,8 @@ CallInfo* Codegen::NewMemCallInfo(CompilationUnit* cu, BasicBlock* bb, MIR* mir, info->result.location = kLocInvalid; } else { info->result = GetRawDest(cu, move_result_mir); - move_result_mir->dalvikInsn.opcode = Instruction::NOP; + move_result_mir->meta.original_opcode = move_result_mir->dalvikInsn.opcode; + move_result_mir->dalvikInsn.opcode = static_cast(kMirOpNop); } info->num_arg_words = mir->ssa_rep->num_uses; info->args = (info->num_arg_words == 0) ? NULL : static_cast -- cgit v1.2.3-59-g8ed1b