blob: 97ca6b2b37d320ec143b0a4c69ebd1bc15dce07c [file] [log] [blame]
Vladimir Marko8a630572014-04-09 18:45:35 +01001/*
2 * Copyright (C) 2014 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
17#ifndef ART_RUNTIME_OAT_FILE_INL_H_
18#define ART_RUNTIME_OAT_FILE_INL_H_
19
20#include "oat_file.h"
21
22namespace art {
23
Vladimir Marko7624d252014-05-02 14:40:15 +010024inline size_t OatFile::OatMethod::GetFrameSizeInBytes() const {
25 const void* code = mirror::ArtMethod::EntryPointToCodePointer(GetQuickCode());
26 if (code == nullptr) {
27 return 0u;
28 }
29 return reinterpret_cast<const OatQuickMethodHeader*>(code)[-1].frame_info_.FrameSizeInBytes();
30}
31
32inline uint32_t OatFile::OatMethod::GetCoreSpillMask() const {
33 const void* code = mirror::ArtMethod::EntryPointToCodePointer(GetQuickCode());
34 if (code == nullptr) {
35 return 0u;
36 }
37 return reinterpret_cast<const OatQuickMethodHeader*>(code)[-1].frame_info_.CoreSpillMask();
38}
39
40inline uint32_t OatFile::OatMethod::GetFpSpillMask() const {
41 const void* code = mirror::ArtMethod::EntryPointToCodePointer(GetQuickCode());
42 if (code == nullptr) {
43 return 0u;
44 }
45 return reinterpret_cast<const OatQuickMethodHeader*>(code)[-1].frame_info_.FpSpillMask();
46}
47
Vladimir Marko8a630572014-04-09 18:45:35 +010048inline uint32_t OatFile::OatMethod::GetMappingTableOffset() const {
49 const uint8_t* mapping_table = GetMappingTable();
50 return static_cast<uint32_t>(mapping_table != nullptr ? mapping_table - begin_ : 0u);
51}
52
53inline uint32_t OatFile::OatMethod::GetVmapTableOffset() const {
54 const uint8_t* vmap_table = GetVmapTable();
55 return static_cast<uint32_t>(vmap_table != nullptr ? vmap_table - begin_ : 0u);
56}
57
58inline const uint8_t* OatFile::OatMethod::GetMappingTable() const {
59 const void* code = mirror::ArtMethod::EntryPointToCodePointer(GetQuickCode());
60 if (code == nullptr) {
61 return nullptr;
62 }
Vladimir Marko7624d252014-05-02 14:40:15 +010063 uint32_t offset = reinterpret_cast<const OatQuickMethodHeader*>(code)[-1].mapping_table_offset_;
Vladimir Marko8a630572014-04-09 18:45:35 +010064 if (UNLIKELY(offset == 0u)) {
65 return nullptr;
66 }
67 return reinterpret_cast<const uint8_t*>(code) - offset;
68}
69
70inline const uint8_t* OatFile::OatMethod::GetVmapTable() const {
71 const void* code = mirror::ArtMethod::EntryPointToCodePointer(GetQuickCode());
72 if (code == nullptr) {
73 return nullptr;
74 }
Vladimir Marko7624d252014-05-02 14:40:15 +010075 uint32_t offset = reinterpret_cast<const OatQuickMethodHeader*>(code)[-1].vmap_table_offset_;
Vladimir Marko8a630572014-04-09 18:45:35 +010076 if (UNLIKELY(offset == 0u)) {
77 return nullptr;
78 }
79 return reinterpret_cast<const uint8_t*>(code) - offset;
80}
81
82} // namespace art
83
84#endif // ART_RUNTIME_OAT_FILE_INL_H_