< prev index next >
src/share/vm/oops/constantPool.hpp
Print this page
*** 60,69 ****
--- 60,85 ----
Symbol* get_symbol() {
return (Symbol*)(_ptr & ~_pseudo_bit);
}
};
+ class CPKlassSlot VALUE_OBJ_CLASS_SPEC {
+ int _name_index;
+ int _resolved_klass_index;
+ public:
+ CPKlassSlot(int n, int rk) {
+ _name_index = n;
+ _resolved_klass_index = rk;
+ }
+ int name_index() const {
+ return _name_index;
+ }
+ int resolved_klass_index() const {
+ return _resolved_klass_index;
+ }
+ };
+
class KlassSizeStats;
class ConstantPool : public Metadata {
friend class VMStructs;
friend class JVMCIVMStructs;
*** 79,89 ****
Array<Klass*>* _resolved_klasses;
enum {
_has_preresolution = 1, // Flags
_on_stack = 2,
! _is_shared_quick = 4
};
enum {
_invalid_resolved_klass_index = 0xffff
};
--- 95,105 ----
Array<Klass*>* _resolved_klasses;
enum {
_has_preresolution = 1, // Flags
_on_stack = 2,
! _is_shared = 4
};
enum {
_invalid_resolved_klass_index = 0xffff
};
*** 160,170 ****
Array<u1>* tags() const { return _tags; }
Array<u2>* operands() const { return _operands; }
bool has_preresolution() const { return (_flags & _has_preresolution) != 0; }
void set_has_preresolution() {
! assert(!is_shared_quick(), "should never be called on shared ConstantPools");
_flags |= _has_preresolution;
}
// Redefine classes support. If a method refering to this constant pool
// is on the executing stack, or as a handle in vm code, this constant pool
--- 176,186 ----
Array<u1>* tags() const { return _tags; }
Array<u2>* operands() const { return _operands; }
bool has_preresolution() const { return (_flags & _has_preresolution) != 0; }
void set_has_preresolution() {
! assert(!is_shared(), "should never be called on shared ConstantPools");
_flags |= _has_preresolution;
}
// Redefine classes support. If a method refering to this constant pool
// is on the executing stack, or as a handle in vm code, this constant pool
*** 172,183 ****
// class.
bool on_stack() const { return (_flags &_on_stack) != 0; }
void set_on_stack(const bool value);
// Faster than MetaspaceObj::is_shared() - used by set_on_stack()
! bool is_shared_quick() const { return (_flags & _is_shared_quick) != 0; }
! void set_is_shared_quick() { _flags |= _is_shared_quick; }
// Klass holding pool
InstanceKlass* pool_holder() const { return _pool_holder; }
void set_pool_holder(InstanceKlass* k) { _pool_holder = k; }
InstanceKlass** pool_holder_addr() { return &_pool_holder; }
--- 188,198 ----
// class.
bool on_stack() const { return (_flags &_on_stack) != 0; }
void set_on_stack(const bool value);
// Faster than MetaspaceObj::is_shared() - used by set_on_stack()
! bool is_shared() const { return (_flags & _is_shared) != 0; }
// Klass holding pool
InstanceKlass* pool_holder() const { return _pool_holder; }
void set_pool_holder(InstanceKlass* k) { _pool_holder = k; }
InstanceKlass** pool_holder_addr() { return &_pool_holder; }
*** 352,374 ****
Klass* klass_at_ignore_error(int which, TRAPS) {
constantPoolHandle h_this(THREAD, this);
return klass_at_impl(h_this, which, false, THREAD);
}
Symbol* klass_name_at(int which) const; // Returns the name, w/o resolving.
! int klass_name_index_at(int which) const;
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.
! int value = *int_at_addr(which);
! int resolved_klass_index = extract_low_short_from_int(value);
! int name_index = extract_high_short_from_int(value);
! assert(tag_at(name_index).is_symbol(), "sanity");
! Klass** adr = resolved_klasses()->adr_at(resolved_klass_index);
return (Klass*)OrderAccess::load_ptr_acquire(adr);
}
// RedefineClasses() API support:
Symbol* klass_at_noresolve(int which) { return klass_name_at(which); }
--- 367,398 ----
Klass* klass_at_ignore_error(int which, TRAPS) {
constantPoolHandle h_this(THREAD, this);
return klass_at_impl(h_this, which, false, THREAD);
}
+ CPKlassSlot klass_slot_at(int which) const {
+ assert(tag_at(which).is_unresolved_klass() || tag_at(which).is_klass(),
+ "Corrupted constant pool");
+ int value = *int_at_addr(which);
+ int name_index = extract_high_short_from_int(value);
+ int resolved_klass_index = extract_low_short_from_int(value);
+ return CPKlassSlot(name_index, resolved_klass_index);
+ }
+
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 (Klass*)OrderAccess::load_ptr_acquire(adr);
}
// RedefineClasses() API support:
Symbol* klass_at_noresolve(int which) { return klass_name_at(which); }
< prev index next >