Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDS support for InlineKlass::null_free_array_klasses() & corrected modifiers #415

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -149,6 +149,11 @@ void FlatArrayKlass::initialize(TRAPS) {
element_klass()->initialize(THREAD);
}

void FlatArrayKlass::metaspace_pointers_do(MetaspaceClosure* it) {
ArrayKlass::metaspace_pointers_do(it);
it->push(&_element_klass);
}

// Oops allocation...
flatArrayOop FlatArrayKlass::allocate(int length, TRAPS) {
check_array_allocation_length(length, max_elements(), CHECK_NULL);
@@ -426,6 +431,14 @@ GrowableArray<Klass*>* FlatArrayKlass::compute_secondary_supers(int num_extra_sl
return secondaries;
}

jint FlatArrayKlass::compute_modifier_flags() const {
// The modifier for an flatArray is the same as its element
jint element_flags = element_klass()->compute_modifier_flags();

return (element_flags & (JVM_ACC_PUBLIC | JVM_ACC_PRIVATE | JVM_ACC_PROTECTED))
| (JVM_ACC_ABSTRACT | JVM_ACC_FINAL);
}

void FlatArrayKlass::print_on(outputStream* st) const {
#ifndef PRODUCT
assert(!is_objArray_klass(), "Unimplemented");
@@ -91,6 +91,8 @@ class FlatArrayKlass : public ArrayKlass {

oop protection_domain() const;

virtual void metaspace_pointers_do(MetaspaceClosure* iter);

static jint array_layout_helper(InlineKlass* vklass); // layout helper for values

// sizing
@@ -140,6 +142,8 @@ class FlatArrayKlass : public ArrayKlass {
inline void oop_oop_iterate_elements_specialized_bounded(flatArrayOop a, OopClosureType* closure, void* low, void* high);

public:
jint compute_modifier_flags() const;

// Printing
void print_on(outputStream* st) const;
void print_value_on(outputStream* st) const;
@@ -209,20 +209,18 @@ Klass* InlineKlass::null_free_inline_array_klass_or_null() {
return null_free_inline_array_klass_or_null(1);
}


void InlineKlass::remove_unshareable_info() {
InstanceKlass::remove_unshareable_info();

*((Array<SigEntry>**)adr_extended_sig()) = NULL;
*((Array<VMRegPair>**)adr_return_regs()) = NULL;
*((address*)adr_pack_handler()) = NULL;
*((address*)adr_pack_handler_jobject()) = NULL;
*((address*)adr_unpack_handler()) = NULL;
assert(pack_handler() == NULL, "pack handler not null");
void InlineKlass::array_klasses_do(void f(Klass* k)) {
InstanceKlass::array_klasses_do(f);
if (null_free_inline_array_klasses() != NULL) {
null_free_inline_array_klasses()->array_klasses_do(f);
}
}

void InlineKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, PackageEntry* pkg_entry, TRAPS) {
InstanceKlass::restore_unshareable_info(loader_data, protection_domain, pkg_entry, CHECK);
void InlineKlass::array_klasses_do(void f(Klass* k, TRAPS), TRAPS) {
InstanceKlass::array_klasses_do(f, THREAD);
if (null_free_inline_array_klasses() != NULL) {
null_free_inline_array_klasses()->array_klasses_do(f, THREAD);
}
}

// Inline type arguments are not passed by reference, instead each
@@ -520,6 +518,46 @@ InlineKlass* InlineKlass::returned_inline_klass(const RegisterMap& map) {
return NULL;
}

// CDS support

void InlineKlass::metaspace_pointers_do(MetaspaceClosure* it) {
InstanceKlass::metaspace_pointers_do(it);

InlineKlass* this_ptr = this;
it->push_internal_pointer(&this_ptr, (intptr_t*)&_adr_inlineklass_fixed_block);
it->push((Klass**)adr_null_free_inline_array_klasses());
}

void InlineKlass::remove_unshareable_info() {
InstanceKlass::remove_unshareable_info();

*((Array<SigEntry>**)adr_extended_sig()) = NULL;
*((Array<VMRegPair>**)adr_return_regs()) = NULL;
*((address*)adr_pack_handler()) = NULL;
*((address*)adr_pack_handler_jobject()) = NULL;
*((address*)adr_unpack_handler()) = NULL;
assert(pack_handler() == NULL, "pack handler not null");
if (null_free_inline_array_klasses() != NULL) {
null_free_inline_array_klasses()->remove_unshareable_info();
}
}

void InlineKlass::remove_java_mirror() {
InstanceKlass::remove_java_mirror();
if (null_free_inline_array_klasses() != NULL) {
null_free_inline_array_klasses()->remove_java_mirror();
}
}

void InlineKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, PackageEntry* pkg_entry, TRAPS) {
InstanceKlass::restore_unshareable_info(loader_data, protection_domain, pkg_entry, CHECK);
if (null_free_inline_array_klasses() != NULL) {
null_free_inline_array_klasses()->restore_unshareable_info(ClassLoaderData::the_null_class_loader_data(), Handle(), CHECK);
}
}

// oop verify

void InlineKlass::verify_on(outputStream* st) {
InstanceKlass::verify_on(st);
guarantee(prototype_header().is_inline_type(), "Prototype header is not inline type");
@@ -529,10 +567,3 @@ void InlineKlass::oop_verify_on(oop obj, outputStream* st) {
InstanceKlass::oop_verify_on(obj, st);
guarantee(obj->mark().is_inline_type(), "Header is not inline type");
}

void InlineKlass::metaspace_pointers_do(MetaspaceClosure* it) {
InstanceKlass::metaspace_pointers_do(it);

InlineKlass* this_ptr = this;
it->push_internal_pointer(&this_ptr, (intptr_t*)&_adr_inlineklass_fixed_block);
}
@@ -129,6 +129,7 @@ class InlineKlass: public InstanceKlass {
int first_field_offset_old();

virtual void remove_unshareable_info();
virtual void remove_java_mirror();
virtual void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, PackageEntry* pkg_entry, TRAPS);
virtual void metaspace_pointers_do(MetaspaceClosure* it);

@@ -141,6 +142,10 @@ class InlineKlass: public InstanceKlass {
// Type testing
bool is_inline_klass_slow() const { return true; }

// Iterators
virtual void array_klasses_do(void f(Klass* k));
virtual void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);

// Casting from Klass*
static InlineKlass* cast(Klass* k);