annotate src/share/vm/gc_implementation/parallelScavenge/adjoiningVirtualSpaces.hpp @ 17937:78bbf4d43a14

8037816: Fix for 8036122 breaks build with Xcode5/clang 8043029: Change 8037816 breaks HS build with older GCC versions which don't support diagnostic pragmas 8043164: Format warning in traceStream.hpp Summary: Backport of main fix + two corrections, enables clang compilation, turns on format attributes, corrects/mutes warnings Reviewed-by: kvn, coleenp, iveresov, twisti
author drchase
date Thu, 22 May 2014 15:52:41 -0400
parents f95d63e2154a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_ADJOININGVIRTUALSPACES_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_ADJOININGVIRTUALSPACES_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "gc_implementation/parallelScavenge/psVirtualspace.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29
0
a61af66fc99e Initial load
duke
parents:
diff changeset
30
a61af66fc99e Initial load
duke
parents:
diff changeset
31 // Contains two virtual spaces that each can individually span
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // most of the reserved region but committed parts of which
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // cannot overlap.
a61af66fc99e Initial load
duke
parents:
diff changeset
34 //
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // +-------+ <--- high_boundary for H
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // | H |
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
39 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
41 // --------- <--- low for H
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // ========= <--- low_boundary for H, high_boundary for L
a61af66fc99e Initial load
duke
parents:
diff changeset
44 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
47 // --------- <--- high for L
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // | L |
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
51 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // +-------+ <--- low_boundary for L
a61af66fc99e Initial load
duke
parents:
diff changeset
54 //
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // Each virtual space in the AdjoiningVirtualSpaces grows and shrink
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // within its reserved region (between the low_boundary and the
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // boundary) independently. If L want to grow above its high_boundary,
a61af66fc99e Initial load
duke
parents:
diff changeset
58 // then the high_boundary of L and the low_boundary of H must be
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // moved up consistently. AdjoiningVirtualSpaces provide the
a61af66fc99e Initial load
duke
parents:
diff changeset
60 // interfaces for moving the this boundary.
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 class AdjoiningVirtualSpaces {
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // space at the high end and the low end, respectively
a61af66fc99e Initial load
duke
parents:
diff changeset
64 PSVirtualSpace* _high;
a61af66fc99e Initial load
duke
parents:
diff changeset
65 PSVirtualSpace* _low;
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // The reserved space spanned by the two spaces.
a61af66fc99e Initial load
duke
parents:
diff changeset
68 ReservedSpace _reserved_space;
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // The minimum byte size for the low space. It will not
a61af66fc99e Initial load
duke
parents:
diff changeset
71 // be shrunk below this value.
a61af66fc99e Initial load
duke
parents:
diff changeset
72 size_t _min_low_byte_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // Same for the high space
a61af66fc99e Initial load
duke
parents:
diff changeset
74 size_t _min_high_byte_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 const size_t _alignment;
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
79 // Allocates two virtual spaces that will be located at the
a61af66fc99e Initial load
duke
parents:
diff changeset
80 // high and low ends. Does no initialization.
a61af66fc99e Initial load
duke
parents:
diff changeset
81 AdjoiningVirtualSpaces(ReservedSpace rs,
a61af66fc99e Initial load
duke
parents:
diff changeset
82 size_t min_low_byte_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
83 size_t min_high_byte_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
84 size_t alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
87 PSVirtualSpace* high() { return _high; }
a61af66fc99e Initial load
duke
parents:
diff changeset
88 PSVirtualSpace* low() { return _low; }
a61af66fc99e Initial load
duke
parents:
diff changeset
89 ReservedSpace reserved_space() { return _reserved_space; }
a61af66fc99e Initial load
duke
parents:
diff changeset
90 size_t min_low_byte_size() { return _min_low_byte_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
91 size_t min_high_byte_size() { return _min_high_byte_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
92 size_t alignment() const { return _alignment; }
a61af66fc99e Initial load
duke
parents:
diff changeset
93
a61af66fc99e Initial load
duke
parents:
diff changeset
94 // move boundary between the two spaces up
a61af66fc99e Initial load
duke
parents:
diff changeset
95 bool adjust_boundary_up(size_t size_in_bytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // and down
a61af66fc99e Initial load
duke
parents:
diff changeset
97 bool adjust_boundary_down(size_t size_in_bytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // Maximum byte size for the high space.
a61af66fc99e Initial load
duke
parents:
diff changeset
100 size_t high_byte_size_limit() {
a61af66fc99e Initial load
duke
parents:
diff changeset
101 return _reserved_space.size() - _min_low_byte_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
102 }
a61af66fc99e Initial load
duke
parents:
diff changeset
103 // Maximum byte size for the low space.
a61af66fc99e Initial load
duke
parents:
diff changeset
104 size_t low_byte_size_limit() {
a61af66fc99e Initial load
duke
parents:
diff changeset
105 return _reserved_space.size() - _min_high_byte_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
106 }
a61af66fc99e Initial load
duke
parents:
diff changeset
107
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // Sets the boundaries for the virtual spaces and commits and
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // initial size;
a61af66fc99e Initial load
duke
parents:
diff changeset
110 void initialize(size_t max_low_byte_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
111 size_t init_low_byte_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
112 size_t init_high_byte_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
113 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
114
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
115 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_ADJOININGVIRTUALSPACES_HPP