< prev index next >

src/hotspot/share/oops/instanceRefKlass.hpp

8201436: Replace oop_ps_push_contents with oop_iterate and closure

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.

43 // Afterwards, the discovered references are processed in decreasing                                                       
44 // order of reachability. Reference objects eligible for notification                                                      
45 // are linked to the static pending_list in class java/lang/ref/Reference,                                                 
46 // and the pending list lock object in the same class is notified.                                                         
47 
48 
49 class InstanceRefKlass: public InstanceKlass {                                                                             
50   friend class InstanceKlass;                                                                                              
51  public:                                                                                                                   
52   static const KlassID ID = InstanceRefKlassID;                                                                            
53 
54  private:                                                                                                                  
55   InstanceRefKlass(const ClassFileParser& parser) : InstanceKlass(parser, InstanceKlass::_misc_kind_reference, ID) {}      
56 
57  public:                                                                                                                   
58   InstanceRefKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }                                      
59 
60   // GC specific object visitors                                                                                           
61   //                                                                                                                       
62 #if INCLUDE_PARALLELGC                                                                                                     
63   // Parallel Scavenge                                                                                                     
64   void oop_ps_push_contents(  oop obj, PSPromotionManager* pm);                                                            
65   // Parallel Compact                                                                                                      
66   void oop_pc_follow_contents(oop obj, ParCompactionManager* cm);                                                          
67   void oop_pc_update_pointers(oop obj, ParCompactionManager* cm);                                                          
68 #endif                                                                                                                     
69 
70   // Oop fields (and metadata) iterators                                                                                   
71   //                                                                                                                       
72   // The InstanceRefKlass iterators also support reference processing.                                                     
73 
74 
75   // Forward iteration                                                                                                     
76   // Iterate over all oop fields and metadata.                                                                             
77   template <typename T, class OopClosureType>                                                                              
78   inline void oop_oop_iterate(oop obj, OopClosureType* closure);                                                           
79 
80   // Reverse iteration                                                                                                     
81   // Iterate over all oop fields and metadata.                                                                             
82   template <typename T, class OopClosureType>                                                                              
83   inline void oop_oop_iterate_reverse(oop obj, OopClosureType* closure);                                                   

43 // Afterwards, the discovered references are processed in decreasing
44 // order of reachability. Reference objects eligible for notification
45 // are linked to the static pending_list in class java/lang/ref/Reference,
46 // and the pending list lock object in the same class is notified.
47 
48 
49 class InstanceRefKlass: public InstanceKlass {
50   friend class InstanceKlass;
51  public:
52   static const KlassID ID = InstanceRefKlassID;
53 
54  private:
55   InstanceRefKlass(const ClassFileParser& parser) : InstanceKlass(parser, InstanceKlass::_misc_kind_reference, ID) {}
56 
57  public:
58   InstanceRefKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
59 
60   // GC specific object visitors
61   //
62 #if INCLUDE_PARALLELGC


63   // Parallel Compact
64   void oop_pc_follow_contents(oop obj, ParCompactionManager* cm);
65   void oop_pc_update_pointers(oop obj, ParCompactionManager* cm);
66 #endif
67 
68   // Oop fields (and metadata) iterators
69   //
70   // The InstanceRefKlass iterators also support reference processing.
71 
72 
73   // Forward iteration
74   // Iterate over all oop fields and metadata.
75   template <typename T, class OopClosureType>
76   inline void oop_oop_iterate(oop obj, OopClosureType* closure);
77 
78   // Reverse iteration
79   // Iterate over all oop fields and metadata.
80   template <typename T, class OopClosureType>
81   inline void oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
< prev index next >