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 */
99 size_t ZCollectedHeap::used() const {
100 return _heap.used();
101 }
102
103 bool ZCollectedHeap::is_maximal_no_gc() const {
104 // Not supported
105 ShouldNotReachHere();
106 return false;
107 }
108
109 bool ZCollectedHeap::is_scavengable(oop obj) {
110 return false;
111 }
112
113 bool ZCollectedHeap::is_in(const void* p) const {
114 return is_in_reserved(p) && _heap.is_in((uintptr_t)p);
115 }
116
117 bool ZCollectedHeap::is_in_closed_subset(const void* p) const {
118 return is_in(p);
119 }
120
121 void ZCollectedHeap::fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap) {
122 // Does nothing, not a parsable heap
123 }
124
125 HeapWord* ZCollectedHeap::allocate_new_tlab(size_t min_size, size_t requested_size, size_t* actual_size) {
126 const size_t size_in_bytes = ZUtils::words_to_bytes(align_object_size(requested_size));
127 const uintptr_t addr = _heap.alloc_tlab(size_in_bytes);
128
129 if (addr != 0) {
130 *actual_size = requested_size;
131 }
132
133 return (HeapWord*)addr;
134 }
135
136 HeapWord* ZCollectedHeap::mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded) {
137 const size_t size_in_bytes = ZUtils::words_to_bytes(align_object_size(size));
138 return (HeapWord*)_heap.alloc_object(size_in_bytes);
139 }
140
141 MetaWord* ZCollectedHeap::satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
142 size_t size,
|
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 */
99 size_t ZCollectedHeap::used() const {
100 return _heap.used();
101 }
102
103 bool ZCollectedHeap::is_maximal_no_gc() const {
104 // Not supported
105 ShouldNotReachHere();
106 return false;
107 }
108
109 bool ZCollectedHeap::is_scavengable(oop obj) {
110 return false;
111 }
112
113 bool ZCollectedHeap::is_in(const void* p) const {
114 return is_in_reserved(p) && _heap.is_in((uintptr_t)p);
115 }
116
117 bool ZCollectedHeap::is_in_closed_subset(const void* p) const {
118 return is_in(p);
119 }
120
121 HeapWord* ZCollectedHeap::allocate_new_tlab(size_t min_size, size_t requested_size, size_t* actual_size) {
122 const size_t size_in_bytes = ZUtils::words_to_bytes(align_object_size(requested_size));
123 const uintptr_t addr = _heap.alloc_tlab(size_in_bytes);
124
125 if (addr != 0) {
126 *actual_size = requested_size;
127 }
128
129 return (HeapWord*)addr;
130 }
131
132 HeapWord* ZCollectedHeap::mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded) {
133 const size_t size_in_bytes = ZUtils::words_to_bytes(align_object_size(size));
134 return (HeapWord*)_heap.alloc_object(size_in_bytes);
135 }
136
137 MetaWord* ZCollectedHeap::satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
138 size_t size,
|