| 94 | } |
| 95 | |
| 96 | DexFile::DexFile(const uint8_t* base, |
| 97 | size_t size, |
| 98 | const uint8_t* data_begin, |
| 99 | size_t data_size, |
| 100 | const std::string& location, |
| 101 | uint32_t location_checksum, |
| 102 | const OatDexFile* oat_dex_file, |
| 103 | std::unique_ptr<DexFileContainer> container, |
| 104 | bool is_compact_dex) |
| 105 | : begin_(base), |
| 106 | size_(size), |
| 107 | data_begin_(data_begin), |
| 108 | data_size_(data_size), |
| 109 | location_(location), |
| 110 | location_checksum_(location_checksum), |
| 111 | header_(reinterpret_cast<const Header*>(base)), |
| 112 | string_ids_(reinterpret_cast<const StringId*>(base + header_->string_ids_off_)), |
| 113 | type_ids_(reinterpret_cast<const TypeId*>(base + header_->type_ids_off_)), |
| 114 | field_ids_(reinterpret_cast<const FieldId*>(base + header_->field_ids_off_)), |
| 115 | method_ids_(reinterpret_cast<const MethodId*>(base + header_->method_ids_off_)), |
| 116 | proto_ids_(reinterpret_cast<const ProtoId*>(base + header_->proto_ids_off_)), |
| 117 | class_defs_(reinterpret_cast<const ClassDef*>(base + header_->class_defs_off_)), |
| 118 | method_handles_(nullptr), |
| 119 | num_method_handles_(0), |
| 120 | call_site_ids_(nullptr), |
| 121 | num_call_site_ids_(0), |
| 122 | oat_dex_file_(oat_dex_file), |
| 123 | container_(std::move(container)), |
| 124 | is_compact_dex_(is_compact_dex), |
| 125 | is_platform_dex_(false) { |
| 126 | CHECK(begin_ != nullptr) << GetLocation(); |
| 127 | CHECK_GT(size_, 0U) << GetLocation(); |
| 128 | // Check base (=header) alignment. |
| 129 | // Must be 4-byte aligned to avoid undefined behavior when accessing |
| 130 | // any of the sections via a pointer. |
| 131 | CHECK_ALIGNED(begin_, alignof(Header)); |
| 132 | |
| 133 | InitializeSectionsFromMapList(); |
| 134 | } |
| 135 | |
| 136 | DexFile::~DexFile() { |
| 137 | // We don't call DeleteGlobalRef on dex_object_ because we're only called by DestroyJavaVM, and |
nothing calls this directly
no outgoing calls
no test coverage detected