Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/jfr/leakprofiler/utilities/rootType.cpp
43750 views
1
/*
2
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*
23
*/
24
25
#include "precompiled.hpp"
26
#include "gc/shared/oopStorage.hpp"
27
#include "gc/shared/oopStorageSet.hpp"
28
#include "jfr/leakprofiler/utilities/rootType.hpp"
29
#include "utilities/debug.hpp"
30
#include "utilities/enumIterator.hpp"
31
32
OopStorage* OldObjectRoot::system_oop_storage(System system) {
33
int val = int(system);
34
if (val >= _strong_oop_storage_set_first && val <= _strong_oop_storage_set_last) {
35
using StrongId = OopStorageSet::StrongId;
36
using Underlying = std::underlying_type_t<StrongId>;
37
auto first = static_cast<Underlying>(EnumRange<StrongId>().first());
38
auto id = static_cast<StrongId>(first + (val - _strong_oop_storage_set_first));
39
return OopStorageSet::storage(id);
40
}
41
return NULL;
42
}
43
44
const char* OldObjectRoot::system_description(System system) {
45
OopStorage* oop_storage = system_oop_storage(system);
46
if (oop_storage != NULL) {
47
return oop_storage->name();
48
}
49
switch (system) {
50
case _system_undetermined:
51
return "<unknown>";
52
case _universe:
53
return "Universe";
54
case _threads:
55
return "Threads";
56
case _class_loader_data:
57
return "Class Loader Data";
58
case _code_cache:
59
return "Code Cache";
60
#if INCLUDE_JVMCI
61
case _jvmci:
62
return "JVMCI";
63
#endif
64
default:
65
ShouldNotReachHere();
66
}
67
return NULL;
68
}
69
70
const char* OldObjectRoot::type_description(Type type) {
71
switch (type) {
72
case _type_undetermined:
73
return "<unknown>";
74
case _stack_variable:
75
return "Stack Variable";
76
case _local_jni_handle:
77
return "Local JNI Handle";
78
case _global_jni_handle:
79
return "Global JNI Handle";
80
case _global_oop_handle:
81
return "Global Object Handle";
82
case _handle_area:
83
return "Handle Area";
84
default:
85
ShouldNotReachHere();
86
}
87
return NULL;
88
}
89
90