diff --git a/src/hotspot/share/oops/methodData.cpp b/src/hotspot/share/oops/methodData.cpp index bc2649ba0ed..3c0c0b54689 100644 --- a/src/hotspot/share/oops/methodData.cpp +++ b/src/hotspot/share/oops/methodData.cpp @@ -1558,6 +1558,8 @@ void MethodData::print_value_on(outputStream* st) const { } void MethodData::print_data_on(outputStream* st) const { + ConditionalMutexLocker ml(extra_data_lock(), !extra_data_lock()->owned_by_self(), + Mutex::_no_safepoint_check_flag); ResourceMark rm; ProfileData* data = first_data(); if (_parameters_type_data_di != no_parameters) { @@ -1568,6 +1570,7 @@ void MethodData::print_data_on(outputStream* st) const { st->fill_to(6); data->print_data_on(st, this); } + st->print_cr("--- Extra data:"); DataLayout* dp = extra_data_base(); DataLayout* end = args_data_limit(); diff --git a/src/hotspot/share/oops/methodData.hpp b/src/hotspot/share/oops/methodData.hpp index 36fcf8ce5fd..8375552a911 100644 --- a/src/hotspot/share/oops/methodData.hpp +++ b/src/hotspot/share/oops/methodData.hpp @@ -2511,7 +2511,7 @@ public: void clean_method_data(bool always_clean); void clean_weak_method_links(); - Mutex* extra_data_lock() { return &_extra_data_lock; } + Mutex* extra_data_lock() const { return const_cast(&_extra_data_lock); } void check_extra_data_locked() const NOT_DEBUG_RETURN; };