< prev index next >

src/os/windows/vm/os_windows.cpp

Print this page




 136     if (ForceTimeHighResolution) {
 137       timeEndPeriod(1L);
 138     }
 139     break;
 140   default:
 141     break;
 142   }
 143   return true;
 144 }
 145 
 146 static inline double fileTimeAsDouble(FILETIME* time) {
 147   const double high  = (double) ((unsigned int) ~0);
 148   const double split = 10000000.0;
 149   double result = (time->dwLowDateTime / split) +
 150                    time->dwHighDateTime * (high/split);
 151   return result;
 152 }
 153 
 154 // Implementation of os
 155 
 156 bool os::getenv(const char* name, char* buffer, int len) {
 157   int result = GetEnvironmentVariable(name, buffer, len);
 158   return result > 0 && result < len;
 159 }
 160 
 161 bool os::unsetenv(const char* name) {
 162   assert(name != NULL, "Null pointer");
 163   return (SetEnvironmentVariable(name, NULL) == TRUE);
 164 }
 165 
 166 // No setuid programs under Windows.
 167 bool os::have_special_privileges() {
 168   return false;
 169 }
 170 
 171 
 172 // This method is  a periodic task to check for misbehaving JNI applications
 173 // under CheckJNI, we can add any periodic checks here.
 174 // For Windows at the moment does nothing
 175 void os::run_periodic_checks() {
 176   return;
 177 }
 178 
 179 // previous UnhandledExceptionFilter, if there is one
 180 static LPTOP_LEVEL_EXCEPTION_FILTER prev_uef_handler = NULL;
 181 
 182 LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo);
 183 
 184 void os::init_system_properties_values() {
 185   // sysclasspath, java_home, dll_dir
 186   {
 187     char *home_path;
 188     char *dll_path;
 189     char *pslash;
 190     char *bin = "\\bin";
 191     char home_dir[MAX_PATH];

 192 
 193     if (!getenv("_ALT_JAVA_HOME_DIR", home_dir, MAX_PATH)) {



 194       os::jvm_path(home_dir, sizeof(home_dir));
 195       // Found the full path to jvm.dll.
 196       // Now cut the path to <java_home>/jre if we can.
 197       *(strrchr(home_dir, '\\')) = '\0';  // get rid of \jvm.dll
 198       pslash = strrchr(home_dir, '\\');
 199       if (pslash != NULL) {
 200         *pslash = '\0';                   // get rid of \{client|server}
 201         pslash = strrchr(home_dir, '\\');
 202         if (pslash != NULL) {
 203           *pslash = '\0';                 // get rid of \bin
 204         }
 205       }
 206     }
 207 
 208     home_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + 1, mtInternal);
 209     if (home_path == NULL) {
 210       return;
 211     }
 212     strcpy(home_path, home_dir);
 213     Arguments::set_java_home(home_path);


5913     if (actual_location == NULL) {
5914       if (VerboseInternalVMTests) {
5915         gclog_or_tty->print("Failed to allocate any memory at "PTR_FORMAT" size "SIZE_FORMAT". Skipping remainder of test.",
5916                             expected_location, large_allocation_size);
5917       }
5918     } else {
5919       // release memory
5920       os::release_memory_special(actual_location, expected_allocation_size);
5921       // only now check, after releasing any memory to avoid any leaks.
5922       assert(actual_location == expected_location,
5923              err_msg("Failed to allocate memory at requested location "PTR_FORMAT" of size "SIZE_FORMAT", is "PTR_FORMAT" instead",
5924              expected_location, expected_allocation_size, actual_location));
5925     }
5926   }
5927 
5928   // restore globals
5929   UseLargePagesIndividualAllocation = old_use_large_pages_individual_allocation;
5930   UseNUMAInterleaving = old_use_numa_interleaving;
5931 }
5932 #endif // PRODUCT
5933 


 136     if (ForceTimeHighResolution) {
 137       timeEndPeriod(1L);
 138     }
 139     break;
 140   default:
 141     break;
 142   }
 143   return true;
 144 }
 145 
 146 static inline double fileTimeAsDouble(FILETIME* time) {
 147   const double high  = (double) ((unsigned int) ~0);
 148   const double split = 10000000.0;
 149   double result = (time->dwLowDateTime / split) +
 150                    time->dwHighDateTime * (high/split);
 151   return result;
 152 }
 153 
 154 // Implementation of os
 155 





 156 bool os::unsetenv(const char* name) {
 157   assert(name != NULL, "Null pointer");
 158   return (SetEnvironmentVariable(name, NULL) == TRUE);
 159 }
 160 
 161 // No setuid programs under Windows.
 162 bool os::have_special_privileges() {
 163   return false;
 164 }
 165 
 166 
 167 // This method is  a periodic task to check for misbehaving JNI applications
 168 // under CheckJNI, we can add any periodic checks here.
 169 // For Windows at the moment does nothing
 170 void os::run_periodic_checks() {
 171   return;
 172 }
 173 
 174 // previous UnhandledExceptionFilter, if there is one
 175 static LPTOP_LEVEL_EXCEPTION_FILTER prev_uef_handler = NULL;
 176 
 177 LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo);
 178 
 179 void os::init_system_properties_values() {
 180   // sysclasspath, java_home, dll_dir
 181   {
 182     char *home_path;
 183     char *dll_path;
 184     char *pslash;
 185     char *bin = "\\bin";
 186     char home_dir[MAX_PATH + 1];
 187     char *alt_home_dir = ::getenv("_ALT_JAVA_HOME_DIR");
 188 
 189     if (alt_home_dir != NULL)  {
 190       strncpy(home_dir, alt_home_dir, MAX_PATH + 1);
 191       home_dir[MAX_PATH] = '\0';
 192     } else {
 193       os::jvm_path(home_dir, sizeof(home_dir));
 194       // Found the full path to jvm.dll.
 195       // Now cut the path to <java_home>/jre if we can.
 196       *(strrchr(home_dir, '\\')) = '\0';  // get rid of \jvm.dll
 197       pslash = strrchr(home_dir, '\\');
 198       if (pslash != NULL) {
 199         *pslash = '\0';                   // get rid of \{client|server}
 200         pslash = strrchr(home_dir, '\\');
 201         if (pslash != NULL) {
 202           *pslash = '\0';                 // get rid of \bin
 203         }
 204       }
 205     }
 206 
 207     home_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + 1, mtInternal);
 208     if (home_path == NULL) {
 209       return;
 210     }
 211     strcpy(home_path, home_dir);
 212     Arguments::set_java_home(home_path);


5912     if (actual_location == NULL) {
5913       if (VerboseInternalVMTests) {
5914         gclog_or_tty->print("Failed to allocate any memory at "PTR_FORMAT" size "SIZE_FORMAT". Skipping remainder of test.",
5915                             expected_location, large_allocation_size);
5916       }
5917     } else {
5918       // release memory
5919       os::release_memory_special(actual_location, expected_allocation_size);
5920       // only now check, after releasing any memory to avoid any leaks.
5921       assert(actual_location == expected_location,
5922              err_msg("Failed to allocate memory at requested location "PTR_FORMAT" of size "SIZE_FORMAT", is "PTR_FORMAT" instead",
5923              expected_location, expected_allocation_size, actual_location));
5924     }
5925   }
5926 
5927   // restore globals
5928   UseLargePagesIndividualAllocation = old_use_large_pages_individual_allocation;
5929   UseNUMAInterleaving = old_use_numa_interleaving;
5930 }
5931 #endif // PRODUCT

< prev index next >