8154059: JVMTI ObjectTagging to UL

Reviewed-by: sspitsyn, mlarsson
This commit is contained in:
Robbin Ehn 2016-04-19 14:21:26 +02:00
parent 9d7444952a
commit 167be2a61c
4 changed files with 13 additions and 21 deletions

View file

@ -70,6 +70,7 @@
LOG_TAG(modules) \ LOG_TAG(modules) \
LOG_TAG(monitorinflation) \ LOG_TAG(monitorinflation) \
LOG_TAG(monitormismatch) \ LOG_TAG(monitormismatch) \
LOG_TAG(objecttagging) \
LOG_TAG(os) \ LOG_TAG(os) \
LOG_TAG(pagesize) \ LOG_TAG(pagesize) \
LOG_TAG(phases) \ LOG_TAG(phases) \

View file

@ -1675,7 +1675,7 @@ JvmtiEnv::FollowReferences(jint heap_filter, jclass klass, jobject initial_objec
HandleMark hm(thread); HandleMark hm(thread);
KlassHandle kh (thread, k_oop); KlassHandle kh (thread, k_oop);
TraceTime t("FollowReferences", TraceJVMTIObjectTagging); TraceTime t("FollowReferences", TRACETIME_LOG(Debug, jvmti, objecttagging));
JvmtiTagMap::tag_map_for(this)->follow_references(heap_filter, kh, initial_object, callbacks, user_data); JvmtiTagMap::tag_map_for(this)->follow_references(heap_filter, kh, initial_object, callbacks, user_data);
return JVMTI_ERROR_NONE; return JVMTI_ERROR_NONE;
} /* end FollowReferences */ } /* end FollowReferences */
@ -1706,7 +1706,7 @@ JvmtiEnv::IterateThroughHeap(jint heap_filter, jclass klass, const jvmtiHeapCall
HandleMark hm(thread); HandleMark hm(thread);
KlassHandle kh (thread, k_oop); KlassHandle kh (thread, k_oop);
TraceTime t("IterateThroughHeap", TraceJVMTIObjectTagging); TraceTime t("IterateThroughHeap", TRACETIME_LOG(Debug, jvmti, objecttagging));
JvmtiTagMap::tag_map_for(this)->iterate_through_heap(heap_filter, kh, callbacks, user_data); JvmtiTagMap::tag_map_for(this)->iterate_through_heap(heap_filter, kh, callbacks, user_data);
return JVMTI_ERROR_NONE; return JVMTI_ERROR_NONE;
} /* end IterateThroughHeap */ } /* end IterateThroughHeap */
@ -1738,7 +1738,7 @@ JvmtiEnv::SetTag(jobject object, jlong tag) {
// tag_result_ptr - NULL is a valid value, must be checked // tag_result_ptr - NULL is a valid value, must be checked
jvmtiError jvmtiError
JvmtiEnv::GetObjectsWithTags(jint tag_count, const jlong* tags, jint* count_ptr, jobject** object_result_ptr, jlong** tag_result_ptr) { JvmtiEnv::GetObjectsWithTags(jint tag_count, const jlong* tags, jint* count_ptr, jobject** object_result_ptr, jlong** tag_result_ptr) {
TraceTime t("GetObjectsWithTags", TraceJVMTIObjectTagging); TraceTime t("GetObjectsWithTags", TRACETIME_LOG(Debug, jvmti, objecttagging));
return JvmtiTagMap::tag_map_for(this)->get_objects_with_tags((jlong*)tags, tag_count, count_ptr, object_result_ptr, tag_result_ptr); return JvmtiTagMap::tag_map_for(this)->get_objects_with_tags((jlong*)tags, tag_count, count_ptr, object_result_ptr, tag_result_ptr);
} /* end GetObjectsWithTags */ } /* end GetObjectsWithTags */
@ -1771,7 +1771,7 @@ JvmtiEnv::IterateOverObjectsReachableFromObject(jobject object, jvmtiObjectRefer
// user_data - NULL is a valid value, must be checked // user_data - NULL is a valid value, must be checked
jvmtiError jvmtiError
JvmtiEnv::IterateOverReachableObjects(jvmtiHeapRootCallback heap_root_callback, jvmtiStackReferenceCallback stack_ref_callback, jvmtiObjectReferenceCallback object_ref_callback, const void* user_data) { JvmtiEnv::IterateOverReachableObjects(jvmtiHeapRootCallback heap_root_callback, jvmtiStackReferenceCallback stack_ref_callback, jvmtiObjectReferenceCallback object_ref_callback, const void* user_data) {
TraceTime t("IterateOverReachableObjects", TraceJVMTIObjectTagging); TraceTime t("IterateOverReachableObjects", TRACETIME_LOG(Debug, jvmti, objecttagging));
JvmtiTagMap::tag_map_for(this)->iterate_over_reachable_objects(heap_root_callback, stack_ref_callback, object_ref_callback, user_data); JvmtiTagMap::tag_map_for(this)->iterate_over_reachable_objects(heap_root_callback, stack_ref_callback, object_ref_callback, user_data);
return JVMTI_ERROR_NONE; return JVMTI_ERROR_NONE;
} /* end IterateOverReachableObjects */ } /* end IterateOverReachableObjects */
@ -1781,7 +1781,7 @@ JvmtiEnv::IterateOverReachableObjects(jvmtiHeapRootCallback heap_root_callback,
// user_data - NULL is a valid value, must be checked // user_data - NULL is a valid value, must be checked
jvmtiError jvmtiError
JvmtiEnv::IterateOverHeap(jvmtiHeapObjectFilter object_filter, jvmtiHeapObjectCallback heap_object_callback, const void* user_data) { JvmtiEnv::IterateOverHeap(jvmtiHeapObjectFilter object_filter, jvmtiHeapObjectCallback heap_object_callback, const void* user_data) {
TraceTime t("IterateOverHeap", TraceJVMTIObjectTagging); TraceTime t("IterateOverHeap", TRACETIME_LOG(Debug, jvmti, objecttagging));
Thread *thread = Thread::current(); Thread *thread = Thread::current();
HandleMark hm(thread); HandleMark hm(thread);
JvmtiTagMap::tag_map_for(this)->iterate_over_heap(object_filter, KlassHandle(), heap_object_callback, user_data); JvmtiTagMap::tag_map_for(this)->iterate_over_heap(object_filter, KlassHandle(), heap_object_callback, user_data);
@ -1805,7 +1805,7 @@ JvmtiEnv::IterateOverInstancesOfClass(oop k_mirror, jvmtiHeapObjectFilter object
Thread *thread = Thread::current(); Thread *thread = Thread::current();
HandleMark hm(thread); HandleMark hm(thread);
KlassHandle klass (thread, k_oop); KlassHandle klass (thread, k_oop);
TraceTime t("IterateOverInstancesOfClass", TraceJVMTIObjectTagging); TraceTime t("IterateOverInstancesOfClass", TRACETIME_LOG(Debug, jvmti, objecttagging));
JvmtiTagMap::tag_map_for(this)->iterate_over_heap(object_filter, klass, heap_object_callback, user_data); JvmtiTagMap::tag_map_for(this)->iterate_over_heap(object_filter, klass, heap_object_callback, user_data);
return JVMTI_ERROR_NONE; return JVMTI_ERROR_NONE;
} /* end IterateOverInstancesOfClass */ } /* end IterateOverInstancesOfClass */

View file

@ -146,11 +146,7 @@ class JvmtiTagHashmap : public CHeapObj<mtInternal> {
_size_index = size_index; _size_index = size_index;
_size = initial_size; _size = initial_size;
_entry_count = 0; _entry_count = 0;
if (TraceJVMTIObjectTagging) { _trace_threshold = initial_trace_threshold;
_trace_threshold = initial_trace_threshold;
} else {
_trace_threshold = -1;
}
_load_factor = load_factor; _load_factor = load_factor;
_resize_threshold = (int)(_load_factor * _size); _resize_threshold = (int)(_load_factor * _size);
_resizing_enabled = true; _resizing_enabled = true;
@ -329,8 +325,7 @@ class JvmtiTagHashmap : public CHeapObj<mtInternal> {
} }
_entry_count++; _entry_count++;
if (trace_threshold() > 0 && entry_count() >= trace_threshold()) { if (log_is_enabled(Debug, jvmti, objecttagging) && entry_count() >= trace_threshold()) {
assert(TraceJVMTIObjectTagging, "should only get here when tracing");
print_memory_usage(); print_memory_usage();
compute_next_trace_threshold(); compute_next_trace_threshold();
} }
@ -409,6 +404,7 @@ void JvmtiTagHashmap::print_memory_usage() {
// compute threshold for the next trace message // compute threshold for the next trace message
void JvmtiTagHashmap::compute_next_trace_threshold() { void JvmtiTagHashmap::compute_next_trace_threshold() {
_trace_threshold = entry_count();
if (trace_threshold() < medium_trace_threshold) { if (trace_threshold() < medium_trace_threshold) {
_trace_threshold += small_trace_threshold; _trace_threshold += small_trace_threshold;
} else { } else {
@ -3413,12 +3409,6 @@ void JvmtiTagMap::do_weak_oops(BoolObjectClosure* is_alive, OopClosure* f) {
delayed_add = next; delayed_add = next;
} }
// stats log_debug(jvmti, objecttagging)("(%d->%d, %d freed, %d total moves)",
if (TraceJVMTIObjectTagging) { hashmap->_entry_count + freed, hashmap->_entry_count, freed, moved);
int post_total = hashmap->_entry_count;
int pre_total = post_total + freed;
tty->print_cr("(%d->%d, %d freed, %d total moves)",
pre_total, post_total, freed, moved);
}
} }

View file

@ -420,6 +420,7 @@ static AliasedLoggingFlag const aliased_logging_flags[] = {
{ "TraceLoaderConstraints", LogLevel::Info, true, LOG_TAGS(classload, constraints) }, { "TraceLoaderConstraints", LogLevel::Info, true, LOG_TAGS(classload, constraints) },
{ "TraceMonitorInflation", LogLevel::Debug, true, LOG_TAGS(monitorinflation) }, { "TraceMonitorInflation", LogLevel::Debug, true, LOG_TAGS(monitorinflation) },
{ "TraceSafepointCleanupTime", LogLevel::Info, true, LOG_TAGS(safepointcleanup) }, { "TraceSafepointCleanupTime", LogLevel::Info, true, LOG_TAGS(safepointcleanup) },
{ "TraceJVMTIObjectTagging", LogLevel::Debug, true, LOG_TAGS(jvmti, objecttagging) },
{ NULL, LogLevel::Off, false, LOG_TAGS(_NO_TAG) } { NULL, LogLevel::Off, false, LOG_TAGS(_NO_TAG) }
}; };