1.1 --- a/src/share/vm/classfile/symbolTable.cpp Thu Mar 19 09:13:24 2009 -0700 1.2 +++ b/src/share/vm/classfile/symbolTable.cpp Fri Mar 20 23:19:36 2009 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -109,6 +109,40 @@ 1.11 return the_table()->lookup(index, name, len, hash); 1.12 } 1.13 1.14 +// Suggestion: Push unicode-based lookup all the way into the hashing 1.15 +// and probing logic, so there is no need for convert_to_utf8 until 1.16 +// an actual new symbolOop is created. 1.17 +symbolOop SymbolTable::lookup_unicode(const jchar* name, int utf16_length, TRAPS) { 1.18 + int utf8_length = UNICODE::utf8_length((jchar*) name, utf16_length); 1.19 + char stack_buf[128]; 1.20 + if (utf8_length < (int) sizeof(stack_buf)) { 1.21 + char* chars = stack_buf; 1.22 + UNICODE::convert_to_utf8(name, utf16_length, chars); 1.23 + return lookup(chars, utf8_length, THREAD); 1.24 + } else { 1.25 + ResourceMark rm(THREAD); 1.26 + char* chars = NEW_RESOURCE_ARRAY(char, utf8_length + 1);; 1.27 + UNICODE::convert_to_utf8(name, utf16_length, chars); 1.28 + return lookup(chars, utf8_length, THREAD); 1.29 + } 1.30 +} 1.31 + 1.32 +symbolOop SymbolTable::lookup_only_unicode(const jchar* name, int utf16_length, 1.33 + unsigned int& hash) { 1.34 + int utf8_length = UNICODE::utf8_length((jchar*) name, utf16_length); 1.35 + char stack_buf[128]; 1.36 + if (utf8_length < (int) sizeof(stack_buf)) { 1.37 + char* chars = stack_buf; 1.38 + UNICODE::convert_to_utf8(name, utf16_length, chars); 1.39 + return lookup_only(chars, utf8_length, hash); 1.40 + } else { 1.41 + ResourceMark rm; 1.42 + char* chars = NEW_RESOURCE_ARRAY(char, utf8_length + 1);; 1.43 + UNICODE::convert_to_utf8(name, utf16_length, chars); 1.44 + return lookup_only(chars, utf8_length, hash); 1.45 + } 1.46 +} 1.47 + 1.48 void SymbolTable::add(constantPoolHandle cp, int names_count, 1.49 const char** names, int* lengths, int* cp_indices, 1.50 unsigned int* hashValues, TRAPS) { 1.51 @@ -126,15 +160,6 @@ 1.52 } 1.53 } 1.54 1.55 -// Needed for preloading classes in signatures when compiling. 1.56 - 1.57 -symbolOop SymbolTable::probe(const char* name, int len) { 1.58 - unsigned int hashValue = hash_symbol(name, len); 1.59 - int index = the_table()->hash_to_index(hashValue); 1.60 - return the_table()->lookup(index, name, len, hashValue); 1.61 -} 1.62 - 1.63 - 1.64 symbolOop SymbolTable::basic_add(int index, u1 *name, int len, 1.65 unsigned int hashValue, TRAPS) { 1.66 assert(!Universe::heap()->is_in_reserved(name) || GC_locker::is_active(),