comparison src/share/vm/memory/filemap.cpp @ 12056:740e263c80c6

8003424: Enable Class Data Sharing for CompressedOops 8016729: ObjectAlignmentInBytes=16 now forces the use of heap based compressed oops 8005933: The -Xshare:auto option is ignored for -server Summary: Move klass metaspace above the heap and support CDS with compressed klass ptrs. Reviewed-by: coleenp, kvn, mgerdin, tschatzl, stefank
author hseigel
date Thu, 15 Aug 2013 20:04:10 -0400
parents 221df7e37535
children 35b99e7e0af2
comparison
equal deleted inserted replaced
12055:d96f52012aaa 12056:740e263c80c6
360 360
361 // Map the whole region at once, assumed to be allocated contiguously. 361 // Map the whole region at once, assumed to be allocated contiguously.
362 ReservedSpace FileMapInfo::reserve_shared_memory() { 362 ReservedSpace FileMapInfo::reserve_shared_memory() {
363 struct FileMapInfo::FileMapHeader::space_info* si = &_header._space[0]; 363 struct FileMapInfo::FileMapHeader::space_info* si = &_header._space[0];
364 char* requested_addr = si->_base; 364 char* requested_addr = si->_base;
365 size_t alignment = os::vm_allocation_granularity(); 365
366 366 size_t size = FileMapInfo::shared_spaces_size();
367 size_t size = align_size_up(SharedReadOnlySize + SharedReadWriteSize +
368 SharedMiscDataSize + SharedMiscCodeSize,
369 alignment);
370 367
371 // Reserve the space first, then map otherwise map will go right over some 368 // Reserve the space first, then map otherwise map will go right over some
372 // other reserved memory (like the code cache). 369 // other reserved memory (like the code cache).
373 ReservedSpace rs(size, alignment, false, requested_addr); 370 ReservedSpace rs(size, os::vm_allocation_granularity(), false, requested_addr);
374 if (!rs.is_reserved()) { 371 if (!rs.is_reserved()) {
375 fail_continue(err_msg("Unable to reserve shared space at required address " INTPTR_FORMAT, requested_addr)); 372 fail_continue(err_msg("Unable to reserve shared space at required address " INTPTR_FORMAT, requested_addr));
376 return rs; 373 return rs;
377 } 374 }
378 // the reserved virtual memory is for mapping class data sharing archive 375 // the reserved virtual memory is for mapping class data sharing archive
557 gclog_or_tty->print(" %s " INTPTR_FORMAT "-" INTPTR_FORMAT, 554 gclog_or_tty->print(" %s " INTPTR_FORMAT "-" INTPTR_FORMAT,
558 shared_region_name[i], 555 shared_region_name[i],
559 si->_base, si->_base + si->_used); 556 si->_base, si->_base + si->_used);
560 } 557 }
561 } 558 }
559
560 // Unmap mapped regions of shared space.
561 void FileMapInfo::stop_sharing_and_unmap(const char* msg) {
562 FileMapInfo *map_info = FileMapInfo::current_info();
563 if (map_info) {
564 map_info->fail_continue(msg);
565 for (int i = 0; i < MetaspaceShared::n_regions; i++) {
566 if (map_info->_header._space[i]._base != NULL) {
567 map_info->unmap_region(i);
568 map_info->_header._space[i]._base = NULL;
569 }
570 }
571 } else if (DumpSharedSpaces) {
572 fail_stop(msg, NULL);
573 }
574 }