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