src/share/vm/oops/symbol.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/oops/symbol.hpp

src/share/vm/oops/symbol.hpp

Print this page

        

*** 221,230 **** --- 221,252 ---- // printing on default output stream void print() { print_on(tty); } void print_value() { print_value_on(tty); } + // Allows two distinct Symbol objects to be considered equal as long as + // they contain the same string. However, no two Symbol objects stored in the same + // SymbolTable would contain the same string. Therefore, if two distinct Symbol + // objects contain the same string, they must belong to different SymbolTables. + inline bool equals(const Symbol* other) const { + if (this && other) { + int len = this->utf8_length(); + if (len != other->utf8_length()) { + return false; + } + if (this->_identity_hash != other->_identity_hash) { + return false; + } + return (strncmp((const char*)(this->base()), (const char*)(other->base()), len) == 0); + } else { + return (this == other); + } + } + inline bool not_equals(const Symbol* other) const { + return !(this->equals(other)); + } + #ifndef PRODUCT // Empty constructor to create a dummy symbol object on stack // only for getting its vtable pointer. Symbol() { }
src/share/vm/oops/symbol.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File