< prev index next >

src/os/windows/vm/os_windows.cpp

Print this page
rev 13549 : 8185712: [windows] Improve native symbol decoder
Reviewed-by:
rev 13550 : [mq]: 8185712-windows-improve-native-symbol-resolver-2


1305   return (vm_lib_location[0] <= addr) && (addr < vm_lib_location[1]);
1306 }
1307 
1308 // print module info; param is outputStream*
1309 static int _print_module(const char* fname, address base_address,
1310                          address top_address, void* param) {
1311   if (!param) return -1;
1312 
1313   outputStream* st = (outputStream*)param;
1314 
1315   st->print(PTR_FORMAT " - " PTR_FORMAT " \t%s\n", base_address, top_address, fname);
1316   return 0;
1317 }
1318 
1319 // Loads .dll/.so and
1320 // in case of error it checks if .dll/.so was built for the
1321 // same architecture as Hotspot is running on
1322 void * os::dll_load(const char *name, char *ebuf, int ebuflen) {
1323   void * result = LoadLibrary(name);
1324   if (result != NULL) {
1325     if (InitializeDbgHelpEarly) {
1326       // Recalculate pdb search path if a DLL was loaded successfully.
1327       SymbolEngine::recalc_search_path();
1328     }
1329     return result;
1330   }
1331 
1332   DWORD errcode = GetLastError();
1333   if (errcode == ERROR_MOD_NOT_FOUND) {
1334     strncpy(ebuf, "Can't find dependent libraries", ebuflen - 1);
1335     ebuf[ebuflen - 1] = '\0';
1336     return NULL;
1337   }
1338 
1339   // Parsing dll below
1340   // If we can read dll-info and find that dll was built
1341   // for an architecture other than Hotspot is running in
1342   // - then print to buffer "DLL was built for a different architecture"
1343   // else call os::lasterror to obtain system error message
1344 
1345   // Read system error message into ebuf
1346   // It may or may not be overwritten below (in the for loop and just above)
1347   lasterror(ebuf, (size_t) ebuflen);
1348   ebuf[ebuflen - 1] = '\0';


4022   NOT_PRODUCT(if (PrintMiscellaneous && Verbose) nx_check_protection());
4023 #endif
4024 
4025   // initialize thread priority policy
4026   prio_init();
4027 
4028   if (UseNUMA && !ForceNUMA) {
4029     UseNUMA = false; // We don't fully support this yet
4030   }
4031 
4032   if (UseNUMAInterleaving) {
4033     // first check whether this Windows OS supports VirtualAllocExNuma, if not ignore this flag
4034     bool success = numa_interleaving_init();
4035     if (!success) UseNUMAInterleaving = false;
4036   }
4037 
4038   if (initSock() != JNI_OK) {
4039     return JNI_ERR;
4040   }
4041 
4042   if (InitializeDbgHelpEarly) {
4043     SymbolEngine::recalc_search_path();
4044   }
4045 
4046   return JNI_OK;
4047 }
4048 
4049 // Mark the polling page as unreadable
4050 void os::make_polling_page_unreadable(void) {
4051   DWORD old_status;
4052   if (!VirtualProtect((char *)_polling_page, os::vm_page_size(),
4053                       PAGE_NOACCESS, &old_status)) {
4054     fatal("Could not disable polling page");
4055   }
4056 }
4057 
4058 // Mark the polling page as readable
4059 void os::make_polling_page_readable(void) {
4060   DWORD old_status;
4061   if (!VirtualProtect((char *)_polling_page, os::vm_page_size(),
4062                       PAGE_READONLY, &old_status)) {
4063     fatal("Could not enable polling page");
4064   }




1305   return (vm_lib_location[0] <= addr) && (addr < vm_lib_location[1]);
1306 }
1307 
1308 // print module info; param is outputStream*
1309 static int _print_module(const char* fname, address base_address,
1310                          address top_address, void* param) {
1311   if (!param) return -1;
1312 
1313   outputStream* st = (outputStream*)param;
1314 
1315   st->print(PTR_FORMAT " - " PTR_FORMAT " \t%s\n", base_address, top_address, fname);
1316   return 0;
1317 }
1318 
1319 // Loads .dll/.so and
1320 // in case of error it checks if .dll/.so was built for the
1321 // same architecture as Hotspot is running on
1322 void * os::dll_load(const char *name, char *ebuf, int ebuflen) {
1323   void * result = LoadLibrary(name);
1324   if (result != NULL) {

1325     // Recalculate pdb search path if a DLL was loaded successfully.
1326     SymbolEngine::recalc_search_path();

1327     return result;
1328   }
1329 
1330   DWORD errcode = GetLastError();
1331   if (errcode == ERROR_MOD_NOT_FOUND) {
1332     strncpy(ebuf, "Can't find dependent libraries", ebuflen - 1);
1333     ebuf[ebuflen - 1] = '\0';
1334     return NULL;
1335   }
1336 
1337   // Parsing dll below
1338   // If we can read dll-info and find that dll was built
1339   // for an architecture other than Hotspot is running in
1340   // - then print to buffer "DLL was built for a different architecture"
1341   // else call os::lasterror to obtain system error message
1342 
1343   // Read system error message into ebuf
1344   // It may or may not be overwritten below (in the for loop and just above)
1345   lasterror(ebuf, (size_t) ebuflen);
1346   ebuf[ebuflen - 1] = '\0';


4020   NOT_PRODUCT(if (PrintMiscellaneous && Verbose) nx_check_protection());
4021 #endif
4022 
4023   // initialize thread priority policy
4024   prio_init();
4025 
4026   if (UseNUMA && !ForceNUMA) {
4027     UseNUMA = false; // We don't fully support this yet
4028   }
4029 
4030   if (UseNUMAInterleaving) {
4031     // first check whether this Windows OS supports VirtualAllocExNuma, if not ignore this flag
4032     bool success = numa_interleaving_init();
4033     if (!success) UseNUMAInterleaving = false;
4034   }
4035 
4036   if (initSock() != JNI_OK) {
4037     return JNI_ERR;
4038   }
4039 

4040   SymbolEngine::recalc_search_path();

4041 
4042   return JNI_OK;
4043 }
4044 
4045 // Mark the polling page as unreadable
4046 void os::make_polling_page_unreadable(void) {
4047   DWORD old_status;
4048   if (!VirtualProtect((char *)_polling_page, os::vm_page_size(),
4049                       PAGE_NOACCESS, &old_status)) {
4050     fatal("Could not disable polling page");
4051   }
4052 }
4053 
4054 // Mark the polling page as readable
4055 void os::make_polling_page_readable(void) {
4056   DWORD old_status;
4057   if (!VirtualProtect((char *)_polling_page, os::vm_page_size(),
4058                       PAGE_READONLY, &old_status)) {
4059     fatal("Could not enable polling page");
4060   }


< prev index next >