blob: c2e6a6585af71025c916c5a3121010a581e7f416 [file] [log] [blame]
Nicolas Geoffray4e92c3c2017-05-08 09:34:26 +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_RUNTIME_DEOPTIMIZATION_KIND_H_
18#define ART_RUNTIME_DEOPTIMIZATION_KIND_H_
19
David Srbecky2f78a9c2020-01-17 15:53:42 +000020#include "base/logging.h"
21
Nicolas Geoffray4e92c3c2017-05-08 09:34:26 +010022namespace art {
23
24enum class DeoptimizationKind {
25 kAotInlineCache = 0,
26 kJitInlineCache,
27 kJitSameTarget,
28 kLoopBoundsBCE,
29 kLoopNullBCE,
30 kBlockBCE,
31 kCHA,
Mythri Alle5097f832021-11-02 14:52:30 +000032 kDebugging,
Nicolas Geoffray4e92c3c2017-05-08 09:34:26 +010033 kFullFrame,
34 kLast = kFullFrame
35};
36
37inline const char* GetDeoptimizationKindName(DeoptimizationKind kind) {
38 switch (kind) {
39 case DeoptimizationKind::kAotInlineCache: return "AOT inline cache";
40 case DeoptimizationKind::kJitInlineCache: return "JIT inline cache";
41 case DeoptimizationKind::kJitSameTarget: return "JIT same target";
42 case DeoptimizationKind::kLoopBoundsBCE: return "loop bounds check elimination";
43 case DeoptimizationKind::kLoopNullBCE: return "loop bounds check elimination on null";
44 case DeoptimizationKind::kBlockBCE: return "block bounds check elimination";
45 case DeoptimizationKind::kCHA: return "class hierarchy analysis";
Mythri Alle5097f832021-11-02 14:52:30 +000046 case DeoptimizationKind::kDebugging: return "Deopt requested for debug support";
Nicolas Geoffray4e92c3c2017-05-08 09:34:26 +010047 case DeoptimizationKind::kFullFrame: return "full frame";
48 }
49 LOG(FATAL) << "Unexpected kind " << static_cast<size_t>(kind);
50 UNREACHABLE();
51}
52
53std::ostream& operator<<(std::ostream& os, const DeoptimizationKind& kind);
54
Mythri Alle5097f832021-11-02 14:52:30 +000055// We use a DeoptimizationStackSlot to record if a deoptimization is required
56// for functions that are already on stack. The value in the slot specifies the
57// reason we need to deoptimize.
58enum class DeoptimizeFlagValue: uint8_t {
59 kCHA = 0b01,
60 kDebug = 0b10,
61 kAll = kCHA | kDebug
62};
63
Nicolas Geoffray4e92c3c2017-05-08 09:34:26 +010064} // namespace art
65
66#endif // ART_RUNTIME_DEOPTIMIZATION_KIND_H_