summaryrefslogtreecommitdiffstats
path: root/oatdump/oatdump.cc
diff options
context:
space:
mode:
authorRazvan A Lupusoru <razvan.a.lupusoru@intel.com>2014-08-29 17:56:46 -0700
committerIan Rogers <irogers@google.com>2014-09-04 08:35:11 -0700
commitfaf9f0d53573025dc5ae5ff6c4412396030cf1da (patch)
treee0beda53198bcfabd24b9a0e11912da4b2c1f16e /oatdump/oatdump.cc
parent328c430e923ce8d18532d0fdd26cd233e73763dd (diff)
downloadart-faf9f0d53573025dc5ae5ff6c4412396030cf1da.zip
art-faf9f0d53573025dc5ae5ff6c4412396030cf1da.tar.gz
art-faf9f0d53573025dc5ae5ff6c4412396030cf1da.tar.bz2
ART: Allow oatdump to print vr stack locations
For both debugging and performance analysis, it is necessary to understand stack layout. This patch adds capability to oatdump to print out the offsets of the locals, ins, method*, and out VRs. Change-Id: I73512f59e4fd2d2b12725a6c76d602182c46ff78 Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
Diffstat (limited to 'oatdump/oatdump.cc')
-rw-r--r--oatdump/oatdump.cc40
1 files changed, 40 insertions, 0 deletions
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index 1feb27d..931ee56 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -396,6 +396,7 @@ class OatDumper {
*indent2_os << StringPrintf("\nvmap_table: %p (offset=0x%08x)\n",
oat_method.GetVmapTable(), oat_method.GetVmapTableOffset());
DumpVmap(*indent2_os, oat_method);
+ DumpVregLocations(*indent2_os, oat_method, code_item);
*indent2_os << StringPrintf("mapping_table: %p (offset=0x%08x)\n",
oat_method.GetMappingTable(), oat_method.GetMappingTableOffset());
if (dump_raw_mapping_table_) {
@@ -492,6 +493,45 @@ class OatDumper {
}
}
+ void DumpVregLocations(std::ostream& os, const OatFile::OatMethod& oat_method,
+ const DexFile::CodeItem* code_item) {
+ if (code_item != nullptr) {
+ size_t num_locals_ins = code_item->registers_size_;
+ size_t num_ins = code_item->ins_size_;
+ size_t num_locals = num_locals_ins - num_ins;
+ size_t num_outs = code_item->outs_size_;
+
+ os << "vr_stack_locations:";
+ for (size_t reg = 0; reg <= num_locals_ins; reg++) {
+ // For readability, delimit the different kinds of VRs.
+ if (reg == num_locals_ins) {
+ os << "\n\tmethod*:";
+ } else if (reg == num_locals && num_ins > 0) {
+ os << "\n\tins:";
+ } else if (reg == 0 && num_locals > 0) {
+ os << "\n\tlocals:";
+ }
+
+ uint32_t offset = StackVisitor::GetVRegOffset(code_item, oat_method.GetCoreSpillMask(),
+ oat_method.GetFpSpillMask(),
+ oat_method.GetFrameSizeInBytes(), reg,
+ GetInstructionSet());
+ os << " v" << reg << "[sp + #" << offset << "]";
+ }
+
+ for (size_t out_reg = 0; out_reg < num_outs; out_reg++) {
+ if (out_reg == 0) {
+ os << "\n\touts:";
+ }
+
+ uint32_t offset = StackVisitor::GetOutVROffset(out_reg, GetInstructionSet());
+ os << " v" << out_reg << "[sp + #" << offset << "]";
+ }
+
+ os << "\n";
+ }
+ }
+
void DescribeVReg(std::ostream& os, const OatFile::OatMethod& oat_method,
const DexFile::CodeItem* code_item, size_t reg, VRegKind kind) {
const uint8_t* raw_table = oat_method.GetVmapTable();