< prev index next >

src/hotspot/share/gc/parallel/psCompactionManager.hpp

8211446: Replace oop_pc_follow_contents with oop_iterate and closure

0 /*                                                                                                                         
1  * Copyright (c) 2005, 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) 2005, 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.

153 
154   inline void follow_klass(Klass* klass);                                                                                  
155 
156   void follow_class_loader(ClassLoaderData* klass);                                                                        
157 
158   // Access function for compaction managers                                                                               
159   static ParCompactionManager* gc_thread_compaction_manager(uint index);                                                   
160 
161   static bool steal(int queue_num, oop& t);                                                                                
162   static bool steal_objarray(int queue_num, ObjArrayTask& t);                                                              
163   static bool steal(int queue_num, size_t& region);                                                                        
164 
165   // Process tasks remaining on any marking stack                                                                          
166   void follow_marking_stacks();                                                                                            
167   inline bool marking_stacks_empty() const;                                                                                
168 
169   // Process tasks remaining on any stack                                                                                  
170   void drain_region_stacks();                                                                                              
171 
172   void follow_contents(oop obj);                                                                                           
173   void follow_contents(objArrayOop array, int index);                                                                      
174 
175   void update_contents(oop obj);                                                                                           
176                                                                                                                            
177   class MarkAndPushClosure: public BasicOopIterateClosure {                                                                
178    private:                                                                                                                
179     ParCompactionManager* _compaction_manager;                                                                             
180    public:                                                                                                                 
181     MarkAndPushClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }                                             
182                                                                                                                            
183     template <typename T> void do_oop_work(T* p);                                                                          
184     virtual void do_oop(oop* p);                                                                                           
185     virtual void do_oop(narrowOop* p);                                                                                     
186                                                                                                                            
187     // This closure provides its own oop verification code.                                                                
188     debug_only(virtual bool should_verify_oops() { return false; })                                                        
189   };                                                                                                                       
190 
191   class FollowStackClosure: public VoidClosure {                                                                           
192    private:                                                                                                                
193     ParCompactionManager* _compaction_manager;                                                                             
194    public:                                                                                                                 
195     FollowStackClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }                                             
196     virtual void do_void();                                                                                                
197   };                                                                                                                       
198 };                                                                                                                         
199 
200 inline ParCompactionManager* ParCompactionManager::manager_array(uint index) {                                             
201   assert(_manager_array != NULL, "access of NULL manager_array");                                                          
202   assert(index <= ParallelGCThreads, "out of range manager_array access");                                                 
203   return _manager_array[index];                                                                                            
204 }                                                                                                                          
205 
206 bool ParCompactionManager::marking_stacks_empty() const {                                                                  
207   return _marking_stack.is_empty() && _objarray_stack.is_empty();                                                          
208 }                                                                                                                          

153 
154   inline void follow_klass(Klass* klass);
155 
156   void follow_class_loader(ClassLoaderData* klass);
157 
158   // Access function for compaction managers
159   static ParCompactionManager* gc_thread_compaction_manager(uint index);
160 
161   static bool steal(int queue_num, oop& t);
162   static bool steal_objarray(int queue_num, ObjArrayTask& t);
163   static bool steal(int queue_num, size_t& region);
164 
165   // Process tasks remaining on any marking stack
166   void follow_marking_stacks();
167   inline bool marking_stacks_empty() const;
168 
169   // Process tasks remaining on any stack
170   void drain_region_stacks();
171 
172   void follow_contents(oop obj);
173   void follow_array(objArrayOop array, int index);
174 
175   void update_contents(oop obj);














176 
177   class FollowStackClosure: public VoidClosure {
178    private:
179     ParCompactionManager* _compaction_manager;
180    public:
181     FollowStackClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }
182     virtual void do_void();
183   };
184 };
185 
186 inline ParCompactionManager* ParCompactionManager::manager_array(uint index) {
187   assert(_manager_array != NULL, "access of NULL manager_array");
188   assert(index <= ParallelGCThreads, "out of range manager_array access");
189   return _manager_array[index];
190 }
191 
192 bool ParCompactionManager::marking_stacks_empty() const {
193   return _marking_stack.is_empty() && _objarray_stack.is_empty();
194 }
< prev index next >