summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2024-04-29 16:27:15 +0200
committerVladimĂ­r Marko <vmarko@google.com>2024-04-29 15:49:09 +0000
commit44f66bd998f12b94dca4fd1def31889718e9db28 (patch)
tree87f39144871c16e55af4f78bf93dfe44f2e24d48
parent8192f5832f9f5b43e4f1b9784c90d9bc5db1ad1a (diff)
downloadart-44f66bd998f12b94dca4fd1def31889718e9db28.tar.gz
Fix reading BCP .bss info for `MethodType`.
Also update `oatdump` to print the mapping. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 297147201 Bug: 335793499 Change-Id: I80e1d3dc1010f403a55aba2efba62133d8772cc9
-rw-r--r--oatdump/oatdump.cc19
-rw-r--r--runtime/oat/oat_file.cc5
2 files changed, 19 insertions, 5 deletions
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index 5e41982bd3..2c17845417 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -550,7 +550,8 @@ class OatDumper {
oat_dex_file->GetTypeBssMapping(),
oat_dex_file->GetPublicTypeBssMapping(),
oat_dex_file->GetPackageTypeBssMapping(),
- oat_dex_file->GetStringBssMapping());
+ oat_dex_file->GetStringBssMapping(),
+ oat_dex_file->GetMethodTypeBssMapping());
}
}
@@ -574,7 +575,8 @@ class OatDumper {
oat_file_.bcp_bss_info_[i].type_bss_mapping,
oat_file_.bcp_bss_info_[i].public_type_bss_mapping,
oat_file_.bcp_bss_info_[i].package_type_bss_mapping,
- oat_file_.bcp_bss_info_[i].string_bss_mapping);
+ oat_file_.bcp_bss_info_[i].string_bss_mapping,
+ oat_file_.bcp_bss_info_[i].method_type_bss_mapping);
}
} else {
// We don't have a runtime, just dump the offsets
@@ -585,6 +587,7 @@ class OatDumper {
DumpBssOffsets(os, "Public Class", oat_file_.bcp_bss_info_[i].public_type_bss_mapping);
DumpBssOffsets(os, "Package Class", oat_file_.bcp_bss_info_[i].package_type_bss_mapping);
DumpBssOffsets(os, "String", oat_file_.bcp_bss_info_[i].string_bss_mapping);
+ DumpBssOffsets(os, "MethodType", oat_file_.bcp_bss_info_[i].method_type_bss_mapping);
}
}
}
@@ -1741,7 +1744,8 @@ class OatDumper {
const IndexBssMapping* type_bss_mapping,
const IndexBssMapping* public_type_bss_mapping,
const IndexBssMapping* package_type_bss_mapping,
- const IndexBssMapping* string_bss_mapping) {
+ const IndexBssMapping* string_bss_mapping,
+ const IndexBssMapping* method_type_bss_mapping) {
DumpBssEntries(os,
"ArtMethod",
method_bss_mapping,
@@ -1773,6 +1777,15 @@ class OatDumper {
dex_file->NumStringIds(),
sizeof(GcRoot<mirror::Class>),
[=](uint32_t index) { return dex_file->GetStringData(dex::StringIndex(index)); });
+ DumpBssEntries(os,
+ "MethodType",
+ method_type_bss_mapping,
+ dex_file->NumProtoIds(),
+ sizeof(GcRoot<mirror::MethodType>),
+ [=](uint32_t index) {
+ const dex::ProtoId& proto_id = dex_file->GetProtoId(dex::ProtoIndex(index));
+ return dex_file->GetProtoSignature(proto_id).ToString();
+ });
}
void DumpBssOffsets(std::ostream& os, const char* slot_type, const IndexBssMapping* mapping) {
diff --git a/runtime/oat/oat_file.cc b/runtime/oat/oat_file.cc
index b013afd378..c7b89c5b62 100644
--- a/runtime/oat/oat_file.cc
+++ b/runtime/oat/oat_file.cc
@@ -975,7 +975,7 @@ bool OatFileBase::Setup(int zip_fd,
const IndexBssMapping* public_type_bss_mapping;
const IndexBssMapping* package_type_bss_mapping;
const IndexBssMapping* string_bss_mapping;
- const IndexBssMapping* method_type_bss_mapping = nullptr;
+ const IndexBssMapping* method_type_bss_mapping;
auto read_index_bss_mapping = [&](const char* tag, /*out*/const IndexBssMapping** mapping) {
return ReadIndexBssMapping(&oat, i, dex_file_location, tag, mapping, error_msg);
};
@@ -1063,7 +1063,8 @@ bool OatFileBase::Setup(int zip_fd,
!read_index_bss_mapping("type", &bcp_bss_info_[i].type_bss_mapping) ||
!read_index_bss_mapping("public type", &bcp_bss_info_[i].public_type_bss_mapping) ||
!read_index_bss_mapping("package type", &bcp_bss_info_[i].package_type_bss_mapping) ||
- !read_index_bss_mapping("string", &bcp_bss_info_[i].string_bss_mapping)) {
+ !read_index_bss_mapping("string", &bcp_bss_info_[i].string_bss_mapping) ||
+ !read_index_bss_mapping("method type", &bcp_bss_info_[i].method_type_bss_mapping)) {
return false;
}
}