< prev index next >

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

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

0 /*                                                                                                                         
1  * Copyright (c) 2001, 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.                                                                                                              
21  *                                                                                                                         
22  */                                                                                                                        
23 
24 #include "precompiled.hpp"                                                                                                 
25 #include "gc/parallel/mutableNUMASpace.hpp"                                                                                
26 #include "gc/parallel/parallelScavengeHeap.hpp"                                                                            
27 #include "gc/parallel/psMarkSweepDecorator.hpp"                                                                            
28 #include "gc/parallel/psScavenge.hpp"                                                                                      
29 #include "gc/parallel/psYoungGen.hpp"                                                                                      
30 #include "gc/shared/gcUtil.hpp"                                                                                            
31 #include "gc/shared/spaceDecorator.hpp"                                                                                    
32 #include "logging/log.hpp"                                                                                                 
33 #include "oops/oop.inline.hpp"                                                                                             
34 #include "runtime/java.hpp"                                                                                                
35 #include "utilities/align.hpp"                                                                                             
36 
37 PSYoungGen::PSYoungGen(size_t        initial_size,                                                                         
38                        size_t        min_size,                                                                             
39                        size_t        max_size) :                                                                           
                                                                                                                           
                                                                                                                           
                                                                                                                           
                                                                                                                           
                                                                                                                           
                                                                                                                           
40   _init_gen_size(initial_size),                                                                                            
41   _min_gen_size(min_size),                                                                                                 
42   _max_gen_size(max_size)                                                                                                  
                                                                                                                           
                                                                                                                           
                                                                                                                           
                                                                                                                           
43 {}                                                                                                                         
44 
45 void PSYoungGen::initialize_virtual_space(ReservedSpace rs, size_t alignment) {                                            
46   assert(_init_gen_size != 0, "Should have a finite size");                                                                
47   _virtual_space = new PSVirtualSpace(rs, alignment);                                                                      
48   if (!virtual_space()->expand_by(_init_gen_size)) {                                                                       
49     vm_exit_during_initialization("Could not reserve enough space for "                                                    
50                                   "object heap");                                                                          
51   }                                                                                                                        
52 }                                                                                                                          
53 
54 void PSYoungGen::initialize(ReservedSpace rs, size_t alignment) {                                                          
55   initialize_virtual_space(rs, alignment);                                                                                 
56   initialize_work();                                                                                                       
57 }                                                                                                                          
58 
59 void PSYoungGen::initialize_work() {                                                                                       
60 
61   _reserved = MemRegion((HeapWord*)virtual_space()->low_boundary(),                                                        

0 /*
1  * Copyright (c) 2001, 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.
21  *
22  */
23 
24 #include "precompiled.hpp"
25 #include "gc/parallel/mutableNUMASpace.hpp"
26 #include "gc/parallel/parallelScavengeHeap.hpp"
27 #include "gc/parallel/psMarkSweepDecorator.hpp"
28 #include "gc/parallel/psScavenge.hpp"
29 #include "gc/parallel/psYoungGen.hpp"
30 #include "gc/shared/gcUtil.hpp"
31 #include "gc/shared/spaceDecorator.hpp"
32 #include "logging/log.hpp"
33 #include "oops/oop.inline.hpp"
34 #include "runtime/java.hpp"
35 #include "utilities/align.hpp"
36 
37 PSYoungGen::PSYoungGen(size_t initial_size, size_t min_size, size_t max_size) :
38   _reserved(),
39   _virtual_space(NULL),
40   _eden_space(NULL),
41   _from_space(NULL),
42   _to_space(NULL),
43   _eden_mark_sweep(NULL),
44   _from_mark_sweep(NULL),
45   _to_mark_sweep(NULL),
46   _init_gen_size(initial_size),
47   _min_gen_size(min_size),
48   _max_gen_size(max_size),
49   _gen_counters(NULL),
50   _eden_counters(NULL),
51   _from_counters(NULL),
52   _to_counters(NULL)
53 {}
54 
55 void PSYoungGen::initialize_virtual_space(ReservedSpace rs, size_t alignment) {
56   assert(_init_gen_size != 0, "Should have a finite size");
57   _virtual_space = new PSVirtualSpace(rs, alignment);
58   if (!virtual_space()->expand_by(_init_gen_size)) {
59     vm_exit_during_initialization("Could not reserve enough space for "
60                                   "object heap");
61   }
62 }
63 
64 void PSYoungGen::initialize(ReservedSpace rs, size_t alignment) {
65   initialize_virtual_space(rs, alignment);
66   initialize_work();
67 }
68 
69 void PSYoungGen::initialize_work() {
70 
71   _reserved = MemRegion((HeapWord*)virtual_space()->low_boundary(),
< prev index next >