Skip to content

Commit

Permalink
Fix typos and bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
fparain committed Jun 11, 2024
1 parent 94bdb17 commit e9205ca
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/hotspot/share/cds/metaspaceShared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ bool MetaspaceShared::_use_optimized_module_handling = true;
// These regions are aligned with MetaspaceShared::core_region_alignment().
//
// These 2 regions are populated in the following steps:
// [0] All classes are loaded in MetaspaceShared::loadable_descripptors(). All metadata are
// [0] All classes are loaded in MetaspaceShared::loadable_descriptors(). All metadata are
// temporarily allocated outside of the shared regions.
// [1] We enter a safepoint and allocate a buffer for the rw/ro regions.
// [2] C++ vtables are copied into the rw region.
Expand Down Expand Up @@ -727,7 +727,7 @@ void MetaspaceShared::get_default_classlist(char* default_classlist, const size_
}
}

void MetaspaceShared::loadable_descripptors(TRAPS) {
void MetaspaceShared::loadable_descriptors(TRAPS) {
char default_classlist[JVM_MAXPATHLEN];
const char* classlist_path;

Expand Down Expand Up @@ -764,7 +764,7 @@ void MetaspaceShared::loadable_descripptors(TRAPS) {
}

void MetaspaceShared::preload_and_dump_impl(TRAPS) {
loadable_descripptors(CHECK);
loadable_descriptors(CHECK);

if (SharedArchiveConfigFile) {
log_info(cds)("Reading extra data from %s ...", SharedArchiveConfigFile);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/cds/metaspaceShared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class MetaspaceShared : AllStatic {

private:
static void preload_and_dump_impl(TRAPS) NOT_CDS_RETURN;
static void loadable_descripptors(TRAPS) NOT_CDS_RETURN;
static void loadable_descriptors(TRAPS) NOT_CDS_RETURN;

public:
static Symbol* symbol_rs_base() {
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/classfile/classFileParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3394,6 +3394,7 @@ u2 ClassFileParser::parse_classfile_loadable_descriptors_attribute(const ClassFi
vmSymbols::java_lang_ClassFormatError(),
"Descriptor from LoadableDescriptors attribute at index \"%d\" in class %s has illegal signature \"%s\"",
descriptor_index, _class_name->as_C_string(), descriptor->as_C_string());
return 0;
}
loadable_descriptors->at_put(index++, descriptor_index);
}
Expand Down
18 changes: 9 additions & 9 deletions src/hotspot/share/oops/instanceKlass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,10 +761,10 @@ void InstanceKlass::deallocate_contents(ClassLoaderData* loader_data) {
}
set_permitted_subclasses(nullptr);

if (loadable_descripptors() != nullptr &&
loadable_descripptors() != Universe::the_empty_short_array() &&
!loadable_descripptors()->is_shared()) {
MetadataFactory::free_array<jushort>(loader_data, loadable_descripptors());
if (loadable_descriptors() != nullptr &&
loadable_descriptors() != Universe::the_empty_short_array() &&
!loadable_descriptors()->is_shared()) {
MetadataFactory::free_array<jushort>(loader_data, loadable_descriptors());
}

// We should deallocate the Annotations instance if it's not in shared spaces.
Expand Down Expand Up @@ -1011,11 +1011,11 @@ bool InstanceKlass::link_class_impl(TRAPS) {
}

// Aggressively preloading all classes from the Preload attribute
if (loadable_descripptors() != nullptr) {
if (loadable_descriptors() != nullptr) {
HandleMark hm(THREAD);
for (int i = 0; i < loadable_descripptors()->length(); i++) {
Symbol* sig = constants()->symbol_at(loadable_descripptors()->at(i));
Symbol* class_name = Signature::strip_envelope(sig); // TempSymbol?
for (int i = 0; i < loadable_descriptors()->length(); i++) {
Symbol* sig = constants()->symbol_at(loadable_descriptors()->at(i));
TempNewSymbol class_name = Signature::strip_envelope(sig);
if (class_name == name()) continue;
log_info(class, preload)("Preloading class %s during linking of class %s because of the class is listed in the LoadableDescriptors attribute", sig->as_C_string(), name()->as_C_string());
oop loader = class_loader();
Expand Down Expand Up @@ -3950,7 +3950,7 @@ void InstanceKlass::print_on(outputStream* st) const {
st->print(BULLET"record components: "); record_components()->print_value_on(st); st->cr();
}
st->print(BULLET"permitted subclasses: "); permitted_subclasses()->print_value_on(st); st->cr();
st->print(BULLET"preload classes: "); loadable_descripptors()->print_value_on(st); st->cr();
st->print(BULLET"preload classes: "); loadable_descriptors()->print_value_on(st); st->cr();
if (java_mirror() != nullptr) {
st->print(BULLET"java mirror: ");
java_mirror()->print_value_on(st);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/oops/instanceKlass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ class InstanceKlass: public Klass {
Array<FieldStatus>* fields_status() const {return _fields_status; }
void set_fields_status(Array<FieldStatus>* array) { _fields_status = array; }

Array<u2>* loadable_descripptors() const { return _loadable_descriptors; }
Array<u2>* loadable_descriptors() const { return _loadable_descriptors; }
void set_loadable_descriptors(Array<u2>* c) { _loadable_descriptors = c; }

// inner classes
Expand Down
14 changes: 7 additions & 7 deletions src/hotspot/share/prims/jvmtiRedefineClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,8 @@ static jvmtiError check_preload_attribute(InstanceKlass* the_class,
// Check whether the class Preload attribute has been changed.
return check_attribute_arrays("Preload",
the_class, scratch_class,
the_class->loadable_descripptors(),
scratch_class->loadable_descripptors());
the_class->loadable_descriptors(),
scratch_class->loadable_descriptors());
}

static bool can_add_or_delete(Method* m) {
Expand Down Expand Up @@ -2103,11 +2103,11 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_permitted_subclasses_attribute(
bool VM_RedefineClasses::rewrite_cp_refs_in_preload_attribute(
InstanceKlass* scratch_class) {

Array<u2>* loadable_descripptors = scratch_class->loadable_descripptors();
assert(loadable_descripptors != nullptr, "unexpected null loadable_descripptors");
for (int i = 0; i < loadable_descripptors->length(); i++) {
u2 cp_index = loadable_descripptors->at(i);
loadable_descripptors->at_put(i, find_new_index(cp_index));
Array<u2>* loadable_descriptors = scratch_class->loadable_descriptors();
assert(loadable_descriptors != nullptr, "unexpected null loadable_descriptors");
for (int i = 0; i < loadable_descriptors->length(); i++) {
u2 cp_index = loadable_descriptors->at(i);
loadable_descriptors->at_put(i, find_new_index(cp_index));
}
return true;
}
Expand Down

0 comments on commit e9205ca

Please sign in to comment.