hotspot/src/os/windows/vm/os_windows.cpp
changeset 32748 6cb8b6ab9081
parent 31963 641ed52732ec
child 33160 c59f1676d27e
child 33105 294e48b4f704
equal deleted inserted replaced
32747:51960ef64fa4 32748:6cb8b6ab9081
  4875 
  4875 
  4876 // Unmap a block of memory.
  4876 // Unmap a block of memory.
  4877 // Returns true=success, otherwise false.
  4877 // Returns true=success, otherwise false.
  4878 
  4878 
  4879 bool os::pd_unmap_memory(char* addr, size_t bytes) {
  4879 bool os::pd_unmap_memory(char* addr, size_t bytes) {
       
  4880   MEMORY_BASIC_INFORMATION mem_info;
       
  4881   if (VirtualQuery(addr, &mem_info, sizeof(mem_info)) == 0) {
       
  4882     if (PrintMiscellaneous && Verbose) {
       
  4883       DWORD err = GetLastError();
       
  4884       tty->print_cr("VirtualQuery() failed: GetLastError->%ld.", err);
       
  4885     }
       
  4886     return false;
       
  4887   }
       
  4888 
       
  4889   // Executable memory was not mapped using CreateFileMapping/MapViewOfFileEx.
       
  4890   // Instead, executable region was allocated using VirtualAlloc(). See
       
  4891   // pd_map_memory() above.
       
  4892   //
       
  4893   // The following flags should match the 'exec_access' flages used for
       
  4894   // VirtualProtect() in pd_map_memory().
       
  4895   if (mem_info.Protect == PAGE_EXECUTE_READ ||
       
  4896       mem_info.Protect == PAGE_EXECUTE_READWRITE) {
       
  4897     return pd_release_memory(addr, bytes);
       
  4898   }
       
  4899 
  4880   BOOL result = UnmapViewOfFile(addr);
  4900   BOOL result = UnmapViewOfFile(addr);
  4881   if (result == 0) {
  4901   if (result == 0) {
  4882     if (PrintMiscellaneous && Verbose) {
  4902     if (PrintMiscellaneous && Verbose) {
  4883       DWORD err = GetLastError();
  4903       DWORD err = GetLastError();
  4884       tty->print_cr("UnmapViewOfFile() failed: GetLastError->%ld.", err);
  4904       tty->print_cr("UnmapViewOfFile() failed: GetLastError->%ld.", err);