Mercurial > hg > graal-compiler
comparison src/os/linux/vm/os_linux.cpp @ 7482:989155e2d07a
Merge with hs25-b15.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 16 Jan 2013 01:34:24 +0100 |
parents | 291ffc492eb6 7d42f3b08300 |
children | 3ac7d10a6572 |
comparison
equal
deleted
inserted
replaced
7381:6761a8f854a4 | 7482:989155e2d07a |
---|---|
319 // char arch[12]; | 319 // char arch[12]; |
320 // sysinfo(SI_ARCHITECTURE, arch, sizeof(arch)); | 320 // sysinfo(SI_ARCHITECTURE, arch, sizeof(arch)); |
321 | 321 |
322 // The next steps are taken in the product version: | 322 // The next steps are taken in the product version: |
323 // | 323 // |
324 // Obtain the JAVA_HOME value from the location of libjvm[_g].so. | 324 // Obtain the JAVA_HOME value from the location of libjvm.so. |
325 // This library should be located at: | 325 // This library should be located at: |
326 // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm[_g].so. | 326 // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm.so. |
327 // | 327 // |
328 // If "/jre/lib/" appears at the right place in the path, then we | 328 // If "/jre/lib/" appears at the right place in the path, then we |
329 // assume libjvm[_g].so is installed in a JDK and we use this path. | 329 // assume libjvm.so is installed in a JDK and we use this path. |
330 // | 330 // |
331 // Otherwise exit with message: "Could not create the Java virtual machine." | 331 // Otherwise exit with message: "Could not create the Java virtual machine." |
332 // | 332 // |
333 // The following extra steps are taken in the debugging version: | 333 // The following extra steps are taken in the debugging version: |
334 // | 334 // |
335 // If "/jre/lib/" does NOT appear at the right place in the path | 335 // If "/jre/lib/" does NOT appear at the right place in the path |
336 // instead of exit check for $JAVA_HOME environment variable. | 336 // instead of exit check for $JAVA_HOME environment variable. |
337 // | 337 // |
338 // If it is defined and we are able to locate $JAVA_HOME/jre/lib/<arch>, | 338 // If it is defined and we are able to locate $JAVA_HOME/jre/lib/<arch>, |
339 // then we append a fake suffix "hotspot/libjvm[_g].so" to this path so | 339 // then we append a fake suffix "hotspot/libjvm.so" to this path so |
340 // it looks like libjvm[_g].so is installed there | 340 // it looks like libjvm.so is installed there |
341 // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm[_g].so. | 341 // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm.so. |
342 // | 342 // |
343 // Otherwise exit. | 343 // Otherwise exit. |
344 // | 344 // |
345 // Important note: if the location of libjvm.so changes this | 345 // Important note: if the location of libjvm.so changes this |
346 // code needs to be changed accordingly. | 346 // code needs to be changed accordingly. |
1677 | 1677 |
1678 const char* os::get_current_directory(char *buf, int buflen) { | 1678 const char* os::get_current_directory(char *buf, int buflen) { |
1679 return getcwd(buf, buflen); | 1679 return getcwd(buf, buflen); |
1680 } | 1680 } |
1681 | 1681 |
1682 // check if addr is inside libjvm[_g].so | 1682 // check if addr is inside libjvm.so |
1683 bool os::address_is_in_vm(address addr) { | 1683 bool os::address_is_in_vm(address addr) { |
1684 static address libjvm_base_addr; | 1684 static address libjvm_base_addr; |
1685 Dl_info dlinfo; | 1685 Dl_info dlinfo; |
1686 | 1686 |
1687 if (libjvm_base_addr == NULL) { | 1687 if (libjvm_base_addr == NULL) { |
2178 print_signal_handler(st, BREAK_SIGNAL, buf, buflen); | 2178 print_signal_handler(st, BREAK_SIGNAL, buf, buflen); |
2179 } | 2179 } |
2180 | 2180 |
2181 static char saved_jvm_path[MAXPATHLEN] = {0}; | 2181 static char saved_jvm_path[MAXPATHLEN] = {0}; |
2182 | 2182 |
2183 // Find the full path to the current module, libjvm.so or libjvm_g.so | 2183 // Find the full path to the current module, libjvm.so |
2184 void os::jvm_path(char *buf, jint buflen) { | 2184 void os::jvm_path(char *buf, jint buflen) { |
2185 // Error checking. | 2185 // Error checking. |
2186 if (buflen < MAXPATHLEN) { | 2186 if (buflen < MAXPATHLEN) { |
2187 assert(false, "must use a large-enough buffer"); | 2187 assert(false, "must use a large-enough buffer"); |
2188 buf[0] = '\0'; | 2188 buf[0] = '\0'; |
2221 char* java_home_var = ::getenv("JAVA_HOME"); | 2221 char* java_home_var = ::getenv("JAVA_HOME"); |
2222 if (java_home_var != NULL && java_home_var[0] != 0) { | 2222 if (java_home_var != NULL && java_home_var[0] != 0) { |
2223 char* jrelib_p; | 2223 char* jrelib_p; |
2224 int len; | 2224 int len; |
2225 | 2225 |
2226 // Check the current module name "libjvm.so" or "libjvm_g.so". | 2226 // Check the current module name "libjvm.so". |
2227 p = strrchr(buf, '/'); | 2227 p = strrchr(buf, '/'); |
2228 assert(strstr(p, "/libjvm") == p, "invalid library name"); | 2228 assert(strstr(p, "/libjvm") == p, "invalid library name"); |
2229 p = strstr(p, "_g") ? "_g" : ""; | |
2230 | 2229 |
2231 rp = realpath(java_home_var, buf); | 2230 rp = realpath(java_home_var, buf); |
2232 if (rp == NULL) | 2231 if (rp == NULL) |
2233 return; | 2232 return; |
2234 | 2233 |
2240 if (0 != access(buf, F_OK)) { | 2239 if (0 != access(buf, F_OK)) { |
2241 snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch); | 2240 snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch); |
2242 } | 2241 } |
2243 | 2242 |
2244 if (0 == access(buf, F_OK)) { | 2243 if (0 == access(buf, F_OK)) { |
2245 // Use current module name "libjvm[_g].so" instead of | 2244 // Use current module name "libjvm.so" |
2246 // "libjvm"debug_only("_g")".so" since for fastdebug version | |
2247 // we should have "libjvm.so" but debug_only("_g") adds "_g"! | |
2248 len = strlen(buf); | 2245 len = strlen(buf); |
2249 snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p); | 2246 snprintf(buf + len, buflen-len, "/hotspot/libjvm.so"); |
2250 } else { | 2247 } else { |
2251 // Go back to path of .so | 2248 // Go back to path of .so |
2252 rp = realpath(dli_fname, buf); | 2249 rp = realpath(dli_fname, buf); |
2253 if (rp == NULL) | 2250 if (rp == NULL) |
2254 return; | 2251 return; |