David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | * |
| 16 | * Header file of an in-memory representation of DEX files. |
| 17 | */ |
| 18 | |
| 19 | #ifndef ART_DEXLAYOUT_DEX_IR_H_ |
| 20 | #define ART_DEXLAYOUT_DEX_IR_H_ |
| 21 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 22 | #include <vector> |
| 23 | #include <stdint.h> |
| 24 | |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 25 | #include "dex_file-inl.h" |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 26 | #include "leb128.h" |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 27 | |
| 28 | namespace art { |
| 29 | namespace dex_ir { |
| 30 | |
| 31 | // Forward declarations for classes used in containers or pointed to. |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 32 | class AnnotationItem; |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 33 | class AnnotationsDirectoryItem; |
| 34 | class AnnotationSetItem; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 35 | class AnnotationSetRefList; |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 36 | class ClassData; |
| 37 | class ClassDef; |
| 38 | class CodeItem; |
| 39 | class DebugInfoItem; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 40 | class EncodedAnnotation; |
| 41 | class EncodedArrayItem; |
| 42 | class EncodedValue; |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 43 | class FieldId; |
| 44 | class FieldItem; |
| 45 | class Header; |
| 46 | class MapList; |
| 47 | class MapItem; |
| 48 | class MethodId; |
| 49 | class MethodItem; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 50 | class ParameterAnnotation; |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 51 | class ProtoId; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 52 | class StringData; |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 53 | class StringId; |
| 54 | class TryItem; |
| 55 | class TypeId; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 56 | class TypeList; |
| 57 | |
| 58 | // Item size constants. |
| 59 | static constexpr size_t kHeaderItemSize = 112; |
| 60 | static constexpr size_t kStringIdItemSize = 4; |
| 61 | static constexpr size_t kTypeIdItemSize = 4; |
| 62 | static constexpr size_t kProtoIdItemSize = 12; |
| 63 | static constexpr size_t kFieldIdItemSize = 8; |
| 64 | static constexpr size_t kMethodIdItemSize = 8; |
| 65 | static constexpr size_t kClassDefItemSize = 32; |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 66 | |
| 67 | // Visitor support |
| 68 | class AbstractDispatcher { |
| 69 | public: |
| 70 | AbstractDispatcher() = default; |
| 71 | virtual ~AbstractDispatcher() { } |
| 72 | |
| 73 | virtual void Dispatch(Header* header) = 0; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 74 | virtual void Dispatch(const StringData* string_data) = 0; |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 75 | virtual void Dispatch(const StringId* string_id) = 0; |
| 76 | virtual void Dispatch(const TypeId* type_id) = 0; |
| 77 | virtual void Dispatch(const ProtoId* proto_id) = 0; |
| 78 | virtual void Dispatch(const FieldId* field_id) = 0; |
| 79 | virtual void Dispatch(const MethodId* method_id) = 0; |
| 80 | virtual void Dispatch(ClassData* class_data) = 0; |
| 81 | virtual void Dispatch(ClassDef* class_def) = 0; |
| 82 | virtual void Dispatch(FieldItem* field_item) = 0; |
| 83 | virtual void Dispatch(MethodItem* method_item) = 0; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 84 | virtual void Dispatch(EncodedArrayItem* array_item) = 0; |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 85 | virtual void Dispatch(CodeItem* code_item) = 0; |
| 86 | virtual void Dispatch(TryItem* try_item) = 0; |
| 87 | virtual void Dispatch(DebugInfoItem* debug_info_item) = 0; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 88 | virtual void Dispatch(AnnotationItem* annotation_item) = 0; |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 89 | virtual void Dispatch(AnnotationSetItem* annotation_set_item) = 0; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 90 | virtual void Dispatch(AnnotationSetRefList* annotation_set_ref_list) = 0; |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 91 | virtual void Dispatch(AnnotationsDirectoryItem* annotations_directory_item) = 0; |
| 92 | virtual void Dispatch(MapList* map_list) = 0; |
| 93 | virtual void Dispatch(MapItem* map_item) = 0; |
| 94 | |
| 95 | private: |
| 96 | DISALLOW_COPY_AND_ASSIGN(AbstractDispatcher); |
| 97 | }; |
| 98 | |
| 99 | // Collections become owners of the objects added by moving them into unique pointers. |
| 100 | template<class T> class CollectionWithOffset { |
| 101 | public: |
| 102 | CollectionWithOffset() = default; |
| 103 | std::vector<std::unique_ptr<T>>& Collection() { return collection_; } |
| 104 | // Read-time support methods |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 105 | void AddItem(T* object, uint32_t offset) { |
| 106 | object->SetOffset(offset); |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 107 | collection_.push_back(std::unique_ptr<T>(object)); |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 108 | } |
| 109 | void AddIndexedItem(T* object, uint32_t offset, uint32_t index) { |
| 110 | object->SetOffset(offset); |
| 111 | object->SetIndex(index); |
| 112 | collection_.push_back(std::unique_ptr<T>(object)); |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 113 | } |
| 114 | // Ordinary object insertion into collection. |
| 115 | void Insert(T object ATTRIBUTE_UNUSED) { |
| 116 | // TODO(sehr): add ordered insertion support. |
| 117 | UNIMPLEMENTED(FATAL) << "Insertion not ready"; |
| 118 | } |
| 119 | uint32_t GetOffset() const { return offset_; } |
| 120 | void SetOffset(uint32_t new_offset) { offset_ = new_offset; } |
| 121 | uint32_t Size() const { return collection_.size(); } |
| 122 | |
| 123 | private: |
| 124 | std::vector<std::unique_ptr<T>> collection_; |
| 125 | uint32_t offset_ = 0; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 126 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 127 | DISALLOW_COPY_AND_ASSIGN(CollectionWithOffset); |
| 128 | }; |
| 129 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 130 | class Collections { |
| 131 | public: |
| 132 | Collections() = default; |
| 133 | |
| 134 | std::vector<std::unique_ptr<StringId>>& StringIds() { return string_ids_.Collection(); } |
| 135 | std::vector<std::unique_ptr<TypeId>>& TypeIds() { return type_ids_.Collection(); } |
| 136 | std::vector<std::unique_ptr<ProtoId>>& ProtoIds() { return proto_ids_.Collection(); } |
| 137 | std::vector<std::unique_ptr<FieldId>>& FieldIds() { return field_ids_.Collection(); } |
| 138 | std::vector<std::unique_ptr<MethodId>>& MethodIds() { return method_ids_.Collection(); } |
| 139 | std::vector<std::unique_ptr<ClassDef>>& ClassDefs() { return class_defs_.Collection(); } |
| 140 | |
| 141 | std::vector<std::unique_ptr<TypeList>>& TypeLists() { return type_lists_.Collection(); } |
| 142 | std::vector<std::unique_ptr<EncodedArrayItem>>& EncodedArrayItems() |
| 143 | { return encoded_array_items_.Collection(); } |
| 144 | |
| 145 | void CreateStringId(const DexFile& dex_file, uint32_t i); |
| 146 | void CreateTypeId(const DexFile& dex_file, uint32_t i); |
| 147 | void CreateProtoId(const DexFile& dex_file, uint32_t i); |
| 148 | void CreateFieldId(const DexFile& dex_file, uint32_t i); |
| 149 | void CreateMethodId(const DexFile& dex_file, uint32_t i); |
| 150 | void CreateClassDef(const DexFile& dex_file, uint32_t i); |
| 151 | |
| 152 | TypeList* CreateTypeList(const DexFile::TypeList* type_list, uint32_t offset, bool allow_empty); |
| 153 | EncodedArrayItem* CreateEncodedArrayItem(const uint8_t* static_data, uint32_t offset); |
| 154 | AnnotationItem* CreateAnnotationItem(const DexFile::AnnotationItem* annotation, uint32_t offset); |
| 155 | AnnotationSetItem* CreateAnnotationSetItem(const DexFile& dex_file, |
| 156 | const DexFile::AnnotationSetItem& disk_annotations_item, uint32_t offset); |
| 157 | AnnotationsDirectoryItem* CreateAnnotationsDirectoryItem(const DexFile& dex_file, |
| 158 | const DexFile::AnnotationsDirectoryItem* disk_annotations_item, uint32_t offset); |
| 159 | CodeItem* CreateCodeItem( |
| 160 | const DexFile& dex_file, const DexFile::CodeItem& disk_code_item, uint32_t offset); |
| 161 | ClassData* CreateClassData(const DexFile& dex_file, const uint8_t* encoded_data, uint32_t offset); |
| 162 | |
| 163 | StringId* GetStringId(uint32_t index) { return StringIds()[index].get(); } |
| 164 | TypeId* GetTypeId(uint32_t index) { return TypeIds()[index].get(); } |
| 165 | ProtoId* GetProtoId(uint32_t index) { return ProtoIds()[index].get(); } |
| 166 | FieldId* GetFieldId(uint32_t index) { return FieldIds()[index].get(); } |
| 167 | MethodId* GetMethodId(uint32_t index) { return MethodIds()[index].get(); } |
| 168 | ClassDef* GetClassDef(uint32_t index) { return ClassDefs()[index].get(); } |
| 169 | |
| 170 | StringId* GetStringIdOrNullPtr(uint32_t index) { |
| 171 | return index == DexFile::kDexNoIndex ? nullptr : GetStringId(index); |
| 172 | } |
| 173 | TypeId* GetTypeIdOrNullPtr(uint16_t index) { |
| 174 | return index == DexFile::kDexNoIndex16 ? nullptr : GetTypeId(index); |
| 175 | } |
| 176 | |
| 177 | uint32_t StringIdsOffset() const { return string_ids_.GetOffset(); } |
| 178 | uint32_t TypeIdsOffset() const { return type_ids_.GetOffset(); } |
| 179 | uint32_t ProtoIdsOffset() const { return proto_ids_.GetOffset(); } |
| 180 | uint32_t FieldIdsOffset() const { return field_ids_.GetOffset(); } |
| 181 | uint32_t MethodIdsOffset() const { return method_ids_.GetOffset(); } |
| 182 | uint32_t ClassDefsOffset() const { return class_defs_.GetOffset(); } |
| 183 | uint32_t StringDatasOffset() const { return string_datas_.GetOffset(); } |
| 184 | uint32_t TypeListsOffset() const { return type_lists_.GetOffset(); } |
| 185 | uint32_t EncodedArrayOffset() const { return encoded_array_items_.GetOffset(); } |
| 186 | uint32_t AnnotationOffset() const { return annotation_items_.GetOffset(); } |
| 187 | uint32_t AnnotationSetOffset() const { return annotation_set_items_.GetOffset(); } |
| 188 | uint32_t AnnotationSetRefListsOffset() const { return annotation_set_ref_lists_.GetOffset(); } |
| 189 | uint32_t AnnotationsDirectoryOffset() const { return annotations_directory_items_.GetOffset(); } |
| 190 | uint32_t DebugInfoOffset() const { return debug_info_items_.GetOffset(); } |
| 191 | uint32_t CodeItemsOffset() const { return code_items_.GetOffset(); } |
| 192 | uint32_t ClassDatasOffset() const { return class_datas_.GetOffset(); } |
| 193 | |
| 194 | void SetStringIdsOffset(uint32_t new_offset) { string_ids_.SetOffset(new_offset); } |
| 195 | void SetTypeIdsOffset(uint32_t new_offset) { type_ids_.SetOffset(new_offset); } |
| 196 | void SetProtoIdsOffset(uint32_t new_offset) { proto_ids_.SetOffset(new_offset); } |
| 197 | void SetFieldIdsOffset(uint32_t new_offset) { field_ids_.SetOffset(new_offset); } |
| 198 | void SetMethodIdsOffset(uint32_t new_offset) { method_ids_.SetOffset(new_offset); } |
| 199 | void SetClassDefsOffset(uint32_t new_offset) { class_defs_.SetOffset(new_offset); } |
| 200 | void SetStringDatasOffset(uint32_t new_offset) { string_datas_.SetOffset(new_offset); } |
| 201 | void SetTypeListsOffset(uint32_t new_offset) { type_lists_.SetOffset(new_offset); } |
| 202 | void SetEncodedArrayOffset(uint32_t new_offset) { encoded_array_items_.SetOffset(new_offset); } |
| 203 | void SetAnnotationOffset(uint32_t new_offset) { annotation_items_.SetOffset(new_offset); } |
| 204 | void SetAnnotationSetOffset(uint32_t new_offset) { annotation_set_items_.SetOffset(new_offset); } |
| 205 | void SetAnnotationSetRefListsOffset(uint32_t new_offset) |
| 206 | { annotation_set_ref_lists_.SetOffset(new_offset); } |
| 207 | void SetAnnotationsDirectoryOffset(uint32_t new_offset) |
| 208 | { annotations_directory_items_.SetOffset(new_offset); } |
| 209 | void SetDebugInfoOffset(uint32_t new_offset) { debug_info_items_.SetOffset(new_offset); } |
| 210 | void SetCodeItemsOffset(uint32_t new_offset) { code_items_.SetOffset(new_offset); } |
| 211 | void SetClassDatasOffset(uint32_t new_offset) { class_datas_.SetOffset(new_offset); } |
| 212 | |
| 213 | uint32_t StringIdsSize() const { return string_ids_.Size(); } |
| 214 | uint32_t TypeIdsSize() const { return type_ids_.Size(); } |
| 215 | uint32_t ProtoIdsSize() const { return proto_ids_.Size(); } |
| 216 | uint32_t FieldIdsSize() const { return field_ids_.Size(); } |
| 217 | uint32_t MethodIdsSize() const { return method_ids_.Size(); } |
| 218 | uint32_t ClassDefsSize() const { return class_defs_.Size(); } |
| 219 | |
| 220 | private: |
| 221 | EncodedValue* ReadEncodedValue(const uint8_t** data); |
| 222 | EncodedValue* ReadEncodedValue(const uint8_t** data, uint8_t type, uint8_t length); |
| 223 | void ReadEncodedValue(const uint8_t** data, uint8_t type, uint8_t length, EncodedValue* item); |
| 224 | |
| 225 | ParameterAnnotation* GenerateParameterAnnotation(const DexFile& dex_file, MethodId* method_id, |
| 226 | const DexFile::AnnotationSetRefList* annotation_set_ref_list, uint32_t offset); |
| 227 | MethodItem* GenerateMethodItem(const DexFile& dex_file, ClassDataItemIterator& cdii); |
| 228 | |
| 229 | CollectionWithOffset<StringId> string_ids_; |
| 230 | CollectionWithOffset<TypeId> type_ids_; |
| 231 | CollectionWithOffset<ProtoId> proto_ids_; |
| 232 | CollectionWithOffset<FieldId> field_ids_; |
| 233 | CollectionWithOffset<MethodId> method_ids_; |
| 234 | CollectionWithOffset<ClassDef> class_defs_; |
| 235 | |
| 236 | CollectionWithOffset<StringData> string_datas_; |
| 237 | CollectionWithOffset<TypeList> type_lists_; |
| 238 | CollectionWithOffset<EncodedArrayItem> encoded_array_items_; |
| 239 | CollectionWithOffset<AnnotationItem> annotation_items_; |
| 240 | CollectionWithOffset<AnnotationSetItem> annotation_set_items_; |
| 241 | CollectionWithOffset<AnnotationSetRefList> annotation_set_ref_lists_; |
| 242 | CollectionWithOffset<AnnotationsDirectoryItem> annotations_directory_items_; |
| 243 | CollectionWithOffset<DebugInfoItem> debug_info_items_; |
| 244 | CollectionWithOffset<CodeItem> code_items_; |
| 245 | CollectionWithOffset<ClassData> class_datas_; |
| 246 | |
| 247 | DISALLOW_COPY_AND_ASSIGN(Collections); |
| 248 | }; |
| 249 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 250 | class Item { |
| 251 | public: |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 252 | Item() { } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 253 | virtual ~Item() { } |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 254 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 255 | uint32_t GetOffset() const { return offset_; } |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 256 | uint32_t GetSize() const { return size_; } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 257 | void SetOffset(uint32_t offset) { offset_ = offset; } |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 258 | void SetSize(uint32_t size) { size_ = size; } |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 259 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 260 | protected: |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 261 | Item(uint32_t offset, uint32_t size) : offset_(offset), size_(size) { } |
| 262 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 263 | uint32_t offset_ = 0; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 264 | uint32_t size_ = 0; |
| 265 | }; |
| 266 | |
| 267 | class IndexedItem : public Item { |
| 268 | public: |
| 269 | IndexedItem() { } |
| 270 | virtual ~IndexedItem() { } |
| 271 | |
| 272 | uint32_t GetIndex() const { return index_; } |
| 273 | void SetIndex(uint32_t index) { index_ = index; } |
| 274 | |
| 275 | protected: |
| 276 | IndexedItem(uint32_t offset, uint32_t size, uint32_t index) |
| 277 | : Item(offset, size), index_(index) { } |
| 278 | |
| 279 | uint32_t index_ = 0; |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 280 | }; |
| 281 | |
| 282 | class Header : public Item { |
| 283 | public: |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 284 | Header(const uint8_t* magic, |
| 285 | uint32_t checksum, |
| 286 | const uint8_t* signature, |
| 287 | uint32_t endian_tag, |
| 288 | uint32_t file_size, |
| 289 | uint32_t header_size, |
| 290 | uint32_t link_size, |
| 291 | uint32_t link_offset, |
| 292 | uint32_t data_size, |
| 293 | uint32_t data_offset) |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 294 | : Item(0, kHeaderItemSize), |
| 295 | checksum_(checksum), |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 296 | endian_tag_(endian_tag), |
| 297 | file_size_(file_size), |
| 298 | header_size_(header_size), |
| 299 | link_size_(link_size), |
| 300 | link_offset_(link_offset), |
| 301 | data_size_(data_size), |
| 302 | data_offset_(data_offset) { |
| 303 | memcpy(magic_, magic, sizeof(magic_)); |
| 304 | memcpy(signature_, signature, sizeof(signature_)); |
| 305 | } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 306 | ~Header() OVERRIDE { } |
| 307 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 308 | static size_t ItemSize() { return kHeaderItemSize; } |
| 309 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 310 | const uint8_t* Magic() const { return magic_; } |
| 311 | uint32_t Checksum() const { return checksum_; } |
| 312 | const uint8_t* Signature() const { return signature_; } |
| 313 | uint32_t EndianTag() const { return endian_tag_; } |
| 314 | uint32_t FileSize() const { return file_size_; } |
| 315 | uint32_t HeaderSize() const { return header_size_; } |
| 316 | uint32_t LinkSize() const { return link_size_; } |
| 317 | uint32_t LinkOffset() const { return link_offset_; } |
| 318 | uint32_t DataSize() const { return data_size_; } |
| 319 | uint32_t DataOffset() const { return data_offset_; } |
| 320 | |
| 321 | void SetChecksum(uint32_t new_checksum) { checksum_ = new_checksum; } |
| 322 | void SetSignature(const uint8_t* new_signature) { |
| 323 | memcpy(signature_, new_signature, sizeof(signature_)); |
| 324 | } |
| 325 | void SetFileSize(uint32_t new_file_size) { file_size_ = new_file_size; } |
| 326 | void SetHeaderSize(uint32_t new_header_size) { header_size_ = new_header_size; } |
| 327 | void SetLinkSize(uint32_t new_link_size) { link_size_ = new_link_size; } |
| 328 | void SetLinkOffset(uint32_t new_link_offset) { link_offset_ = new_link_offset; } |
| 329 | void SetDataSize(uint32_t new_data_size) { data_size_ = new_data_size; } |
| 330 | void SetDataOffset(uint32_t new_data_offset) { data_offset_ = new_data_offset; } |
| 331 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 332 | Collections& GetCollections() { return collections_; } |
Jeff Hao | c3acfc5 | 2016-08-29 14:18:26 -0700 | [diff] [blame] | 333 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 334 | void Accept(AbstractDispatcher* dispatch) { dispatch->Dispatch(this); } |
| 335 | |
| 336 | private: |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 337 | uint8_t magic_[8]; |
| 338 | uint32_t checksum_; |
| 339 | uint8_t signature_[DexFile::kSha1DigestSize]; |
| 340 | uint32_t endian_tag_; |
| 341 | uint32_t file_size_; |
| 342 | uint32_t header_size_; |
| 343 | uint32_t link_size_; |
| 344 | uint32_t link_offset_; |
| 345 | uint32_t data_size_; |
| 346 | uint32_t data_offset_; |
| 347 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 348 | Collections collections_; |
| 349 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 350 | DISALLOW_COPY_AND_ASSIGN(Header); |
| 351 | }; |
| 352 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 353 | class StringData : public Item { |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 354 | public: |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 355 | explicit StringData(const char* data) : data_(strdup(data)) { |
| 356 | size_ = UnsignedLeb128Size(strlen(data)) + strlen(data); |
| 357 | } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 358 | |
| 359 | const char* Data() const { return data_.get(); } |
| 360 | |
| 361 | void Accept(AbstractDispatcher* dispatch) const { dispatch->Dispatch(this); } |
| 362 | |
| 363 | private: |
| 364 | std::unique_ptr<const char> data_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 365 | |
| 366 | DISALLOW_COPY_AND_ASSIGN(StringData); |
| 367 | }; |
| 368 | |
| 369 | class StringId : public IndexedItem { |
| 370 | public: |
| 371 | explicit StringId(StringData* string_data) : string_data_(string_data) { |
| 372 | size_ = kStringIdItemSize; |
| 373 | } |
| 374 | ~StringId() OVERRIDE { } |
| 375 | |
| 376 | static size_t ItemSize() { return kStringIdItemSize; } |
| 377 | |
| 378 | const char* Data() const { return string_data_->Data(); } |
| 379 | StringData* DataItem() const { return string_data_; } |
| 380 | |
| 381 | void Accept(AbstractDispatcher* dispatch) const { dispatch->Dispatch(this); } |
| 382 | |
| 383 | private: |
| 384 | StringData* string_data_; |
| 385 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 386 | DISALLOW_COPY_AND_ASSIGN(StringId); |
| 387 | }; |
| 388 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 389 | class TypeId : public IndexedItem { |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 390 | public: |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 391 | explicit TypeId(StringId* string_id) : string_id_(string_id) { size_ = kTypeIdItemSize; } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 392 | ~TypeId() OVERRIDE { } |
| 393 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 394 | static size_t ItemSize() { return kTypeIdItemSize; } |
| 395 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 396 | StringId* GetStringId() const { return string_id_; } |
| 397 | |
| 398 | void Accept(AbstractDispatcher* dispatch) const { dispatch->Dispatch(this); } |
| 399 | |
| 400 | private: |
| 401 | StringId* string_id_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 402 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 403 | DISALLOW_COPY_AND_ASSIGN(TypeId); |
| 404 | }; |
| 405 | |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 406 | using TypeIdVector = std::vector<const TypeId*>; |
| 407 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 408 | class TypeList : public Item { |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 409 | public: |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 410 | explicit TypeList(TypeIdVector* type_list) : type_list_(type_list) { |
| 411 | size_ = sizeof(uint32_t) + (type_list->size() * sizeof(uint16_t)); |
| 412 | } |
| 413 | ~TypeList() OVERRIDE { } |
| 414 | |
| 415 | const TypeIdVector* GetTypeList() const { return type_list_.get(); } |
| 416 | |
| 417 | private: |
| 418 | std::unique_ptr<TypeIdVector> type_list_; |
| 419 | |
| 420 | DISALLOW_COPY_AND_ASSIGN(TypeList); |
| 421 | }; |
| 422 | |
| 423 | class ProtoId : public IndexedItem { |
| 424 | public: |
| 425 | ProtoId(const StringId* shorty, const TypeId* return_type, TypeList* parameters) |
| 426 | : shorty_(shorty), return_type_(return_type), parameters_(parameters) |
| 427 | { size_ = kProtoIdItemSize; } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 428 | ~ProtoId() OVERRIDE { } |
| 429 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 430 | static size_t ItemSize() { return kProtoIdItemSize; } |
| 431 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 432 | const StringId* Shorty() const { return shorty_; } |
| 433 | const TypeId* ReturnType() const { return return_type_; } |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 434 | const TypeIdVector& Parameters() const { return *parameters_->GetTypeList(); } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 435 | |
| 436 | void Accept(AbstractDispatcher* dispatch) const { dispatch->Dispatch(this); } |
| 437 | |
| 438 | private: |
| 439 | const StringId* shorty_; |
| 440 | const TypeId* return_type_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 441 | TypeList* parameters_; |
| 442 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 443 | DISALLOW_COPY_AND_ASSIGN(ProtoId); |
| 444 | }; |
| 445 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 446 | class FieldId : public IndexedItem { |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 447 | public: |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 448 | FieldId(const TypeId* klass, const TypeId* type, const StringId* name) |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 449 | : class_(klass), type_(type), name_(name) { size_ = kFieldIdItemSize; } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 450 | ~FieldId() OVERRIDE { } |
| 451 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 452 | static size_t ItemSize() { return kFieldIdItemSize; } |
| 453 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 454 | const TypeId* Class() const { return class_; } |
| 455 | const TypeId* Type() const { return type_; } |
| 456 | const StringId* Name() const { return name_; } |
| 457 | |
| 458 | void Accept(AbstractDispatcher* dispatch) const { dispatch->Dispatch(this); } |
| 459 | |
| 460 | private: |
| 461 | const TypeId* class_; |
| 462 | const TypeId* type_; |
| 463 | const StringId* name_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 464 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 465 | DISALLOW_COPY_AND_ASSIGN(FieldId); |
| 466 | }; |
| 467 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 468 | class MethodId : public IndexedItem { |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 469 | public: |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 470 | MethodId(const TypeId* klass, const ProtoId* proto, const StringId* name) |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 471 | : class_(klass), proto_(proto), name_(name) { size_ = kMethodIdItemSize; } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 472 | ~MethodId() OVERRIDE { } |
| 473 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 474 | static size_t ItemSize() { return kMethodIdItemSize; } |
| 475 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 476 | const TypeId* Class() const { return class_; } |
| 477 | const ProtoId* Proto() const { return proto_; } |
| 478 | const StringId* Name() const { return name_; } |
| 479 | |
| 480 | void Accept(AbstractDispatcher* dispatch) const { dispatch->Dispatch(this); } |
| 481 | |
| 482 | private: |
| 483 | const TypeId* class_; |
| 484 | const ProtoId* proto_; |
| 485 | const StringId* name_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 486 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 487 | DISALLOW_COPY_AND_ASSIGN(MethodId); |
| 488 | }; |
| 489 | |
| 490 | class FieldItem : public Item { |
| 491 | public: |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 492 | FieldItem(uint32_t access_flags, const FieldId* field_id) |
| 493 | : access_flags_(access_flags), field_id_(field_id) { } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 494 | ~FieldItem() OVERRIDE { } |
| 495 | |
| 496 | uint32_t GetAccessFlags() const { return access_flags_; } |
| 497 | const FieldId* GetFieldId() const { return field_id_; } |
| 498 | |
| 499 | void Accept(AbstractDispatcher* dispatch) { dispatch->Dispatch(this); } |
| 500 | |
| 501 | private: |
| 502 | uint32_t access_flags_; |
| 503 | const FieldId* field_id_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 504 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 505 | DISALLOW_COPY_AND_ASSIGN(FieldItem); |
| 506 | }; |
| 507 | |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 508 | using FieldItemVector = std::vector<std::unique_ptr<FieldItem>>; |
| 509 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 510 | class MethodItem : public Item { |
| 511 | public: |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 512 | MethodItem(uint32_t access_flags, const MethodId* method_id, const CodeItem* code) |
| 513 | : access_flags_(access_flags), method_id_(method_id), code_(code) { } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 514 | ~MethodItem() OVERRIDE { } |
| 515 | |
| 516 | uint32_t GetAccessFlags() const { return access_flags_; } |
| 517 | const MethodId* GetMethodId() const { return method_id_; } |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 518 | const CodeItem* GetCodeItem() const { return code_; } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 519 | |
| 520 | void Accept(AbstractDispatcher* dispatch) { dispatch->Dispatch(this); } |
| 521 | |
| 522 | private: |
| 523 | uint32_t access_flags_; |
| 524 | const MethodId* method_id_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 525 | const CodeItem* code_; |
| 526 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 527 | DISALLOW_COPY_AND_ASSIGN(MethodItem); |
| 528 | }; |
| 529 | |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 530 | using MethodItemVector = std::vector<std::unique_ptr<MethodItem>>; |
| 531 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 532 | class EncodedValue { |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 533 | public: |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 534 | explicit EncodedValue(uint8_t type) : type_(type) { } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 535 | |
| 536 | int8_t Type() const { return type_; } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 537 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 538 | void SetBoolean(bool z) { u_.bool_val_ = z; } |
| 539 | void SetByte(int8_t b) { u_.byte_val_ = b; } |
| 540 | void SetShort(int16_t s) { u_.short_val_ = s; } |
| 541 | void SetChar(uint16_t c) { u_.char_val_ = c; } |
| 542 | void SetInt(int32_t i) { u_.int_val_ = i; } |
| 543 | void SetLong(int64_t l) { u_.long_val_ = l; } |
| 544 | void SetFloat(float f) { u_.float_val_ = f; } |
| 545 | void SetDouble(double d) { u_.double_val_ = d; } |
| 546 | void SetStringId(StringId* string_id) { u_.string_val_ = string_id; } |
| 547 | void SetTypeId(TypeId* type_id) { u_.type_val_ = type_id; } |
| 548 | void SetFieldId(FieldId* field_id) { u_.field_val_ = field_id; } |
| 549 | void SetMethodId(MethodId* method_id) { u_.method_val_ = method_id; } |
| 550 | void SetEncodedArray(EncodedArrayItem* encoded_array) { encoded_array_.reset(encoded_array); } |
| 551 | void SetEncodedAnnotation(EncodedAnnotation* encoded_annotation) |
| 552 | { encoded_annotation_.reset(encoded_annotation); } |
| 553 | |
| 554 | bool GetBoolean() const { return u_.bool_val_; } |
| 555 | int8_t GetByte() const { return u_.byte_val_; } |
| 556 | int16_t GetShort() const { return u_.short_val_; } |
| 557 | uint16_t GetChar() const { return u_.char_val_; } |
| 558 | int32_t GetInt() const { return u_.int_val_; } |
| 559 | int64_t GetLong() const { return u_.long_val_; } |
| 560 | float GetFloat() const { return u_.float_val_; } |
| 561 | double GetDouble() const { return u_.double_val_; } |
| 562 | StringId* GetStringId() const { return u_.string_val_; } |
| 563 | TypeId* GetTypeId() const { return u_.type_val_; } |
| 564 | FieldId* GetFieldId() const { return u_.field_val_; } |
| 565 | MethodId* GetMethodId() const { return u_.method_val_; } |
| 566 | EncodedArrayItem* GetEncodedArray() const { return encoded_array_.get(); } |
| 567 | EncodedAnnotation* GetEncodedAnnotation() const { return encoded_annotation_.get(); } |
| 568 | |
| 569 | EncodedAnnotation* ReleaseEncodedAnnotation() { return encoded_annotation_.release(); } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 570 | |
| 571 | private: |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 572 | uint8_t type_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 573 | union { |
| 574 | bool bool_val_; |
| 575 | int8_t byte_val_; |
| 576 | int16_t short_val_; |
| 577 | uint16_t char_val_; |
| 578 | int32_t int_val_; |
| 579 | int64_t long_val_; |
| 580 | float float_val_; |
| 581 | double double_val_; |
| 582 | StringId* string_val_; |
| 583 | TypeId* type_val_; |
| 584 | FieldId* field_val_; |
| 585 | MethodId* method_val_; |
| 586 | } u_; |
| 587 | std::unique_ptr<EncodedArrayItem> encoded_array_; |
| 588 | std::unique_ptr<EncodedAnnotation> encoded_annotation_; |
| 589 | |
| 590 | DISALLOW_COPY_AND_ASSIGN(EncodedValue); |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 591 | }; |
| 592 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 593 | using EncodedValueVector = std::vector<std::unique_ptr<EncodedValue>>; |
| 594 | |
| 595 | class AnnotationElement { |
| 596 | public: |
| 597 | AnnotationElement(StringId* name, EncodedValue* value) : name_(name), value_(value) { } |
| 598 | |
| 599 | StringId* GetName() const { return name_; } |
| 600 | EncodedValue* GetValue() const { return value_.get(); } |
| 601 | |
| 602 | private: |
| 603 | StringId* name_; |
| 604 | std::unique_ptr<EncodedValue> value_; |
| 605 | |
| 606 | DISALLOW_COPY_AND_ASSIGN(AnnotationElement); |
| 607 | }; |
| 608 | |
| 609 | using AnnotationElementVector = std::vector<std::unique_ptr<AnnotationElement>>; |
| 610 | |
| 611 | class EncodedAnnotation { |
| 612 | public: |
| 613 | EncodedAnnotation(TypeId* type, AnnotationElementVector* elements) |
| 614 | : type_(type), elements_(elements) { } |
| 615 | |
| 616 | TypeId* GetType() const { return type_; } |
| 617 | AnnotationElementVector* GetAnnotationElements() const { return elements_.get(); } |
| 618 | |
| 619 | private: |
| 620 | TypeId* type_; |
| 621 | std::unique_ptr<AnnotationElementVector> elements_; |
| 622 | |
| 623 | DISALLOW_COPY_AND_ASSIGN(EncodedAnnotation); |
| 624 | }; |
| 625 | |
| 626 | class EncodedArrayItem : public Item { |
| 627 | public: |
| 628 | explicit EncodedArrayItem(EncodedValueVector* encoded_values) |
| 629 | : encoded_values_(encoded_values) { } |
| 630 | |
| 631 | EncodedValueVector* GetEncodedValues() const { return encoded_values_.get(); } |
| 632 | |
| 633 | private: |
| 634 | std::unique_ptr<EncodedValueVector> encoded_values_; |
| 635 | |
| 636 | DISALLOW_COPY_AND_ASSIGN(EncodedArrayItem); |
| 637 | }; |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 638 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 639 | class ClassData : public Item { |
| 640 | public: |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 641 | ClassData(FieldItemVector* static_fields, |
| 642 | FieldItemVector* instance_fields, |
| 643 | MethodItemVector* direct_methods, |
| 644 | MethodItemVector* virtual_methods) |
| 645 | : static_fields_(static_fields), |
| 646 | instance_fields_(instance_fields), |
| 647 | direct_methods_(direct_methods), |
| 648 | virtual_methods_(virtual_methods) { } |
| 649 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 650 | ~ClassData() OVERRIDE = default; |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 651 | FieldItemVector* StaticFields() { return static_fields_.get(); } |
| 652 | FieldItemVector* InstanceFields() { return instance_fields_.get(); } |
| 653 | MethodItemVector* DirectMethods() { return direct_methods_.get(); } |
| 654 | MethodItemVector* VirtualMethods() { return virtual_methods_.get(); } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 655 | |
| 656 | void Accept(AbstractDispatcher* dispatch) { dispatch->Dispatch(this); } |
| 657 | |
| 658 | private: |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 659 | std::unique_ptr<FieldItemVector> static_fields_; |
| 660 | std::unique_ptr<FieldItemVector> instance_fields_; |
| 661 | std::unique_ptr<MethodItemVector> direct_methods_; |
| 662 | std::unique_ptr<MethodItemVector> virtual_methods_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 663 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 664 | DISALLOW_COPY_AND_ASSIGN(ClassData); |
| 665 | }; |
| 666 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 667 | class ClassDef : public IndexedItem { |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 668 | public: |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 669 | ClassDef(const TypeId* class_type, |
| 670 | uint32_t access_flags, |
| 671 | const TypeId* superclass, |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 672 | TypeList* interfaces, |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 673 | const StringId* source_file, |
| 674 | AnnotationsDirectoryItem* annotations, |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 675 | EncodedArrayItem* static_values, |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 676 | ClassData* class_data) |
| 677 | : class_type_(class_type), |
| 678 | access_flags_(access_flags), |
| 679 | superclass_(superclass), |
| 680 | interfaces_(interfaces), |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 681 | source_file_(source_file), |
| 682 | annotations_(annotations), |
| 683 | static_values_(static_values), |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 684 | class_data_(class_data) { size_ = kClassDefItemSize; } |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 685 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 686 | ~ClassDef() OVERRIDE { } |
| 687 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 688 | static size_t ItemSize() { return kClassDefItemSize; } |
| 689 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 690 | const TypeId* ClassType() const { return class_type_; } |
| 691 | uint32_t GetAccessFlags() const { return access_flags_; } |
| 692 | const TypeId* Superclass() const { return superclass_; } |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 693 | const TypeIdVector* Interfaces() |
| 694 | { return interfaces_ == nullptr ? nullptr: interfaces_->GetTypeList(); } |
| 695 | uint32_t InterfacesOffset() { return interfaces_ == nullptr ? 0 : interfaces_->GetOffset(); } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 696 | const StringId* SourceFile() const { return source_file_; } |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 697 | AnnotationsDirectoryItem* Annotations() const { return annotations_; } |
| 698 | EncodedArrayItem* StaticValues() { return static_values_; } |
| 699 | ClassData* GetClassData() { return class_data_; } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 700 | |
Jeff Hao | c3acfc5 | 2016-08-29 14:18:26 -0700 | [diff] [blame] | 701 | MethodItem* GenerateMethodItem(Header& header, ClassDataItemIterator& cdii); |
| 702 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 703 | void Accept(AbstractDispatcher* dispatch) { dispatch->Dispatch(this); } |
| 704 | |
| 705 | private: |
| 706 | const TypeId* class_type_; |
| 707 | uint32_t access_flags_; |
| 708 | const TypeId* superclass_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 709 | TypeList* interfaces_; |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 710 | const StringId* source_file_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 711 | AnnotationsDirectoryItem* annotations_; |
| 712 | EncodedArrayItem* static_values_; |
| 713 | ClassData* class_data_; |
| 714 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 715 | DISALLOW_COPY_AND_ASSIGN(ClassDef); |
| 716 | }; |
| 717 | |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 718 | class CatchHandler { |
| 719 | public: |
| 720 | CatchHandler(const TypeId* type_id, uint32_t address) : type_id_(type_id), address_(address) { } |
| 721 | |
| 722 | const TypeId* GetTypeId() const { return type_id_; } |
| 723 | uint32_t GetAddress() const { return address_; } |
| 724 | |
| 725 | private: |
| 726 | const TypeId* type_id_; |
| 727 | uint32_t address_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 728 | |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 729 | DISALLOW_COPY_AND_ASSIGN(CatchHandler); |
| 730 | }; |
| 731 | |
| 732 | using CatchHandlerVector = std::vector<std::unique_ptr<const CatchHandler>>; |
| 733 | |
| 734 | class TryItem : public Item { |
| 735 | public: |
| 736 | TryItem(uint32_t start_addr, uint16_t insn_count, CatchHandlerVector* handlers) |
| 737 | : start_addr_(start_addr), insn_count_(insn_count), handlers_(handlers) { } |
| 738 | ~TryItem() OVERRIDE { } |
| 739 | |
| 740 | uint32_t StartAddr() const { return start_addr_; } |
| 741 | uint16_t InsnCount() const { return insn_count_; } |
| 742 | const CatchHandlerVector& GetHandlers() const { return *handlers_.get(); } |
| 743 | |
| 744 | void Accept(AbstractDispatcher* dispatch) { dispatch->Dispatch(this); } |
| 745 | |
| 746 | private: |
| 747 | uint32_t start_addr_; |
| 748 | uint16_t insn_count_; |
| 749 | std::unique_ptr<CatchHandlerVector> handlers_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 750 | |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 751 | DISALLOW_COPY_AND_ASSIGN(TryItem); |
| 752 | }; |
| 753 | |
| 754 | using TryItemVector = std::vector<std::unique_ptr<const TryItem>>; |
| 755 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 756 | class CodeItem : public Item { |
| 757 | public: |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 758 | CodeItem(uint16_t registers_size, |
| 759 | uint16_t ins_size, |
| 760 | uint16_t outs_size, |
| 761 | DebugInfoItem* debug_info, |
| 762 | uint32_t insns_size, |
| 763 | uint16_t* insns, |
| 764 | TryItemVector* tries) |
| 765 | : registers_size_(registers_size), |
| 766 | ins_size_(ins_size), |
| 767 | outs_size_(outs_size), |
| 768 | debug_info_(debug_info), |
| 769 | insns_size_(insns_size), |
| 770 | insns_(insns), |
| 771 | tries_(tries) { } |
| 772 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 773 | ~CodeItem() OVERRIDE { } |
| 774 | |
| 775 | uint16_t RegistersSize() const { return registers_size_; } |
| 776 | uint16_t InsSize() const { return ins_size_; } |
| 777 | uint16_t OutsSize() const { return outs_size_; } |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 778 | uint16_t TriesSize() const { return tries_ == nullptr ? 0 : tries_->size(); } |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 779 | DebugInfoItem* DebugInfo() const { return debug_info_; } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 780 | uint32_t InsnsSize() const { return insns_size_; } |
| 781 | uint16_t* Insns() const { return insns_.get(); } |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 782 | TryItemVector* Tries() const { return tries_.get(); } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 783 | |
| 784 | void Accept(AbstractDispatcher* dispatch) { dispatch->Dispatch(this); } |
| 785 | |
| 786 | private: |
| 787 | uint16_t registers_size_; |
| 788 | uint16_t ins_size_; |
| 789 | uint16_t outs_size_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 790 | DebugInfoItem* debug_info_; |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 791 | uint32_t insns_size_; |
| 792 | std::unique_ptr<uint16_t[]> insns_; |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 793 | std::unique_ptr<TryItemVector> tries_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 794 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 795 | DISALLOW_COPY_AND_ASSIGN(CodeItem); |
| 796 | }; |
| 797 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 798 | struct PositionInfo { |
| 799 | PositionInfo(uint32_t address, uint32_t line) : address_(address), line_(line) { } |
| 800 | |
| 801 | uint32_t address_; |
| 802 | uint32_t line_; |
| 803 | }; |
| 804 | |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 805 | using PositionInfoVector = std::vector<std::unique_ptr<PositionInfo>>; |
| 806 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 807 | struct LocalInfo { |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 808 | LocalInfo(const char* name, |
| 809 | const char* descriptor, |
| 810 | const char* signature, |
| 811 | uint32_t start_address, |
| 812 | uint32_t end_address, |
| 813 | uint16_t reg) |
| 814 | : name_(name), |
| 815 | descriptor_(descriptor), |
| 816 | signature_(signature), |
| 817 | start_address_(start_address), |
| 818 | end_address_(end_address), |
| 819 | reg_(reg) { } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 820 | |
| 821 | std::string name_; |
| 822 | std::string descriptor_; |
| 823 | std::string signature_; |
| 824 | uint32_t start_address_; |
| 825 | uint32_t end_address_; |
| 826 | uint16_t reg_; |
| 827 | }; |
| 828 | |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 829 | using LocalInfoVector = std::vector<std::unique_ptr<LocalInfo>>; |
| 830 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 831 | class DebugInfoItem : public Item { |
| 832 | public: |
| 833 | DebugInfoItem() = default; |
| 834 | |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 835 | PositionInfoVector& GetPositionInfo() { return positions_; } |
| 836 | LocalInfoVector& GetLocalInfo() { return locals_; } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 837 | |
| 838 | private: |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 839 | PositionInfoVector positions_; |
| 840 | LocalInfoVector locals_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 841 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 842 | DISALLOW_COPY_AND_ASSIGN(DebugInfoItem); |
| 843 | }; |
| 844 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 845 | class AnnotationItem : public Item { |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 846 | public: |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 847 | AnnotationItem(uint8_t visibility, EncodedAnnotation* annotation) |
| 848 | : visibility_(visibility), annotation_(annotation) { } |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 849 | |
| 850 | uint8_t GetVisibility() const { return visibility_; } |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 851 | EncodedAnnotation* GetAnnotation() const { return annotation_.get(); } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 852 | |
| 853 | void Accept(AbstractDispatcher* dispatch) { dispatch->Dispatch(this); } |
| 854 | |
| 855 | private: |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 856 | uint8_t visibility_; |
| 857 | std::unique_ptr<EncodedAnnotation> annotation_; |
| 858 | |
| 859 | DISALLOW_COPY_AND_ASSIGN(AnnotationItem); |
| 860 | }; |
| 861 | |
| 862 | class AnnotationSetItem : public Item { |
| 863 | public: |
| 864 | explicit AnnotationSetItem(std::vector<AnnotationItem*>* items) : items_(items) { |
| 865 | size_ = sizeof(uint32_t) + items->size() * sizeof(uint32_t); |
| 866 | } |
| 867 | ~AnnotationSetItem() OVERRIDE { } |
| 868 | |
| 869 | std::vector<AnnotationItem*>* GetItems() { return items_.get(); } |
| 870 | |
| 871 | void Accept(AbstractDispatcher* dispatch) { dispatch->Dispatch(this); } |
| 872 | |
| 873 | private: |
| 874 | std::unique_ptr<std::vector<AnnotationItem*>> items_; |
| 875 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 876 | DISALLOW_COPY_AND_ASSIGN(AnnotationSetItem); |
| 877 | }; |
| 878 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 879 | class AnnotationSetRefList : public Item { |
| 880 | public: |
| 881 | explicit AnnotationSetRefList(std::vector<AnnotationSetItem*>* items) : items_(items) { |
| 882 | size_ = sizeof(uint32_t) + items->size() * sizeof(uint32_t); |
| 883 | } |
| 884 | ~AnnotationSetRefList() OVERRIDE { } |
| 885 | |
| 886 | std::vector<AnnotationSetItem*>* GetItems() { return items_.get(); } |
| 887 | |
| 888 | void Accept(AbstractDispatcher* dispatch) { dispatch->Dispatch(this); } |
| 889 | |
| 890 | private: |
| 891 | std::unique_ptr<std::vector<AnnotationSetItem*>> items_; |
| 892 | |
| 893 | DISALLOW_COPY_AND_ASSIGN(AnnotationSetRefList); |
| 894 | }; |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 895 | |
| 896 | class FieldAnnotation { |
| 897 | public: |
| 898 | FieldAnnotation(FieldId* field_id, AnnotationSetItem* annotation_set_item) |
| 899 | : field_id_(field_id), annotation_set_item_(annotation_set_item) { } |
| 900 | |
| 901 | FieldId* GetFieldId() const { return field_id_; } |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 902 | AnnotationSetItem* GetAnnotationSetItem() const { return annotation_set_item_; } |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 903 | |
| 904 | private: |
| 905 | FieldId* field_id_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 906 | AnnotationSetItem* annotation_set_item_; |
| 907 | |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 908 | DISALLOW_COPY_AND_ASSIGN(FieldAnnotation); |
| 909 | }; |
| 910 | |
| 911 | using FieldAnnotationVector = std::vector<std::unique_ptr<FieldAnnotation>>; |
| 912 | |
| 913 | class MethodAnnotation { |
| 914 | public: |
| 915 | MethodAnnotation(MethodId* method_id, AnnotationSetItem* annotation_set_item) |
| 916 | : method_id_(method_id), annotation_set_item_(annotation_set_item) { } |
| 917 | |
| 918 | MethodId* GetMethodId() const { return method_id_; } |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 919 | AnnotationSetItem* GetAnnotationSetItem() const { return annotation_set_item_; } |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 920 | |
| 921 | private: |
| 922 | MethodId* method_id_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 923 | AnnotationSetItem* annotation_set_item_; |
| 924 | |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 925 | DISALLOW_COPY_AND_ASSIGN(MethodAnnotation); |
| 926 | }; |
| 927 | |
| 928 | using MethodAnnotationVector = std::vector<std::unique_ptr<MethodAnnotation>>; |
| 929 | |
| 930 | class ParameterAnnotation { |
| 931 | public: |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 932 | ParameterAnnotation(MethodId* method_id, AnnotationSetRefList* annotations) |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 933 | : method_id_(method_id), annotations_(annotations) { } |
| 934 | |
| 935 | MethodId* GetMethodId() const { return method_id_; } |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 936 | AnnotationSetRefList* GetAnnotations() { return annotations_; } |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 937 | |
| 938 | private: |
| 939 | MethodId* method_id_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 940 | AnnotationSetRefList* annotations_; |
| 941 | |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 942 | DISALLOW_COPY_AND_ASSIGN(ParameterAnnotation); |
| 943 | }; |
| 944 | |
| 945 | using ParameterAnnotationVector = std::vector<std::unique_ptr<ParameterAnnotation>>; |
| 946 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 947 | class AnnotationsDirectoryItem : public Item { |
| 948 | public: |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 949 | AnnotationsDirectoryItem(AnnotationSetItem* class_annotation, |
| 950 | FieldAnnotationVector* field_annotations, |
| 951 | MethodAnnotationVector* method_annotations, |
| 952 | ParameterAnnotationVector* parameter_annotations) |
| 953 | : class_annotation_(class_annotation), |
| 954 | field_annotations_(field_annotations), |
| 955 | method_annotations_(method_annotations), |
| 956 | parameter_annotations_(parameter_annotations) { } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 957 | |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 958 | AnnotationSetItem* GetClassAnnotation() const { return class_annotation_; } |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 959 | FieldAnnotationVector* GetFieldAnnotations() { return field_annotations_.get(); } |
| 960 | MethodAnnotationVector* GetMethodAnnotations() { return method_annotations_.get(); } |
| 961 | ParameterAnnotationVector* GetParameterAnnotations() { return parameter_annotations_.get(); } |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 962 | |
| 963 | void Accept(AbstractDispatcher* dispatch) { dispatch->Dispatch(this); } |
| 964 | |
| 965 | private: |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 966 | AnnotationSetItem* class_annotation_; |
David Sehr | 853a8e1 | 2016-09-01 13:03:50 -0700 | [diff] [blame] | 967 | std::unique_ptr<FieldAnnotationVector> field_annotations_; |
| 968 | std::unique_ptr<MethodAnnotationVector> method_annotations_; |
| 969 | std::unique_ptr<ParameterAnnotationVector> parameter_annotations_; |
Jeff Hao | 3ab96b4 | 2016-09-09 18:35:01 -0700 | [diff] [blame] | 970 | |
David Sehr | 7629f60 | 2016-08-07 16:01:51 -0700 | [diff] [blame] | 971 | DISALLOW_COPY_AND_ASSIGN(AnnotationsDirectoryItem); |
| 972 | }; |
| 973 | |
| 974 | // TODO(sehr): implement MapList. |
| 975 | class MapList : public Item { |
| 976 | public: |
| 977 | void Accept(AbstractDispatcher* dispatch) { dispatch->Dispatch(this); } |
| 978 | |
| 979 | private: |
| 980 | DISALLOW_COPY_AND_ASSIGN(MapList); |
| 981 | }; |
| 982 | |
| 983 | class MapItem : public Item { |
| 984 | public: |
| 985 | void Accept(AbstractDispatcher* dispatch) { dispatch->Dispatch(this); } |
| 986 | |
| 987 | private: |
| 988 | DISALLOW_COPY_AND_ASSIGN(MapItem); |
| 989 | }; |
| 990 | |
| 991 | } // namespace dex_ir |
| 992 | } // namespace art |
| 993 | |
| 994 | #endif // ART_DEXLAYOUT_DEX_IR_H_ |