hotspot/src/share/vm/oops/constantPoolOop.cpp
Print this page
rev 611 : Merge
*** 1,10 ****
#ifdef USE_PRAGMA_IDENT_SRC
#pragma ident "@(#)constantPoolOop.cpp 1.104 07/05/05 17:06:01 JVM"
#endif
/*
! * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,10 ----
#ifdef USE_PRAGMA_IDENT_SRC
#pragma ident "@(#)constantPoolOop.cpp 1.104 07/05/05 17:06:01 JVM"
#endif
/*
! * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 26,35 ****
--- 26,47 ----
*/
# 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));
*** 334,345 ****
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) {
--- 346,359 ----
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) {
*** 386,395 ****
--- 400,422 ----
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());