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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "cds/archiveBuilder.hpp"
27 #include "cds/archiveHeapLoader.inline.hpp"
28 #include "cds/archiveUtils.hpp"
29 #include "cds/cdsConfig.hpp"
30 #include "cds/classListParser.hpp"
31 #include "cds/classListWriter.hpp"
32 #include "cds/dynamicArchive.hpp"
33 #include "cds/filemap.hpp"
34 #include "cds/heapShared.hpp"
35 #include "cds/metaspaceShared.hpp"
36 #include "classfile/systemDictionaryShared.hpp"
37 #include "classfile/vmClasses.hpp"
38 #include "interpreter/bootstrapInfo.hpp"
39 #include "memory/metaspaceUtils.hpp"
40 #include "memory/resourceArea.hpp"
41 #include "oops/compressedOops.inline.hpp"
42 #include "runtime/arguments.hpp"
43 #include "utilities/bitMap.inline.hpp"
44 #include "utilities/debug.hpp"
45 #include "utilities/formatBuffer.hpp"
46 #include "utilities/globalDefinitions.hpp"
47
48 CHeapBitMap* ArchivePtrMarker::_ptrmap = nullptr;
49 CHeapBitMap* ArchivePtrMarker::_rw_ptrmap = nullptr;
50 CHeapBitMap* ArchivePtrMarker::_ro_ptrmap = nullptr;
51 VirtualSpace* ArchivePtrMarker::_vs;
52
53 bool ArchivePtrMarker::_compacted;
54
55 void ArchivePtrMarker::initialize(CHeapBitMap* ptrmap, VirtualSpace* vs) {
56 assert(_ptrmap == nullptr, "initialize only once");
57 assert(_rw_ptrmap == nullptr, "initialize only once");
58 assert(_ro_ptrmap == nullptr, "initialize only once");
59 _vs = vs;
60 _compacted = false;
61 _ptrmap = ptrmap;
62
63 // Use this as initial guesstimate. We should need less space in the
64 // archive, but if we're wrong the bitmap will be expanded automatically.
65 size_t estimated_archive_size = MetaspaceGC::capacity_until_GC();
66 // But set it smaller in debug builds so we always test the expansion code.
67 // (Default archive is about 12MB).
68 DEBUG_ONLY(estimated_archive_size = 6 * M);
69
70 // We need one bit per pointer in the archive.
71 _ptrmap->initialize(estimated_archive_size / sizeof(intptr_t));
72 }
73
74 void ArchivePtrMarker::initialize_rw_ro_maps(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_ptrmap) {
75 address* rw_bottom = (address*)ArchiveBuilder::current()->rw_region()->base();
76 address* ro_bottom = (address*)ArchiveBuilder::current()->ro_region()->base();
77
78 _rw_ptrmap = rw_ptrmap;
79 _ro_ptrmap = ro_ptrmap;
80
81 size_t rw_size = ArchiveBuilder::current()->rw_region()->used() / sizeof(address);
82 size_t ro_size = ArchiveBuilder::current()->ro_region()->used() / sizeof(address);
83 // ro_start is the first bit in _ptrmap that covers the pointer that would sit at ro_bottom.
84 // E.g., if rw_bottom = (address*)100
85 // ro_bottom = (address*)116
86 // then for 64-bit platform:
87 // ro_start = ro_bottom - rw_bottom = (116 - 100) / sizeof(address) = 2;
88 size_t ro_start = ro_bottom - rw_bottom;
89
90 // Note: ptrmap is big enough only to cover the last pointer in ro_region.
91 // See ArchivePtrMarker::compact()
92 _rw_ptrmap->initialize(rw_size);
93 _ro_ptrmap->initialize(_ptrmap->size() - ro_start);
94
95 for (size_t rw_bit = 0; rw_bit < _rw_ptrmap->size(); rw_bit++) {
96 _rw_ptrmap->at_put(rw_bit, _ptrmap->at(rw_bit));
97 }
98
99 for(size_t ro_bit = ro_start; ro_bit < _ptrmap->size(); ro_bit++) {
100 _ro_ptrmap->at_put(ro_bit-ro_start, _ptrmap->at(ro_bit));
101 }
102 assert(_ptrmap->size() - ro_start == _ro_ptrmap->size(), "must be");
103 }
104
105 void ArchivePtrMarker::mark_pointer(address* ptr_loc) {
106 assert(_ptrmap != nullptr, "not initialized");
107 assert(!_compacted, "cannot mark anymore");
108
109 if (ptr_base() <= ptr_loc && ptr_loc < ptr_end()) {
110 address value = *ptr_loc;
111 // We don't want any pointer that points to very bottom of the archive, otherwise when
112 // MetaspaceShared::default_base_address()==0, we can't distinguish between a pointer
113 // to nothing (null) vs a pointer to an objects that happens to be at the very bottom
114 // of the archive.
115 assert(value != (address)ptr_base(), "don't point to the bottom of the archive");
116
117 if (value != nullptr) {
118 assert(uintx(ptr_loc) % sizeof(intptr_t) == 0, "pointers must be stored in aligned addresses");
119 size_t idx = ptr_loc - ptr_base();
120 if (_ptrmap->size() <= idx) {
121 _ptrmap->resize((idx + 1) * 2);
122 }
245 char* DumpRegion::allocate(size_t num_bytes) {
246 char* p = (char*)align_up(_top, (size_t)SharedSpaceObjectAlignment);
247 char* newtop = p + align_up(num_bytes, (size_t)SharedSpaceObjectAlignment);
248 expand_top_to(newtop);
249 memset(p, 0, newtop - p);
250 return p;
251 }
252
253 void DumpRegion::append_intptr_t(intptr_t n, bool need_to_mark) {
254 assert(is_aligned(_top, sizeof(intptr_t)), "bad alignment");
255 intptr_t *p = (intptr_t*)_top;
256 char* newtop = _top + sizeof(intptr_t);
257 expand_top_to(newtop);
258 *p = n;
259 if (need_to_mark) {
260 ArchivePtrMarker::mark_pointer(p);
261 }
262 }
263
264 void DumpRegion::print(size_t total_bytes) const {
265 log_debug(cds)("%s space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used] at " INTPTR_FORMAT,
266 _name, used(), percent_of(used(), total_bytes), reserved(), percent_of(used(), reserved()),
267 p2i(ArchiveBuilder::current()->to_requested(_base)));
268 }
269
270 void DumpRegion::print_out_of_space_msg(const char* failing_region, size_t needed_bytes) {
271 log_error(cds)("[%-8s] " PTR_FORMAT " - " PTR_FORMAT " capacity =%9d, allocated =%9d",
272 _name, p2i(_base), p2i(_top), int(_end - _base), int(_top - _base));
273 if (strcmp(_name, failing_region) == 0) {
274 log_error(cds)(" required = %d", int(needed_bytes));
275 }
276 }
277
278 void DumpRegion::init(ReservedSpace* rs, VirtualSpace* vs) {
279 _rs = rs;
280 _vs = vs;
281 // Start with 0 committed bytes. The memory will be committed as needed.
282 if (!_vs->initialize(*_rs, 0)) {
283 fatal("Unable to allocate memory for shared space");
284 }
285 _base = _top = _rs->base();
286 _end = _rs->end();
287 }
288
289 void DumpRegion::pack(DumpRegion* next) {
290 assert(!is_packed(), "sanity");
291 _end = (char*)align_up(_top, MetaspaceShared::core_region_alignment());
292 _is_packed = true;
293 if (next != nullptr) {
294 next->_rs = _rs;
295 next->_vs = _vs;
296 next->_base = next->_top = this->_end;
297 next->_end = _rs->end();
298 }
299 }
300
301 void WriteClosure::do_ptr(void** p) {
302 // Write ptr into the archive; ptr can be:
303 // (a) null -> written as 0
304 // (b) a "buffered" address -> written as is
305 // (c) a "source" address -> convert to "buffered" and write
306 // The common case is (c). E.g., when writing the vmClasses into the archive.
307 // We have (b) only when we don't have a corresponding source object. E.g.,
308 // the archived c++ vtable entries.
309 address ptr = *(address*)p;
310 if (ptr != nullptr && !ArchiveBuilder::current()->is_in_buffer_space(ptr)) {
311 ptr = ArchiveBuilder::current()->get_buffered_addr(ptr);
312 }
353 if (SystemDictionaryShared::is_supported_invokedynamic(bootstrap_specifier)) {
354 const constantPoolHandle& pool = bootstrap_specifier->pool();
355 if (SystemDictionaryShared::is_builtin_loader(pool->pool_holder()->class_loader_data())) {
356 // Currently lambda proxy classes are supported only for the built-in loaders.
357 ResourceMark rm(THREAD);
358 int pool_index = bootstrap_specifier->bss_index();
359 ClassListWriter w;
360 w.stream()->print("%s %s", ClassListParser::lambda_proxy_tag(), pool->pool_holder()->name()->as_C_string());
361 CDSIndyInfo cii;
362 ClassListParser::populate_cds_indy_info(pool, pool_index, &cii, CHECK);
363 GrowableArray<const char*>* indy_items = cii.items();
364 for (int i = 0; i < indy_items->length(); i++) {
365 w.stream()->print(" %s", indy_items->at(i));
366 }
367 w.stream()->cr();
368 }
369 }
370 }
371 }
372
373 size_t HeapRootSegments::size_in_bytes(size_t seg_idx) {
374 assert(seg_idx < _count, "In range");
375 return objArrayOopDesc::object_size(size_in_elems(seg_idx)) * HeapWordSize;
376 }
377
378 int HeapRootSegments::size_in_elems(size_t seg_idx) {
379 assert(seg_idx < _count, "In range");
380 if (seg_idx != _count - 1) {
381 return _max_size_in_elems;
382 } else {
383 // Last slice, leftover
384 return _roots_count % _max_size_in_elems;
385 }
386 }
387
388 size_t HeapRootSegments::segment_offset(size_t seg_idx) {
389 assert(seg_idx < _count, "In range");
390 return _base_offset + seg_idx * _max_size_in_bytes;
391 }
392
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "cds/archiveBuilder.hpp"
27 #include "cds/archiveHeapLoader.inline.hpp"
28 #include "cds/archiveUtils.hpp"
29 #include "cds/cdsConfig.hpp"
30 #include "cds/classListParser.hpp"
31 #include "cds/classListWriter.hpp"
32 #include "cds/dynamicArchive.hpp"
33 #include "cds/filemap.hpp"
34 #include "cds/heapShared.hpp"
35 #include "cds/metaspaceShared.hpp"
36 #include "classfile/classLoader.hpp"
37 #include "classfile/systemDictionaryShared.hpp"
38 #include "classfile/vmClasses.hpp"
39 #include "interpreter/bootstrapInfo.hpp"
40 #include "memory/metaspaceUtils.hpp"
41 #include "memory/resourceArea.hpp"
42 #include "oops/compressedOops.inline.hpp"
43 #include "oops/klass.inline.hpp"
44 #include "runtime/arguments.hpp"
45 #include "utilities/bitMap.inline.hpp"
46 #include "utilities/debug.hpp"
47 #include "utilities/formatBuffer.hpp"
48 #include "utilities/globalDefinitions.hpp"
49
50 CHeapBitMap* ArchivePtrMarker::_ptrmap = nullptr;
51 CHeapBitMap* ArchivePtrMarker::_rw_ptrmap = nullptr;
52 CHeapBitMap* ArchivePtrMarker::_ro_ptrmap = nullptr;
53 CHeapBitMap* ArchivePtrMarker::_cc_ptrmap = nullptr;
54 VirtualSpace* ArchivePtrMarker::_vs;
55
56 bool ArchivePtrMarker::_compacted;
57
58 void ArchivePtrMarker::initialize(CHeapBitMap* ptrmap, VirtualSpace* vs) {
59 assert(_ptrmap == nullptr, "initialize only once");
60 assert(_rw_ptrmap == nullptr, "initialize only once");
61 assert(_ro_ptrmap == nullptr, "initialize only once");
62 assert(_cc_ptrmap == nullptr, "initialize only once");
63 _vs = vs;
64 _compacted = false;
65 _ptrmap = ptrmap;
66
67 // Use this as initial guesstimate. We should need less space in the
68 // archive, but if we're wrong the bitmap will be expanded automatically.
69 size_t estimated_archive_size = MetaspaceGC::capacity_until_GC();
70 // But set it smaller in debug builds so we always test the expansion code.
71 // (Default archive is about 12MB).
72 DEBUG_ONLY(estimated_archive_size = 6 * M);
73
74 // We need one bit per pointer in the archive.
75 _ptrmap->initialize(estimated_archive_size / sizeof(intptr_t));
76 }
77
78 void ArchivePtrMarker::initialize_rw_ro_cc_maps(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_ptrmap, CHeapBitMap* cc_ptrmap) {
79 address* rw_bottom = (address*)ArchiveBuilder::current()->rw_region()->base();
80 address* ro_bottom = (address*)ArchiveBuilder::current()->ro_region()->base();
81 address* cc_bottom = (address*)ArchiveBuilder::current()->cc_region()->base();
82
83 _rw_ptrmap = rw_ptrmap;
84 _ro_ptrmap = ro_ptrmap;
85 _cc_ptrmap = cc_ptrmap;
86
87 size_t rw_size = ArchiveBuilder::current()->rw_region()->used() / sizeof(address);
88 size_t ro_size = ArchiveBuilder::current()->ro_region()->used() / sizeof(address);
89 size_t cc_size = ArchiveBuilder::current()->cc_region()->used() / sizeof(address);
90 // ro_start is the first bit in _ptrmap that covers the pointer that would sit at ro_bottom.
91 // E.g., if rw_bottom = (address*)100
92 // ro_bottom = (address*)116
93 // then for 64-bit platform:
94 // ro_start = ro_bottom - rw_bottom = (116 - 100) / sizeof(address) = 2;
95 size_t ro_start = ro_bottom - rw_bottom;
96 size_t cc_start = cc_bottom - rw_bottom;
97
98 // Note: ptrmap is big enough only to cover the last pointer in cc_region or ro_region.
99 // See ArchivePtrMarker::compact()
100 if (ro_start + ro_size >_ptrmap->size()) {
101 ro_size = _ptrmap->size() - ro_start; // ro is smaller than we thought
102 cc_size = 0; // cc is empty
103 } else if (cc_size != 0 && cc_start + cc_size > _ptrmap->size()) {
104 cc_size = _ptrmap->size() - cc_start; // ro is smaller than we thought
105 }
106
107 assert(rw_size < _ptrmap->size(), "sanity");
108 assert(ro_size < _ptrmap->size(), "sanity");
109 assert(cc_size < _ptrmap->size(), "sanity");
110 assert(rw_size + ro_size + cc_size <= _ptrmap->size(), "sanity");
111
112 _rw_ptrmap->initialize(rw_size);
113 _ro_ptrmap->initialize(ro_size);
114 _cc_ptrmap->initialize(cc_size);
115
116 for (size_t i = 0; i < rw_size; i++) {
117 _rw_ptrmap->at_put(i, _ptrmap->at(i));
118 }
119 for (size_t i = 0; i < ro_size; i++) {
120 _ro_ptrmap->at_put(i, _ptrmap->at(ro_start + i));
121 }
122 for (size_t i = 0; i < cc_size; i++) {
123 _cc_ptrmap->at_put(i, _ptrmap->at(cc_start + i));
124 }
125 }
126
127 void ArchivePtrMarker::mark_pointer(address* ptr_loc) {
128 assert(_ptrmap != nullptr, "not initialized");
129 assert(!_compacted, "cannot mark anymore");
130
131 if (ptr_base() <= ptr_loc && ptr_loc < ptr_end()) {
132 address value = *ptr_loc;
133 // We don't want any pointer that points to very bottom of the archive, otherwise when
134 // MetaspaceShared::default_base_address()==0, we can't distinguish between a pointer
135 // to nothing (null) vs a pointer to an objects that happens to be at the very bottom
136 // of the archive.
137 assert(value != (address)ptr_base(), "don't point to the bottom of the archive");
138
139 if (value != nullptr) {
140 assert(uintx(ptr_loc) % sizeof(intptr_t) == 0, "pointers must be stored in aligned addresses");
141 size_t idx = ptr_loc - ptr_base();
142 if (_ptrmap->size() <= idx) {
143 _ptrmap->resize((idx + 1) * 2);
144 }
267 char* DumpRegion::allocate(size_t num_bytes) {
268 char* p = (char*)align_up(_top, (size_t)SharedSpaceObjectAlignment);
269 char* newtop = p + align_up(num_bytes, (size_t)SharedSpaceObjectAlignment);
270 expand_top_to(newtop);
271 memset(p, 0, newtop - p);
272 return p;
273 }
274
275 void DumpRegion::append_intptr_t(intptr_t n, bool need_to_mark) {
276 assert(is_aligned(_top, sizeof(intptr_t)), "bad alignment");
277 intptr_t *p = (intptr_t*)_top;
278 char* newtop = _top + sizeof(intptr_t);
279 expand_top_to(newtop);
280 *p = n;
281 if (need_to_mark) {
282 ArchivePtrMarker::mark_pointer(p);
283 }
284 }
285
286 void DumpRegion::print(size_t total_bytes) const {
287 char* base = used() > 0 ? ArchiveBuilder::current()->to_requested(_base) : nullptr;
288 log_debug(cds)("%s space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used] at " INTPTR_FORMAT,
289 _name, used(), percent_of(used(), total_bytes), reserved(), percent_of(used(), reserved()),
290 p2i(base));
291 }
292
293 void DumpRegion::print_out_of_space_msg(const char* failing_region, size_t needed_bytes) {
294 log_error(cds)("[%-8s] " PTR_FORMAT " - " PTR_FORMAT " capacity =%9d, allocated =%9d",
295 _name, p2i(_base), p2i(_top), int(_end - _base), int(_top - _base));
296 if (strcmp(_name, failing_region) == 0) {
297 log_error(cds)(" required = %d", int(needed_bytes));
298 }
299 }
300
301 void DumpRegion::init(ReservedSpace* rs, VirtualSpace* vs) {
302 _rs = rs;
303 _vs = vs;
304 // Start with 0 committed bytes. The memory will be committed as needed.
305 if (!_vs->initialize(*_rs, 0)) {
306 fatal("Unable to allocate memory for shared space");
307 }
308 _base = _top = _rs->base();
309 _end = _rs->end();
310 }
311
312 void DumpRegion::pack(DumpRegion* next) {
313 if (!is_packed()) {
314 _end = (char*)align_up(_top, MetaspaceShared::core_region_alignment());
315 _is_packed = true;
316 }
317 if (next != nullptr) {
318 next->_rs = _rs;
319 next->_vs = _vs;
320 next->_base = next->_top = this->_end;
321 next->_end = _rs->end();
322 }
323 }
324
325 void WriteClosure::do_ptr(void** p) {
326 // Write ptr into the archive; ptr can be:
327 // (a) null -> written as 0
328 // (b) a "buffered" address -> written as is
329 // (c) a "source" address -> convert to "buffered" and write
330 // The common case is (c). E.g., when writing the vmClasses into the archive.
331 // We have (b) only when we don't have a corresponding source object. E.g.,
332 // the archived c++ vtable entries.
333 address ptr = *(address*)p;
334 if (ptr != nullptr && !ArchiveBuilder::current()->is_in_buffer_space(ptr)) {
335 ptr = ArchiveBuilder::current()->get_buffered_addr(ptr);
336 }
377 if (SystemDictionaryShared::is_supported_invokedynamic(bootstrap_specifier)) {
378 const constantPoolHandle& pool = bootstrap_specifier->pool();
379 if (SystemDictionaryShared::is_builtin_loader(pool->pool_holder()->class_loader_data())) {
380 // Currently lambda proxy classes are supported only for the built-in loaders.
381 ResourceMark rm(THREAD);
382 int pool_index = bootstrap_specifier->bss_index();
383 ClassListWriter w;
384 w.stream()->print("%s %s", ClassListParser::lambda_proxy_tag(), pool->pool_holder()->name()->as_C_string());
385 CDSIndyInfo cii;
386 ClassListParser::populate_cds_indy_info(pool, pool_index, &cii, CHECK);
387 GrowableArray<const char*>* indy_items = cii.items();
388 for (int i = 0; i < indy_items->length(); i++) {
389 w.stream()->print(" %s", indy_items->at(i));
390 }
391 w.stream()->cr();
392 }
393 }
394 }
395 }
396
397 // Used in logging: "boot", "boot2", "plat", "app" and "unreg";
398 const char* ArchiveUtils::class_category(Klass* k) {
399 if (ArchiveBuilder::is_active() && ArchiveBuilder::current()->is_in_buffer_space(k)) {
400 k = ArchiveBuilder::current()->get_source_addr(k);
401 }
402
403 if (k->is_array_klass()) {
404 return "array";
405 } else {
406 oop loader = k->class_loader();
407 if (loader == nullptr) {
408 if (k->module() != nullptr &&
409 k->module()->name() != nullptr &&
410 k->module()->name()->equals("java.base")) {
411 return "boot"; // boot classes in java.base
412 } else {
413 return "boot2"; // boot classes outside of java.base
414 }
415 } else {
416 if (loader == SystemDictionary::java_platform_loader()) {
417 return "plat";
418 } else if (loader == SystemDictionary::java_system_loader()) {
419 return "app";
420 } else {
421 return "unreg";
422 }
423 }
424 }
425 }
426
427 // "boot", "platform", "app" or nullptr
428 const char* ArchiveUtils::builtin_loader_name_or_null(oop loader) {
429 if (loader == nullptr) {
430 return "boot";
431 } else if (loader == SystemDictionary::java_platform_loader()) {
432 return "platform";
433 } else if (loader == SystemDictionary::java_system_loader()) {
434 return "app";
435 } else {
436 return nullptr;
437 }
438 }
439
440 // "boot", "platform", "app". Asserts if not a built-in-loader
441 const char* ArchiveUtils::builtin_loader_name(oop loader) {
442 const char* name = builtin_loader_name_or_null(loader);
443 assert(name != nullptr, "must be a built-in loader");
444 return name;
445 }
446
447 bool ArchiveUtils::builtin_loader_from_type(const char* loader_type, oop* value_ret) {
448 if (strcmp(loader_type, "boot") == 0) {
449 *value_ret = nullptr;
450 return true;
451 } else if (strcmp(loader_type, "platform") == 0) {
452 *value_ret = SystemDictionary::java_platform_loader();
453 return true;
454 } else if (strcmp(loader_type, "app") == 0) {
455 *value_ret = SystemDictionary::java_system_loader();
456 return true;
457 } else {
458 DEBUG_ONLY(*value_ret = cast_to_oop((void*)badOopVal));
459 return false;
460 }
461 }
462
463 oop ArchiveUtils::builtin_loader_from_type(int loader_type) {
464 if (loader_type == ClassLoader::BOOT_LOADER) {
465 return nullptr;
466 } else if (loader_type == ClassLoader::PLATFORM_LOADER) {
467 return SystemDictionary::java_platform_loader();
468 } else if (loader_type == ClassLoader::APP_LOADER) {
469 return SystemDictionary::java_system_loader();
470 } else {
471 ShouldNotReachHere();
472 return nullptr;
473 }
474 }
475
476 size_t HeapRootSegments::size_in_bytes(size_t seg_idx) {
477 assert(seg_idx < _count, "In range");
478 return objArrayOopDesc::object_size(size_in_elems(seg_idx)) * HeapWordSize;
479 }
480
481 int HeapRootSegments::size_in_elems(size_t seg_idx) {
482 assert(seg_idx < _count, "In range");
483 if (seg_idx != _count - 1) {
484 return _max_size_in_elems;
485 } else {
486 // Last slice, leftover
487 return _roots_count % _max_size_in_elems;
488 }
489 }
490
491 size_t HeapRootSegments::segment_offset(size_t seg_idx) {
492 assert(seg_idx < _count, "In range");
493 return _base_offset + seg_idx * _max_size_in_bytes;
494 }
|