Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,

ldrw(scan_temp, Address(recv_klass, Klass::vtable_length_offset()));

// %%% Could store the aligned, prescaled offset in the klassoop.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, but what's the point of the %%% in all those comments? Might want to remove that, while you're there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is an old-style TODO. I'm considering if we shouldn't just remove these comments. What do people think about that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not even sure what they want to say, really. Should be good to remove, and if anybody can make sense of it, record an issue in the bug-tracker?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I removed the %%%. I'll wait a little bit to see if someone else wants to keep them for some reason, if not, I'll remove them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think leaving these comments without the %%% seems fine. Describing this idea in a CR is a lot more difficult than seeing it in context as commentary, and unless the enhancement has other motivation, it won't be picked up. Leaving the comment as a clue seems useful.

// Could store the aligned, prescaled offset in the klass.
// lea(scan_temp, Address(recv_klass, scan_temp, times_vte_scale, vtable_base));
lea(scan_temp, Address(recv_klass, scan_temp, Address::lsl(3)));
add(scan_temp, scan_temp, vtable_base);
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,7 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
int log_vte_size= exact_log2(vtableEntry::size_in_bytes());

lwz(scan_temp, in_bytes(Klass::vtable_length_offset()), recv_klass);
// %%% We should store the aligned, prescaled offset in the klassoop.
// We should store the aligned, prescaled offset in the klass.
// Then the next several instructions would fold away.

sldi(scan_temp, scan_temp, log_vte_size);
Expand Down Expand Up @@ -2010,7 +2010,7 @@ void MacroAssembler::check_klass_subtype_fast_path(Register sub_klass,
// super_check_offset is register.
assert_different_registers(sub_klass, super_klass, cached_super, super_check_offset.as_register());
}
// The loaded value is the offset from KlassOopDesc.
// The loaded value is the offset from Klass.

ld(cached_super, super_check_offset, sub_klass);
cmpd(CCR0, cached_super, super_klass);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2502,7 +2502,7 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,

lwu(scan_tmp, Address(recv_klass, Klass::vtable_length_offset()));

// %%% Could store the aligned, prescaled offset in the klassoop.
// Could store the aligned, prescaled offset in the klass.
shadd(scan_tmp, scan_tmp, recv_klass, scan_tmp, 3);
add(scan_tmp, scan_tmp, vtable_base);

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/macroAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4339,7 +4339,7 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,

movl(scan_temp, Address(recv_klass, Klass::vtable_length_offset()));

// %%% Could store the aligned, prescaled offset in the klassoop.
// Could store the aligned, prescaled offset in the klass.
lea(scan_temp, Address(recv_klass, scan_temp, times_vte_scale, vtable_base));

