661 // Return true if given address is in the mapped shared space. |
661 // Return true if given address is in the mapped shared space. |
662 bool MetaspaceShared::is_in_shared_space(const void* p) { |
662 bool MetaspaceShared::is_in_shared_space(const void* p) { |
663 if (_ro_base == NULL || _rw_base == NULL) { |
663 if (_ro_base == NULL || _rw_base == NULL) { |
664 return false; |
664 return false; |
665 } else { |
665 } else { |
666 return ((p > _ro_base && p < (_ro_base + SharedReadOnlySize)) || |
666 return ((p >= _ro_base && p < (_ro_base + SharedReadOnlySize)) || |
667 (p > _rw_base && p < (_rw_base + SharedReadWriteSize))); |
667 (p >= _rw_base && p < (_rw_base + SharedReadWriteSize))); |
668 } |
668 } |
669 } |
669 } |
670 |
670 |
671 void MetaspaceShared::print_shared_spaces() { |
671 void MetaspaceShared::print_shared_spaces() { |
672 gclog_or_tty->print_cr("Shared Spaces:"); |
672 gclog_or_tty->print_cr("Shared Spaces:"); |
690 size_t image_alignment = mapinfo->alignment(); |
690 size_t image_alignment = mapinfo->alignment(); |
691 |
691 |
692 // Map in the shared memory and then map the regions on top of it |
692 // Map in the shared memory and then map the regions on top of it |
693 ReservedSpace shared_rs = mapinfo->reserve_shared_memory(); |
693 ReservedSpace shared_rs = mapinfo->reserve_shared_memory(); |
694 if (!shared_rs.is_reserved()) return false; |
694 if (!shared_rs.is_reserved()) return false; |
695 |
|
696 // Split reserved memory into pieces (windows needs this) |
|
697 ReservedSpace ro_rs = shared_rs.first_part(SharedReadOnlySize); |
|
698 ReservedSpace tmp_rs1 = shared_rs.last_part(SharedReadOnlySize); |
|
699 ReservedSpace rw_rs = tmp_rs1.first_part(SharedReadWriteSize); |
|
700 ReservedSpace tmp_rs2 = tmp_rs1.last_part(SharedReadWriteSize); |
|
701 ReservedSpace md_rs = tmp_rs2.first_part(SharedMiscDataSize); |
|
702 ReservedSpace mc_rs = tmp_rs2.last_part(SharedMiscDataSize); |
|
703 |
695 |
704 // Map each shared region |
696 // Map each shared region |
705 if ((_ro_base = mapinfo->map_region(ro)) != NULL && |
697 if ((_ro_base = mapinfo->map_region(ro)) != NULL && |
706 (_rw_base = mapinfo->map_region(rw)) != NULL && |
698 (_rw_base = mapinfo->map_region(rw)) != NULL && |
707 (_md_base = mapinfo->map_region(md)) != NULL && |
699 (_md_base = mapinfo->map_region(md)) != NULL && |