8195109: ServiceUtil::visible_oop is not needed anymore

Strip out ServiceUtil and all users of it

Reviewed-by: coleenp, stefank, jcbeyler, sspitsyn
This commit is contained in:
Chris Plummer 2018-03-21 13:07:19 -07:00
parent 35460b0e85
commit fcd067c48d
5 changed files with 7 additions and 138 deletions

View File

@ -57,7 +57,6 @@
#include "runtime/thread.inline.hpp"
#include "runtime/threadSMR.hpp"
#include "runtime/vframe.hpp"
#include "services/serviceUtil.hpp"
#include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
#include "gc/parallel/psMarkSweep.hpp"
@ -2363,10 +2362,6 @@ void JvmtiExport::post_data_dump() {
void JvmtiExport::post_monitor_contended_enter(JavaThread *thread, ObjectMonitor *obj_mntr) {
oop object = (oop)obj_mntr->object();
if (!ServiceUtil::visible_oop(object)) {
// Ignore monitor contended enter for vm internal object.
return;
}
JvmtiThreadState *state = thread->jvmti_thread_state();
if (state == NULL) {
return;
@ -2398,10 +2393,6 @@ void JvmtiExport::post_monitor_contended_enter(JavaThread *thread, ObjectMonitor
void JvmtiExport::post_monitor_contended_entered(JavaThread *thread, ObjectMonitor *obj_mntr) {
oop object = (oop)obj_mntr->object();
if (!ServiceUtil::visible_oop(object)) {
// Ignore monitor contended entered for vm internal object.
return;
}
JvmtiThreadState *state = thread->jvmti_thread_state();
if (state == NULL) {
return;
@ -2465,10 +2456,6 @@ void JvmtiExport::post_monitor_wait(JavaThread *thread, oop object,
void JvmtiExport::post_monitor_waited(JavaThread *thread, ObjectMonitor *obj_mntr, jboolean timed_out) {
oop object = (oop)obj_mntr->object();
if (!ServiceUtil::visible_oop(object)) {
// Ignore monitor waited for vm internal object.
return;
}
JvmtiThreadState *state = thread->jvmti_thread_state();
if (state == NULL) {
return;
@ -2761,9 +2748,7 @@ JvmtiVMObjectAllocEventCollector::~JvmtiVMObjectAllocEventCollector() {
set_enabled(false);
for (int i = 0; i < _allocated->length(); i++) {
oop obj = _allocated->at(i);
if (ServiceUtil::visible_oop(obj)) {
JvmtiExport::post_vm_object_alloc(JavaThread::current(), obj);
}
JvmtiExport::post_vm_object_alloc(JavaThread::current(), obj);
}
delete _allocated;
}

View File

@ -55,7 +55,6 @@
#include "runtime/vframe.hpp"
#include "runtime/vmThread.hpp"
#include "runtime/vm_operations.hpp"
#include "services/serviceUtil.hpp"
#include "utilities/macros.hpp"
// JvmtiTagHashmapEntry
@ -1324,9 +1323,6 @@ void IterateOverHeapObjectClosure::do_object(oop o) {
// check if iteration has been halted
if (is_iteration_aborted()) return;
// ignore any objects that aren't visible to profiler
if (!ServiceUtil::visible_oop(o)) return;
// instanceof check when filtering by klass
if (klass() != NULL && !o->is_a(klass())) {
return;
@ -1407,9 +1403,6 @@ void IterateThroughHeapObjectClosure::do_object(oop obj) {
// check if iteration has been halted
if (is_iteration_aborted()) return;
// ignore any objects that aren't visible to profiler
if (!ServiceUtil::visible_oop(obj)) return;
// apply class filter
if (is_filtered_by_klass_filter(obj, klass())) return;
@ -1987,8 +1980,6 @@ void CallbackInvoker::initialize_for_advanced_heap_walk(JvmtiTagMap* tag_map,
// invoke basic style heap root callback
inline bool CallbackInvoker::invoke_basic_heap_root_callback(jvmtiHeapRootKind root_kind, oop obj) {
assert(ServiceUtil::visible_oop(obj), "checking");
// if we heap roots should be reported
jvmtiHeapRootCallback cb = basic_context()->heap_root_callback();
if (cb == NULL) {
@ -2016,8 +2007,6 @@ inline bool CallbackInvoker::invoke_basic_stack_ref_callback(jvmtiHeapRootKind r
jmethodID method,
int slot,
oop obj) {
assert(ServiceUtil::visible_oop(obj), "checking");
// if we stack refs should be reported
jvmtiStackReferenceCallback cb = basic_context()->stack_ref_callback();
if (cb == NULL) {
@ -2048,9 +2037,6 @@ inline bool CallbackInvoker::invoke_basic_object_reference_callback(jvmtiObjectR
oop referree,
jint index) {
assert(ServiceUtil::visible_oop(referrer), "checking");
assert(ServiceUtil::visible_oop(referree), "checking");
BasicHeapWalkContext* context = basic_context();
// callback requires the referrer's tag. If it's the same referrer
@ -2092,8 +2078,6 @@ inline bool CallbackInvoker::invoke_basic_object_reference_callback(jvmtiObjectR
// invoke advanced style heap root callback
inline bool CallbackInvoker::invoke_advanced_heap_root_callback(jvmtiHeapReferenceKind ref_kind,
oop obj) {
assert(ServiceUtil::visible_oop(obj), "checking");
AdvancedHeapWalkContext* context = advanced_context();
// check that callback is provided
@ -2148,8 +2132,6 @@ inline bool CallbackInvoker::invoke_advanced_stack_ref_callback(jvmtiHeapReferen
jlocation bci,
jint slot,
oop obj) {
assert(ServiceUtil::visible_oop(obj), "checking");
AdvancedHeapWalkContext* context = advanced_context();
// check that callback is provider
@ -2223,9 +2205,6 @@ inline bool CallbackInvoker::invoke_advanced_object_reference_callback(jvmtiHeap
// field index is only valid field in reference_info
static jvmtiHeapReferenceInfo reference_info = { 0 };
assert(ServiceUtil::visible_oop(referrer), "checking");
assert(ServiceUtil::visible_oop(obj), "checking");
AdvancedHeapWalkContext* context = advanced_context();
// check that callback is provider
@ -2279,7 +2258,6 @@ inline bool CallbackInvoker::invoke_advanced_object_reference_callback(jvmtiHeap
inline bool CallbackInvoker::report_simple_root(jvmtiHeapReferenceKind kind, oop obj) {
assert(kind != JVMTI_HEAP_REFERENCE_STACK_LOCAL &&
kind != JVMTI_HEAP_REFERENCE_JNI_LOCAL, "not a simple root");
assert(ServiceUtil::visible_oop(obj), "checking");
if (is_basic_heap_walk()) {
// map to old style root kind
@ -2604,13 +2582,6 @@ class SimpleRootsClosure : public OopClosure {
}
}
// some objects are ignored - in the case of simple
// roots it's mostly Symbol*s that we are skipping
// here.
if (!ServiceUtil::visible_oop(o)) {
return;
}
// invoke the callback
_continue = CallbackInvoker::report_simple_root(kind, o);
@ -2651,10 +2622,6 @@ class JNILocalRootsClosure : public OopClosure {
return;
}
if (!ServiceUtil::visible_oop(o)) {
return;
}
// invoke the callback
_continue = CallbackInvoker::report_jni_local_root(_thread_tag, _tid, _depth, _method, o);
}
@ -2982,7 +2949,7 @@ inline bool VM_HeapWalkOperation::iterate_over_object(oop o) {
if (!is_primitive_field_type(type)) {
oop fld_o = o->obj_field(field->field_offset());
// ignore any objects that aren't visible to profiler
if (fld_o != NULL && ServiceUtil::visible_oop(fld_o)) {
if (fld_o != NULL) {
assert(Universe::heap()->is_in_reserved(fld_o), "unsafe code should not "
"have references to Klass* anymore");
int slot = field->field_index();

View File

@ -29,8 +29,10 @@
#include "runtime/thread.inline.hpp"
#include "runtime/threadSMR.inline.hpp"
#include "services/threadService.hpp"
#include "utilities/copy.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/resourceHash.hpp"
#include "utilities/vmError.hpp"
Monitor* ThreadsSMRSupport::_delete_lock =
new Monitor(Monitor::special, "Thread_SMR_delete_lock",

View File

@ -1,84 +0,0 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_SERVICES_SERVICEUTIL_HPP
#define SHARE_VM_SERVICES_SERVICEUTIL_HPP
#include "classfile/systemDictionary.hpp"
#include "oops/objArrayOop.hpp"
#include "oops/oop.inline.hpp"
//
// Serviceability utility functions.
// (Shared by MM and JVMTI).
//
class ServiceUtil : public AllStatic {
public:
// Return true if oop represents an object that is "visible"
// to the java world.
static inline bool visible_oop(oop o) {
// instance
if (o->is_instance()) {
// instance objects are visible
if (o->klass() != SystemDictionary::Class_klass()) {
return true;
}
if (java_lang_Class::is_primitive(o)) {
return true;
}
// java.lang.Classes are visible
Klass* k = java_lang_Class::as_Klass(o);
if (k->is_klass()) {
// if it's a class for an object, an object array, or
// primitive (type) array then it's visible.
if (k->is_instance_klass()) {
return true;
}
if (k->is_objArray_klass()) {
return true;
}
if (k->is_typeArray_klass()) {
return true;
}
}
fatal("visible_oop: should never reach here #1");
return false;
}
// object arrays are visible if they aren't system object arrays
if (o->is_objArray()) {
return true;
}
// type arrays are visible
if (o->is_typeArray()) {
return true;
}
// everything else (Method*s, ...) aren't visible
fatal("visible_oop: should never reach here #2");
return false;
}; // end of visible_oop()
};
#endif // SHARE_VM_SERVICES_SERVICEUTIL_HPP

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,7 +35,6 @@
#include "runtime/thread.hpp"
#include "runtime/threadSMR.hpp"
#include "services/management.hpp"
#include "services/serviceUtil.hpp"
class OopClosure;
class ThreadDumpResult;
@ -548,7 +547,7 @@ class JavaThreadBlockedOnMonitorEnterState : public JavaThreadStatusChanger {
static bool wait_reenter_begin(JavaThread *java_thread, ObjectMonitor *obj_m) {
assert((java_thread != NULL), "Java thread should not be null here");
bool active = false;
if (is_alive(java_thread) && ServiceUtil::visible_oop((oop)obj_m->object())) {
if (is_alive(java_thread)) {
active = contended_enter_begin(java_thread);
}
return active;
@ -569,7 +568,7 @@ class JavaThreadBlockedOnMonitorEnterState : public JavaThreadStatusChanger {
// like for vm internal objects and for external objects which are not contended
// thread status is not changed and contended enter stat is not collected.
_active = false;
if (is_alive() && ServiceUtil::visible_oop((oop)obj_m->object()) && obj_m->contentions() > 0) {
if (is_alive() && obj_m->contentions() > 0) {
_stat = java_thread->get_thread_stat();
_active = contended_enter_begin(java_thread);
}