339 return table->basic_add(index, (u1*)name, (int)strlen(name), hash, false, THREAD); |
339 return table->basic_add(index, (u1*)name, (int)strlen(name), hash, false, THREAD); |
340 } |
340 } |
341 |
341 |
342 Symbol* SymbolTable::basic_add(int index_arg, u1 *name, int len, |
342 Symbol* SymbolTable::basic_add(int index_arg, u1 *name, int len, |
343 unsigned int hashValue_arg, bool c_heap, TRAPS) { |
343 unsigned int hashValue_arg, bool c_heap, TRAPS) { |
344 assert(!Universe::heap()->is_in_reserved(name) || GC_locker::is_active(), |
344 assert(!Universe::heap()->is_in_reserved(name), |
345 "proposed name of symbol must be stable"); |
345 "proposed name of symbol must be stable"); |
346 |
346 |
347 // Don't allow symbols to be created which cannot fit in a Symbol*. |
347 // Don't allow symbols to be created which cannot fit in a Symbol*. |
348 if (len > Symbol::max_length()) { |
348 if (len > Symbol::max_length()) { |
349 THROW_MSG_0(vmSymbols::java_lang_InternalError(), |
349 THROW_MSG_0(vmSymbols::java_lang_InternalError(), |
683 |
683 |
684 // Found |
684 // Found |
685 if (found_string != NULL) return found_string; |
685 if (found_string != NULL) return found_string; |
686 |
686 |
687 debug_only(StableMemoryChecker smc(name, len * sizeof(name[0]))); |
687 debug_only(StableMemoryChecker smc(name, len * sizeof(name[0]))); |
688 assert(!Universe::heap()->is_in_reserved(name) || GC_locker::is_active(), |
688 assert(!Universe::heap()->is_in_reserved(name), |
689 "proposed name of symbol must be stable"); |
689 "proposed name of symbol must be stable"); |
690 |
690 |
691 Handle string; |
691 Handle string; |
692 // try to reuse the string if possible |
692 // try to reuse the string if possible |
693 if (!string_or_null.is_null()) { |
693 if (!string_or_null.is_null()) { |