src/os/windows/vm/os_windows.cpp

Print this page
rev 2110 : [mq]: is-debugger-present


1771   // do nothing
1772 }
1773 
1774 static char saved_jvm_path[MAX_PATH] = {0};
1775 
1776 // Find the full path to the current module, jvm.dll or jvm_g.dll
1777 void os::jvm_path(char *buf, jint buflen) {
1778   // Error checking.
1779   if (buflen < MAX_PATH) {
1780     assert(false, "must use a large-enough buffer");
1781     buf[0] = '\0';
1782     return;
1783   }
1784   // Lazy resolve the path to current module.
1785   if (saved_jvm_path[0] != 0) {
1786     strcpy(buf, saved_jvm_path);
1787     return;
1788   }
1789 
1790   buf[0] = '\0';
1791   if (strcmp(Arguments::sun_java_launcher(), "gamma") == 0) {
1792      // Support for the gamma launcher. Check for an
1793      // JAVA_HOME environment variable
1794      // and fix up the path so it looks like
1795      // libjvm.so is installed there (append a fake suffix
1796      // hotspot/libjvm.so).
1797      char* java_home_var = ::getenv("JAVA_HOME");
1798      if (java_home_var != NULL && java_home_var[0] != 0) {
1799 
1800         strncpy(buf, java_home_var, buflen);
1801 
1802         // determine if this is a legacy image or modules image
1803         // modules image doesn't have "jre" subdirectory
1804         size_t len = strlen(buf);
1805         char* jrebin_p = buf + len;
1806         jio_snprintf(jrebin_p, buflen-len, "\\jre\\bin\\");
1807         if (0 != _access(buf, 0)) {
1808           jio_snprintf(jrebin_p, buflen-len, "\\bin\\");
1809         }
1810         len = strlen(buf);
1811         jio_snprintf(buf + len, buflen-len, "hotspot\\jvm.dll");


3398   assert((_default_stack_size & (_vm_page_size - 1)) == 0,
3399     "stack size not a multiple of page size");
3400 
3401   initialize_performance_counter();
3402 
3403   // Win95/Win98 scheduler bug work-around. The Win95/98 scheduler is
3404   // known to deadlock the system, if the VM issues to thread operations with
3405   // a too high frequency, e.g., such as changing the priorities.
3406   // The 6000 seems to work well - no deadlocks has been notices on the test
3407   // programs that we have seen experience this problem.
3408   if (!os::win32::is_nt()) {
3409     StarvationMonitorInterval = 6000;
3410   }
3411 }
3412 
3413 
3414 void os::win32::setmode_streams() {
3415   _setmode(_fileno(stdin), _O_BINARY);
3416   _setmode(_fileno(stdout), _O_BINARY);
3417   _setmode(_fileno(stderr), _O_BINARY);





3418 }
3419 
3420 
3421 int os::message_box(const char* title, const char* message) {
3422   int result = MessageBox(NULL, message, title,
3423                           MB_YESNO | MB_ICONERROR | MB_SYSTEMMODAL | MB_DEFAULT_DESKTOP_ONLY);
3424   return result == IDYES;
3425 }
3426 
3427 int os::allocate_thread_local_storage() {
3428   return TlsAlloc();
3429 }
3430 
3431 
3432 void os::free_thread_local_storage(int index) {
3433   TlsFree(index);
3434 }
3435 
3436 
3437 void os::thread_local_storage_at_put(int index, void* value) {




1771   // do nothing
1772 }
1773 
1774 static char saved_jvm_path[MAX_PATH] = {0};
1775 
1776 // Find the full path to the current module, jvm.dll or jvm_g.dll
1777 void os::jvm_path(char *buf, jint buflen) {
1778   // Error checking.
1779   if (buflen < MAX_PATH) {
1780     assert(false, "must use a large-enough buffer");
1781     buf[0] = '\0';
1782     return;
1783   }
1784   // Lazy resolve the path to current module.
1785   if (saved_jvm_path[0] != 0) {
1786     strcpy(buf, saved_jvm_path);
1787     return;
1788   }
1789 
1790   buf[0] = '\0';
1791   if (Arguments::created_by_gamma_launcher()) {
1792      // Support for the gamma launcher. Check for an
1793      // JAVA_HOME environment variable
1794      // and fix up the path so it looks like
1795      // libjvm.so is installed there (append a fake suffix
1796      // hotspot/libjvm.so).
1797      char* java_home_var = ::getenv("JAVA_HOME");
1798      if (java_home_var != NULL && java_home_var[0] != 0) {
1799 
1800         strncpy(buf, java_home_var, buflen);
1801 
1802         // determine if this is a legacy image or modules image
1803         // modules image doesn't have "jre" subdirectory
1804         size_t len = strlen(buf);
1805         char* jrebin_p = buf + len;
1806         jio_snprintf(jrebin_p, buflen-len, "\\jre\\bin\\");
1807         if (0 != _access(buf, 0)) {
1808           jio_snprintf(jrebin_p, buflen-len, "\\bin\\");
1809         }
1810         len = strlen(buf);
1811         jio_snprintf(buf + len, buflen-len, "hotspot\\jvm.dll");


3398   assert((_default_stack_size & (_vm_page_size - 1)) == 0,
3399     "stack size not a multiple of page size");
3400 
3401   initialize_performance_counter();
3402 
3403   // Win95/Win98 scheduler bug work-around. The Win95/98 scheduler is
3404   // known to deadlock the system, if the VM issues to thread operations with
3405   // a too high frequency, e.g., such as changing the priorities.
3406   // The 6000 seems to work well - no deadlocks has been notices on the test
3407   // programs that we have seen experience this problem.
3408   if (!os::win32::is_nt()) {
3409     StarvationMonitorInterval = 6000;
3410   }
3411 }
3412 
3413 
3414 void os::win32::setmode_streams() {
3415   _setmode(_fileno(stdin), _O_BINARY);
3416   _setmode(_fileno(stdout), _O_BINARY);
3417   _setmode(_fileno(stderr), _O_BINARY);
3418 }
3419 
3420 
3421 bool os::is_debugger_attached() {
3422   return IsDebuggerPresent() ? true : false;
3423 }
3424 
3425 
3426 int os::message_box(const char* title, const char* message) {
3427   int result = MessageBox(NULL, message, title,
3428                           MB_YESNO | MB_ICONERROR | MB_SYSTEMMODAL | MB_DEFAULT_DESKTOP_ONLY);
3429   return result == IDYES;
3430 }
3431 
3432 int os::allocate_thread_local_storage() {
3433   return TlsAlloc();
3434 }
3435 
3436 
3437 void os::free_thread_local_storage(int index) {
3438   TlsFree(index);
3439 }
3440 
3441 
3442 void os::thread_local_storage_at_put(int index, void* value) {