提交 1b1587d7 编写于 作者: D dsamersoff

Merge

...@@ -44,7 +44,8 @@ void GCNotifier::pushNotification(GCMemoryManager *mgr, const char *action, cons ...@@ -44,7 +44,8 @@ void GCNotifier::pushNotification(GCMemoryManager *mgr, const char *action, cons
// Make a copy of the last GC statistics // Make a copy of the last GC statistics
// GC may occur between now and the creation of the notification // GC may occur between now and the creation of the notification
int num_pools = MemoryService::num_memory_pools(); int num_pools = MemoryService::num_memory_pools();
GCStatInfo* stat = new GCStatInfo(num_pools); // stat is deallocated inside GCNotificationRequest
GCStatInfo* stat = new(ResourceObj::C_HEAP) GCStatInfo(num_pools);
mgr->get_last_gc_stat(stat); mgr->get_last_gc_stat(stat);
GCNotificationRequest *request = new GCNotificationRequest(os::javaTimeMillis(),mgr,action,cause,stat); GCNotificationRequest *request = new GCNotificationRequest(os::javaTimeMillis(),mgr,action,cause,stat);
addRequest(request); addRequest(request);
......
...@@ -2047,15 +2047,15 @@ JVM_ENTRY(void, jmm_GetLastGCStat(JNIEnv *env, jobject obj, jmmGCStat *gc_stat)) ...@@ -2047,15 +2047,15 @@ JVM_ENTRY(void, jmm_GetLastGCStat(JNIEnv *env, jobject obj, jmmGCStat *gc_stat))
// Make a copy of the last GC statistics // Make a copy of the last GC statistics
// GC may occur while constructing the last GC information // GC may occur while constructing the last GC information
int num_pools = MemoryService::num_memory_pools(); int num_pools = MemoryService::num_memory_pools();
GCStatInfo* stat = new GCStatInfo(num_pools); GCStatInfo stat(num_pools);
if (mgr->get_last_gc_stat(stat) == 0) { if (mgr->get_last_gc_stat(&stat) == 0) {
gc_stat->gc_index = 0; gc_stat->gc_index = 0;
return; return;
} }
gc_stat->gc_index = stat->gc_index(); gc_stat->gc_index = stat.gc_index();
gc_stat->start_time = Management::ticks_to_ms(stat->start_time()); gc_stat->start_time = Management::ticks_to_ms(stat.start_time());
gc_stat->end_time = Management::ticks_to_ms(stat->end_time()); gc_stat->end_time = Management::ticks_to_ms(stat.end_time());
// Current implementation does not have GC extension attributes // Current implementation does not have GC extension attributes
gc_stat->num_gc_ext_attributes = 0; gc_stat->num_gc_ext_attributes = 0;
...@@ -2073,17 +2073,17 @@ JVM_ENTRY(void, jmm_GetLastGCStat(JNIEnv *env, jobject obj, jmmGCStat *gc_stat)) ...@@ -2073,17 +2073,17 @@ JVM_ENTRY(void, jmm_GetLastGCStat(JNIEnv *env, jobject obj, jmmGCStat *gc_stat))
objArrayHandle usage_after_gc_ah(THREAD, au); objArrayHandle usage_after_gc_ah(THREAD, au);
for (int i = 0; i < num_pools; i++) { for (int i = 0; i < num_pools; i++) {
Handle before_usage = MemoryService::create_MemoryUsage_obj(stat->before_gc_usage_for_pool(i), CHECK); Handle before_usage = MemoryService::create_MemoryUsage_obj(stat.before_gc_usage_for_pool(i), CHECK);
Handle after_usage; Handle after_usage;
MemoryUsage u = stat->after_gc_usage_for_pool(i); MemoryUsage u = stat.after_gc_usage_for_pool(i);
if (u.max_size() == 0 && u.used() > 0) { if (u.max_size() == 0 && u.used() > 0) {
// If max size == 0, this pool is a survivor space. // If max size == 0, this pool is a survivor space.
// Set max size = -1 since the pools will be swapped after GC. // Set max size = -1 since the pools will be swapped after GC.
MemoryUsage usage(u.init_size(), u.used(), u.committed(), (size_t)-1); MemoryUsage usage(u.init_size(), u.used(), u.committed(), (size_t)-1);
after_usage = MemoryService::create_MemoryUsage_obj(usage, CHECK); after_usage = MemoryService::create_MemoryUsage_obj(usage, CHECK);
} else { } else {
after_usage = MemoryService::create_MemoryUsage_obj(stat->after_gc_usage_for_pool(i), CHECK); after_usage = MemoryService::create_MemoryUsage_obj(stat.after_gc_usage_for_pool(i), CHECK);
} }
usage_before_gc_ah->obj_at_put(i, before_usage()); usage_before_gc_ah->obj_at_put(i, before_usage());
usage_after_gc_ah->obj_at_put(i, after_usage()); usage_after_gc_ah->obj_at_put(i, after_usage());
......
...@@ -214,8 +214,8 @@ GCMemoryManager::~GCMemoryManager() { ...@@ -214,8 +214,8 @@ GCMemoryManager::~GCMemoryManager() {
void GCMemoryManager::initialize_gc_stat_info() { void GCMemoryManager::initialize_gc_stat_info() {
assert(MemoryService::num_memory_pools() > 0, "should have one or more memory pools"); assert(MemoryService::num_memory_pools() > 0, "should have one or more memory pools");
_last_gc_stat = new GCStatInfo(MemoryService::num_memory_pools()); _last_gc_stat = new(ResourceObj::C_HEAP) GCStatInfo(MemoryService::num_memory_pools());
_current_gc_stat = new GCStatInfo(MemoryService::num_memory_pools()); _current_gc_stat = new(ResourceObj::C_HEAP) GCStatInfo(MemoryService::num_memory_pools());
// tracking concurrent collections we need two objects: one to update, and one to // tracking concurrent collections we need two objects: one to update, and one to
// hold the publicly available "last (completed) gc" information. // hold the publicly available "last (completed) gc" information.
} }
......
...@@ -108,7 +108,7 @@ public: ...@@ -108,7 +108,7 @@ public:
const char* name() { return "CodeCacheManager"; } const char* name() { return "CodeCacheManager"; }
}; };
class GCStatInfo : public CHeapObj { class GCStatInfo : public ResourceObj {
private: private:
size_t _index; size_t _index;
jlong _start_time; jlong _start_time;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册