< prev index next >

src/hotspot/share/runtime/thread.cpp

RFE_8195103_reduce_initial_card_marks

0 /*                                                                                                                         
1  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.                                            
2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.                                                           
3  *                                                                                                                         
4  * This code is free software; you can redistribute it and/or modify it                                                    
5  * under the terms of the GNU General Public License version 2 only, as                                                    
6  * published by the Free Software Foundation.                                                                              
7  *                                                                                                                         
8  * This code is distributed in the hope that it will be useful, but WITHOUT                                                
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or                                                   
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License                                                   
11  * version 2 for more details (a copy is included in the LICENSE file that                                                 
12  * accompanied this code).                                                                                                 
13  *                                                                                                                         
14  * You should have received a copy of the GNU General Public License version                                               
15  * 2 along with this work; if not, write to the Free Software Foundation,                                                  
16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.                                                           
17  *                                                                                                                         
18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA                                                 
19  * or visit www.oracle.com if you need additional information or have any                                                  
20  * questions.                                                                                                              

0 /*
1  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3  *
4  * This code is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 only, as
6  * published by the Free Software Foundation.
7  *
8  * This code is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11  * version 2 for more details (a copy is included in the LICENSE file that
12  * accompanied this code).
13  *
14  * You should have received a copy of the GNU General Public License version
15  * 2 along with this work; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19  * or visit www.oracle.com if you need additional information or have any
20  * questions.

1976     JNIHandleBlock::release_block(block);                                                                                  
1977   }                                                                                                                        
1978 
1979   if (free_handle_block() != NULL) {                                                                                       
1980     JNIHandleBlock* block = free_handle_block();                                                                           
1981     set_free_handle_block(NULL);                                                                                           
1982     JNIHandleBlock::release_block(block);                                                                                  
1983   }                                                                                                                        
1984 
1985   // These have to be removed while this is still a valid thread.                                                          
1986   remove_stack_guard_pages();                                                                                              
1987 
1988   if (UseTLAB) {                                                                                                           
1989     tlab().make_parsable(true);  // retire TLAB                                                                            
1990   }                                                                                                                        
1991 
1992   if (JvmtiEnv::environments_might_exist()) {                                                                              
1993     JvmtiExport::cleanup_thread(this);                                                                                     
1994   }                                                                                                                        
1995 
1996   // We must flush any deferred card marks before removing a thread from                                                   
1997   // the list of active threads.                                                                                           
1998   Universe::heap()->flush_deferred_store_barrier(this);                                                                    
1999   assert(deferred_card_mark().is_empty(), "Should have been flushed");                                                     
2000                                                                                                                            
2001 #if INCLUDE_ALL_GCS                                                                                                        
2002   // We must flush the G1-related buffers before removing a thread                                                         
2003   // from the list of active threads. We must do this after any deferred                                                   
2004   // card marks have been flushed (above) so that any entries that are                                                     
2005   // added to the thread's dirty card queue as a result are not lost.                                                      
2006   if (UseG1GC) {                                                                                                           
2007     flush_barrier_queues();                                                                                                
2008   }                                                                                                                        
2009 #endif // INCLUDE_ALL_GCS                                                                                                  
2010 
2011   log_info(os, thread)("JavaThread %s (tid: " UINTX_FORMAT ").",                                                           
2012     exit_type == JavaThread::normal_exit ? "exiting" : "detaching",                                                        
2013     os::current_thread_id());                                                                                              
2014 
2015   if (log_is_enabled(Debug, os, thread, timer)) {                                                                          
2016     _timer_exit_phase3.stop();                                                                                             
2017     _timer_exit_phase4.start();                                                                                            
2018   }                                                                                                                        
2019   // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread                    
2020   Threads::remove(this);                                                                                                   
2021 
2022   if (log_is_enabled(Debug, os, thread, timer)) {                                                                          
2023     _timer_exit_phase4.stop();                                                                                             
2024     ResourceMark rm(this);                                                                                                 
2025     log_debug(os, thread, timer)("name='%s'"                                                                               
2026                                  ", exit-phase1=" JLONG_FORMAT                                                             
2027                                  ", exit-phase2=" JLONG_FORMAT                                                             
2028                                  ", exit-phase3=" JLONG_FORMAT                                                             

1976     JNIHandleBlock::release_block(block);
1977   }
1978 
1979   if (free_handle_block() != NULL) {
1980     JNIHandleBlock* block = free_handle_block();
1981     set_free_handle_block(NULL);
1982     JNIHandleBlock::release_block(block);
1983   }
1984 
1985   // These have to be removed while this is still a valid thread.
1986   remove_stack_guard_pages();
1987 
1988   if (UseTLAB) {
1989     tlab().make_parsable(true);  // retire TLAB
1990   }
1991 
1992   if (JvmtiEnv::environments_might_exist()) {
1993     JvmtiExport::cleanup_thread(this);
1994   }
1995 
1996   // We must flush any deferred card marks and other various GC barrier
1997   // related buffers (e.g. G1 SATB buffer and G1 dirty card queue buffer)
1998   // before removing a thread from the list of active threads.
1999   BarrierSet::barrier_set()->flush_deferred_barriers(this);










2000 
2001   log_info(os, thread)("JavaThread %s (tid: " UINTX_FORMAT ").",
2002     exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
2003     os::current_thread_id());
2004 
2005   if (log_is_enabled(Debug, os, thread, timer)) {
2006     _timer_exit_phase3.stop();
2007     _timer_exit_phase4.start();
2008   }
2009   // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
2010   Threads::remove(this);
2011 
2012   if (log_is_enabled(Debug, os, thread, timer)) {
2013     _timer_exit_phase4.stop();
2014     ResourceMark rm(this);
2015     log_debug(os, thread, timer)("name='%s'"
2016                                  ", exit-phase1=" JLONG_FORMAT
2017                                  ", exit-phase2=" JLONG_FORMAT
2018                                  ", exit-phase3=" JLONG_FORMAT
< prev index next >