Encode quickening info in .vdex.
We quicken vdex files for performance reasons, but when taking an OTA,
we need to revert the quickening to the original instructions. As vdex
should be independent of the oat file and oat file versions, we encode
the quickening data in the vdex.
test: m test-art-host-jit m test-art-host-gtest
bug:30937355
Change-Id: I9a543a161b70aa1cff99f8fe6f5b5cab7a6c4d31
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index c7bf231..4e81d50 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -64,6 +64,7 @@
#include "string_reference.h"
#include "thread_list.h"
#include "type_lookup_table.h"
+#include "vdex_file.h"
#include "verifier/method_verifier.h"
#include "well_known_classes.h"
@@ -1029,13 +1030,19 @@
if (options_.absolute_addresses_) {
vios->Stream() << StringPrintf("%p ", oat_method.GetVmapTable());
}
- uint32_t vmap_table_offset = oat_method.GetVmapTableOffset();
+ uint32_t vmap_table_offset = method_header == nullptr ? 0 : method_header->vmap_table_offset_;
vios->Stream() << StringPrintf("(offset=0x%08x)\n", vmap_table_offset);
- if (vmap_table_offset > oat_file_.Size()) {
+
+ size_t vmap_table_offset_limit =
+ (kIsVdexEnabled && IsMethodGeneratedByDexToDexCompiler(oat_method, code_item))
+ ? oat_file_.GetVdexFile()->Size()
+ : method_header->GetCode() - oat_file_.Begin();
+ if (vmap_table_offset >= vmap_table_offset_limit) {
vios->Stream() << StringPrintf("WARNING: "
"vmap table offset 0x%08x is past end of file 0x%08zx. "
"vmap table offset was loaded from offset 0x%08x.\n",
- vmap_table_offset, oat_file_.Size(),
+ vmap_table_offset,
+ vmap_table_offset_limit,
oat_method.GetVmapTableOffsetOffset());
success = false;
} else if (options_.dump_vmap_) {