if (return_method) {
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/c1/c1_LIRGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1323,9 +1323,9 @@ void LIRGenerator::do_getModifiers(Intrinsic* x) {
// from the primitive class itself. See spec for Class.getModifiers that provides
// the typed array klasses with similar modifiers as their component types.

Klass* univ_klass_obj = Universe::byteArrayKlassObj();
assert(univ_klass_obj->modifier_flags() == (JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC), "Sanity");
LIR_Opr prim_klass = LIR_OprFact::metadataConst(univ_klass_obj);
Klass* univ_klass = Universe::byteArrayKlass();
assert(univ_klass->modifier_flags() == (JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC), "Sanity");
LIR_Opr prim_klass = LIR_OprFact::metadataConst(univ_klass);

LIR_Opr recv_klass = new_register(T_METADATA);
__ move(new LIR_Address(receiver.result(), java_lang_Class::klass_offset(), T_ADDRESS), recv_klass, info);
Expand Down
7 changes: 3 additions & 4 deletions src/hotspot/share/cds/archiveHeapWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "runtime/java.hpp"
#include "runtime/mutexLocker.hpp"
#include "utilities/bitMap.inline.hpp"

#if INCLUDE_G1GC
#include "gc/g1/g1CollectedHeap.hpp"
#include "gc/g1/g1HeapRegion.hpp"
Expand Down Expand Up @@ -188,7 +187,7 @@ void ArchiveHeapWriter::ensure_buffer_space(size_t min_bytes) {
}

void ArchiveHeapWriter::copy_roots_to_buffer(GrowableArrayCHeap<oop, mtClassShared>* roots) {
Klass* k = Universe::objectArrayKlassObj(); // already relocated to point to archived klass
Klass* k = Universe::objectArrayKlass(); // already relocated to point to archived klass
int length = roots->length();
_heap_roots_word_size = objArrayOopDesc::object_size(length);
size_t byte_size = _heap_roots_word_size * HeapWordSize;
Expand Down Expand Up @@ -315,7 +314,7 @@ int ArchiveHeapWriter::filler_array_length(size_t fill_bytes) {

HeapWord* ArchiveHeapWriter::init_filler_array_at_buffer_top(int array_length, size_t fill_bytes) {
assert(UseCompressedClassPointers, "Archived heap only supported for compressed klasses");
Klass* oak = Universe::objectArrayKlassObj(); // already relocated to point to archived klass
Klass* oak = Universe::objectArrayKlass(); // already relocated to point to archived klass
HeapWord* mem = offset_to_buffered_address<HeapWord*>(_buffer_used);
memset(mem, 0, fill_bytes);
oopDesc::set_mark(mem, markWord::prototype());
Expand Down Expand Up @@ -594,7 +593,7 @@ void ArchiveHeapWriter::relocate_embedded_oops(GrowableArrayCHeap<oop, mtClassSh
// Relocate HeapShared::roots(), which is created in copy_roots_to_buffer() and
// doesn't have a corresponding src_obj, so we can't use EmbeddedOopRelocator on it.
oop requested_roots = requested_obj_from_buffer_offset(_heap_roots_offset);
update_header_for_requested_obj(requested_roots, nullptr, Universe::objectArrayKlassObj());
update_header_for_requested_obj(requested_roots, nullptr, Universe::objectArrayKlass());
int length = roots != nullptr ? roots->length() : 0;
for (int i = 0; i < length; i++) {
if (UseCompressedOops) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/cds/dynamicArchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class DynamicArchiveBuilder : public ArchiveBuilder {
void iterate_primitive_array_klasses(MetaspaceClosure* it) {
for (int i = T_BOOLEAN; i <= T_LONG; i++) {
assert(is_java_primitive((BasicType)i), "sanity");
Klass* k = Universe::typeArrayKlassObj((BasicType)i); // this give you "[I", etc
Klass* k = Universe::typeArrayKlass((BasicType)i); // this give you "[I", etc
assert(MetaspaceShared::is_shared_static((void*)k),
"one-dimensional primitive array should be in static archive");
ArrayKlass* ak = ArrayKlass::cast(k);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/cds/heapShared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ void KlassSubGraphInfo::add_subgraph_object_klass(Klass* orig_k) {
"must be boot class");
check_allowed_klass(InstanceKlass::cast(ObjArrayKlass::cast(orig_k)->bottom_klass()));
}
if (buffered_k == Universe::objectArrayKlassObj()) {
if (buffered_k == Universe::objectArrayKlass()) {
// Initialized early during Universe::genesis. No need to be added
// to the list.
return;
Expand Down
16 changes: 8 additions & 8 deletions src/hotspot/share/ci/ciObjectFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ void ciObjectFactory::init_shared_objects() {
init_ident_of(ciEnv::_unloaded_ciobjarrayklass);
assert(ciEnv::_unloaded_ciobjarrayklass->is_obj_array_klass(), "just checking");

get_metadata(Universe::boolArrayKlassObj());
get_metadata(Universe::charArrayKlassObj());
get_metadata(Universe::floatArrayKlassObj());
get_metadata(Universe::doubleArrayKlassObj());
get_metadata(Universe::byteArrayKlassObj());
get_metadata(Universe::shortArrayKlassObj());
get_metadata(Universe::intArrayKlassObj());
get_metadata(Universe::longArrayKlassObj());
get_metadata(Universe::boolArrayKlass());
get_metadata(Universe::charArrayKlass());
get_metadata(Universe::floatArrayKlass());
get_metadata(Universe::doubleArrayKlass());
get_metadata(Universe::byteArrayKlass());
get_metadata(Universe::shortArrayKlass());
get_metadata(Universe::intArrayKlass());
get_metadata(Universe::longArrayKlass());

assert(_non_perm_count == 0, "no shared non-perm objects");

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/ci/ciTypeArrayKlass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ciTypeArrayKlass::ciTypeArrayKlass(Klass* k) : ciArrayKlass(k) {
//
// Implementation of make.
ciTypeArrayKlass* ciTypeArrayKlass::make_impl(BasicType t) {
Klass* k = Universe::typeArrayKlassObj(t);
Klass* k = Universe::typeArrayKlass(t);
return CURRENT_ENV->get_type_array_klass(k);
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/classfile/javaClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ oop java_lang_Class::create_basic_type_mirror(const char* basic_type_name, Basic
// introducing a new VM klass (see comment in ClassFileParser)
oop java_class = InstanceMirrorKlass::cast(vmClasses::Class_klass())->allocate_instance(nullptr, CHECK_NULL);
if (type != T_VOID) {
Klass* aklass = Universe::typeArrayKlassObj(type);
Klass* aklass = Universe::typeArrayKlass(type);
assert(aklass != nullptr, "correct bootstrap");
release_set_array_klass(java_class, aklass);
}
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/classfile/systemDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ Klass* SystemDictionary::resolve_array_class_or_null(Symbol* class_name,
k = k->array_klass(ndims, CHECK_NULL);
}
} else {
k = Universe::typeArrayKlassObj(t);
k = Universe::typeArrayKlass(t);
k = TypeArrayKlass::cast(k)->array_klass(ndims, CHECK_NULL);
}
return k;
Expand Down Expand Up @@ -782,7 +782,7 @@ Klass* SystemDictionary::find_instance_or_array_klass(Thread* current,
int ndims = ss.skip_array_prefix(); // skip all '['s
BasicType t = ss.type();
if (t != T_OBJECT) {
k = Universe::typeArrayKlassObj(t);
k = Universe::typeArrayKlass(t);
} else {
k = SystemDictionary::find_instance_klass(current, ss.as_symbol(), class_loader, protection_domain);
}
Expand Down Expand Up @@ -1727,7 +1727,7 @@ Klass* SystemDictionary::find_constrained_instance_or_array_klass(
int ndims = ss.skip_array_prefix(); // skip all '['s
BasicType t = ss.type();
if (t != T_OBJECT) {
klass = Universe::typeArrayKlassObj(t);
klass = Universe::typeArrayKlass(t);
} else {
MutexLocker mu(current, SystemDictionary_lock);
klass = LoaderConstraintTable::find_constrained_klass(ss.as_symbol(), class_loader_data(class_loader));
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ inline bool G1CollectedHeap::requires_barriers(stackChunkOop obj) const {

inline bool G1CollectedHeap::is_obj_filler(const oop obj) {
Klass* k = obj->klass_raw();
return k == Universe::fillerArrayKlassObj() || k == vmClasses::FillerObject_klass();
return k == Universe::fillerArrayKlass() || k == vmClasses::FillerObject_klass();
}

inline bool G1CollectedHeap::is_obj_dead(const oop obj, const HeapRegion* hr) const {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/parallel/psParallelCompact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
DerivedPointerTable::set_active(false);
#endif

// adjust_roots() updates Universe::_intArrayKlassObj which is
// adjust_roots() updates Universe::_intArrayKlass which is
// needed by the compaction for filling holes in the dense prefix.
adjust_roots();

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shared/collectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ CollectedHeap::fill_with_array(HeapWord* start, size_t words, bool zap)
const size_t len = payload_size * HeapWordSize / sizeof(jint);
assert((int)len >= 0, "size too large " SIZE_FORMAT " becomes %d", words, (int)len);

ObjArrayAllocator allocator(Universe::fillerArrayKlassObj(), words, (int)len, /* do_zero */ false);
ObjArrayAllocator allocator(Universe::fillerArrayKlass(), words, (int)len, /* do_zero */ false);
allocator.initialize(start);
if (CDSConfig::is_dumping_heap()) {
// This array is written into the CDS archive. Make sure it
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1607,10 +1607,10 @@ void BytecodeInterpreter::run(interpreterState istate) {
ARRAY_INTRO(-3);
int item = STACK_INT(-1);
// if it is a T_BOOLEAN array, mask the stored value to 0/1
if (arrObj->klass() == Universe::boolArrayKlassObj()) {
if (arrObj->klass() == Universe::boolArrayKlass()) {
item &= 1;
} else {
assert(arrObj->klass() == Universe::byteArrayKlassObj(),
assert(arrObj->klass() == Universe::byteArrayKlass(),
"should be byte array otherwise");
}
((typeArrayOop)arrObj)->byte_at_put(index, item);
Expand Down
20 changes: 10 additions & 10 deletions src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,9 @@ static void write_primitive(JfrCheckpointWriter* writer, KlassPtr type_array_kla
assert(writer != nullptr, "invariant");
assert(_artifacts != nullptr, "invariant");
writer->write(primitive_id(type_array_klass));
writer->write(cld_id(get_cld(Universe::boolArrayKlassObj()), false));
writer->write(cld_id(get_cld(Universe::boolArrayKlass()), false));
writer->write(mark_symbol(primitive_symbol(type_array_klass), false));
writer->write(package_id(Universe::boolArrayKlassObj(), false));
writer->write(package_id(Universe::boolArrayKlass(), false));
writer->write(get_primitive_flags());
writer->write<bool>(false);
}
Expand All @@ -468,14 +468,14 @@ static bool is_initial_typeset_for_chunk() {
// It will use a reserved constant.
static void do_primitives() {
assert(is_initial_typeset_for_chunk(), "invariant");
write_primitive(_writer, Universe::boolArrayKlassObj());
write_primitive(_writer, Universe::byteArrayKlassObj());
write_primitive(_writer, Universe::charArrayKlassObj());
write_primitive(_writer, Universe::shortArrayKlassObj());
write_primitive(_writer, Universe::intArrayKlassObj());
write_primitive(_writer, Universe::longArrayKlassObj());
write_primitive(_writer, Universe::floatArrayKlassObj());
write_primitive(_writer, Universe::doubleArrayKlassObj());
write_primitive(_writer, Universe::boolArrayKlass());
write_primitive(_writer, Universe::byteArrayKlass());
write_primitive(_writer, Universe::charArrayKlass());
write_primitive(_writer, Universe::shortArrayKlass());
write_primitive(_writer, Universe::intArrayKlass());
write_primitive(_writer, Universe::longArrayKlass());
write_primitive(_writer, Universe::floatArrayKlass());
write_primitive(_writer, Universe::doubleArrayKlass());
write_primitive(_writer, nullptr); // void.class
}

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/jvmci/jvmciCodeInstaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,8 @@ ScopeValue* CodeInstaller::get_scope_value(HotSpotCompiledCodeStream* stream, u1
void CodeInstaller::record_object_value(ObjectValue* sv, HotSpotCompiledCodeStream* stream, JVMCI_TRAPS) {
oop javaMirror = JNIHandles::resolve(sv->klass()->as_ConstantOopWriteValue()->value());
Klass* klass = java_lang_Class::as_Klass(javaMirror);
bool isLongArray = klass == Universe::longArrayKlassObj();
bool isByteArray = klass == Universe::byteArrayKlassObj();
bool isLongArray = klass == Universe::longArrayKlass();
bool isByteArray = klass == Universe::byteArrayKlass();

u2 length = stream->read_u2("values:length");
for (jint i = 0; i < length; i++) {
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ C2V_VMENTRY_NULL(jobject, lookupType, (JNIEnv* env, jobject, jstring jname, ARGU
resolved_klass = resolved_klass->array_klass(ndim, CHECK_NULL);
}
} else {
resolved_klass = TypeArrayKlass::cast(Universe::typeArrayKlassObj(ss.type()))->array_klass(ndim, CHECK_NULL);
resolved_klass = TypeArrayKlass::cast(Universe::typeArrayKlass(ss.type()))->array_klass(ndim, CHECK_NULL);
}
} else {
resolved_klass = SystemDictionary::find_instance_klass(THREAD, class_name,
Expand All @@ -656,7 +656,7 @@ C2V_VMENTRY_NULL(jobject, getArrayType, (JNIEnv* env, jobject, jchar type_char,
if (type == T_VOID) {
return nullptr;
}
array_klass = Universe::typeArrayKlassObj(type);
array_klass = Universe::typeArrayKlass(type);
if (array_klass == nullptr) {
JVMCI_THROW_MSG_NULL(InternalError, err_msg("No array klass for primitive type %s", type2name(type)));
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/jvmci/jvmciEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,7 @@ JVMCIPrimitiveArray JVMCIEnv::new_byteArray(int length, JVMCI_TRAPS) {
JVMCIObjectArray JVMCIEnv::new_byte_array_array(int length, JVMCI_TRAPS) {
JavaThread* THREAD = JavaThread::current(); // For exception macros.
if (is_hotspot()) {
Klass* byteArrayArrayKlass = TypeArrayKlass::cast(Universe::byteArrayKlassObj ())->array_klass(CHECK_(JVMCIObject()));
Klass* byteArrayArrayKlass = TypeArrayKlass::cast(Universe::byteArrayKlass())->array_klass(CHECK_(JVMCIObject()));
objArrayOop result = ObjArrayKlass::cast(byteArrayArrayKlass) ->allocate(length, CHECK_(JVMCIObject()));
return wrap(result);
} else {
Expand Down
20 changes: 10 additions & 10 deletions src/hotspot/share/memory/heapInspection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ const char* KlassInfoEntry::name() const {
if (_klass->name() != nullptr) {
name = _klass->external_name();
} else {
if (_klass == Universe::boolArrayKlassObj()) name = "<boolArrayKlass>"; else
if (_klass == Universe::charArrayKlassObj()) name = "<charArrayKlass>"; else
if (_klass == Universe::floatArrayKlassObj()) name = "<floatArrayKlass>"; else
if (_klass == Universe::doubleArrayKlassObj()) name = "<doubleArrayKlass>"; else
if (_klass == Universe::byteArrayKlassObj()) name = "<byteArrayKlass>"; else
if (_klass == Universe::shortArrayKlassObj()) name = "<shortArrayKlass>"; else
if (_klass == Universe::intArrayKlassObj()) name = "<intArrayKlass>"; else
if (_klass == Universe::longArrayKlassObj()) name = "<longArrayKlass>"; else
if (_klass == Universe::boolArrayKlass()) name = "<boolArrayKlass>"; else
if (_klass == Universe::charArrayKlass()) name = "<charArrayKlass>"; else
if (_klass == Universe::floatArrayKlass()) name = "<floatArrayKlass>"; else
if (_klass == Universe::doubleArrayKlass()) name = "<doubleArrayKlass>"; else
if (_klass == Universe::byteArrayKlass()) name = "<byteArrayKlass>"; else
if (_klass == Universe::shortArrayKlass()) name = "<shortArrayKlass>"; else
if (_klass == Universe::intArrayKlass()) name = "<intArrayKlass>"; else
if (_klass == Universe::longArrayKlass()) name = "<longArrayKlass>"; else
name = "<no name>";
}
return name;
Expand Down Expand Up @@ -170,7 +170,7 @@ class KlassInfoTable::AllClassesFinder : public LockedClassesDo {

KlassInfoTable::KlassInfoTable(bool add_all_classes) {
_size_of_instances_in_words = 0;
_ref = (HeapWord*) Universe::boolArrayKlassObj();
_ref = (uintptr_t) Universe::boolArrayKlass();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems weird (non-obvious) to cast to uintptr_t here. I see it is only used in KlassInfoTable::hash(), which is weird, too. I am not sure that this even does a useful hashing. Might be worth to get rid of the whole thing and use the fastHash stuff that @rose00 proposed for Lilliput. Perhaps in a follow-up. I'd probably either cast to void* or Klass*, or cast to uintptr_t as you did and remove the unnecessary cast in ::hash().

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I'll start by removing the redundant cast in ::hash().

_buckets =
(KlassInfoBucket*) AllocateHeap(sizeof(KlassInfoBucket) * _num_buckets,
mtInternal, CURRENT_PC, AllocFailStrategy::RETURN_NULL);
Expand All @@ -196,7 +196,7 @@ KlassInfoTable::~KlassInfoTable() {
}

uint KlassInfoTable::hash(const Klass* p) {
return (uint)(((uintptr_t)p - (uintptr_t)_ref) >> 2);
return (uint)(((uintptr_t)p - _ref) >> 2);
}

KlassInfoEntry* KlassInfoTable::lookup(Klass* k) {
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/share/memory/heapInspection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,8 @@ class KlassInfoTable: public StackObj {
size_t _size_of_instances_in_words;

// An aligned reference address (typically the least
// address in the perm gen) used for hashing klass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rats I missed this.

// objects.
HeapWord* _ref;
// address in the metaspace) used for hashing klasses.
uintptr_t _ref;

KlassInfoBucket* _buckets;
uint hash(const Klass* p);
Expand Down
Loading