< prev index next >

src/hotspot/share/runtime/fieldDescriptor.cpp

Print this page
@@ -29,10 +29,11 @@
  #include "oops/constantPool.hpp"
  #include "oops/instanceKlass.hpp"
  #include "oops/klass.inline.hpp"
  #include "oops/oop.inline.hpp"
  #include "oops/fieldStreams.inline.hpp"
+ #include "oops/inlineKlass.inline.hpp"
  #include "runtime/fieldDescriptor.inline.hpp"
  #include "runtime/handles.inline.hpp"
  #include "runtime/signature.hpp"
  
  Symbol* fieldDescriptor::generic_signature() const {

@@ -42,11 +43,12 @@
    return _cp->symbol_at(_fieldinfo.generic_signature_index());
  }
  
  bool fieldDescriptor::is_trusted_final() const {
    InstanceKlass* ik = field_holder();
-   return is_final() && (is_static() || ik->is_hidden() || ik->is_record());
+   return is_final() && (is_static() || ik->is_hidden() || ik->is_record() || ik->is_inline_klass()
+                         || (ik->is_abstract() && !ik->is_identity_class() && !ik->is_interface()));
  }
  
  AnnotationArray* fieldDescriptor::annotations() const {
    InstanceKlass* ik = field_holder();
    Array<AnnotationArray*>* md = ik->fields_annotations();

@@ -123,14 +125,16 @@
  }
  
  void fieldDescriptor::print() const { print_on(tty); }
  
  void fieldDescriptor::print_on_for(outputStream* st, oop obj) {
-   print_on(st);
-   st->print(" ");
- 
    BasicType ft = field_type();
+   if (!is_null_free_inline_type()) {
+     print_on(st);
+     st->print(" ");
+   }
+   jint as_int = 0;
    switch (ft) {
      case T_BYTE:
        st->print("%d", obj->byte_field(offset()));
        break;
      case T_CHAR:

@@ -156,17 +160,23 @@
        break;
      case T_BOOLEAN:
        st->print("%s", obj->bool_field(offset()) ? "true" : "false");
        break;
      case T_ARRAY:
-       if (obj->obj_field(offset()) != nullptr) {
-         obj->obj_field(offset())->print_value_on(st);
-       } else {
-         st->print("null");
-       }
-       break;
      case T_OBJECT:
+       if (is_flat()) { // only some inline types can be flat
+         assert(is_null_free_inline_type(), "Only null free inline type fields can be flat");
+         // Print fields of flat fields (recursively)
+         InlineKlass* vk = InlineKlass::cast(field_holder()->get_inline_type_field_klass(index()));
+         int field_offset = offset() - vk->first_field_offset();
+         obj = cast_to_oop(cast_from_oop<address>(obj) + field_offset);
+         st->print_cr("Flat inline type field '%s':", vk->name()->as_C_string());
+         FieldPrinter print_field(st, obj);
+         vk->do_nonstatic_fields(&print_field);
+         return; // Do not print underlying representation
+       }
+       // Not flat inline type field, fall through
        if (obj->obj_field(offset()) != nullptr) {
          obj->obj_field(offset())->print_value_on(st);
        } else {
          st->print("null");
        }
< prev index next >