1979 // Lock to modify extra data, and prevent Safepoint from breaking the lock
1980 MutexLocker ml(extra_data_lock(), Mutex::_no_safepoint_check_flag);
1981
1982 clean_extra_data(&cl);
1983 verify_extra_data_clean(&cl);
1984 }
1985
1986 void MethodData::deallocate_contents(ClassLoaderData* loader_data) {
1987 release_C_heap_structures();
1988 }
1989
1990 void MethodData::release_C_heap_structures() {
1991 #if INCLUDE_JVMCI
1992 FailedSpeculation::free_failed_speculations(get_failed_speculations_address());
1993 #endif
1994 }
1995
1996 #if INCLUDE_CDS
1997 void MethodData::remove_unshareable_info() {
1998 _extra_data_lock = nullptr;
1999 }
2000
2001 void MethodData::restore_unshareable_info(TRAPS) {
2002 //_extra_data_lock = new Mutex(Mutex::nosafepoint, "MDOExtraData_lock");
2003 }
2004 #endif // INCLUDE_CDS
2005
2006 #ifdef ASSERT
2007 void MethodData::check_extra_data_locked() const {
2008 // Cast const away, just to be able to verify the lock
2009 // Usually we only want non-const accesses on the lock,
2010 // so this here is an exception.
2011 MethodData* self = (MethodData*)this;
2012 assert(self->extra_data_lock()->owned_by_self() || CDSConfig::is_dumping_archive(), "must have lock");
2013 assert(!Thread::current()->is_Java_thread() ||
2014 JavaThread::current()->is_in_no_safepoint_scope(),
2015 "JavaThread must have NoSafepointVerifier inside lock scope");
2016 }
2017 #endif
|
1979 // Lock to modify extra data, and prevent Safepoint from breaking the lock
1980 MutexLocker ml(extra_data_lock(), Mutex::_no_safepoint_check_flag);
1981
1982 clean_extra_data(&cl);
1983 verify_extra_data_clean(&cl);
1984 }
1985
1986 void MethodData::deallocate_contents(ClassLoaderData* loader_data) {
1987 release_C_heap_structures();
1988 }
1989
1990 void MethodData::release_C_heap_structures() {
1991 #if INCLUDE_JVMCI
1992 FailedSpeculation::free_failed_speculations(get_failed_speculations_address());
1993 #endif
1994 }
1995
1996 #if INCLUDE_CDS
1997 void MethodData::remove_unshareable_info() {
1998 _extra_data_lock = nullptr;
1999 #if INCLUDE_JVMCI
2000 _failed_speculations = nullptr;
2001 #endif
2002 }
2003
2004 void MethodData::restore_unshareable_info(TRAPS) {
2005 //_extra_data_lock = new Mutex(Mutex::nosafepoint, "MDOExtraData_lock");
2006 }
2007 #endif // INCLUDE_CDS
2008
2009 #ifdef ASSERT
2010 void MethodData::check_extra_data_locked() const {
2011 // Cast const away, just to be able to verify the lock
2012 // Usually we only want non-const accesses on the lock,
2013 // so this here is an exception.
2014 MethodData* self = (MethodData*)this;
2015 assert(self->extra_data_lock()->owned_by_self() || CDSConfig::is_dumping_archive(), "must have lock");
2016 assert(!Thread::current()->is_Java_thread() ||
2017 JavaThread::current()->is_in_no_safepoint_scope(),
2018 "JavaThread must have NoSafepointVerifier inside lock scope");
2019 }
2020 #endif
|