diff --git a/src/hotspot/share/c1/c1_Runtime1.cpp b/src/hotspot/share/c1/c1_Runtime1.cpp index eaf71f8a6f4..ad292cbdb21 100644 --- a/src/hotspot/share/c1/c1_Runtime1.cpp +++ b/src/hotspot/share/c1/c1_Runtime1.cpp @@ -378,8 +378,7 @@ static void allocate_instance(JavaThread* current, Klass* klass, TRAPS) { // make sure klass is initialized h->initialize(CHECK); oop obj = nullptr; - // TODO is this correct? C2 uses ciInlineKlass::is_empty instead - if (h->is_inline_klass() && InlineKlass::cast(h)->is_empty_inline_type()) { + if (h->is_inline_klass() && InlineKlass::cast(h)->is_empty_inline_type()) { obj = InlineKlass::cast(h)->default_value(); assert(obj != nullptr, "default value must exist"); } else { diff --git a/src/hotspot/share/ci/ciInlineKlass.cpp b/src/hotspot/share/ci/ciInlineKlass.cpp index b63e3cbb24e..1d1f489233c 100644 --- a/src/hotspot/share/ci/ciInlineKlass.cpp +++ b/src/hotspot/share/ci/ciInlineKlass.cpp @@ -97,9 +97,7 @@ bool ciInlineKlass::is_empty() { // Do not use InlineKlass::is_empty_inline_type here because it does // consider the container empty even if fields of empty inline types // are not flat - // TODO double check, I think we can also consider it empty if it only contains null-free flat fields of empty inline klasses return nof_declared_nonstatic_fields() == 0; - //return nof_nonstatic_fields() == 0; } // When passing an inline type's fields as arguments, count the number diff --git a/src/hotspot/share/ci/ciInstanceKlass.cpp b/src/hotspot/share/ci/ciInstanceKlass.cpp index 16d1f8ca96f..66214183227 100644 --- a/src/hotspot/share/ci/ciInstanceKlass.cpp +++ b/src/hotspot/share/ci/ciInstanceKlass.cpp @@ -536,7 +536,6 @@ GrowableArray* ciInstanceKlass::compute_nonstatic_fields_impl(Growable } // allocate the array: - // TODO why do we need this? if (flen == 0 && !is_inlinetype()) { return nullptr; // return nothing if none are locally declared } diff --git a/src/hotspot/share/ci/ciReplay.cpp b/src/hotspot/share/ci/ciReplay.cpp index 044ca366d04..c2e0af30047 100644 --- a/src/hotspot/share/ci/ciReplay.cpp +++ b/src/hotspot/share/ci/ciReplay.cpp @@ -1150,11 +1150,6 @@ class CompileReplay : public StackObj { Klass* actual_array_klass = parse_klass(CHECK_(true)); Klass* kelem = ObjArrayKlass::cast(actual_array_klass)->element_klass(); value = oopFactory::new_objArray(kelem, length, CHECK_(true)); - } else if (field_signature[0] == JVM_SIGNATURE_ARRAY) { - // TODO this is dead, right? - Klass* kelem = resolve_klass(field_signature + 1, CHECK_(true)); - parse_klass(CHECK_(true)); // eat up the array class name - value = oopFactory::new_valueArray(kelem, length, CHECK_(true)); } else { report_error("unhandled array staticfield"); } diff --git a/src/hotspot/share/code/nmethod.cpp b/src/hotspot/share/code/nmethod.cpp index 0383f20eea2..174ffa55688 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -3812,11 +3812,9 @@ void nmethod::print_nmethod_labels(outputStream* stream, address block_begin, bo } if (!did_name) stream->print("%s", type2name(t)); - if ((*sig)._offset == -1) { - // TODO it's also -1 if it's not from a flat field - //stream->print(" IS INIT"); - } else if ((*sig)._sort_offset != (*sig)._offset) { - stream->print(" NULL MARKER"); + // If the entry has a non-default sort_offset, it must be a null marker + if ((*sig)._sort_offset != (*sig)._offset) { + stream->print(" (null marker)"); } } if (at_old_sp) { diff --git a/src/hotspot/share/oops/fieldStreams.hpp b/src/hotspot/share/oops/fieldStreams.hpp index f240757a1a4..7a6331cd712 100644 --- a/src/hotspot/share/oops/fieldStreams.hpp +++ b/src/hotspot/share/oops/fieldStreams.hpp @@ -301,6 +301,10 @@ class HierarchicalFieldStream : public StackObj { bool is_null_free_inline_type() { return _current_stream.is_null_free_inline_type(); } + + int null_marker_offset() { + return _current_stream.null_marker_offset(); + } }; #endif // SHARE_OOPS_FIELDSTREAMS_HPP diff --git a/src/hotspot/share/oops/inlineKlass.cpp b/src/hotspot/share/oops/inlineKlass.cpp index ac54b49c611..318e822f527 100644 --- a/src/hotspot/share/oops/inlineKlass.cpp +++ b/src/hotspot/share/oops/inlineKlass.cpp @@ -306,9 +306,7 @@ int InlineKlass::collect_fields(GrowableArray* sig, float& max_offset, // Resolve klass of flat field and recursively collect fields int field_null_marker_offset = -1; if (!fs.is_null_free_inline_type()) { - // TODO can we use null_marker_offset() instead? - InlineLayoutInfo* li = inline_layout_info_adr(fs.index()); - field_null_marker_offset = base_off + li->null_marker_offset() - (base_off > 0 ? first_field_offset() : 0); + field_null_marker_offset = base_off + fs.null_marker_offset() - (base_off > 0 ? first_field_offset() : 0); } Klass* vk = get_inline_type_field_klass(fs.index()); count += InlineKlass::cast(vk)->collect_fields(sig, max_offset, offset, field_null_marker_offset); diff --git a/src/hotspot/share/runtime/sharedRuntime.cpp b/src/hotspot/share/runtime/sharedRuntime.cpp index 8edfb557cd6..58523e5f527 100644 --- a/src/hotspot/share/runtime/sharedRuntime.cpp +++ b/src/hotspot/share/runtime/sharedRuntime.cpp @@ -2868,8 +2868,9 @@ void CompiledEntrySignature::compute_calling_conventions(bool init) { _sig_cc_ro->appendAll(vk->extended_sig()); if (bt == T_OBJECT) { // Nullable inline type argument, insert InlineTypeNode::IsInit field right after T_METADATA delimiter - _sig_cc->insert_before(last+1, SigEntry(T_BOOLEAN)); - _sig_cc_ro->insert_before(last_ro+1, SigEntry(T_BOOLEAN)); + // Set the sort_offset so that the field is detected as null marker by nmethod::print_nmethod_labels. + _sig_cc->insert_before(last+1, SigEntry(T_BOOLEAN, -1, 0)); + _sig_cc_ro->insert_before(last_ro+1, SigEntry(T_BOOLEAN, -1, 0)); } } } else { diff --git a/src/hotspot/share/runtime/signature.hpp b/src/hotspot/share/runtime/signature.hpp index 0ab0ef19fa9..5df593519e5 100644 --- a/src/hotspot/share/runtime/signature.hpp +++ b/src/hotspot/share/runtime/signature.hpp @@ -577,11 +577,10 @@ typedef GrowableArrayFilterIterator ExtendedSignature; // specially. See comment for InlineKlass::collect_fields(). class SigEntry { public: - // TODO improve these comments - BasicType _bt; - int _offset; // Offset of the corresponding field in it's value class holder for scalarized arguments (-1 otherwise). Used for packing and unpacking + BasicType _bt; // Basic type of the argument + int _offset; // Offset of the field in its value class holder for scalarized arguments (-1 otherwise). Used for packing and unpacking. float _sort_offset; // Offset used for sorting - Symbol* _symbol; // For printing + Symbol* _symbol; // Symbol for printing SigEntry() : _bt(T_ILLEGAL), _offset(-1), _sort_offset(-1), _symbol(NULL) {}