1.1 --- a/src/share/vm/ci/ciSymbol.cpp Thu Jan 27 13:42:28 2011 -0800 1.2 +++ b/src/share/vm/ci/ciSymbol.cpp Thu Jan 27 16:11:27 2011 -0800 1.3 @@ -30,23 +30,27 @@ 1.4 // ------------------------------------------------------------------ 1.5 // ciSymbol::ciSymbol 1.6 // 1.7 -// Preallocated handle variant. Used with handles from vmSymboHandles. 1.8 -ciSymbol::ciSymbol(symbolHandle h_s, vmSymbols::SID sid) 1.9 - : ciObject(h_s), _sid(sid) 1.10 +// Preallocated symbol variant. Used with symbols from vmSymbols. 1.11 +ciSymbol::ciSymbol(Symbol* s, vmSymbols::SID sid) 1.12 + : _symbol(s), _sid(sid) 1.13 { 1.14 + assert(_symbol != NULL, "adding null symbol"); 1.15 + _symbol->increment_refcount(); // increment ref count 1.16 assert(sid_ok(), "must be in vmSymbols"); 1.17 } 1.18 1.19 // Normal case for non-famous symbols. 1.20 -ciSymbol::ciSymbol(symbolOop s) 1.21 - : ciObject(s), _sid(vmSymbols::NO_SID) 1.22 +ciSymbol::ciSymbol(Symbol* s) 1.23 + : _symbol(s), _sid(vmSymbols::NO_SID) 1.24 { 1.25 + assert(_symbol != NULL, "adding null symbol"); 1.26 + _symbol->increment_refcount(); // increment ref count 1.27 assert(sid_ok(), "must not be in vmSymbols"); 1.28 } 1.29 1.30 // ciSymbol 1.31 // 1.32 -// This class represents a symbolOop in the HotSpot virtual 1.33 +// This class represents a Symbol* in the HotSpot virtual 1.34 // machine. 1.35 1.36 // ------------------------------------------------------------------ 1.37 @@ -55,20 +59,20 @@ 1.38 // The text of the symbol as a null-terminated C string. 1.39 const char* ciSymbol::as_utf8() { 1.40 VM_QUICK_ENTRY_MARK; 1.41 - symbolOop s = get_symbolOop(); 1.42 + Symbol* s = get_symbol(); 1.43 return s->as_utf8(); 1.44 } 1.45 1.46 // ------------------------------------------------------------------ 1.47 // ciSymbol::base 1.48 -jbyte* ciSymbol::base() { 1.49 - GUARDED_VM_ENTRY(return get_symbolOop()->base();) 1.50 +const jbyte* ciSymbol::base() { 1.51 + GUARDED_VM_ENTRY(return get_symbol()->base();) 1.52 } 1.53 1.54 // ------------------------------------------------------------------ 1.55 // ciSymbol::byte_at 1.56 int ciSymbol::byte_at(int i) { 1.57 - GUARDED_VM_ENTRY(return get_symbolOop()->byte_at(i);) 1.58 + GUARDED_VM_ENTRY(return get_symbol()->byte_at(i);) 1.59 } 1.60 1.61 // ------------------------------------------------------------------ 1.62 @@ -76,7 +80,7 @@ 1.63 // 1.64 // Tests if the symbol starts with the given prefix. 1.65 bool ciSymbol::starts_with(const char* prefix, int len) const { 1.66 - GUARDED_VM_ENTRY(return get_symbolOop()->starts_with(prefix, len);) 1.67 + GUARDED_VM_ENTRY(return get_symbol()->starts_with(prefix, len);) 1.68 } 1.69 1.70 // ------------------------------------------------------------------ 1.71 @@ -84,13 +88,13 @@ 1.72 // 1.73 // Determines where the symbol contains the given substring. 1.74 int ciSymbol::index_of_at(int i, const char* str, int len) const { 1.75 - GUARDED_VM_ENTRY(return get_symbolOop()->index_of_at(i, str, len);) 1.76 + GUARDED_VM_ENTRY(return get_symbol()->index_of_at(i, str, len);) 1.77 } 1.78 1.79 // ------------------------------------------------------------------ 1.80 // ciSymbol::utf8_length 1.81 int ciSymbol::utf8_length() { 1.82 - GUARDED_VM_ENTRY(return get_symbolOop()->utf8_length();) 1.83 + GUARDED_VM_ENTRY(return get_symbol()->utf8_length();) 1.84 } 1.85 1.86 // ------------------------------------------------------------------ 1.87 @@ -107,7 +111,7 @@ 1.88 // 1.89 // Print the value of this symbol on an outputStream 1.90 void ciSymbol::print_symbol_on(outputStream *st) { 1.91 - GUARDED_VM_ENTRY(get_symbolOop()->print_symbol_on(st);) 1.92 + GUARDED_VM_ENTRY(get_symbol()->print_symbol_on(st);) 1.93 } 1.94 1.95 // ------------------------------------------------------------------ 1.96 @@ -116,15 +120,13 @@ 1.97 // Make a ciSymbol from a C string (implementation). 1.98 ciSymbol* ciSymbol::make_impl(const char* s) { 1.99 EXCEPTION_CONTEXT; 1.100 - // For some reason, oopFactory::new_symbol doesn't declare its 1.101 - // char* argument as const. 1.102 - symbolOop sym = oopFactory::new_symbol((char*)s, (int)strlen(s), THREAD); 1.103 + TempNewSymbol sym = SymbolTable::new_symbol(s, THREAD); 1.104 if (HAS_PENDING_EXCEPTION) { 1.105 CLEAR_PENDING_EXCEPTION; 1.106 CURRENT_THREAD_ENV->record_out_of_memory_failure(); 1.107 return ciEnv::_unloaded_cisymbol; 1.108 } 1.109 - return CURRENT_THREAD_ENV->get_object(sym)->as_symbol(); 1.110 + return CURRENT_THREAD_ENV->get_symbol(sym); 1.111 } 1.112 1.113 // ------------------------------------------------------------------