提交 f1074612 编写于 作者: J jcoomes

8057827: notify an obj when allocation context stats are available

Reviewed-by: mikael, jmasa, tschatzl
上级 0fbcc6a6
......@@ -46,6 +46,7 @@ public:
inline void clear() { }
inline void update(bool full_gc) { }
inline void update_at_remark() { }
inline bool available() { return false; }
};
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCATIONCONTEXT_HPP
......@@ -126,6 +126,8 @@ oop Universe::_null_ptr_exception_instance = NULL;
oop Universe::_arithmetic_exception_instance = NULL;
oop Universe::_virtual_machine_error_instance = NULL;
oop Universe::_vm_exception = NULL;
oop Universe::_allocation_context_notification_obj = NULL;
Method* Universe::_throw_illegal_access_error = NULL;
Array<int>* Universe::_the_empty_int_array = NULL;
Array<u2>* Universe::_the_empty_short_array = NULL;
......@@ -195,6 +197,7 @@ void Universe::oops_do(OopClosure* f, bool do_all) {
f->do_oop((oop*)&_main_thread_group);
f->do_oop((oop*)&_system_thread_group);
f->do_oop((oop*)&_vm_exception);
f->do_oop((oop*)&_allocation_context_notification_obj);
debug_only(f->do_oop((oop*)&_fullgc_alot_dummy_array);)
}
......
......@@ -178,6 +178,8 @@ class Universe: AllStatic {
// the vm thread.
static oop _vm_exception;
static oop _allocation_context_notification_obj;
// The particular choice of collected heap.
static CollectedHeap* _collectedHeap;
......@@ -307,6 +309,10 @@ class Universe: AllStatic {
static oop arithmetic_exception_instance() { return _arithmetic_exception_instance; }
static oop virtual_machine_error_instance() { return _virtual_machine_error_instance; }
static oop vm_exception() { return _vm_exception; }
static inline oop allocation_context_notification_obj();
static inline void set_allocation_context_notification_obj(oop obj);
static Method* throw_illegal_access_error() { return _throw_illegal_access_error; }
static Array<int>* the_empty_int_array() { return _the_empty_int_array; }
......
......@@ -41,4 +41,12 @@ inline bool Universe::field_type_should_be_aligned(BasicType type) {
return type == T_DOUBLE || type == T_LONG;
}
inline oop Universe::allocation_context_notification_obj() {
return _allocation_context_notification_obj;
}
inline void Universe::set_allocation_context_notification_obj(oop obj) {
_allocation_context_notification_obj = obj;
}
#endif // SHARE_VM_MEMORY_UNIVERSE_INLINE_HPP
......@@ -28,6 +28,7 @@
#include "runtime/serviceThread.hpp"
#include "runtime/mutexLocker.hpp"
#include "prims/jvmtiImpl.hpp"
#include "services/allocationContextService.hpp"
#include "services/gcNotifier.hpp"
#include "services/diagnosticArgument.hpp"
#include "services/diagnosticFramework.hpp"
......@@ -86,6 +87,7 @@ void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
bool has_jvmti_events = false;
bool has_gc_notification_event = false;
bool has_dcmd_notification_event = false;
bool acs_notify = false;
JvmtiDeferredEvent jvmti_event;
{
// Need state transition ThreadBlockInVM so that this thread
......@@ -102,7 +104,8 @@ void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
while (!(sensors_changed = LowMemoryDetector::has_pending_requests()) &&
!(has_jvmti_events = JvmtiDeferredEventQueue::has_events()) &&
!(has_gc_notification_event = GCNotifier::has_event()) &&
!(has_dcmd_notification_event = DCmdFactory::has_pending_jmx_notification())) {
!(has_dcmd_notification_event = DCmdFactory::has_pending_jmx_notification()) &&
!(acs_notify = AllocationContextService::should_notify())) {
// wait until one of the sensors has pending requests, or there is a
// pending JVMTI event or JMX GC notification to post
Service_lock->wait(Mutex::_no_safepoint_check_flag);
......@@ -128,6 +131,10 @@ void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
if(has_dcmd_notification_event) {
DCmdFactory::send_notification(CHECK);
}
if (acs_notify) {
AllocationContextService::notify(CHECK);
}
}
}
......
/*
* Copyright (c) 2014, 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_ALLOCATION_CONTEXT_SERVICE_HPP
#define SHARE_VM_SERVICES_ALLOCATION_CONTEXT_SERVICE_HPP
#include "utilities/exceptions.hpp"
class AllocationContextService: public AllStatic {
public:
static inline bool should_notify();
static inline void notify(TRAPS);
};
bool AllocationContextService::should_notify() { return false; }
void AllocationContextService::notify(TRAPS) { }
#endif // SHARE_VM_SERVICES_ALLOCATION_CONTEXT_SERVICE_HPP
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册