< prev index next >

src/hotspot/share/gc/parallel/adjoiningGenerations.cpp

8221260: Initialize more class members on construction, remove some unused ones
Reviewed-by:

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

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

101     assert(young_rs.size() == heap_rs.size(), "Didn't reserve all of the heap");                                           
102 
103     // Create the generations.  Virtual spaces are not passed in.                                                          
104     _young_gen = new PSYoungGen(init_high_byte_size,                                                                       
105                                 min_high_byte_size,                                                                        
106                                 max_high_byte_size);                                                                       
107     _old_gen = new PSOldGen(init_low_byte_size,                                                                            
108                             min_low_byte_size,                                                                             
109                             max_low_byte_size,                                                                             
110                             "old", 1);                                                                                     
111 
112     // The virtual spaces are created by the initialization of the gens.                                                   
113     _young_gen->initialize(young_rs, alignment);                                                                           
114     assert(young_gen()->gen_size_limit() == young_rs.size(),                                                               
115       "Consistency check");                                                                                                
116     _old_gen->initialize(old_rs, alignment, "old", 1);                                                                     
117     assert(old_gen()->gen_size_limit() == old_rs.size(), "Consistency check");                                             
118   }                                                                                                                        
119 }                                                                                                                          
120 
121 AdjoiningGenerations::AdjoiningGenerations() { }                                                                           
122 
123 size_t AdjoiningGenerations::reserved_byte_size() {                                                                        
124   return virtual_spaces()->reserved_space().size();                                                                        
125 }                                                                                                                          
126 
127 void log_before_expansion(bool old, size_t expand_in_bytes, size_t change_in_bytes, size_t max_size) {                     
128   Log(gc, ergo, heap) log;                                                                                                 
129   if (!log.is_debug()) {                                                                                                   
130    return;                                                                                                                 
131   }                                                                                                                        
132   log.debug("Before expansion of %s gen with boundary move", old ? "old" : "young");                                       
133   log.debug("  Requested change: " SIZE_FORMAT_HEX "  Attempted change: " SIZE_FORMAT_HEX,                                 
134                         expand_in_bytes, change_in_bytes);                                                                 
135   ResourceMark rm;                                                                                                         
136   LogStream ls(log.debug());                                                                                               
137   ParallelScavengeHeap::heap()->print_on(&ls);                                                                             
138   log.debug("  PS%sGen max size: " SIZE_FORMAT "K", old ? "Old" : "Young", max_size/K);                                    
139 }                                                                                                                          
140 

101     assert(young_rs.size() == heap_rs.size(), "Didn't reserve all of the heap");
102 
103     // Create the generations.  Virtual spaces are not passed in.
104     _young_gen = new PSYoungGen(init_high_byte_size,
105                                 min_high_byte_size,
106                                 max_high_byte_size);
107     _old_gen = new PSOldGen(init_low_byte_size,
108                             min_low_byte_size,
109                             max_low_byte_size,
110                             "old", 1);
111 
112     // The virtual spaces are created by the initialization of the gens.
113     _young_gen->initialize(young_rs, alignment);
114     assert(young_gen()->gen_size_limit() == young_rs.size(),
115       "Consistency check");
116     _old_gen->initialize(old_rs, alignment, "old", 1);
117     assert(old_gen()->gen_size_limit() == old_rs.size(), "Consistency check");
118   }
119 }
120 
121 AdjoiningGenerations::AdjoiningGenerations(): _young_gen(NULL), _old_gen(NULL), _virtual_spaces(NULL) { }
122 
123 size_t AdjoiningGenerations::reserved_byte_size() {
124   return virtual_spaces()->reserved_space().size();
125 }
126 
127 void log_before_expansion(bool old, size_t expand_in_bytes, size_t change_in_bytes, size_t max_size) {
128   Log(gc, ergo, heap) log;
129   if (!log.is_debug()) {
130    return;
131   }
132   log.debug("Before expansion of %s gen with boundary move", old ? "old" : "young");
133   log.debug("  Requested change: " SIZE_FORMAT_HEX "  Attempted change: " SIZE_FORMAT_HEX,
134                         expand_in_bytes, change_in_bytes);
135   ResourceMark rm;
136   LogStream ls(log.debug());
137   ParallelScavengeHeap::heap()->print_on(&ls);
138   log.debug("  PS%sGen max size: " SIZE_FORMAT "K", old ? "Old" : "Young", max_size/K);
139 }
140 
< prev index next >