xref: /aosp_15_r20/art/runtime/arch/context-inl.h (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
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 // This file is special-purpose for cases where you want a stack context. Most users should use
18 // Context::Create().
19 
20 #include "arch/instruction_set.h"
21 #include "context.h"
22 
23 #ifndef ART_RUNTIME_ARCH_CONTEXT_INL_H_
24 #define ART_RUNTIME_ARCH_CONTEXT_INL_H_
25 
26 #include "arm/context_arm.h"
27 #include "arm64/context_arm64.h"
28 #include "riscv64/context_riscv64.h"
29 #include "x86/context_x86.h"
30 #include "x86_64/context_x86_64.h"
31 
32 namespace art HIDDEN {
33 
34 namespace detail {
35 
36 template <InstructionSet>
37 struct ContextSelector;
38 
39 template <>
40 struct ContextSelector<InstructionSet::kArm> { using type = arm::ArmContext; };
41 template <>
42 struct ContextSelector<InstructionSet::kArm64> { using type = arm64::Arm64Context; };
43 template <>
44 struct ContextSelector<InstructionSet::kRiscv64> { using type = riscv64::Riscv64Context; };
45 template <>
46 struct ContextSelector<InstructionSet::kX86> { using type = x86::X86Context; };
47 template <>
48 struct ContextSelector<InstructionSet::kX86_64> { using type = x86_64::X86_64Context; };
49 
50 }  // namespace detail
51 
52 template <InstructionSet Isa>
53 using RuntimeContextTypeArch = typename detail::ContextSelector<Isa>::type;
54 using RuntimeContextType = RuntimeContextTypeArch<kRuntimeQuickCodeISA>;
55 
56 }  // namespace art
57 
58 #endif  // ART_RUNTIME_ARCH_CONTEXT_INL_H_
59