src/share/vm/oops/constantPoolOop.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot-dvm Cdiff src/share/vm/oops/constantPoolOop.cpp

src/share/vm/oops/constantPoolOop.cpp

Print this page
rev 421 : [mq]: anonk.patch

*** 23,32 **** --- 23,44 ---- */ # include "incls/_precompiled.incl" # include "incls/_constantPoolOop.cpp.incl" + void constantPoolOopDesc::set_flag_at(FlagBit fb) { + const int MAX_STATE_CHANGES = 2; + for (int i = MAX_STATE_CHANGES + 10; i > 0; i--) { + int oflags = _flags; + int nflags = oflags | (1 << (int)fb); + if (Atomic::cmpxchg(nflags, &_flags, oflags) == oflags) + return; + } + assert(false, "failed to cmpxchg flags"); + _flags |= (1 << (int)fb); // better than nothing + } + klassOop constantPoolOopDesc::klass_at_impl(constantPoolHandle this_oop, int which, TRAPS) { // A resolved constantPool entry will contain a klassOop, otherwise a symbolOop. // It is not safe to rely on the tag bit's here, since we don't have a lock, and the entry and // tag is not updated atomicly. oop entry = *(this_oop->obj_at_addr(which));
*** 331,342 **** char* constantPoolOopDesc::string_at_noresolve(int which) { // Test entry type in case string is resolved while in here. oop entry = *(obj_at_addr(which)); if (entry->is_symbol()) { return ((symbolOop)entry)->as_C_string(); ! } else { return java_lang_String::as_utf8_string(entry); } } symbolOop constantPoolOopDesc::name_ref_at(int which) { --- 343,356 ---- char* constantPoolOopDesc::string_at_noresolve(int which) { // Test entry type in case string is resolved while in here. oop entry = *(obj_at_addr(which)); if (entry->is_symbol()) { return ((symbolOop)entry)->as_C_string(); ! } else if (java_lang_String::is_instance(entry)) { return java_lang_String::as_utf8_string(entry); + } else { + return (char*)"<pseudo-string>"; } } symbolOop constantPoolOopDesc::name_ref_at(int which) {
*** 383,392 **** --- 397,419 ---- assert(java_lang_String::is_instance(entry), "must be string"); return entry; } + bool constantPoolOopDesc::is_pseudo_string_at(int which) { + oop entry = *(obj_at_addr(which)); + if (entry->is_symbol()) + // Not yet resolved, but it will resolve to a string. + return false; + else if (java_lang_String::is_instance(entry)) + return false; // actually, it might be a non-interned or non-perm string + else + // truly pseudo + return true; + } + + bool constantPoolOopDesc::klass_name_at_matches(instanceKlassHandle k, int which) { // Names are interned, so we can compare symbolOops directly symbolOop cp_name = klass_name_at(which); return (cp_name == k->name());
src/share/vm/oops/constantPoolOop.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File