oat.h revision 2faa5f1271587cda765f26bcf2951065300a01ff
12faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes/* 22faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * Copyright (C) 2011 The Android Open Source Project 32faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * 42faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * Licensed under the Apache License, Version 2.0 (the "License"); 52faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * you may not use this file except in compliance with the License. 62faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * You may obtain a copy of the License at 72faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * 82faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 92faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * 102faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * Unless required by applicable law or agreed to in writing, software 112faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 122faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 132faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * See the License for the specific language governing permissions and 142faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * limitations under the License. 152faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes */ 16e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom 17e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom#ifndef ART_SRC_OAT_H_ 18e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom#define ART_SRC_OAT_H_ 19e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom 20e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom#include <vector> 21e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom 22e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom#include "dex_file.h" 23e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom#include "macros.h" 24e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom 25e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstromnamespace art { 26e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom 27e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstromclass PACKED OatHeader { 28e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom public: 29e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom OatHeader() {} 30e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom OatHeader(const std::vector<const DexFile*>* dex_files); 31e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom 32e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom bool IsValid() const; 33e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom const char* GetMagic() const; 34e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom uint32_t GetChecksum() const; 35e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom void UpdateChecksum(const void* data, size_t length); 36e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom uint32_t GetDexFileCount() const; 37e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom uint32_t GetExecutableOffset() const; 38e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom void SetExecutableOffset(uint32_t executable_offset); 39e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom 40e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom private: 41e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom static const uint8_t kOatMagic[4]; 42e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom static const uint8_t kOatVersion[4]; 43e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom 44e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom uint8_t magic_[4]; 45e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom uint8_t version_[4]; 46e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom uint32_t adler32_checksum_; 47e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom uint32_t dex_file_count_; 48e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom uint32_t executable_offset_; 49e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom 50e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom DISALLOW_COPY_AND_ASSIGN(OatHeader); 51e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom}; 52e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom 533320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstromclass PACKED OatMethodOffsets { 543320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom public: 553320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom OatMethodOffsets(); 563320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom OatMethodOffsets(uint32_t code_offset, 573320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom uint32_t frame_size_in_bytes, 583320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom uint32_t core_spill_mask, 593320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom uint32_t fp_spill_mask, 603320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom uint32_t mapping_table_offset, 613320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom uint32_t vmap_table_offset, 62e7d856b911222aa000ca2be0f8f63f5b292141c3Brian Carlstrom uint32_t gc_map_offset, 633320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom uint32_t invoke_stub_offset); 643320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom ~OatMethodOffsets(); 653320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom 663320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom uint32_t code_offset_; 673320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom uint32_t frame_size_in_bytes_; 683320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom uint32_t core_spill_mask_; 693320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom uint32_t fp_spill_mask_; 703320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom uint32_t mapping_table_offset_; 713320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom uint32_t vmap_table_offset_; 72e7d856b911222aa000ca2be0f8f63f5b292141c3Brian Carlstrom uint32_t gc_map_offset_; 733320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom uint32_t invoke_stub_offset_; 743320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom}; 753320cf46afd082398aa401b246e6f301cebdf64dBrian Carlstrom 76e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom} // namespace art 77e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom 78e24fa61603a60ade3797e4a0c8b3fccb346cb048Brian Carlstrom#endif // ART_SRC_OAT_H_ 79