1 /*
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
69 }
70
71 unsigned int total_collections() const {
72 return _total_collections;
73 }
74
75 ZPage* wait() {
76 return _result.get();
77 }
78
79 void satisfy(ZPage* page) {
80 _result.set(page);
81 }
82 };
83
84 ZPage* const ZPageAllocator::gc_marker = (ZPage*)-1;
85
86 ZPageAllocator::ZPageAllocator(size_t min_capacity, size_t max_capacity, size_t max_reserve) :
87 _lock(),
88 _virtual(),
89 _physical(max_capacity, ZPageSizeMin),
90 _cache(),
91 _max_reserve(max_reserve),
92 _pre_mapped(_virtual, _physical, try_ensure_unused_for_pre_mapped(min_capacity)),
93 _used_high(0),
94 _used_low(0),
95 _used(0),
96 _allocated(0),
97 _reclaimed(0),
98 _queue(),
99 _detached() {}
100
101 bool ZPageAllocator::is_initialized() const {
102 return _physical.is_initialized() &&
103 _virtual.is_initialized() &&
104 _pre_mapped.is_initialized();
105 }
106
107 size_t ZPageAllocator::max_capacity() const {
108 return _physical.max_capacity();
109 }
|
1 /*
2 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
69 }
70
71 unsigned int total_collections() const {
72 return _total_collections;
73 }
74
75 ZPage* wait() {
76 return _result.get();
77 }
78
79 void satisfy(ZPage* page) {
80 _result.set(page);
81 }
82 };
83
84 ZPage* const ZPageAllocator::gc_marker = (ZPage*)-1;
85
86 ZPageAllocator::ZPageAllocator(size_t min_capacity, size_t max_capacity, size_t max_reserve) :
87 _lock(),
88 _virtual(),
89 _physical(max_capacity),
90 _cache(),
91 _max_reserve(max_reserve),
92 _pre_mapped(_virtual, _physical, try_ensure_unused_for_pre_mapped(min_capacity)),
93 _used_high(0),
94 _used_low(0),
95 _used(0),
96 _allocated(0),
97 _reclaimed(0),
98 _queue(),
99 _detached() {}
100
101 bool ZPageAllocator::is_initialized() const {
102 return _physical.is_initialized() &&
103 _virtual.is_initialized() &&
104 _pre_mapped.is_initialized();
105 }
106
107 size_t ZPageAllocator::max_capacity() const {
108 return _physical.max_capacity();
109 }
|