< prev index next >

src/hotspot/share/oops/symbol.cpp

Print this page
rev 55090 : secret-sfac

*** 72,101 **** assert(((Symbol*)p)->refcount() == 0, "should not call this"); FreeHeap(p); } // ------------------------------------------------------------------ ! // Symbol::starts_with // ! // Tests if the symbol starts with the specified prefix of the given ! // length. ! bool Symbol::starts_with(const char* prefix, int len) const { ! if (len > utf8_length()) return false; while (len-- > 0) { ! if (prefix[len] != char_at(len)) return false; } assert(len == -1, "we should be at the beginning"); return true; } bool Symbol::is_Q_signature() const { ! return utf8_length() > 2 && char_at(0) == 'Q' && char_at(utf8_length() - 1) == ';'; } Symbol* Symbol::fundamental_name(TRAPS) { ! if ((char_at(0) == 'Q' || char_at(0) == 'L') && char_at(utf8_length() - 1) == ';') { return SymbolTable::lookup(this, 1, utf8_length() - 1, CHECK_NULL); } else { // reference count is incremented to be consistent with the behavior with // the SymbolTable::lookup() call above this->increment_refcount(); --- 72,115 ---- assert(((Symbol*)p)->refcount() == 0, "should not call this"); FreeHeap(p); } // ------------------------------------------------------------------ ! // Symbol::contains_byte_at // ! // Tests if the symbol contains the given byte at the given position. ! bool Symbol::contains_byte_at(int position, char code_byte) const { ! if (position < 0) return false; // can happen with ends_with ! if (position >= utf8_length()) return false; ! return code_byte == char_at(position); ! } ! ! // ------------------------------------------------------------------ ! // Symbol::contains_utf8_at ! // ! // Tests if the symbol contains the given utf8 substring ! // at the given byte position. ! bool Symbol::contains_utf8_at(int position, const char* substring, int len) const { ! assert(len > 0 && substring != NULL && (int) strlen(substring) >= len, ! "substring must be valid"); ! if (len == 1) return contains_byte_at(position, substring[0]); ! if (position < 0) return false; // can happen with ends_with ! if (position + len > utf8_length()) return false; while (len-- > 0) { ! if (substring[len] != char_at(position + len)) return false; } assert(len == -1, "we should be at the beginning"); return true; } bool Symbol::is_Q_signature() const { ! return utf8_length() > 2 && char_at(0) == 'Q' && ends_with(';'); } Symbol* Symbol::fundamental_name(TRAPS) { ! if ((char_at(0) == 'Q' || char_at(0) == 'L') && ends_with(';')) { return SymbolTable::lookup(this, 1, utf8_length() - 1, CHECK_NULL); } else { // reference count is incremented to be consistent with the behavior with // the SymbolTable::lookup() call above this->increment_refcount();
*** 105,123 **** bool Symbol::is_same_fundamental_type(Symbol* s) const { if (this == s) return true; if (utf8_length() < 3) return false; int offset1, offset2, len; ! if (char_at(utf8_length() - 1) == ';') { if (char_at(0) != 'Q' && char_at(0) != 'L') return false; offset1 = 1; len = utf8_length() - 2; } else { offset1 = 0; len = utf8_length(); } ! if (s->char_at(s->utf8_length() - 1) == ';') { if (s->char_at(0) != 'Q' && s->char_at(0) != 'L') return false; offset2 = 1; } else { offset2 = 0; } --- 119,137 ---- bool Symbol::is_same_fundamental_type(Symbol* s) const { if (this == s) return true; if (utf8_length() < 3) return false; int offset1, offset2, len; ! if (ends_with(';')) { if (char_at(0) != 'Q' && char_at(0) != 'L') return false; offset1 = 1; len = utf8_length() - 2; } else { offset1 = 0; len = utf8_length(); } ! if (ends_with(';')) { if (s->char_at(0) != 'Q' && s->char_at(0) != 'L') return false; offset2 = 1; } else { offset2 = 0; }
< prev index next >