5780 // do an allocation at an address selected by the OS to get a good one. |
5780 // do an allocation at an address selected by the OS to get a good one. |
5781 const size_t large_allocation_size = os::large_page_size() * 4; |
5781 const size_t large_allocation_size = os::large_page_size() * 4; |
5782 char* result = os::reserve_memory_special(large_allocation_size, os::large_page_size(), NULL, false); |
5782 char* result = os::reserve_memory_special(large_allocation_size, os::large_page_size(), NULL, false); |
5783 if (result == NULL) { |
5783 if (result == NULL) { |
5784 if (VerboseInternalVMTests) { |
5784 if (VerboseInternalVMTests) { |
5785 gclog_or_tty->print("Failed to allocate control block with size "SIZE_FORMAT". Skipping remainder of test.", |
5785 gclog_or_tty->print("Failed to allocate control block with size " SIZE_FORMAT ". Skipping remainder of test.", |
5786 large_allocation_size); |
5786 large_allocation_size); |
5787 } |
5787 } |
5788 } else { |
5788 } else { |
5789 os::release_memory_special(result, large_allocation_size); |
5789 os::release_memory_special(result, large_allocation_size); |
5790 |
5790 |
5793 const size_t expected_allocation_size = os::large_page_size(); |
5793 const size_t expected_allocation_size = os::large_page_size(); |
5794 char* expected_location = result + os::large_page_size(); |
5794 char* expected_location = result + os::large_page_size(); |
5795 char* actual_location = os::reserve_memory_special(expected_allocation_size, os::large_page_size(), expected_location, false); |
5795 char* actual_location = os::reserve_memory_special(expected_allocation_size, os::large_page_size(), expected_location, false); |
5796 if (actual_location == NULL) { |
5796 if (actual_location == NULL) { |
5797 if (VerboseInternalVMTests) { |
5797 if (VerboseInternalVMTests) { |
5798 gclog_or_tty->print("Failed to allocate any memory at "PTR_FORMAT" size "SIZE_FORMAT". Skipping remainder of test.", |
5798 gclog_or_tty->print("Failed to allocate any memory at " PTR_FORMAT " size " SIZE_FORMAT ". Skipping remainder of test.", |
5799 expected_location, large_allocation_size); |
5799 expected_location, large_allocation_size); |
5800 } |
5800 } |
5801 } else { |
5801 } else { |
5802 // release memory |
5802 // release memory |
5803 os::release_memory_special(actual_location, expected_allocation_size); |
5803 os::release_memory_special(actual_location, expected_allocation_size); |
5804 // only now check, after releasing any memory to avoid any leaks. |
5804 // only now check, after releasing any memory to avoid any leaks. |
5805 assert(actual_location == expected_location, |
5805 assert(actual_location == expected_location, |
5806 err_msg("Failed to allocate memory at requested location "PTR_FORMAT" of size "SIZE_FORMAT", is "PTR_FORMAT" instead", |
5806 err_msg("Failed to allocate memory at requested location " PTR_FORMAT " of size " SIZE_FORMAT ", is " PTR_FORMAT " instead", |
5807 expected_location, expected_allocation_size, actual_location)); |
5807 expected_location, expected_allocation_size, actual_location)); |
5808 } |
5808 } |
5809 } |
5809 } |
5810 |
5810 |
5811 // restore globals |
5811 // restore globals |