mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8225054: Compiler implementation for records
8225052: javax.lang.model support for records 8225053: Preview APIs support for records 8225055: Javadoc for records 8226314: com.sun.source support for records 8227113: Specification for java.lang.Record 8233526: JVM support for records Implement records in the compiler and the JVM, including serialization, reflection and APIs support Co-authored-by: Brian Goetz <brian.goetz@oracle.com> Co-authored-by: Maurizio Cimadamore <maurizio.cimadamore@oracle.com> Co-authored-by: Harold Seigel <harold.seigel@oracle.com> Co-authored-by: Joe Darcy <joe.darcy@oracle.com> Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com> Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com> Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com> Reviewed-by: mcimadamore, briangoetz, alanb, darcy, chegar, jrose, jlahoda, coleenp, dholmes, lfoltan, mchung, sadayapalam, hannesw, sspitsyn
This commit is contained in:
parent
0a375cfa2d
commit
827e5e3226
351 changed files with 24958 additions and 6395 deletions
|
@ -63,6 +63,7 @@
|
|||
#include "oops/klass.inline.hpp"
|
||||
#include "oops/method.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/recordComponent.hpp"
|
||||
#include "oops/symbol.hpp"
|
||||
#include "prims/jvmtiExport.hpp"
|
||||
#include "prims/jvmtiRedefineClasses.hpp"
|
||||
|
@ -436,6 +437,7 @@ InstanceKlass::InstanceKlass(const ClassFileParser& parser, unsigned kind, Klass
|
|||
_nest_members(NULL),
|
||||
_nest_host_index(0),
|
||||
_nest_host(NULL),
|
||||
_record_components(NULL),
|
||||
_static_field_size(parser.static_field_size()),
|
||||
_nonstatic_oop_map_size(nonstatic_oop_map_size(parser.total_oop_map_count())),
|
||||
_itable_len(parser.itable_size()),
|
||||
|
@ -504,6 +506,17 @@ void InstanceKlass::deallocate_interfaces(ClassLoaderData* loader_data,
|
|||
}
|
||||
}
|
||||
|
||||
void InstanceKlass::deallocate_record_components(ClassLoaderData* loader_data,
|
||||
Array<RecordComponent*>* record_components) {
|
||||
if (record_components != NULL && !record_components->is_shared()) {
|
||||
for (int i = 0; i < record_components->length(); i++) {
|
||||
RecordComponent* record_component = record_components->at(i);
|
||||
MetadataFactory::free_metadata(loader_data, record_component);
|
||||
}
|
||||
MetadataFactory::free_array<RecordComponent*>(loader_data, record_components);
|
||||
}
|
||||
}
|
||||
|
||||
// This function deallocates the metadata and C heap pointers that the
|
||||
// InstanceKlass points to.
|
||||
void InstanceKlass::deallocate_contents(ClassLoaderData* loader_data) {
|
||||
|
@ -532,6 +545,9 @@ void InstanceKlass::deallocate_contents(ClassLoaderData* loader_data) {
|
|||
deallocate_methods(loader_data, methods());
|
||||
set_methods(NULL);
|
||||
|
||||
deallocate_record_components(loader_data, record_components());
|
||||
set_record_components(NULL);
|
||||
|
||||
if (method_ordering() != NULL &&
|
||||
method_ordering() != Universe::the_empty_int_array() &&
|
||||
!method_ordering()->is_shared()) {
|
||||
|
@ -2339,6 +2355,7 @@ void InstanceKlass::metaspace_pointers_do(MetaspaceClosure* it) {
|
|||
}
|
||||
|
||||
it->push(&_nest_members);
|
||||
it->push(&_record_components);
|
||||
}
|
||||
|
||||
void InstanceKlass::remove_unshareable_info() {
|
||||
|
@ -3270,6 +3287,9 @@ void InstanceKlass::print_on(outputStream* st) const {
|
|||
}
|
||||
st->print(BULLET"inner classes: "); inner_classes()->print_value_on(st); st->cr();
|
||||
st->print(BULLET"nest members: "); nest_members()->print_value_on(st); st->cr();
|
||||
if (record_components() != NULL) {
|
||||
st->print(BULLET"record components: "); record_components()->print_value_on(st); st->cr();
|
||||
}
|
||||
if (java_mirror() != NULL) {
|
||||
st->print(BULLET"java mirror: ");
|
||||
java_mirror()->print_value_on(st);
|
||||
|
@ -3532,6 +3552,7 @@ void InstanceKlass::collect_statistics(KlassSizeStats *sz) const {
|
|||
n += (sz->_fields_bytes = sz->count_array(fields()));
|
||||
n += (sz->_inner_classes_bytes = sz->count_array(inner_classes()));
|
||||
n += (sz->_nest_members_bytes = sz->count_array(nest_members()));
|
||||
n += (sz->_record_components_bytes = sz->count_array(record_components()));
|
||||
sz->_ro_bytes += n;
|
||||
|
||||
const ConstantPool* cp = constants();
|
||||
|
@ -3554,6 +3575,17 @@ void InstanceKlass::collect_statistics(KlassSizeStats *sz) const {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
const Array<RecordComponent*>* components = record_components();
|
||||
if (components != NULL) {
|
||||
for (int i = 0; i < components->length(); i++) {
|
||||
RecordComponent* component = components->at(i);
|
||||
if (component != NULL) {
|
||||
component->collect_statistics(sz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif // INCLUDE_SERVICES
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue