< prev index next >
src/hotspot/share/oops/constantPool.hpp
Print this page
*** 129,139 ****
int _version;
} _saved;
void set_tags(Array<u1>* tags) { _tags = tags; }
void tag_at_put(int which, jbyte t) { tags()->at_put(which, t); }
! void release_tag_at_put(int which, jbyte t) { tags()->release_at_put(which, t); }
u1* tag_addr_at(int which) const { return tags()->adr_at(which); }
void set_operands(Array<u2>* operands) { _operands = operands; }
--- 129,139 ----
int _version;
} _saved;
void set_tags(Array<u1>* tags) { _tags = tags; }
void tag_at_put(int which, jbyte t) { tags()->at_put(which, t); }
! void release_tag_at_put(int which, jbyte t);
u1* tag_addr_at(int which) const { return tags()->adr_at(which); }
void set_operands(Array<u2>* operands) { _operands = operands; }
*** 141,158 ****
void set_flags(int f) { _flags = f; }
private:
intptr_t* base() const { return (intptr_t*) (((char*) this) + sizeof(ConstantPool)); }
! CPSlot slot_at(int which) const {
! assert(is_within_bounds(which), "index out of bounds");
! assert(!tag_at(which).is_unresolved_klass() && !tag_at(which).is_unresolved_klass_in_error(), "Corrupted constant pool");
! // Uses volatile because the klass slot changes without a lock.
! intptr_t adr = OrderAccess::load_acquire(obj_at_addr(which));
! assert(adr != 0 || which == 0, "cp entry for klass should not be zero");
! return CPSlot(adr);
! }
void slot_at_put(int which, CPSlot s) const {
assert(is_within_bounds(which), "index out of bounds");
assert(s.value() != 0, "Caught something");
*(intptr_t*)&base()[which] = s.value();
--- 141,151 ----
void set_flags(int f) { _flags = f; }
private:
intptr_t* base() const { return (intptr_t*) (((char*) this) + sizeof(ConstantPool)); }
! CPSlot slot_at(int which) const;
void slot_at_put(int which, CPSlot s) const {
assert(is_within_bounds(which), "index out of bounds");
assert(s.value() != 0, "Caught something");
*(intptr_t*)&base()[which] = s.value();
*** 378,388 ****
*int_at_addr(which) = ((jint) signature_index<<16) | name_index; // Not so nice
}
// Tag query
! constantTag tag_at(int which) const { return (constantTag)tags()->at_acquire(which); }
// Fetching constants
Klass* klass_at(int which, TRAPS) {
constantPoolHandle h_this(THREAD, this);
--- 371,381 ----
*int_at_addr(which) = ((jint) signature_index<<16) | name_index; // Not so nice
}
// Tag query
! constantTag tag_at(int which) const;
// Fetching constants
Klass* klass_at(int which, TRAPS) {
constantPoolHandle h_this(THREAD, this);
*** 407,426 ****
Symbol* klass_name_at(int which) const; // Returns the name, w/o resolving.
int klass_name_index_at(int which) const {
return klass_slot_at(which).name_index();
}
! Klass* resolved_klass_at(int which) const { // Used by Compiler
! guarantee(tag_at(which).is_klass(), "Corrupted constant pool");
! // Must do an acquire here in case another thread resolved the klass
! // behind our back, lest we later load stale values thru the oop.
! CPKlassSlot kslot = klass_slot_at(which);
! assert(tag_at(kslot.name_index()).is_symbol(), "sanity");
!
! Klass** adr = resolved_klasses()->adr_at(kslot.resolved_klass_index());
! return OrderAccess::load_acquire(adr);
! }
// RedefineClasses() API support:
Symbol* klass_at_noresolve(int which) { return klass_name_at(which); }
void temp_unresolved_klass_at_put(int which, int name_index) {
// Used only during constant pool merging for class redefinition. The resolved klass index
--- 400,410 ----
Symbol* klass_name_at(int which) const; // Returns the name, w/o resolving.
int klass_name_index_at(int which) const {
return klass_slot_at(which).name_index();
}
! Klass* resolved_klass_at(int which) const; // Used by Compiler
// RedefineClasses() API support:
Symbol* klass_at_noresolve(int which) { return klass_name_at(which); }
void temp_unresolved_klass_at_put(int which, int name_index) {
// Used only during constant pool merging for class redefinition. The resolved klass index
*** 473,499 ****
// This can happen if the user patches a live
// object into a CONSTANT_String entry of an anonymous class.
// Method oops internally created for method handles may also
// use pseudo-strings to link themselves to related metaobjects.
! bool is_pseudo_string_at(int which) {
! assert(tag_at(which).is_string(), "Corrupted constant pool");
! return slot_at(which).is_pseudo_string();
! }
! oop pseudo_string_at(int which, int obj_index) {
! assert(is_pseudo_string_at(which), "must be a pseudo-string");
! oop s = resolved_references()->obj_at(obj_index);
! return s;
! }
! oop pseudo_string_at(int which) {
! assert(is_pseudo_string_at(which), "must be a pseudo-string");
! int obj_index = cp_to_object_index(which);
! oop s = resolved_references()->obj_at(obj_index);
! return s;
! }
void pseudo_string_at_put(int which, int obj_index, oop x) {
assert(tag_at(which).is_string(), "Corrupted constant pool");
Symbol* sym = unresolved_string_at(which);
slot_at_put(which, CPSlot(sym, CPSlot::_pseudo_bit));
--- 457,471 ----
// This can happen if the user patches a live
// object into a CONSTANT_String entry of an anonymous class.
// Method oops internally created for method handles may also
// use pseudo-strings to link themselves to related metaobjects.
! bool is_pseudo_string_at(int which);
! oop pseudo_string_at(int which, int obj_index);
! oop pseudo_string_at(int which);
void pseudo_string_at_put(int which, int obj_index, oop x) {
assert(tag_at(which).is_string(), "Corrupted constant pool");
Symbol* sym = unresolved_string_at(which);
slot_at_put(which, CPSlot(sym, CPSlot::_pseudo_bit));
< prev index next >