blob: e60b30fed2f82fb788c8a4c8f7dc4c471965260b [file] [log] [blame]
Vladimir Markod8dbc8d2017-09-20 13:37:47 +01001/*
2 * Copyright (C) 2017 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_COMPILER_COMPILED_METHOD_INL_H_
18#define ART_COMPILER_COMPILED_METHOD_INL_H_
19
20#include "compiled_method.h"
21
22#include "base/array_ref.h"
23#include "base/length_prefixed_array.h"
24#include "linker/linker_patch.h"
25
26namespace art {
27
28inline ArrayRef<const uint8_t> CompiledCode::GetQuickCode() const {
29 return GetArray(quick_code_);
30}
31
32template <typename T>
33inline ArrayRef<const T> CompiledCode::GetArray(const LengthPrefixedArray<T>* array) {
34 if (array == nullptr) {
35 return ArrayRef<const T>();
36 }
37 DCHECK_NE(array->size(), 0u);
38 return ArrayRef<const T>(&array->At(0), array->size());
39}
40
Vladimir Markod8dbc8d2017-09-20 13:37:47 +010041inline ArrayRef<const uint8_t> CompiledMethod::GetVmapTable() const {
42 return GetArray(vmap_table_);
43}
44
45inline ArrayRef<const uint8_t> CompiledMethod::GetCFIInfo() const {
46 return GetArray(cfi_info_);
47}
48
49inline ArrayRef<const linker::LinkerPatch> CompiledMethod::GetPatches() const {
50 return GetArray(patches_);
51}
52
53} // namespace art
54
55#endif // ART_COMPILER_COMPILED_METHOD_INL_H_