src/share/vm/oops/symbol.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/share/vm/oops/symbol.hpp	Thu Apr 16 13:30:53 2015
--- new/src/share/vm/oops/symbol.hpp	Thu Apr 16 13:30:53 2015

*** 221,230 **** --- 221,249 ---- // 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 != NULL) && (other != NULL)) { + int len = this->utf8_length(); + if (len != other->utf8_length()) { + 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