mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8252921: NMT overwrite memory type for region assert when building dynamic archive
Reviewed-by: minqi, iklam, dholmes
This commit is contained in:
parent
0c287de4f6
commit
8c02bdbf13
3 changed files with 12 additions and 14 deletions
|
@ -363,6 +363,10 @@ void Thread::record_stack_base_and_size() {
|
|||
void Thread::register_thread_stack_with_NMT() {
|
||||
MemTracker::record_thread_stack(stack_end(), stack_size());
|
||||
}
|
||||
|
||||
void Thread::unregister_thread_stack_with_NMT() {
|
||||
MemTracker::release_thread_stack(stack_end(), stack_size());
|
||||
}
|
||||
#endif // INCLUDE_NMT
|
||||
|
||||
void Thread::call_run() {
|
||||
|
@ -428,19 +432,6 @@ Thread::~Thread() {
|
|||
barrier_set->on_thread_destroy(this);
|
||||
}
|
||||
|
||||
// stack_base can be NULL if the thread is never started or exited before
|
||||
// record_stack_base_and_size called. Although, we would like to ensure
|
||||
// that all started threads do call record_stack_base_and_size(), there is
|
||||
// not proper way to enforce that.
|
||||
#if INCLUDE_NMT
|
||||
if (_stack_base != NULL) {
|
||||
MemTracker::release_thread_stack(stack_end(), stack_size());
|
||||
#ifdef ASSERT
|
||||
set_stack_base(NULL);
|
||||
#endif
|
||||
}
|
||||
#endif // INCLUDE_NMT
|
||||
|
||||
// deallocate data structures
|
||||
delete resource_area();
|
||||
// since the handle marks are using the handle area, we have to deallocated the root
|
||||
|
@ -1340,6 +1331,7 @@ void NonJavaThread::pre_run() {
|
|||
void NonJavaThread::post_run() {
|
||||
JFR_ONLY(Jfr::on_thread_exit(this);)
|
||||
remove_from_the_list();
|
||||
unregister_thread_stack_with_NMT();
|
||||
// Ensure thread-local-storage is cleared before termination.
|
||||
Thread::clear_thread_current();
|
||||
}
|
||||
|
@ -2013,6 +2005,7 @@ void JavaThread::thread_main_inner() {
|
|||
// Shared teardown for all JavaThreads
|
||||
void JavaThread::post_run() {
|
||||
this->exit(false);
|
||||
this->unregister_thread_stack_with_NMT();
|
||||
// Defer deletion to here to ensure 'this' is still referenceable in call_run
|
||||
// for any shared tear-down.
|
||||
this->smr_delete();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue