Add "kind" argument to Get/SetVReg.

In order to determine where a register is promoted its necessary to know
the kind of use of the register.
Extend notion of precise-ness to numeric verifier register types.
Dump verifier output in oatdump.
Dump vregs with their location or constant value.
Introduce indenting ostream utility.

Change-Id: Ia3d29497877976bc24465484743bca08236e1768
diff --git a/src/verifier/method_verifier.h b/src/verifier/method_verifier.h
index 42283a2..95d7905 100644
--- a/src/verifier/method_verifier.h
+++ b/src/verifier/method_verifier.h
@@ -113,6 +113,8 @@
   kTrackRegsAll,
 };
 
+// A mapping from a dex pc to the register line statuses as they are immediately prior to the
+// execution of that instruction.
 class PcToRegisterLineTable {
  public:
   PcToRegisterLineTable() {}
@@ -137,7 +139,6 @@
 
  private:
   typedef SafeMap<int32_t, RegisterLine*> Table;
-  // Map from a dex pc to the register status associated with it
   Table pc_to_register_line_;
 };
 
@@ -162,7 +163,19 @@
                                  std::string& error)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
-  static void VerifyMethodAndDump(AbstractMethod* method)
+  static void VerifyMethodAndDump(std::ostream& os, uint32_t method_idx, const DexFile* dex_file,
+                                  DexCache* dex_cache, ClassLoader* class_loader,
+                                  uint32_t class_def_idx, const DexFile::CodeItem* code_item,
+                                  AbstractMethod* method, uint32_t method_access_flags)
+      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+  static std::vector<int32_t> DescribeVRegs(uint32_t dex_method_idx,
+                                            const DexFile* dex_file, DexCache* dex_cache,
+                                            ClassLoader* class_loader,
+                                            uint32_t class_def_idx,
+                                            const DexFile::CodeItem* code_item,
+                                            AbstractMethod* method,
+                                            uint32_t method_access_flags, uint32_t dex_pc)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
   uint8_t EncodePcToReferenceMapData() const;
@@ -180,7 +193,7 @@
 
   // Log for verification information.
   std::ostream& LogVerifyInfo() {
-    return info_messages_ << "VFY: " << PrettyMethod(method_idx_, *dex_file_)
+    return info_messages_ << "VFY: " << PrettyMethod(dex_method_idx_, *dex_file_)
                           << '[' << reinterpret_cast<void*>(work_insn_idx_) << "] : ";
   }
 
@@ -576,6 +589,9 @@
   // Compute sizes for GC map data
   void ComputeGcMapSizes(size_t* gc_points, size_t* ref_bitmap_bits, size_t* log2_max_gc_pc);
 
+  // Describe VRegs at the given dex pc.
+  std::vector<int32_t> DescribeVRegs(uint32_t dex_pc);
+
   InsnFlags* CurrentInsnFlags();
 
   // All the GC maps that the verifier has created
@@ -617,7 +633,7 @@
   // Storage for the register status we're saving for later.
   UniquePtr<RegisterLine> saved_line_;
 
-  uint32_t method_idx_;  // The method we're working on.
+  uint32_t dex_method_idx_;  // The method we're working on.
   // Its object representation if known.
   AbstractMethod* foo_method_ GUARDED_BY(Locks::mutator_lock_);
   uint32_t method_access_flags_;  // Method's access flags.