< prev index next >

src/hotspot/share/oops/symbol.cpp

Print this page

        

*** 85,94 **** --- 85,137 ---- } 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(); + return this; + } + } + + 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; + } + if ((offset2 + len) > s->utf8_length()) return false; + if ((utf8_length() - offset1 * 2) != (s->utf8_length() - offset2 * 2)) + return false; + int l = len; + while (l-- > 0) { + if (char_at(offset1 + l) != s->char_at(offset2 + l)) + return false; + } + return true; + } // ------------------------------------------------------------------ // Symbol::index_of // // Finds if the given string is a substring of this symbol's utf8 bytes.
*** 304,310 **** --- 347,365 ---- jbyte* bytes = (jbyte*) s->bytes(); return os::is_readable_range(bytes, bytes + len); } + void Symbol::print_Qvalue_on(outputStream* st) const { + if (this == NULL) { + st->print("NULL"); + } else { + st->print("'Q"); + for (int i = 0; i < utf8_length(); i++) { + st->print("%c", char_at(i)); + } + st->print(";'"); + } + } + // SymbolTable prints this in its statistics NOT_PRODUCT(size_t Symbol::_total_count = 0;)
< prev index next >