--- old/src/share/vm/oops/symbol.cpp 2016-09-28 08:26:23.000000000 -0700 +++ new/src/share/vm/oops/symbol.cpp 2016-09-28 08:26:23.000000000 -0700 @@ -98,6 +98,25 @@ // ------------------------------------------------------------------ +// Symbol::ends_with +// +// Tests if the symbol ends with the specified suffix of the given +// length. +bool Symbol::ends_with(const char* suffix, int len) const { + const int utf8_len = utf8_length(); + if (len > utf8_len) return false; + int pos = utf8_len; + while (len-- > 0) { + pos--; + if (suffix[len] != (char) byte_at(pos)) + return false; + } + assert(len == -1, "we should be at the beginning"); + return true; +} + + +// ------------------------------------------------------------------ // Symbol::index_of // // Finds if the given string is a substring of this symbol's utf8 bytes.