1 /*
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 
26 namespace art {
27 
GetQuickCode()28 inline ArrayRef<const uint8_t> CompiledCode::GetQuickCode() const {
29   return GetArray(quick_code_);
30 }
31 
32 template <typename T>
GetArray(const LengthPrefixedArray<T> * array)33 inline 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 
GetVmapTable()41 inline ArrayRef<const uint8_t> CompiledMethod::GetVmapTable() const {
42   return GetArray(vmap_table_);
43 }
44 
GetCFIInfo()45 inline ArrayRef<const uint8_t> CompiledMethod::GetCFIInfo() const {
46   return GetArray(cfi_info_);
47 }
48 
GetPatches()49 inline 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_
56