--- a/hotspot/src/share/vm/services/management.cpp Fri Aug 31 16:39:35 2012 -0700
+++ b/hotspot/src/share/vm/services/management.cpp Sat Sep 01 13:25:18 2012 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, 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
@@ -29,7 +29,6 @@
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
#include "oops/klass.hpp"
-#include "oops/klassOop.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/arguments.hpp"
@@ -59,15 +58,15 @@
PerfVariable* Management::_end_vm_creation_time = NULL;
PerfVariable* Management::_vm_init_done_time = NULL;
-klassOop Management::_sensor_klass = NULL;
-klassOop Management::_threadInfo_klass = NULL;
-klassOop Management::_memoryUsage_klass = NULL;
-klassOop Management::_memoryPoolMXBean_klass = NULL;
-klassOop Management::_memoryManagerMXBean_klass = NULL;
-klassOop Management::_garbageCollectorMXBean_klass = NULL;
-klassOop Management::_managementFactory_klass = NULL;
-klassOop Management::_garbageCollectorImpl_klass = NULL;
-klassOop Management::_gcInfo_klass = NULL;
+Klass* Management::_sensor_klass = NULL;
+Klass* Management::_threadInfo_klass = NULL;
+Klass* Management::_memoryUsage_klass = NULL;
+Klass* Management::_memoryPoolMXBean_klass = NULL;
+Klass* Management::_memoryManagerMXBean_klass = NULL;
+Klass* Management::_garbageCollectorMXBean_klass = NULL;
+Klass* Management::_managementFactory_klass = NULL;
+Klass* Management::_garbageCollectorImpl_klass = NULL;
+Klass* Management::_gcInfo_klass = NULL;
jmmOptionalSupport Management::_optional_support = {0};
TimeStamp Management::_stamp;
@@ -136,7 +135,7 @@
// Load and initialize the sun.management.Agent class
// invoke startAgent method to start the management server
Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
- klassOop k = SystemDictionary::resolve_or_fail(vmSymbols::sun_management_Agent(),
+ Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::sun_management_Agent(),
loader,
Handle(),
true,
@@ -156,12 +155,15 @@
memcpy(support, &_optional_support, sizeof(jmmOptionalSupport));
}
-klassOop Management::load_and_initialize_klass(Symbol* sh, TRAPS) {
- klassOop k = SystemDictionary::resolve_or_fail(sh, true, CHECK_NULL);
+Klass* Management::load_and_initialize_klass(Symbol* sh, TRAPS) {
+ Klass* k = SystemDictionary::resolve_or_fail(sh, true, CHECK_NULL);
instanceKlassHandle ik (THREAD, k);
if (ik->should_be_initialized()) {
ik->initialize(CHECK_NULL);
}
+ // If these classes change to not be owned by the boot loader, they need
+ // to be walked to keep their class loader alive in oops_do.
+ assert(ik->class_loader() == NULL, "need to follow in oops_do");
return ik();
}
@@ -184,75 +186,65 @@
void Management::oops_do(OopClosure* f) {
MemoryService::oops_do(f);
ThreadService::oops_do(f);
-
- f->do_oop((oop*) &_sensor_klass);
- f->do_oop((oop*) &_threadInfo_klass);
- f->do_oop((oop*) &_memoryUsage_klass);
- f->do_oop((oop*) &_memoryPoolMXBean_klass);
- f->do_oop((oop*) &_memoryManagerMXBean_klass);
- f->do_oop((oop*) &_garbageCollectorMXBean_klass);
- f->do_oop((oop*) &_managementFactory_klass);
- f->do_oop((oop*) &_garbageCollectorImpl_klass);
- f->do_oop((oop*) &_gcInfo_klass);
}
-klassOop Management::java_lang_management_ThreadInfo_klass(TRAPS) {
+Klass* Management::java_lang_management_ThreadInfo_klass(TRAPS) {
if (_threadInfo_klass == NULL) {
_threadInfo_klass = load_and_initialize_klass(vmSymbols::java_lang_management_ThreadInfo(), CHECK_NULL);
}
return _threadInfo_klass;
}
-klassOop Management::java_lang_management_MemoryUsage_klass(TRAPS) {
+Klass* Management::java_lang_management_MemoryUsage_klass(TRAPS) {
if (_memoryUsage_klass == NULL) {
_memoryUsage_klass = load_and_initialize_klass(vmSymbols::java_lang_management_MemoryUsage(), CHECK_NULL);
}
return _memoryUsage_klass;
}
-klassOop Management::java_lang_management_MemoryPoolMXBean_klass(TRAPS) {
+Klass* Management::java_lang_management_MemoryPoolMXBean_klass(TRAPS) {
if (_memoryPoolMXBean_klass == NULL) {
_memoryPoolMXBean_klass = load_and_initialize_klass(vmSymbols::java_lang_management_MemoryPoolMXBean(), CHECK_NULL);
}
return _memoryPoolMXBean_klass;
}
-klassOop Management::java_lang_management_MemoryManagerMXBean_klass(TRAPS) {
+Klass* Management::java_lang_management_MemoryManagerMXBean_klass(TRAPS) {
if (_memoryManagerMXBean_klass == NULL) {
_memoryManagerMXBean_klass = load_and_initialize_klass(vmSymbols::java_lang_management_MemoryManagerMXBean(), CHECK_NULL);
}
return _memoryManagerMXBean_klass;
}
-klassOop Management::java_lang_management_GarbageCollectorMXBean_klass(TRAPS) {
+Klass* Management::java_lang_management_GarbageCollectorMXBean_klass(TRAPS) {
if (_garbageCollectorMXBean_klass == NULL) {
_garbageCollectorMXBean_klass = load_and_initialize_klass(vmSymbols::java_lang_management_GarbageCollectorMXBean(), CHECK_NULL);
}
return _garbageCollectorMXBean_klass;
}
-klassOop Management::sun_management_Sensor_klass(TRAPS) {
+Klass* Management::sun_management_Sensor_klass(TRAPS) {
if (_sensor_klass == NULL) {
_sensor_klass = load_and_initialize_klass(vmSymbols::sun_management_Sensor(), CHECK_NULL);
}
return _sensor_klass;
}
-klassOop Management::sun_management_ManagementFactory_klass(TRAPS) {
+Klass* Management::sun_management_ManagementFactory_klass(TRAPS) {
if (_managementFactory_klass == NULL) {
_managementFactory_klass = load_and_initialize_klass(vmSymbols::sun_management_ManagementFactory(), CHECK_NULL);
}
return _managementFactory_klass;
}
-klassOop Management::sun_management_GarbageCollectorImpl_klass(TRAPS) {
+Klass* Management::sun_management_GarbageCollectorImpl_klass(TRAPS) {
if (_garbageCollectorImpl_klass == NULL) {
_garbageCollectorImpl_klass = load_and_initialize_klass(vmSymbols::sun_management_GarbageCollectorImpl(), CHECK_NULL);
}
return _garbageCollectorImpl_klass;
}
-klassOop Management::com_sun_management_GcInfo_klass(TRAPS) {
+Klass* Management::com_sun_management_GcInfo_klass(TRAPS) {
if (_gcInfo_klass == NULL) {
_gcInfo_klass = load_and_initialize_klass(vmSymbols::com_sun_management_GcInfo(), CHECK_NULL);
}
@@ -303,7 +295,7 @@
// Helper function to construct a ThreadInfo object
instanceOop Management::create_thread_info_instance(ThreadSnapshot* snapshot, TRAPS) {
- klassOop k = Management::java_lang_management_ThreadInfo_klass(CHECK_NULL);
+ Klass* k = Management::java_lang_management_ThreadInfo_klass(CHECK_NULL);
instanceKlassHandle ik (THREAD, k);
JavaValue result(T_VOID);
@@ -333,7 +325,7 @@
typeArrayHandle depths_array,
objArrayHandle synchronizers_array,
TRAPS) {
- klassOop k = Management::java_lang_management_ThreadInfo_klass(CHECK_NULL);
+ Klass* k = Management::java_lang_management_ThreadInfo_klass(CHECK_NULL);
instanceKlassHandle ik (THREAD, k);
JavaValue result(T_VOID);
@@ -388,7 +380,7 @@
oop mgr_obj = JNIHandles::resolve(mgr);
instanceHandle h(THREAD, (instanceOop) mgr_obj);
- klassOop k = Management::java_lang_management_GarbageCollectorMXBean_klass(CHECK_NULL);
+ Klass* k = Management::java_lang_management_GarbageCollectorMXBean_klass(CHECK_NULL);
if (!h->is_a(k)) {
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"the object is not an instance of java.lang.management.GarbageCollectorMXBean class",
@@ -433,8 +425,8 @@
static void validate_thread_info_array(objArrayHandle infoArray_h, TRAPS) {
// check if the element of infoArray is of type ThreadInfo class
- klassOop threadinfo_klass = Management::java_lang_management_ThreadInfo_klass(CHECK);
- klassOop element_klass = objArrayKlass::cast(infoArray_h->klass())->element_klass();
+ Klass* threadinfo_klass = Management::java_lang_management_ThreadInfo_klass(CHECK);
+ Klass* element_klass = objArrayKlass::cast(infoArray_h->klass())->element_klass();
if (element_klass != threadinfo_klass) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"infoArray element type is not ThreadInfo class");
@@ -574,7 +566,7 @@
}
// Allocate the resulting MemoryPoolMXBean[] object
- klassOop k = Management::java_lang_management_MemoryPoolMXBean_klass(CHECK_NULL);
+ Klass* k = Management::java_lang_management_MemoryPoolMXBean_klass(CHECK_NULL);
instanceKlassHandle ik (THREAD, k);
objArrayOop r = oopFactory::new_objArray(ik(), num_memory_pools, CHECK_NULL);
objArrayHandle poolArray(THREAD, r);
@@ -619,7 +611,7 @@
}
// Allocate the resulting MemoryManagerMXBean[] object
- klassOop k = Management::java_lang_management_MemoryManagerMXBean_klass(CHECK_NULL);
+ Klass* k = Management::java_lang_management_MemoryManagerMXBean_klass(CHECK_NULL);
instanceKlassHandle ik (THREAD, k);
objArrayOop r = oopFactory::new_objArray(ik(), num_mgrs, CHECK_NULL);
objArrayHandle mgrArray(THREAD, r);
@@ -696,7 +688,7 @@
THROW(vmSymbols::java_lang_NullPointerException());
}
- klassOop sensor_klass = Management::sun_management_Sensor_klass(CHECK);
+ Klass* sensor_klass = Management::sun_management_Sensor_klass(CHECK);
oop s = JNIHandles::resolve(sensorObj);
assert(s->is_instance(), "Sensor should be an instanceOop");
instanceHandle sensor_h(THREAD, (instanceOop) s);
@@ -1306,7 +1298,7 @@
int num_snapshots = dump_result.num_snapshots();
// create the result ThreadInfo[] object
- klassOop k = Management::java_lang_management_ThreadInfo_klass(CHECK_NULL);
+ Klass* k = Management::java_lang_management_ThreadInfo_klass(CHECK_NULL);
instanceKlassHandle ik (THREAD, k);
objArrayOop r = oopFactory::new_objArray(ik(), num_snapshots, CHECK_NULL);
objArrayHandle result_h(THREAD, r);
@@ -1723,7 +1715,7 @@
objArrayOop ta = objArrayOop(JNIHandles::resolve_non_null(names));
objArrayHandle names_ah(THREAD, ta);
// Make sure we have a String array
- klassOop element_klass = objArrayKlass::cast(names_ah->klass())->element_klass();
+ Klass* element_klass = objArrayKlass::cast(names_ah->klass())->element_klass();
if (element_klass != SystemDictionary::String_klass()) {
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Array element type is not String class", 0);
@@ -1877,7 +1869,7 @@
objArrayHandle names_ah(THREAD, na);
// Make sure we have a String array
- klassOop element_klass = objArrayKlass::cast(names_ah->klass())->element_klass();
+ Klass* element_klass = objArrayKlass::cast(names_ah->klass())->element_klass();
if (element_klass != SystemDictionary::String_klass()) {
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Array element type is not String class", 0);
@@ -1993,8 +1985,8 @@
}
// check if the element of array is of type MemoryUsage class
- klassOop usage_klass = Management::java_lang_management_MemoryUsage_klass(CHECK_0);
- klassOop element_klass = objArrayKlass::cast(array_h->klass())->element_klass();
+ Klass* usage_klass = Management::java_lang_management_MemoryUsage_klass(CHECK_0);
+ Klass* element_klass = objArrayKlass::cast(array_h->klass())->element_klass();
if (element_klass != usage_klass) {
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"The element type is not MemoryUsage class", 0);
@@ -2142,7 +2134,7 @@
objArrayHandle cmds_ah(THREAD, ca);
// Make sure we have a String array
- klassOop element_klass = objArrayKlass::cast(cmds_ah->klass())->element_klass();
+ Klass* element_klass = objArrayKlass::cast(cmds_ah->klass())->element_klass();
if (element_klass != SystemDictionary::String_klass()) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Array element type is not String class");