hotspot/src/share/vm/oops/constantPoolOop.cpp
changeset 2860 cf13b84eb2f9
parent 2570 ecc7862946d4
child 4429 d7eb4e2099aa
equal deleted inserted replaced
2775:c33e7d38c921 2860:cf13b84eb2f9
  1179       }
  1179       }
  1180       case JVM_CONSTANT_String: {
  1180       case JVM_CONSTANT_String: {
  1181         unsigned int hash;
  1181         unsigned int hash;
  1182         char *str = string_at_noresolve(idx);
  1182         char *str = string_at_noresolve(idx);
  1183         symbolOop sym = SymbolTable::lookup_only(str, (int) strlen(str), hash);
  1183         symbolOop sym = SymbolTable::lookup_only(str, (int) strlen(str), hash);
  1184         idx1 = tbl->symbol_to_value(sym);
  1184         if (sym == NULL) {
       
  1185           // sym can be NULL if string refers to incorrectly encoded JVM_CONSTANT_Utf8
       
  1186           // this can happen with JVM TI; see CR 6839599 for more details
       
  1187           oop string = *(obj_at_addr(idx));
       
  1188           assert(java_lang_String::is_instance(string),"Not a String");
       
  1189           DBG(printf("Error #%03hd tag=%03hd\n", idx, tag));
       
  1190           idx1 = 0;
       
  1191           for (int j = 0; j < tbl->table_size() && idx1 == 0; j++) {
       
  1192             for (SymbolHashMapEntry* cur = tbl->bucket(j); cur != NULL; cur = cur->next()) {
       
  1193               int length;
       
  1194               sym = cur->symbol();
       
  1195               jchar* chars = sym->as_unicode(length);
       
  1196               if (java_lang_String::equals(string, chars, length)) {
       
  1197                 idx1 = cur->value();
       
  1198                 DBG(printf("Index found: %d\n",idx1));
       
  1199                 break;
       
  1200               }
       
  1201             }
       
  1202           }
       
  1203         } else {
       
  1204           idx1 = tbl->symbol_to_value(sym);
       
  1205         }
  1185         assert(idx1 != 0, "Have not found a hashtable entry");
  1206         assert(idx1 != 0, "Have not found a hashtable entry");
  1186         Bytes::put_Java_u2((address) (bytes+1), idx1);
  1207         Bytes::put_Java_u2((address) (bytes+1), idx1);
  1187         DBG(printf("JVM_CONSTANT_String: idx=#%03hd, %s", idx1, str));
  1208         DBG(printf("JVM_CONSTANT_String: idx=#%03hd, %s", idx1, str));
  1188         break;
  1209         break;
  1189       }
  1210       }