< prev index next >

src/share/vm/compiler/disassembler.cpp

Print this page
rev 10979 : 8140594: Various minor code improvements (compiler)


  96   {
  97     // Match "jvm[^/]*" in jvm_path.
  98     const char* base = buf;
  99     const char* p = strrchr(buf, *os::file_separator());
 100     if (p != NULL) lib_offset = p - base + 1;
 101     p = strstr(p ? p : base, "jvm");
 102     if (p != NULL)  jvm_offset = p - base;
 103   }
 104 #endif
 105   // Find the disassembler shared library.
 106   // Search for several paths derived from libjvm, in this order:
 107   // 1. <home>/jre/lib/<arch>/<vm>/libhsdis-<arch>.so  (for compatibility)
 108   // 2. <home>/jre/lib/<arch>/<vm>/hsdis-<arch>.so
 109   // 3. <home>/jre/lib/<arch>/hsdis-<arch>.so
 110   // 4. hsdis-<arch>.so  (using LD_LIBRARY_PATH)
 111   if (jvm_offset >= 0) {
 112     // 1. <home>/jre/lib/<arch>/<vm>/libhsdis-<arch>.so
 113     strcpy(&buf[jvm_offset], hsdis_library_name);
 114     strcat(&buf[jvm_offset], os::dll_file_extension());
 115     _library = os::dll_load(buf, ebuf, sizeof ebuf);
 116     if (_library == NULL) {
 117       // 2. <home>/jre/lib/<arch>/<vm>/hsdis-<arch>.so
 118       strcpy(&buf[lib_offset], hsdis_library_name);
 119       strcat(&buf[lib_offset], os::dll_file_extension());
 120       _library = os::dll_load(buf, ebuf, sizeof ebuf);
 121     }
 122     if (_library == NULL) {
 123       // 3. <home>/jre/lib/<arch>/hsdis-<arch>.so
 124       buf[lib_offset - 1] = '\0';
 125       const char* p = strrchr(buf, *os::file_separator());
 126       if (p != NULL) {
 127         lib_offset = p - buf + 1;
 128         strcpy(&buf[lib_offset], hsdis_library_name);
 129         strcat(&buf[lib_offset], os::dll_file_extension());
 130         _library = os::dll_load(buf, ebuf, sizeof ebuf);
 131       }
 132     }
 133   }
 134   if (_library == NULL) {
 135     // 4. hsdis-<arch>.so  (using LD_LIBRARY_PATH)
 136     strcpy(&buf[0], hsdis_library_name);
 137     strcat(&buf[0], os::dll_file_extension());
 138     _library = os::dll_load(buf, ebuf, sizeof ebuf);
 139   }
 140   if (_library != NULL) {
 141     _decode_instructions_virtual = CAST_TO_FN_PTR(Disassembler::decode_func_virtual,
 142                                           os::dll_lookup(_library, decode_instructions_virtual_name));




  96   {
  97     // Match "jvm[^/]*" in jvm_path.
  98     const char* base = buf;
  99     const char* p = strrchr(buf, *os::file_separator());
 100     if (p != NULL) lib_offset = p - base + 1;
 101     p = strstr(p ? p : base, "jvm");
 102     if (p != NULL) jvm_offset = p - base;
 103   }
 104 #endif
 105   // Find the disassembler shared library.
 106   // Search for several paths derived from libjvm, in this order:
 107   // 1. <home>/jre/lib/<arch>/<vm>/libhsdis-<arch>.so  (for compatibility)
 108   // 2. <home>/jre/lib/<arch>/<vm>/hsdis-<arch>.so
 109   // 3. <home>/jre/lib/<arch>/hsdis-<arch>.so
 110   // 4. hsdis-<arch>.so  (using LD_LIBRARY_PATH)
 111   if (jvm_offset >= 0) {
 112     // 1. <home>/jre/lib/<arch>/<vm>/libhsdis-<arch>.so
 113     strcpy(&buf[jvm_offset], hsdis_library_name);
 114     strcat(&buf[jvm_offset], os::dll_file_extension());
 115     _library = os::dll_load(buf, ebuf, sizeof ebuf);
 116     if (_library == NULL && lib_offset >= 0) {
 117       // 2. <home>/jre/lib/<arch>/<vm>/hsdis-<arch>.so
 118       strcpy(&buf[lib_offset], hsdis_library_name);
 119       strcat(&buf[lib_offset], os::dll_file_extension());
 120       _library = os::dll_load(buf, ebuf, sizeof ebuf);
 121     }
 122     if (_library == NULL && lib_offset > 0) {
 123       // 3. <home>/jre/lib/<arch>/hsdis-<arch>.so
 124       buf[lib_offset - 1] = '\0';
 125       const char* p = strrchr(buf, *os::file_separator());
 126       if (p != NULL) {
 127         lib_offset = p - buf + 1;
 128         strcpy(&buf[lib_offset], hsdis_library_name);
 129         strcat(&buf[lib_offset], os::dll_file_extension());
 130         _library = os::dll_load(buf, ebuf, sizeof ebuf);
 131       }
 132     }
 133   }
 134   if (_library == NULL) {
 135     // 4. hsdis-<arch>.so  (using LD_LIBRARY_PATH)
 136     strcpy(&buf[0], hsdis_library_name);
 137     strcat(&buf[0], os::dll_file_extension());
 138     _library = os::dll_load(buf, ebuf, sizeof ebuf);
 139   }
 140   if (_library != NULL) {
 141     _decode_instructions_virtual = CAST_TO_FN_PTR(Disassembler::decode_func_virtual,
 142                                           os::dll_lookup(_library, decode_instructions_virtual_name));


< prev index next >