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_RUNTIME_DEOPTIMIZATION_KIND_H_
18 #define ART_RUNTIME_DEOPTIMIZATION_KIND_H_
19 
20 namespace art {
21 
22 enum class DeoptimizationKind {
23   kAotInlineCache = 0,
24   kJitInlineCache,
25   kJitSameTarget,
26   kLoopBoundsBCE,
27   kLoopNullBCE,
28   kBlockBCE,
29   kCHA,
30   kFullFrame,
31   kLast = kFullFrame
32 };
33 
GetDeoptimizationKindName(DeoptimizationKind kind)34 inline const char* GetDeoptimizationKindName(DeoptimizationKind kind) {
35   switch (kind) {
36     case DeoptimizationKind::kAotInlineCache: return "AOT inline cache";
37     case DeoptimizationKind::kJitInlineCache: return "JIT inline cache";
38     case DeoptimizationKind::kJitSameTarget: return "JIT same target";
39     case DeoptimizationKind::kLoopBoundsBCE: return "loop bounds check elimination";
40     case DeoptimizationKind::kLoopNullBCE: return "loop bounds check elimination on null";
41     case DeoptimizationKind::kBlockBCE: return "block bounds check elimination";
42     case DeoptimizationKind::kCHA: return "class hierarchy analysis";
43     case DeoptimizationKind::kFullFrame: return "full frame";
44   }
45   LOG(FATAL) << "Unexpected kind " << static_cast<size_t>(kind);
46   UNREACHABLE();
47 }
48 
49 std::ostream& operator<<(std::ostream& os, const DeoptimizationKind& kind);
50 
51 }  // namespace art
52 
53 #endif  // ART_RUNTIME_DEOPTIMIZATION_KIND_H_
54